Exemplo n.º 1
0
 static StringDb()
 {
     dbFile = "nox.csf";
     Current = new StringDb(noxPath + dbFile);
 }
Exemplo n.º 2
0
        private void menuItem2_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter = "Nox Strings File (*.csf)|*.csf";
            fd.ShowDialog();

            if (System.IO.File.Exists(fd.FileName))
            {
                //TODO: check for changes and prompt to save
                StringDb db = new StringDb(fd.FileName);
                db.Write(File.OpenWrite("output.csf"));
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("Export:");
                Console.WriteLine("A - Export ThingDB");
                Console.WriteLine("M - Export Maps");
                Console.WriteLine("X - Export Tiles");
                Console.WriteLine("P - Export TileEdges");
                Console.WriteLine("Y - Export Walls");
                Console.WriteLine("L - Export Sequences");
                Console.WriteLine("U - Export Objects");
                Console.WriteLine("B - Export OtherImages");
                Console.WriteLine("I - Export Audio");
                Console.WriteLine("S - Export Map Scripts");
                Console.WriteLine("W - Export Soundset");
                Console.WriteLine("T - Export StringDB");
                Console.WriteLine("E - Export MonsterDB");
                Console.WriteLine("O - ModDB");
                Console.WriteLine("Q - Quit");

                thingdb = new ThingDb();
                moddb = new ModifierDb();
                bag = new VideoBag(@"C:\GOG Games\Nox\video8.bag");
                ssilist = new Lexicon<uint, VideoBag.SpriteSheetInfo>();

                switch (Convert.ToChar(Console.Read()))
                {
                    case 'T':
                        {
                            var stringdb = new StringDb();
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength = int.MaxValue;
                            var json = jsonserialize.Serialize(stringdb);
                            System.IO.File.WriteAllText("StringDB.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("StringDB.json", json);
                        }
                        break;
                    case 'A':
                        {

                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(thingdb);
                            System.IO.File.WriteAllText("ThingDB.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("ThingDB.json", json);
                        }
                        break;
                    case 'I':
                        {
                            AudioBag abag = new AudioBag(NoxDb.NoxPath + "Audio.bag");
                            abag.ExtractAll("audio");

                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength = int.MaxValue;
                            var json = jsonserialize.Serialize(abag);
                            System.IO.File.WriteAllText("Audio.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("Audio.json", json);
                        }
                        break;
                    case 'M':
                        {
                            ExportMaps();
                            /*
                            Map map = new Map(@"C:\Program Files (x86)\Nox\maps\BluDeath\BluDeath.map", thingdb);
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(map);
                            System.IO.File.WriteAllText("BlueDeath.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("BlueDeath.json", json);J*/
                        }
                        break;
                    case 'S':
                        {
                            ExportMapScripts();
                            /*
                            Map map = new Map(@"C:\Program Files (x86)\Nox\maps\BluDeath\BluDeath.map", thingdb);
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(map);
                            System.IO.File.WriteAllText("BlueDeath.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("BlueDeath.json", json);J*/
                        }
                        break;
                    case 'O':
                        {
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(moddb);
                            System.IO.File.WriteAllText("ModDB.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("ModDB.json", json);
                        }
                        break;
                    case 'X':
                        {
                            ExportTiles();
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(ssilist);
                            System.IO.File.WriteAllText("TileSprites.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("TileSprites.json", json);
                        }
                        break;
                    case 'P':
                        {
                            ExportEdgeTiles();
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(ssilist);
                            System.IO.File.WriteAllText("TileEdgeSprites.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("TileEdgeSprites.json", json);
                        }
                        break;
                    case 'Y':
                        {
                            ExportWalls();
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(ssilist);
                            System.IO.File.WriteAllText("WallSprites.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("WallSprites.json", json);
                        }
                        break;
                    case 'B':
                        {
                            ExportOtherSprites();
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(ssilist);
                            System.IO.File.WriteAllText("OtherSprites.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("OtherSprites.json", json);
                        }
                        break;
                    case 'L':
                        {
                            ExportSequences();
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength = int.MaxValue;
                            var json = jsonserialize.Serialize(ssilist);
                            System.IO.File.WriteAllText("SequenceSprites.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("SequenceSprites.json", json);
                        }
                        break;
                    case 'U':
                        {
                            var jsonserialize = new JavaScriptSerializer();
                            try
                            {
                                string cont = System.IO.File.ReadAllText("ObjectSprites.min.json");
                                ssilist = jsonserialize.Deserialize<Lexicon<uint, VideoBag.SpriteSheetInfo>>(cont);
                            }
                            catch {}

                            ExportObjects();

                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(ssilist);
                            System.IO.File.WriteAllText("ObjectSprites.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("ObjectSprites.json", json);
                        }
                        break;
                    case 'E':
                        {
                            var mdb = new MonsterDb();
                            mdb.LoadMonsterInfo();
                            var jsonserialize = new JavaScriptSerializer();
                            jsonserialize.MaxJsonLength *= 5;
                            var json = jsonserialize.Serialize(mdb);
                            System.IO.File.WriteAllText("MonsterDB.min.json", json);
                            json = JSON_PrettyPrinter.Process(json);
                            System.IO.File.WriteAllText("MonsterDB.json", json);

                        }
                        break;
                    case 'W':
                        {
                            new SoundsetDb();
                            new GamedataDb();
                        }
                        break;
                    case 'Q':
                        return;
                }
            }
        }
Exemplo n.º 4
0
 static StringDb()
 {
     dbFile  = "nox.csf";
     Current = new StringDb(NoxPath + dbFile);
 }