diff --git a/BallanceTasEditor.sln b/BallanceTasEditor.sln
index 4625436..e32fb19 100644
--- a/BallanceTasEditor.sln
+++ b/BallanceTasEditor.sln
@@ -5,7 +5,7 @@ VisualStudioVersion = 17.14.36414.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BallanceTasEditor", "BallanceTasEditor\BallanceTasEditor.csproj", "{DD898514-03ED-4257-AFD1-290EEDF68113}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BallanceTasEditorTest", "BallanceTasEditorTest\BallanceTasEditorTest.csproj", "{1DC1A8CD-E963-4FF8-91D9-059522419961}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BallanceTasEditorTests", "BallanceTasEditorTests\BallanceTasEditorTests.csproj", "{D2E825CE-691B-48D7-8D87-D2CED1B25FF9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -17,10 +17,10 @@ Global
{DD898514-03ED-4257-AFD1-290EEDF68113}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD898514-03ED-4257-AFD1-290EEDF68113}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD898514-03ED-4257-AFD1-290EEDF68113}.Release|Any CPU.Build.0 = Release|Any CPU
- {1DC1A8CD-E963-4FF8-91D9-059522419961}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1DC1A8CD-E963-4FF8-91D9-059522419961}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1DC1A8CD-E963-4FF8-91D9-059522419961}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1DC1A8CD-E963-4FF8-91D9-059522419961}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D2E825CE-691B-48D7-8D87-D2CED1B25FF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D2E825CE-691B-48D7-8D87-D2CED1B25FF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D2E825CE-691B-48D7-8D87-D2CED1B25FF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D2E825CE-691B-48D7-8D87-D2CED1B25FF9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/BallanceTasEditor/BallanceTasEditor.csproj b/BallanceTasEditor/BallanceTasEditor.csproj
index 9b868b0..e8605ce 100644
--- a/BallanceTasEditor/BallanceTasEditor.csproj
+++ b/BallanceTasEditor/BallanceTasEditor.csproj
@@ -99,7 +99,7 @@
-
+
MainWindow.xaml
Code
diff --git a/BallanceTasEditor/Utils/TasMemory.cs b/BallanceTasEditor/Utils/TasStorage.cs
similarity index 95%
rename from BallanceTasEditor/Utils/TasMemory.cs
rename to BallanceTasEditor/Utils/TasStorage.cs
index 16da0e2..be1e7b3 100644
--- a/BallanceTasEditor/Utils/TasMemory.cs
+++ b/BallanceTasEditor/Utils/TasStorage.cs
@@ -10,7 +10,7 @@ namespace BallanceTasEditor.Utils {
///
/// 所有用于在内存中存储TAS帧的结构都必须实现此interface。
///
- public interface ITasMemory where T : class {
+ public interface ITasStorage {
///
/// 访问给定索引的值。
///
@@ -61,8 +61,8 @@ namespace BallanceTasEditor.Utils {
///
/// 其实就是把List的InsertRange的复杂度从O(n*m)修正为O(n)。
///
- public class GapBufferTasMemory : ITasMemory where T : class {
- public GapBufferTasMemory() {
+ public class GapBufferTasStorage : ITasStorage {
+ public GapBufferTasStorage() {
}
@@ -97,8 +97,8 @@ namespace BallanceTasEditor.Utils {
///
/// 由于List的InsertRange的复杂度是O(n*m),可能不符合要求。
///
- public class ListTasMemory : ITasMemory where T : class {
- public ListTasMemory() {
+ public class ListTasStorage : ITasStorage {
+ public ListTasStorage() {
m_Container = new List();
}
@@ -132,8 +132,8 @@ namespace BallanceTasEditor.Utils {
///
/// 传统的基于LinkedList的TAS存储器。
///
- public class LegacyTasMemory : ITasMemory where T : class {
- public LegacyTasMemory() {
+ public class LegacyTasStorage : ITasStorage {
+ public LegacyTasStorage() {
m_Container = new LinkedList();
m_Cursor = null;
m_CursorIndex = null;
@@ -165,7 +165,7 @@ namespace BallanceTasEditor.Utils {
///
private void MoveToIndex(int desiredIndex) {
// 检查基本环境
- if (desiredIndex >= GetCount())
+ if (desiredIndex < 0 || desiredIndex >= GetCount())
throw new ArgumentOutOfRangeException("Index out of range");
if (m_Cursor is null || !m_CursorIndex.HasValue || IsEmpty())
throw new InvalidOperationException("Can not move cursor when container is empty.");
diff --git a/BallanceTasEditorTest/UnitTest1.cs b/BallanceTasEditorTest/UnitTest1.cs
deleted file mode 100644
index 59ed8e9..0000000
--- a/BallanceTasEditorTest/UnitTest1.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-
-namespace BallanceTasEditorTest {
- [TestClass]
- public class UnitTest1 {
- [TestMethod]
- public void TestMethod1() {
- }
- }
-}
diff --git a/BallanceTasEditorTest/BallanceTasEditorTest.csproj b/BallanceTasEditorTests/BallanceTasEditorTests.csproj
similarity index 95%
rename from BallanceTasEditorTest/BallanceTasEditorTest.csproj
rename to BallanceTasEditorTests/BallanceTasEditorTests.csproj
index 2f059d8..5edd915 100644
--- a/BallanceTasEditorTest/BallanceTasEditorTest.csproj
+++ b/BallanceTasEditorTests/BallanceTasEditorTests.csproj
@@ -5,11 +5,11 @@
Debug
AnyCPU
- {1DC1A8CD-E963-4FF8-91D9-059522419961}
+ {D2E825CE-691B-48D7-8D87-D2CED1B25FF9}
Library
Properties
- BallanceTasEditorTest
- BallanceTasEditorTest
+ BallanceTasEditorTests
+ BallanceTasEditorTests
v4.8
512
{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
@@ -49,8 +49,8 @@
-
+
diff --git a/BallanceTasEditorTest/Properties/AssemblyInfo.cs b/BallanceTasEditorTests/Properties/AssemblyInfo.cs
similarity index 74%
rename from BallanceTasEditorTest/Properties/AssemblyInfo.cs
rename to BallanceTasEditorTests/Properties/AssemblyInfo.cs
index 4363650..84551d8 100644
--- a/BallanceTasEditorTest/Properties/AssemblyInfo.cs
+++ b/BallanceTasEditorTests/Properties/AssemblyInfo.cs
@@ -2,18 +2,18 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-[assembly: AssemblyTitle("BallanceTasEditorTest")]
+[assembly: AssemblyTitle("BallanceTasEditorTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("BallanceTasEditorTest")]
+[assembly: AssemblyProduct("BallanceTasEditorTests")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
-[assembly: Guid("1dc1a8cd-e963-4ff8-91d9-059522419961")]
+[assembly: Guid("d2e825ce-691b-48d7-8d87-d2ced1b25ff9")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/BallanceTasEditorTests/Utils/TasStorageTests.cs b/BallanceTasEditorTests/Utils/TasStorageTests.cs
new file mode 100644
index 0000000..09995e5
--- /dev/null
+++ b/BallanceTasEditorTests/Utils/TasStorageTests.cs
@@ -0,0 +1,164 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BallanceTasEditor.Utils;
+
+namespace BallanceTasEditorTests.Utils {
+ [TestClass]
+ public class TasStorageTests {
+
+ private static readonly int[] PROBE = { 10, 20, 30, 40, 50 };
+
+ private static IEnumerable