public static void ByteArray(ref byte[] arr, string label) { if (Scribe.mode == LoadSaveMode.Saving) { if (arr != null) { byte[] array = CompressUtility.Compress(arr); if (array.Length < arr.Length) { string text = DataExposeUtility.AddLineBreaksToLongString(Convert.ToBase64String(array)); Scribe_Values.Look <string>(ref text, label + "Deflate", null, false); } else { string text2 = DataExposeUtility.AddLineBreaksToLongString(Convert.ToBase64String(arr)); Scribe_Values.Look <string>(ref text2, label, null, false); } } } if (Scribe.mode == LoadSaveMode.LoadingVars) { string text3 = null; Scribe_Values.Look <string>(ref text3, label + "Deflate", null, false); if (text3 != null) { arr = CompressUtility.Decompress(Convert.FromBase64String(DataExposeUtility.RemoveLineBreaks(text3))); } else { Scribe_Values.Look <string>(ref text3, label, null, false); if (text3 != null) { arr = Convert.FromBase64String(DataExposeUtility.RemoveLineBreaks(text3)); } else { arr = null; } } } }
public static void ByteArray(ref byte[] arr, string label) { if (Scribe.mode == LoadSaveMode.Saving && arr != null) { byte[] array = CompressUtility.Compress(arr); if (array.Length < arr.Length) { string value = AddLineBreaksToLongString(Convert.ToBase64String(array)); Scribe_Values.Look(ref value, label + "Deflate"); } else { string value2 = AddLineBreaksToLongString(Convert.ToBase64String(arr)); Scribe_Values.Look(ref value2, label); } } if (Scribe.mode != LoadSaveMode.LoadingVars) { return; } string value3 = null; Scribe_Values.Look(ref value3, label + "Deflate"); if (value3 != null) { arr = CompressUtility.Decompress(Convert.FromBase64String(RemoveLineBreaks(value3))); return; } Scribe_Values.Look(ref value3, label); if (value3 != null) { arr = Convert.FromBase64String(RemoveLineBreaks(value3)); } else { arr = null; } }