修改错误类型

This commit is contained in:
ww-rm
2025-03-20 14:03:33 +08:00
parent f14ab870f7
commit 8c921a6ed5
8 changed files with 18 additions and 12 deletions

View File

@@ -71,7 +71,7 @@ namespace SpineViewer.Spine.Implementations.Spine
catch
{
// 都不行就报错
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
}
}

View File

@@ -70,7 +70,7 @@ namespace SpineViewer.Spine.Implementations.Spine
catch
{
// 都不行就报错
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
}
}

View File

@@ -68,7 +68,7 @@ namespace SpineViewer.Spine.Implementations.Spine
catch
{
// 都不行就报错
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
}
}

View File

@@ -71,7 +71,7 @@ namespace SpineViewer.Spine.Implementations.Spine
catch
{
// 都不行就报错
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
}
}

View File

@@ -70,7 +70,7 @@ namespace SpineViewer.Spine.Implementations.Spine
catch
{
// 都不行就报错
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
}
}

View File

@@ -70,7 +70,7 @@ namespace SpineViewer.Spine.Implementations.Spine
catch
{
// 都不行就报错
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
}
}

View File

@@ -70,7 +70,7 @@ namespace SpineViewer.Spine.Implementations.Spine
catch
{
// 都不行就报错
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
}
}

View File

@@ -98,7 +98,7 @@ namespace SpineViewer.Spine
if (JsonNode.Parse(input) is JsonObject root)
return root;
else
throw new InvalidOperationException($"{jsonPath} is not a valid json object");
throw new InvalidDataException($"{jsonPath} is not a valid json object");
}
/// <summary>
@@ -116,14 +116,17 @@ namespace SpineViewer.Spine
/// </summary>
public abstract JsonObject ToVersion(JsonObject root, Version version);
protected class SkeletonReader
/// <summary>
/// 二进制骨骼文件读
/// </summary>
public class BinaryReader
{
protected byte[] buffer = new byte[32];
protected byte[] bytesBigEndian = new byte[8];
public readonly List<string> StringTable = new(32);
protected Stream input;
public SkeletonReader(Stream input) { this.input = input; }
public BinaryReader(Stream input) { this.input = input; }
public int Read()
{
int val = input.ReadByte();
@@ -219,14 +222,17 @@ namespace SpineViewer.Spine
}
}
protected class SkeletonWriter
/// <summary>
/// 二进制骨骼文件写
/// </summary>
protected class BinaryWriter
{
protected byte[] buffer = new byte[32];
protected byte[] bytesBigEndian = new byte[8];
public readonly List<string> StringTable = new(32);
protected Stream output;
public SkeletonWriter(Stream output) { this.output = output; }
public BinaryWriter(Stream output) { this.output = output; }
public void Write(int val) => output.WriteByte((byte)val);
public void WriteByte(byte val) => output.WriteByte(val);
public void WriteUByte(byte val) => output.WriteByte(val);