static private byte[] GetSoftfile(SoftFile softFile) { return(Extension.Combine(Extension.GetBytes(softFile.Description.Length), Encoding.ASCII.GetBytes(softFile.Description), Extension.GetBytes((int)softFile.Id), Extension.GetBytes((ushort)softFile.Name.Length), Encoding.ASCII.GetBytes(softFile.Name), Extension.GetBytes((ushort)softFile.Thumbnail.Length), Encoding.ASCII.GetBytes(softFile.Thumbnail), Extension.GetBytes((ushort)softFile.Hash.Length), Encoding.ASCII.GetBytes(softFile.Hash), GetTags(softFile))); }
static private byte[] GetData(Child <SoftFile> child) { ushort namelength = (ushort)child.Name.Length; int softfilelength; byte[] softfile = new byte[0]; if (child.Item == null) { softfilelength = 0; } else { softfile = GetSoftfile(child.Item); softfilelength = softfile.Length; } ushort numberofchildren = (ushort)child.Children.Count; byte[][] children = new byte[numberofchildren][]; for (int i = 0; i < numberofchildren; i++) { children[i] = GetData(child.Children[i]); } if (softfilelength > 0) { return(Extension.Combine(Extension.GetBytes(namelength), Encoding.ASCII.GetBytes(child.Name), Extension.GetBytes(softfilelength), softfile, Extension.GetBytes(numberofchildren), Extension.Combine(children))); } else { return(Extension.Combine(Extension.GetBytes(namelength), Encoding.ASCII.GetBytes(child.Name), Extension.GetBytes(softfilelength), Extension.GetBytes(numberofchildren), Extension.Combine(children))); } }