diff --git a/BallanceTASEditor/BallanceTASEditor.csproj b/BallanceTASEditor/BallanceTASEditor.csproj
index ae75845..d4c1b74 100644
--- a/BallanceTASEditor/BallanceTASEditor.csproj
+++ b/BallanceTASEditor/BallanceTASEditor.csproj
@@ -40,6 +40,9 @@
icon.ico
+
+ ..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll
+
..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
@@ -57,9 +60,6 @@
-
- ..\packages\zlib.net.1.0.4.0\lib\zlib.net.dll
-
diff --git a/BallanceTASEditor/Core/ZlibUtil.cs b/BallanceTASEditor/Core/ZlibUtil.cs
index 2273eab..2bbbac5 100644
--- a/BallanceTASEditor/Core/ZlibUtil.cs
+++ b/BallanceTASEditor/Core/ZlibUtil.cs
@@ -1,4 +1,4 @@
-using BallanceTASEditor.Core.TASStruct;
+using BallanceTASEditor.Core.TASStruct;
using System;
using System.Collections.Generic;
using System.IO;
@@ -12,34 +12,63 @@ namespace BallanceTASEditor.Core {
public static void CompressTAS(LinkedList mem, FileStream file) {
file.Write(BitConverter.GetBytes(mem.Count * ConstValue.FRAMEDATA_SIZE), 0, 4);
- var zo = new zlib.ZOutputStream(file, 9);
- var node = mem.First;
- while (node != null) {
- zo.Write(BitConverter.GetBytes(node.Value.deltaTime), 0, 4);
- zo.Write(BitConverter.GetBytes(node.Value.keystates), 0, 4);
- node = node.Next;
+ using (var zo = new Ionic.Zlib.ZlibStream(file, Ionic.Zlib.CompressionMode.Compress, Ionic.Zlib.CompressionLevel.Level9, true)) {
+ var node = mem.First;
+ while (node != null) {
+ zo.Write(BitConverter.GetBytes(node.Value.deltaTime), 0, 4);
+ zo.Write(BitConverter.GetBytes(node.Value.keystates), 0, 4);
+ node = node.Next;
+ }
+ zo.Close();
}
- zo.finish();
- zo.Close();
+
+ //var zo = new zlib.ZOutputStream(file, 9);
+ //var node = mem.First;
+ //while (node != null) {
+ // zo.Write(BitConverter.GetBytes(node.Value.deltaTime), 0, 4);
+ // zo.Write(BitConverter.GetBytes(node.Value.keystates), 0, 4);
+ // node = node.Next;
+ //}
+ //zo.finish();
+ //zo.Close();
}
public static void DecompressTAS(LinkedList ls, FileStream file) {
var lengthTemp = new byte[4];
- var mem = new MemoryStream();
file.Read(lengthTemp, 0, 4);
Int32 expectedLength = BitConverter.ToInt32(lengthTemp, 0);
long expectedCount = expectedLength / ConstValue.FRAMEDATA_SIZE;
- var zo = new zlib.ZOutputStream(mem);
- CopyStream(file, zo);
- zo.finish();
+ using (var mem = new MemoryStream()) {
+ using (var zo = new Ionic.Zlib.ZlibStream(mem, Ionic.Zlib.CompressionMode.Decompress, true)) {
+ CopyStream(file, zo);
+ zo.Close();
+ }
- mem.Seek(0, SeekOrigin.Begin);
- for(long i = 0; i < expectedCount; i++) {
- ls.AddLast(new FrameData(mem));
+ mem.Seek(0, SeekOrigin.Begin);
+ for (long i = 0; i < expectedCount; i++) {
+ ls.AddLast(new FrameData(mem));
+ }
+ mem.Close();
}
- mem.Close();
- zo.Close();
+
+ //mem.Seek(0, SeekOrigin.Begin);
+ //for (long i = 0; i < expectedCount; i++) {
+ // ls.AddLast(new FrameData(mem));
+ //}
+ //mem.Close();
+ //zo.Close();
+
+ //var zo = new zlib.ZOutputStream(mem);
+ //CopyStream(file, zo);
+ //zo.finish();
+
+ //mem.Seek(0, SeekOrigin.Begin);
+ //for (long i = 0; i < expectedCount; i++) {
+ // ls.AddLast(new FrameData(mem));
+ //}
+ //mem.Close();
+ //zo.Close();
}
public static void CopyStream(Stream origin, Stream target) {
diff --git a/BallanceTASEditor/Language/CHS.xaml b/BallanceTASEditor/Language/CHS.xaml
index df4d04e..9a1e6bc 100644
--- a/BallanceTASEditor/Language/CHS.xaml
+++ b/BallanceTASEditor/Language/CHS.xaml
@@ -1,4 +1,4 @@
-
@@ -62,7 +62,7 @@
Ballance TAS 编辑器
基于 MIT 开源许可证发布
-版本:1.1 stable
+版本:1.2 stable
程序:yyc12345.
图标设计:plAer_2
文件未关闭。您想直接退出吗?所有修改不会被保存。
diff --git a/BallanceTASEditor/Language/DefaultLanguage.xaml b/BallanceTASEditor/Language/DefaultLanguage.xaml
index 015967b..bf1d71b 100644
--- a/BallanceTASEditor/Language/DefaultLanguage.xaml
+++ b/BallanceTASEditor/Language/DefaultLanguage.xaml
@@ -1,4 +1,4 @@
-
@@ -62,7 +62,7 @@
Ballance TAS Editor
Under MIT License
-Version: 1.1 stable
+Version: 1.2 stable
Program: yyc12345.
Icon design: plAer_2
File is not closed. Do you want to just quit? All changes will not be saved.
diff --git a/BallanceTASEditor/MainWindow.xaml b/BallanceTASEditor/MainWindow.xaml
index 1a449e5..9964cdb 100644
--- a/BallanceTASEditor/MainWindow.xaml
+++ b/BallanceTASEditor/MainWindow.xaml
@@ -1,4 +1,4 @@
-
-
+
diff --git a/BallanceTASEditor/MainWindow.xaml.cs b/BallanceTASEditor/MainWindow.xaml.cs
index d6f7fb4..2bf86fe 100644
--- a/BallanceTASEditor/MainWindow.xaml.cs
+++ b/BallanceTASEditor/MainWindow.xaml.cs
@@ -1,4 +1,4 @@
-using BallanceTASEditor.Core;
+using BallanceTASEditor.Core;
using BallanceTASEditor.Core.TASStruct;
using BallanceTASEditor.UI;
using System;
@@ -90,8 +90,8 @@ namespace BallanceTASEditor {
}
private void funcMenu_Help_About(object sender, RoutedEventArgs e) {
- MessageBox.Show(I18NProcessor.GetI18N("code_MainWindow_Menu_Help_About"),
- I18NProcessor.GetI18N("code_Shared_ProgramName"),
+ MessageBox.Show(I18NProcessor.GetI18N("code_MainWindow_Menu_Help_About"),
+ I18NProcessor.GetI18N("code_Shared_ProgramName"),
MessageBoxButton.OK, MessageBoxImage.Information);
}
@@ -248,7 +248,7 @@ namespace BallanceTASEditor {
private void funcWindow_KeyUp(object sender, KeyEventArgs e) {
if (mFile == null || mViewer == null) return;
- switch(e.Key) {
+ switch (e.Key) {
case Key.A:
mSlider.MoveSliderManually(true, true, mViewer.GetItemCountInPage());
break;
@@ -280,7 +280,7 @@ namespace BallanceTASEditor {
// normally move
mSlider.MoveSliderManually(true, false, mViewer.GetItemCountInPage());
}
-
+
} else if (e.Delta < 0) {
// wheel down
if (KeyboardState.IsKeyPressed(KeyboardState.VirtualKeyStates.VK_SHIFT)) {
@@ -309,8 +309,7 @@ namespace BallanceTASEditor {
var arr = (System.Array)e.Data.GetData(DataFormats.FileDrop);
if (arr.Length != 1) e.Effects = DragDropEffects.None;
else e.Effects = DragDropEffects.Link;
- }
- else e.Effects = DragDropEffects.None;
+ } else e.Effects = DragDropEffects.None;
}
#endregion
@@ -331,15 +330,22 @@ namespace BallanceTASEditor {
}
private void OpenFile(string file) {
+#if DEBUG
+#else
try {
+#endif
mFile = new TASFile(file);
+
+#if DEBUG
+#else
} catch {
MessageBox.Show(I18NProcessor.GetI18N("code_MainWindow_Menu_File_Open_Fail"),
- I18NProcessor.GetI18N("code_Shared_ProgramName"),
+ I18NProcessor.GetI18N("code_Shared_ProgramName"),
MessageBoxButton.OK, MessageBoxImage.Error);
mFile = null;
return;
}
+#endif
mViewer = new TASViewer(mFile, mSlider, mFlow);
diff --git a/BallanceTASEditor/packages.config b/BallanceTASEditor/packages.config
index 83372d1..0f8f05a 100644
--- a/BallanceTASEditor/packages.config
+++ b/BallanceTASEditor/packages.config
@@ -1,5 +1,5 @@
+
-
\ No newline at end of file