private static void Tags(UnLoader a, string[] i) { a.PackInt(i.Length); for (int b = 0; b < i.Length; b++) { a.PackString(i[b]); } }
private static void SaveSoftFile(UnLoader a, SoftFile i) { a.PackInt(i.Id); a.PackString(i.Name); a.PackString(i.ThumbnailPath); Tags(a, i.TagArray); SaveSHA256(a, i.SHA256); }
private static void Save(FileStream fs, CentralDirectory i) { var a = new UnLoader(fs); SaveCentralIndex(a, i); //var b = i.Self; //foreach (var c in b) SaveSoftDir(a, i.Self); }
private static void SaveSHA256(UnLoader a, SHA256 i) { if (i == null || i.Hash == null || i.Hash.Length != 32) { a.PackByte(0); } else { a.PackByte(32); a.Pack(i.Hash); } }
private static void SaveCentralIndex(UnLoader a, CentralIndex s) { a.PackInt(s.CurId); var files = s.Files; int fileCount = files.Count; a.PackInt(fileCount); for (int i = 0; i < fileCount; i++) { SaveSoftFile(a, files[i]); } }
private static void SaveSoftDir(UnLoader a, SoftDirectory i) { var subdirs = i.SubDirectories; var files = i.SoftFiles; int subdircount = subdirs.Count; int filecount = files.Count; a.PackInt(i.Id); a.PackInt(subdircount); a.PackInt(filecount); a.PackString(i.Name); a.PackString(i.ThumbnailPath); Tags(a, i.TagArray); for (int b = 0; b < subdircount; b++) { SaveSoftDir(a, subdirs[b]); } for (int b = 0; b < filecount; b++) { a.PackInt(files[b].Id); } }