修改错误类型
This commit is contained in:
@@ -71,7 +71,7 @@ namespace SpineViewer.Spine.Implementations.Spine
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// 都不行就报错
|
// 都不行就报错
|
||||||
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
|
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace SpineViewer.Spine.Implementations.Spine
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// 都不行就报错
|
// 都不行就报错
|
||||||
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
|
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace SpineViewer.Spine.Implementations.Spine
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// 都不行就报错
|
// 都不行就报错
|
||||||
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
|
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace SpineViewer.Spine.Implementations.Spine
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// 都不行就报错
|
// 都不行就报错
|
||||||
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
|
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace SpineViewer.Spine.Implementations.Spine
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// 都不行就报错
|
// 都不行就报错
|
||||||
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
|
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace SpineViewer.Spine.Implementations.Spine
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// 都不行就报错
|
// 都不行就报错
|
||||||
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
|
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace SpineViewer.Spine.Implementations.Spine
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// 都不行就报错
|
// 都不行就报错
|
||||||
throw new ArgumentException($"Unknown skeleton file format {SkelPath}");
|
throw new InvalidDataException($"Unknown skeleton file format {SkelPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace SpineViewer.Spine
|
|||||||
if (JsonNode.Parse(input) is JsonObject root)
|
if (JsonNode.Parse(input) is JsonObject root)
|
||||||
return root;
|
return root;
|
||||||
else
|
else
|
||||||
throw new InvalidOperationException($"{jsonPath} is not a valid json object");
|
throw new InvalidDataException($"{jsonPath} is not a valid json object");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -116,14 +116,17 @@ namespace SpineViewer.Spine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract JsonObject ToVersion(JsonObject root, Version version);
|
public abstract JsonObject ToVersion(JsonObject root, Version version);
|
||||||
|
|
||||||
protected class SkeletonReader
|
/// <summary>
|
||||||
|
/// 二进制骨骼文件读
|
||||||
|
/// </summary>
|
||||||
|
public class BinaryReader
|
||||||
{
|
{
|
||||||
protected byte[] buffer = new byte[32];
|
protected byte[] buffer = new byte[32];
|
||||||
protected byte[] bytesBigEndian = new byte[8];
|
protected byte[] bytesBigEndian = new byte[8];
|
||||||
public readonly List<string> StringTable = new(32);
|
public readonly List<string> StringTable = new(32);
|
||||||
protected Stream input;
|
protected Stream input;
|
||||||
|
|
||||||
public SkeletonReader(Stream input) { this.input = input; }
|
public BinaryReader(Stream input) { this.input = input; }
|
||||||
public int Read()
|
public int Read()
|
||||||
{
|
{
|
||||||
int val = input.ReadByte();
|
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[] buffer = new byte[32];
|
||||||
protected byte[] bytesBigEndian = new byte[8];
|
protected byte[] bytesBigEndian = new byte[8];
|
||||||
public readonly List<string> StringTable = new(32);
|
public readonly List<string> StringTable = new(32);
|
||||||
protected Stream output;
|
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 Write(int val) => output.WriteByte((byte)val);
|
||||||
public void WriteByte(byte val) => output.WriteByte(val);
|
public void WriteByte(byte val) => output.WriteByte(val);
|
||||||
public void WriteUByte(byte val) => output.WriteByte(val);
|
public void WriteUByte(byte val) => output.WriteByte(val);
|
||||||
|
|||||||
Reference in New Issue
Block a user