Beispiel #1
0
 public Deserializer(string location)
 {
     saveLocation = String.Format("{0}/{1}", Path.GetDirectoryName(location), Path.GetFileNameWithoutExtension(location));
     tsd_File     = (TSD_File) new YAXSerializer(typeof(TSD_File)).DeserializeFromFile(location);
     WriteFile();
     File.WriteAllBytes(saveLocation, bytes.ToArray());
 }
Beispiel #2
0
 public Deserializer(TSD_File _tsd_File, string _saveLocation)
 {
     saveLocation = _saveLocation;
     tsd_File     = _tsd_File;
     WriteFile();
     File.WriteAllBytes(saveLocation, bytes.ToArray());
 }
Beispiel #3
0
        public void Parse()
        {
            tsd_File           = new TSD_File();
            tsd_File.Triggers  = new List <TSD_Trigger>();
            tsd_File.Events    = new List <TSD_Event>();
            tsd_File.Globals   = new List <TSD_Global>();
            tsd_File.Constants = new List <TSD_Constant>();
            tsd_File.Zones     = new List <TSD_Zone>();

            //Offsets and counts
            int currentOffset  = 0;
            int currentSection = 0;

            for (int i = 0; i < 5; i++)
            {
                if (currentOffset > 0)
                {
                    currentOffset += 8;
                }
                currentSection = rawBytes[currentOffset];
                currentOffset++;

                switch (currentSection)
                {
                case 1:
                    currentOffset = ParseSection1(currentOffset);
                    break;

                case 2:
                    currentOffset = ParseSection2(currentOffset);
                    break;

                case 3:
                    currentOffset = ParseSection3(currentOffset);
                    break;

                case 4:
                    currentOffset = ParseSection4(currentOffset);
                    break;

                case 5:
                    currentOffset = ParseSection5(currentOffset);
                    break;
                }
            }
        }
Beispiel #4
0
 public Deserializer(TSD_File _tsd_File)
 {
     tsd_File = _tsd_File;
     WriteFile();
 }