-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9227568
commit eb49686
Showing
7 changed files
with
165 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System.Text; | ||
using UnityAsset.NET.IO; | ||
|
||
namespace UnityAsset.NET; | ||
|
||
public struct Hash128 | ||
{ | ||
public byte[] data; //16 bytes | ||
|
||
public Hash128(byte[] data) | ||
{ | ||
this.data = data; | ||
} | ||
public Hash128(AssetReader reader) | ||
{ | ||
data = reader.ReadBytes(16); | ||
} | ||
|
||
public bool IsZero() | ||
{ | ||
if (data == null) | ||
return true; | ||
|
||
for (int i = 0; i < data.Length; i++) | ||
{ | ||
if (data[i] != 0) | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
StringBuilder hex = new StringBuilder(data.Length * 2); | ||
|
||
foreach (byte b in data) | ||
{ | ||
hex.AppendFormat("{0:x2}", b); | ||
} | ||
|
||
return hex.ToString(); | ||
} | ||
|
||
public static Hash128 NewBlankHash() | ||
{ | ||
return new Hash128() { data = new byte[16] }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using UnityAsset.NET.IO; | ||
|
||
namespace UnityAsset.NET.SerializedFile; | ||
|
||
public class SerializedTypeReference | ||
{ | ||
public string ClassName; | ||
|
||
public string Namespace; | ||
|
||
public string AsmName; | ||
|
||
public SerializedTypeReference() { } | ||
|
||
public SerializedTypeReference(string className, string nameSpace, string asmName) | ||
{ | ||
ClassName = className; | ||
Namespace = nameSpace; | ||
AsmName = asmName; | ||
} | ||
|
||
public void ReadMetadata(AssetReader reader) | ||
{ | ||
ClassName = reader.ReadNullTerminated(); | ||
Namespace = reader.ReadNullTerminated(); | ||
AsmName = reader.ReadNullTerminated(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters