Exemplo n.º 1
0
 void Open(Page page, string file)
 {
     try
     {
         FileInfo info = new FileInfo(file);
         page.file = info.FullName;
         if (info.Name == "level.dat") { page.Text = info.Directory.Name; }
         else { page.Text = info.Name; }
         //Text = "INVedit - " + page.Text;
         page.changed = false;
         btnSave.Enabled = true;
         btnEdit.Enabled = true;
         btnEnchant.Enabled = true;
         // btnCloseTab.Enabled = true;
         btnReload.Enabled = true;
         NbtTag tag = NbtTag.Load(file);
         if (tag.Type == NbtTagType.Compound && tag.Contains("Data")) { tag = tag["Data"]; }
         if (tag.Type == NbtTagType.Compound && tag.Contains("Player")) { tag = tag["Player"]; }
         if (tag.Type == NbtTagType.Compound && tag.Contains("Inventory")) { tag = tag["Inventory"]; }
         if (tag.Name != "Inventory") { throw new Exception("Can't find Inventory tag."); }
         Inventory.Load(tag, page.slots);
     }
     catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }
Exemplo n.º 2
0
 void BtnNewClick(object sender, EventArgs e)
 {
     Page page = new Page();
     page.Changed += Change;
     Change(null);
     page.Text = "unnamed.inv";
     Text = "INVedit - unnamed.inv";
     tabControl.TabPages.Add(page);
     tabControl.SelectedTab = page;
     //btnSave.Enabled = true;
     //btnCloseTab.Enabled = true;
     //btnReload.Enabled = false;
 }
Exemplo n.º 3
0
 void Open(string file)
 {
     Page page = new Page();
     page.Changed += Change;
     Change(null);
     Open(page, file);
     tabControl.TabPages.Add(page);
     tabControl.SelectedTab = page;
 }