Exemplo n.º 1
0
 private void btnConvertGbot_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Filter = "Grimoire Bots (*.gbot)|*.gbot";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 string converted = BotConverter.GenCodeGrimoire(ofd.FileName);
                 using (SaveFileDialog sfd = new SaveFileDialog())
                 {
                     sfd.Filter = "RBot Scripts (*.cs)|*.cs";
                     if (sfd.ShowDialog() == DialogResult.OK)
                     {
                         File.WriteAllText(sfd.FileName, converted);
                     }
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show($"Error during conversion:\r\n{ex}");
             }
         }
     }
 }
Exemplo n.º 2
0
 private void btnLoadGbot_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Filter = "Grimoire Bots (*.gbot)|*.gbot";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 string converted = BotConverter.GenCodeGrimoire(ofd.FileName);
                 string save      = Path.GetTempFileName() + ".cs";
                 File.WriteAllText(save, converted);
                 ScriptManager.LoadedScript = save;
                 Text = $"Scripts - {Path.GetFileName(ofd.FileName)}";
             }
             catch (Exception ex)
             {
                 MessageBox.Show($"Error during conversion:\r\n{ex}");
             }
         }
     }
 }