Пример #1
0
            public static FileData Load(byte[] byteArr)
            {
                FileType fileType           = (FileType)byteArr[0];
                int      fileTypeByteAmount = 1;

                byte[] headerSizeBytes      = new byte[] { byteArr[1], byteArr[2] };
                int    headerSizeByteAmount = headerSizeBytes.Length;
                short  headerSize           = System.BitConverter.ToInt16(headerSizeBytes, 0);

                byte[] headerBytes = new byte[headerSize];
                System.Array.Copy(byteArr, fileTypeByteAmount + headerSizeByteAmount, headerBytes, 0, headerSize);
                string headerCompressed = System.Text.Encoding.UTF8.GetString(headerBytes);
                string header           = GetUnCompressedString(headerCompressed);

                HeaderData headerData = HeaderData.Load(header);

                byte[] saveBytes = new byte[headerData.saveByteLength];
                System.Array.Copy(byteArr, fileTypeByteAmount + headerSizeByteAmount + headerBytes.Length, saveBytes, 0, headerData.saveByteLength);
                string saveCompressed = System.Text.Encoding.UTF8.GetString(saveBytes);

                string save = GetUnCompressedString(saveCompressed);

                FileData fileData;

                fileData.fileType   = fileType;
                fileData.headerData = headerData;
                fileData.save       = save;

                return(fileData);
            }
Пример #2
0
        private static HeaderData Load_Header(string header)
        {
            HeaderData headerData = HeaderData.Load(header);

            return(headerData);
        }