加入报错输入框,清理代码
This commit is contained in:
parent
56e17d0292
commit
5ee67609b7
@ -1,8 +1,4 @@
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace Migrator
|
||||
namespace Migrator
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
|
@ -22,7 +22,14 @@
|
||||
<Button Name ="BrowseSourceFolderButton" FontSize ="16" Content="浏览" Canvas.Left="680" Canvas.Top="10" Width="40" Command="{Binding SelectSourceCommand}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<Button x:Name ="BrowseDestFolderButton" FontSize ="16" Content="浏览" Canvas.Left="680" Canvas.Top="47" Width="40" Command="{Binding SelectDestCommand}" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Button FontSize ="16" Content="开始迁移" Canvas.Left="30" Canvas.Top="127" Width="140" Command="{Binding MigrateCommand}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<TextBlock FontSize ="16" Canvas.Left="50" Canvas.Top="220" Width="700" TextWrapping="Wrap" Text="本工具用于辅助迁移塔的地图、元件等数据,不保证结果的正确性,请仔细手动核对结果,并注意备份原工程。
本工具不能迁移公共事件,插件和脚本,建议您手动逐个迁移。 
同理,道具,敌人,地图等地方的事件和脚本很可能无法使用,请仔细核对。 
部分事件块迁移后不能被新编辑器识别,会显示为自定义事件(如AddValue等),但不一定失效,请根据具体情况决定是否改写。
使用本工具复刻产生少量错误属于正常现象,自行修正即可,有严重bug(不能打开编辑器等)请根据控制台报错修正相应文件格式,或联系工具作者。"/>
|
||||
<CheckBox Name ="MigrateConfig" Content="迁移配置表格" Height="26" Canvas.Left="200" Canvas.Top="130" Width="100" IsChecked="{Binding MigrateServerTable}"/>
|
||||
<CheckBox Name ="MigrateConfig" Content="迁移配置表格" Height="26" Canvas.Left="426" Canvas.Top="134" Width="100" IsChecked="{Binding MigrateServerTable}"/>
|
||||
<Button FontSize ="16" Content="查看帮助" Canvas.Left="223" Canvas.Top="127" Width="140" Command="{Binding MigrateCommand}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
<ListBox Height="90" Canvas.Left="30" Canvas.Top="230" Width="690" ItemsSource="{Binding ErrorMessages}" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Text}" Foreground="{Binding Color}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Canvas>
|
||||
</Window>
|
||||
|
@ -1,16 +1,4 @@
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using H5MotaUpdate.ViewModels;
|
||||
using System.Windows;
|
||||
|
||||
namespace H5MotaUpdate
|
||||
{
|
||||
|
@ -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文件
|
||||
|
45
ViewModels/Migrator/ErrorLogger.cs
Normal file
45
ViewModels/Migrator/ErrorLogger.cs
Normal file
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user