public static void SerializeList(List <Sample> samples, string path) { FileStream fs = new FileStream(path, FileMode.CreateNew, FileAccess.Write); BinaryWriter b = new BinaryWriter(fs); b.Write(samples.Count); for (int i = 0, imax = samples.Count; i < imax; i++) { Sample s = samples[i]; byte[] datas = s.Serialize(); b.Write(datas.Length); b.Write(datas); } b.Close(); }
public static void SerializeList(List<Sample> samples, string path) { FileStream fs = new FileStream(path, FileMode.CreateNew, FileAccess.Write); BinaryWriter b = new BinaryWriter(fs); #if UNITY_EDITOR UnityEditor.EditorUtility.ClearProgressBar(); #endif b.Write(samples.Count); for (int i = 0, imax = samples.Count; i < imax; i++) { Sample s = samples[i]; #if UNITY_EDITOR UnityEditor.EditorUtility.DisplayProgressBar("serialize profiler data", "serialize " + s.name, (float)i / (float)imax); #endif byte[] datas = s.Serialize(); b.Write(datas.Length); b.Write(datas); } b.Close(); #if UNITY_EDITOR UnityEditor.EditorUtility.ClearProgressBar(); #endif }