예제 #1
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     StaticBenchmark.Begin();
     FileStream file = new FileStream(filename2, FileMode.Open);
     MemoryStream ms;
     using (file)
     {
         ms = new MemoryStream((int)file.Length);
         Buffering.Copy(file, ms);
         file.Close();
     }
     Map m = new Map(ms);
     Decompiler decompiler = new Decompiler(m);
     foreach (Map.TagIndex.TagInfo Entry in m.Index.TagEntries)
     {
         if (Entry.Type == "sbsp" || Entry.Type == "ltmp")
             decompiler.Decompile(Entry, m.PrimaryMagic);
         else
             decompiler.Decompile(Entry, m.SecondaryMagic);
     }
     StaticBenchmark.End();
     MessageBox.Show(string.Format("Finished in: {0}", StaticBenchmark.Result), "Decompile Successful");
 }
예제 #2
0
 public void ImportMap(Map map)
 {
     OnImportBegin();
     Decompiler decompiler = new Decompiler(map);
     Directory.SetCurrentDirectory(SourceDirectory);
     foreach (Index.TagInformation Entry in map.Index.TagEntries)
     {
         string filename = Path.ChangeExtension(map.Tagnames[Entry.Index & 0x0000FFFF], Index.GetCleanType(Entry.Type.ToString()).Trim()) + Tag.Path.Extension;
         if (Entry.Type == "sbsp" || Entry.Type == "ltmp")
             decompiler.Decompile(Entry, filename, map.PrimaryMagic);
         else if (Entry.Type == "unic")
             decompiler.DecompileUnic(Entry, filename, map.SecondaryMagic, map.Unicode[UnicodeTable.Language.English]);
         else
             decompiler.Decompile(Entry, filename, map.SecondaryMagic);
         if (Entry.Type == "scnr") Scenario = filename;
     }
     Save();
     OnImportCompleted();
 }