加入报错输入框,清理代码
This commit is contained in:
1 parent
56e17d0292
commit
5ee67609b7
16 files changed
+95
-210
No files matched your search
+12
-12
@@ -1,19 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
@@ -66,18 +55,29 @@ namespace H5MotaUpdate.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<ColoredString> ErrorMessages => ErrorLogger.ErrorMessages;
|
||||
|
||||
public ICommand SelectSourceCommand { get; set; }
|
||||
public ICommand SelectDestCommand { get; set; }
|
||||
public ICommand MigrateCommand { get; set; }
|
||||
public ICommand HelpCommand { get; set; }
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
ErrorLogger.LogError("111", "red");
|
||||
ErrorLogger.LogError("222", "");
|
||||
ErrorLogger.LogError("222", "");
|
||||
ErrorLogger.LogError("222", "");
|
||||
ErrorLogger.LogError("222", "");
|
||||
ErrorLogger.LogError("222", "");
|
||||
ErrorLogger.LogError("222", "");
|
||||
SourceRootDirectory = "请选择包含要翻新的旧塔的文件夹";
|
||||
DestRootDirectory = "请选择一个包含新的2.10.3样板的文件夹";
|
||||
VersionString = "-";
|
||||
SelectSourceCommand = new RelayCommand(SelectSourceRootFolder);
|
||||
SelectDestCommand = new RelayCommand(SelectDestRootFolder);
|
||||
MigrateCommand = new RelayCommand(StartMigrate);
|
||||
HelpCommand = new RelayCommand(FileUtils.ShowHelp);
|
||||
MigrateServerTable = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Effects;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.VisualBasic.Devices;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
// 功能:复制project/enemy.js文件
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using Brush = System.Windows.Media.Brush;
|
||||
using Brushes = System.Windows.Media.Brushes;
|
||||
public class ColoredString
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public Brush Color { get; set; }
|
||||
|
||||
public ColoredString(string text, Brush color)
|
||||
{
|
||||
Text = text;
|
||||
Color = color;
|
||||
}
|
||||
}
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
internal static class ErrorLogger
|
||||
{
|
||||
private static ObservableCollection<ColoredString> _errorMessages = new ObservableCollection<ColoredString>();
|
||||
|
||||
public static ObservableCollection<ColoredString> ErrorMessages { get { return _errorMessages; } }
|
||||
|
||||
public static void LogError(string error, string color)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
case "red":
|
||||
ErrorMessages.Add(new ColoredString(error, Brushes.Red));
|
||||
break;
|
||||
case "black":
|
||||
default:
|
||||
ErrorMessages.Add(new ColoredString(error, Brushes.Black));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void Clear()
|
||||
{
|
||||
_errorMessages.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices.JavaScript;
|
||||
using System.Text;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
internal class ItemsJSMigrator
|
||||
@@ -92,7 +77,7 @@ namespace H5MotaUpdate.ViewModels
|
||||
if (newItemDatas.ContainsKey(key))
|
||||
{
|
||||
JObject itemData = (JObject)newItemDatas[key];
|
||||
if (ele== "itemEffectTip")
|
||||
if (ele == "itemEffectTip")
|
||||
{
|
||||
valueString = "${" + valueString + "}";
|
||||
}
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Drawing;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
@@ -158,7 +143,7 @@ namespace H5MotaUpdate.ViewModels
|
||||
foreach (string filePath in files)
|
||||
{
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
if (fileName == "icons.png" && version<new Version(2,5,4)) //检查icons长度
|
||||
if (fileName == "icons.png" && version < new Version(2, 5, 4)) //检查icons长度
|
||||
{
|
||||
using (Bitmap image = new Bitmap(filePath))
|
||||
{
|
||||
|
||||
@@ -1,25 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Effects;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.VisualBasic.Devices;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
internal class ServerTableMigrator
|
||||
{
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
@@ -151,5 +135,13 @@ namespace H5MotaUpdate.ViewModels
|
||||
MessageBox.Show("迁移" + fileName + $"文件出现错误:{e.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开readme文件
|
||||
/// </summary>
|
||||
public static void ShowHelp()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,6 @@
|
||||
using System;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
@@ -208,8 +200,9 @@ namespace H5MotaUpdate.ViewModels
|
||||
/// 将塔的地图尺寸写入libs/core.js
|
||||
/// <summary>
|
||||
public static void WriteMapWidth(string destFilePath, int width, int height)
|
||||
{
|
||||
try {
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string tempFilePath = destFilePath + ".tmp";
|
||||
string fileContent = File.ReadAllText(destFilePath);
|
||||
@@ -219,8 +212,9 @@ namespace H5MotaUpdate.ViewModels
|
||||
File.Delete(destFilePath);
|
||||
File.Move(tempFilePath, destFilePath);
|
||||
}
|
||||
catch {
|
||||
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace H5MotaUpdate.ViewModels
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user