Beispiel #1
0
 static void Main(string[] args)
 {
     var parser = new ValveFormatParser {Path = @"C:\VFP.txt"};
     parser.LoadFile();
     /*parser.Nodes.ForEach(delegate(DataNode n)
                              {
                                  Console.WriteLine(n.Key + " = " + n.Value);
                                  n.SubNodes.ForEach(delegate(DataNode no)
                                                         {
                                                             Console.WriteLine("\t" + no.Key + " = " + no.Value);
                                                             no.SubNodes.ForEach(delegate(DataNode nod)
                                                                                     {
                                                                                         Console.WriteLine("\t\t" + nod.Key + " = " + nod.Value);
                                                                                     });
                                                         });
                              });*/
     Console.WriteLine("Saving tree...");
     File.WriteAllText(@"C:\VFP_out.txt", parser.RootNode.ToString());
     Console.WriteLine("Saving output...");
     parser.SaveFile(@"C:\VFP_save.txt");
     Console.WriteLine("Done!");
     Console.ReadLine();
 }
Beispiel #2
0
 private void tfenglishtxtToolStripMenuItem_Click(object sender, EventArgs e)
 {
     string ret = "";
     using (var diag = new OpenFileWindow())
     {
         Cursor = Cursors.WaitCursor;
         ret = diag.ShowWindow("tf_english.txt", @"\tf\resource\");
     }
     Cursor = Cursors.Arrow;
     if (!String.IsNullOrEmpty(ret))
     {
         wait = true;
         Cursor.Current = Cursors.WaitCursor;
         englishParser = new ValveFormatParser(ret);
         englishParser.LoadFile();
         Cursor.Current = Cursors.Arrow;
         if (englishParser.RootNode.Key != "lang")
         {
             MessageBox.Show("That is not tf_english.txt.\r\nPlease select tf_english.txt!",
                             "TF2 Items Editor",
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
             englishParser = null;
             wait = false;
             return;
         }
         stripTxt.Text = "";
         stripTxt.Image = null;
         groupTips.Enabled = true;
         comboTipClasses.SelectedIndex = 0;
         wait = false;
     }
 }
Beispiel #3
0
 private void itemsgametxtToolStripMenuItem_Click(object sender, EventArgs e)
 {
     string ret;
     using (var diag = new OpenFileWindow())
     {
         Cursor = Cursors.WaitCursor;
         ret = diag.ShowWindow("items_game.txt", @"\tf\scripts\items\");
     }
     Cursor = Cursors.Arrow;
     if (!String.IsNullOrEmpty(ret))
     {
         Cursor.Current = Cursors.WaitCursor;
         itemsParser = new ValveFormatParser(ret);
         itemsParser.LoadFile();
         Cursor.Current = Cursors.Arrow;
         if (itemsParser.RootNode.Key != "items_game")
         {
             MessageBox.Show("That is not items_game.txt.\r\nPlease select items_game.txt!",
                             "TF2 Items Editor",
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
             itemsParser = null;
             return;
         }
         LoadItems();
         stripTxt.Text = "Edit->Attributes to open the attributes window!";
         stripTxt.Image = images.Images["Info"];
     }
 }