Exemplo n.º 1
0
        public void Save(string filePath)
        {
            this.Path   = filePath;
            FileHandler = new RoseFileHandler(filePath, FileMode.Create, Encoding.GetEncoding("EUC-KR"));
            FileHandler.Write <short>((short)listDDS.Count);
            int totalElementCount = 0;

            listDDS.ForEach(delegate(DDS dds){
                FileHandler.WriteSString(dds.Path);
                FileHandler.Write <int>(dds.ColourKey);
                totalElementCount += dds.ListDDS_element.Count;
            });

            FileHandler.Write <short>((short)totalElementCount);

            listDDS.ForEach(delegate(DDS dds){
                FileHandler.Write <short>((short)dds.ListDDS_element.Count);
                dds.ListDDS_element.ForEach(delegate(DDS.DDSElement dds_element)
                {
                    FileHandler.Write <short>(dds_element.OwnerId);
                    FileHandler.Write <int>(dds_element.X);
                    FileHandler.Write <int>(dds_element.Y);
                    FileHandler.Write <int>(dds_element.Width + dds_element.X);
                    FileHandler.Write <int>(dds_element.Height + dds_element.Y);
                    FileHandler.Write <int>(dds_element.Color);
                    FileHandler.Write <string>(dds_element.Name);
                });
            });
            FileHandler.Dispose();
        }
Exemplo n.º 2
0
        public void Load(string filePath)
        {
            this.Path   = filePath;
            FileHandler = new RoseFileHandler(filePath, FileMode.Open, Encoding.GetEncoding("EUC-KR"));
            short DDSCount = FileHandler.Read <short>();

            this.listDDS = new List <DDS>(DDSCount);
            for (int i = 0; i < DDSCount; i++)
            {
                DDS newDDS = new DDS();
                newDDS.Path      = FileHandler.ReadSString();
                newDDS.ColourKey = FileHandler.Read <int>();
                this.listDDS.Add(newDDS);
            }

            short TotalementCount = FileHandler.Read <short>();

            for (int i = 0; i < DDSCount; i++)
            {
                short ElementCount = FileHandler.Read <short>();
                listDDS[i].ListDDS_element = new List <DDS.DDSElement>(ElementCount);
                for (int a = 0; a < ElementCount; a++)
                {
                    DDS.DDSElement newElement = new DDS.DDSElement();
                    newElement.OwnerId = FileHandler.Read <short>();
                    newElement.X       = FileHandler.Read <int>();
                    newElement.Y       = FileHandler.Read <int>();
                    newElement.Width   = FileHandler.Read <int>() - newElement.X;
                    newElement.Height  = FileHandler.Read <int>() - newElement.Y;
                    newElement.Color   = FileHandler.Read <int>();
                    newElement.Name    = FileHandler.Read <string>(0x20);
                    listDDS[i].ListDDS_element.Add(newElement);
                }
            }
            FileHandler.Dispose();
        }