2 Commits
v1.0 ... v1.2

Author SHA1 Message Date
96f61362d3 fix: fix issue that fail to open legal TAS file.
- switch zlib library from zlib.net to DotNetZip because old one can not handle zlib-compressed file properly.
- bump version to 1.2
2024-07-26 23:20:11 +08:00
e8fc96e3ac feat: add version feature
- add version info for Assembly.
- update version to 1.1
- add info textblock in main window for more convenient debug because some users only send a screenshot without reference any version info.
- fix typo
- fix menu dynamic resource link error
2022-05-11 15:08:04 +08:00
8 changed files with 124 additions and 59 deletions

View File

@ -40,6 +40,9 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
@ -57,9 +60,6 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=47d7877cb3620160">
<HintPath>..\packages\zlib.net.1.0.4.0\lib\zlib.net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">

View File

@ -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<FrameData> mem, FileStream file) {
file.Write(BitConverter.GetBytes(mem.Count * ConstValue.FRAMEDATA_SIZE), 0, 4);
var zo = new zlib.ZOutputStream(file, 9);
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.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<FrameData> 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);
using (var mem = new MemoryStream()) {
using (var zo = new Ionic.Zlib.ZlibStream(mem, Ionic.Zlib.CompressionMode.Decompress, true)) {
CopyStream(file, zo);
zo.finish();
zo.Close();
}
mem.Seek(0, SeekOrigin.Begin);
for(long i = 0; i < expectedCount; i++) {
for (long i = 0; i < expectedCount; i++) {
ls.AddLast(new FrameData(mem));
}
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) {

View File

@ -1,4 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BallanceTASEditor.Language"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
@ -43,7 +43,7 @@
<sys:String x:Key="ui_TASFlow_Menu_Cut">剪切</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_Copy">复制</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_PasteAfter">粘贴于后方</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_PasterBefore">粘贴于前方</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_PasteBefore">粘贴于前方</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_Delete">删除</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_DeleteAfter">向后删除</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_DeleteBefore">向前删除</sys:String>
@ -62,9 +62,10 @@
<sys:String x:Key="code_Shared_ProgramName">Ballance TAS 编辑器</sys:String>
<sys:String x:Key="code_MainWindow_Menu_Help_About" xml:space="preserve">基于 MIT 开源许可证发布
版本1.0 stable
版本1.2 stable
程序yyc12345.
图标设计plAer_2</sys:String>
<sys:String x:Key="code_MainWindow_Closing">文件未关闭。您想直接退出吗?所有修改不会被保存。</sys:String>
<sys:String x:Key="code_MainWindow_Menu_File_Close">您想要关闭这个TAS文件吗</sys:String>
<sys:String x:Key="code_MainWindow_Menu_File_Open_Fail">无法打开文件文件可能不是合法的TAS文件。</sys:String>
<sys:String x:Key="code_MainWindow_Menu_Display_ItemCount">输入新的数量(&lt;=5 &amp;&amp; &gt;=30</sys:String>

View File

@ -1,4 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BallanceTASEditor.Language"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
@ -43,7 +43,7 @@
<sys:String x:Key="ui_TASFlow_Menu_Cut">Cut</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_Copy">Copy</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_PasteAfter">Paste after this</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_PasterBefore">Paste before this</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_PasteBefore">Paste before this</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_Delete">Delete</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_DeleteAfter">Delete this frame</sys:String>
<sys:String x:Key="ui_TASFlow_Menu_DeleteBefore">Delete last frame</sys:String>
@ -62,9 +62,10 @@
<sys:String x:Key="code_Shared_ProgramName">Ballance TAS Editor</sys:String>
<sys:String x:Key="code_MainWindow_Menu_Help_About" xml:space="preserve">Under MIT License
Version: 1.0 stable
Version: 1.2 stable
Program: yyc12345.
Icon design: plAer_2</sys:String>
<sys:String x:Key="code_MainWindow_Closing">File is not closed. Do you want to just quit? All changes will not be saved.</sys:String>
<sys:String x:Key="code_MainWindow_Menu_File_Close">Do you want to close this TAS file?</sys:String>
<sys:String x:Key="code_MainWindow_Menu_File_Open_Fail">Fail to open file. This file might not a legal TAS file.</sys:String>
<sys:String x:Key="code_MainWindow_Menu_Display_ItemCount">Input new count (&lt;=5 &amp;&amp; &gt;=30)</sys:String>

View File

@ -1,4 +1,4 @@
<Window x:Class="BallanceTASEditor.MainWindow"
<Window x:Class="BallanceTASEditor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -8,7 +8,7 @@
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
mc:Ignorable="d"
Title="{DynamicResource ui_MainWindow_Title}" Height="500" Width="800" KeyUp="funcWindow_KeyUp"
input:InputMethod.IsInputMethodEnabled="False" MouseWheel="funcWindow_MouseWheel" Icon="icon.ico">
input:InputMethod.IsInputMethodEnabled="False" MouseWheel="funcWindow_MouseWheel" Icon="icon.ico" Closing="funcWindow_Closing">
<!-- shortcut defination-->
<Window.Resources>
@ -145,11 +145,11 @@
<MenuItem x:Name="uiDataMenu_Cut" Header="{DynamicResource ui_TASFlow_Menu_Cut}" Click="funcDataMenu_Cut" InputGestureText="Ctrl + X"/>
<MenuItem x:Name="uiDataMenu_Copy" Header="{DynamicResource ui_TASFlow_Menu_Copy}" Click="funcDataMenu_Copy" InputGestureText="Ctrl + C"/>
<MenuItem x:Name="uiDataMenu_PasteAfter" Header="{DynamicResource ui_TASFlow_Menu_PasteAfter}" Click="funcDataMenu_PasteAfter" InputGestureText="Ctrl + V"/>
<MenuItem x:Name="uiDataMenu_PasteBefore" Header="{DynamicResource ui_TASFlow_Menu_PasterBefore}" Click="funcDataMenu_PasteBefore"/>
<MenuItem x:Name="uiDataMenu_PasteBefore" Header="{DynamicResource ui_TASFlow_Menu_PasteBefore}" Click="funcDataMenu_PasteBefore"/>
<Separator/>
<MenuItem x:Name="uiDataMenu_Delete" Header="{DynamicResource ui_TASFlow_Menu_Delete}" Click="funcDataMenu_Delete"/>
<MenuItem x:Name="uiDataMenu_DeleteAfter" Header="{DynamicResource ui_TASFlow_Menu_DeleteAfter}" Click="funcDataMenu_DeleteAfter" InputGestureText="Del"/>
<MenuItem x:Name="uiDataMenu_DeleteBefore" Header="{DynamicResource ui_TASFlow_Menu_PasterBefore}" Click="funcDataMenu_DeleteBefore" InputGestureText="Backspace"/>
<MenuItem x:Name="uiDataMenu_DeleteBefore" Header="{DynamicResource ui_TASFlow_Menu_DeleteBefore}" Click="funcDataMenu_DeleteBefore" InputGestureText="Backspace"/>
<Separator/>
<MenuItem x:Name="uiDataMenu_AddAfter" Header="{DynamicResource ui_TASFlow_Menu_AddAfter}" Click="funcDataMenu_AddAfter"/>
<MenuItem x:Name="uiDataMenu_AddBefore" Header="{DynamicResource ui_TASFlow_Menu_AddBefore}" Click="funcDataMenu_AddBefore"/>
@ -242,16 +242,28 @@
</Grid>
<StatusBar x:Name="uiStatusbar" Grid.Row="2">
<StatusBarItem x:Name="uiStatusbar_Runtime_Mode">
<Grid>
<TextBlock x:Name="uiStatusbar_Mode_Cursor" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Cursor}"/>
<TextBlock x:Name="uiStatusbar_Mode_Fill" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Fill}"/>
<TextBlock x:Name="uiStatusbar_Mode_Overwrite" Text="{DynamicResource ui_MainWindow_StatusBar_Mode_Overwritten}"/>
</Grid>
<Separator/>
</StatusBarItem>
<Separator x:Name="uiStatusbar_Runtime_Separator1"/>
<StatusBarItem x:Name="uiStatusbar_Runtime_PasteMode">
<TextBlock x:Name="uiStatusbar_OverwrittenPaste" Text="{DynamicResource ui_MainWindow_StatusBar_OverwrittenPaste}"/>
<Separator/>
</StatusBarItem>
<Separator x:Name="uiStatusbar_Runtime_Separator2"/>
<StatusBarItem x:Name="uiStatusbar_Runtime_Selected">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{DynamicResource ui_MainWindow_StatusBar_Selected}"/>
<TextBlock x:Name="uiStatusbar_Selected" Text="-"/>
</StackPanel>
</StatusBarItem>
<StatusBarItem DockPanel.Dock="Right" HorizontalAlignment="Right">
<TextBlock Text="v1.2 stable" Foreground="Gray" FontStyle="Italic"/>
</StatusBarItem>
</StatusBar>
</Grid>

View File

@ -1,4 +1,4 @@
using BallanceTASEditor.Core;
using BallanceTASEditor.Core;
using BallanceTASEditor.Core.TASStruct;
using BallanceTASEditor.UI;
using System;
@ -124,6 +124,14 @@ namespace BallanceTASEditor {
RefreshUI(false);
}
private void funcWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
if (!(mFile is null)) {
if (!DialogUtil.ConfirmDialog(I18NProcessor.GetI18N("code_MainWindow_Closing"))) {
e.Cancel = true;
}
}
}
private void funcMenu_Display_ItemCount(object sender, RoutedEventArgs e) {
int newvalue = 0;
if (DialogUtil.InputNumber(I18NProcessor.GetI18N("code_MainWindow_Menu_Display_ItemCount"), 5, 30, ref newvalue)) {
@ -240,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;
@ -301,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
@ -323,8 +330,14 @@ 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"),
@ -332,6 +345,7 @@ namespace BallanceTASEditor {
mFile = null;
return;
}
#endif
mViewer = new TASViewer(mFile, mSlider, mFlow);
@ -392,7 +406,11 @@ namespace BallanceTASEditor {
uiMenu_Display_Undo.IsEnabled = true;
uiMenu_Display_Redo.IsEnabled = true;
uiStatusbar.Visibility = Visibility.Visible;
uiStatusbar_Runtime_Mode.Visibility = Visibility.Visible;
uiStatusbar_Runtime_PasteMode.Visibility = Visibility.Visible;
uiStatusbar_Runtime_Selected.Visibility = Visibility.Visible;
uiStatusbar_Runtime_Separator1.Visibility = Visibility.Visible;
uiStatusbar_Runtime_Separator2.Visibility = Visibility.Visible;
} else {
uiEditorPanel.Visibility = Visibility.Collapsed;
uiEditorNote.Visibility = Visibility.Visible;
@ -408,7 +426,11 @@ namespace BallanceTASEditor {
uiMenu_Display_Undo.IsEnabled = false;
uiMenu_Display_Redo.IsEnabled = false;
uiStatusbar.Visibility = Visibility.Collapsed;
uiStatusbar_Runtime_Mode.Visibility = Visibility.Collapsed;
uiStatusbar_Runtime_PasteMode.Visibility = Visibility.Collapsed;
uiStatusbar_Runtime_Selected.Visibility = Visibility.Collapsed;
uiStatusbar_Runtime_Separator1.Visibility = Visibility.Collapsed;
uiStatusbar_Runtime_Separator2.Visibility = Visibility.Collapsed;
}
}

View File

@ -7,12 +7,12 @@ using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("BallanceTASEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("Ballance TAS Editor")]
[assembly: AssemblyDescription("Ballance TAS Editor")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BallanceTASEditor")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyCompany("Ballance Community")]
[assembly: AssemblyProduct("Ballance TAS Editor")]
[assembly: AssemblyCopyright("Copyright © Ballance Community 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -51,5 +51,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetZip" version="1.9.1.8" targetFramework="net45" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
<package id="zlib.net" version="1.0.4.0" targetFramework="net40" />
</packages>