Example #1
0
        public bool Save(string filePath)
        {
            try {
                foreach (TextEntity text in Texts)
                {
                    text.ReinsertLines();
                }

                UInt32 newExportsAddress        = StartPosition + GetActionsLength() + 12;             // + EXPORT_DATA.Length
                UInt32 newCollectionLinkAddress = newExportsAddress + ExportsCount * EXPORT_SIZE + 16; // + COLLECTION_LINK.length

                StartData = ByteUtil.InsertUint32(StartData, newExportsAddress, HEADER_OFFSET);
                StartData = ByteUtil.InsertUint32(StartData, newCollectionLinkAddress, HEADER_OFFSET + 3 * 4);

                NewFile.AddRange(StartData);

                WriteActions();
                WriteExports();
                WriteCollectionLink();

                File.WriteAllBytes(filePath, NewFile.ToArray());
                return(true);
            }
            catch (Exception e) {
                Console.WriteLine(e);
                return(false);
            }
        }