예제 #1
0
 public void GuiCodeTxt_TextChanged(object sender, EventArgs e)
 {
     try
     {
         LineP.Invalidate();
         //比如 map_title    ok
         string currentTabName = Main.Mainfrm.tabControl1.TabPages[Main.Mainfrm.tabControl1.SelectedIndex].Text.Substring(Main.Mainfrm.tabControl1.TabPages[Main.Mainfrm.tabControl1.SelectedIndex].Text.IndexOf(":") + 1);  //map_title.yml [文档]
         string newName        = currentTabName.Substring(0, currentTabName.LastIndexOf("[") - 5);
         if (Main.Mainfrm.tabControl1.TabPages[Main.Mainfrm.tabControl1.SelectedIndex].Tag == "image")
         {
             Stream stream = File.Open(Main.ImagesPath + newName + ".xml", FileMode.Open, FileAccess.Write, FileShare.ReadWrite);
             stream.Seek(0, SeekOrigin.Begin);
             stream.SetLength(0);
             stream.Close();
             File.WriteAllText(Main.ImagesPath + newName + ".xml", Main.Mainfrm.tabControl1.TabPages[Main.Mainfrm.tabControl1.SelectedIndex].Controls[0].Controls[0].Text);
             XmlMethods.ReadIm(Main.ImagesPath + newName + ".xml");
             Main.Mainfrm.GuiPropertyGrid.SelectedObject = SGuiFrame.Im;
         }
         else if (Main.Mainfrm.tabControl1.TabPages[Main.Mainfrm.tabControl1.SelectedIndex].Tag == "button")
         {
             Stream stream = File.Open(Main.ButtonsPath + newName + ".xml", FileMode.Open, FileAccess.Write, FileShare.ReadWrite);
             stream.Seek(0, SeekOrigin.Begin);
             stream.SetLength(0);
             stream.Close();
             File.WriteAllText(Main.ButtonsPath + newName + ".xml", Main.Mainfrm.tabControl1.TabPages[Main.Mainfrm.tabControl1.SelectedIndex].Controls[0].Controls[0].Text);
             XmlMethods.ReadBt(Main.ButtonsPath + newName + ".xml");
             Main.Mainfrm.GuiPropertyGrid.SelectedObject = SGuiFrame.Bt;
         }
         else if (Main.Mainfrm.tabControl1.TabPages[Main.Mainfrm.tabControl1.SelectedIndex].Tag == "text")
         {
             Stream stream = File.Open(Main.TextsPath + newName + ".xml", FileMode.Open, FileAccess.Write, FileShare.ReadWrite);
             stream.Seek(0, SeekOrigin.Begin);
             stream.SetLength(0);
             stream.Close();
             File.WriteAllText(Main.TextsPath + newName + ".xml", Main.Mainfrm.tabControl1.TabPages[Main.Mainfrm.tabControl1.SelectedIndex].Controls[0].Controls[0].Text);
             XmlMethods.ReadTxt(Main.TextsPath + newName + ".xml");
             Main.Mainfrm.GuiPropertyGrid.SelectedObject = SGuiFrame.Txt;
         }
     }
     catch
     {
     }
 }
예제 #2
0
 public void GuiCodeTxt_VScroll(object sender, EventArgs e)
 {
     LineP.Invalidate();
 }