Esempio n. 1
0
 private void RunCommand(YnoteCommand c)
 {
     try
     {
         foreach (var command in Commands)
         {
             if (command.Key == c.Key)
             {
                 command.ProcessCommand(c.Value, Globals.Ynote);
             }
         }
         if (c.Key == "SetSyntax" || c.Key == "SetSyntaxFile")
         {
             LangMenu.Text = c.Value;
         }
         completemenu.Items = null;
         if (!IsDisposed)
         {
             Close();
         }
     }
     catch
     {
         MessageBox.Show("Error Running Command!");
         if (!IsDisposed)
         {
             Close();
         }
     }
 }
Esempio n. 2
0
 private void RunCommand(YnoteCommand c)
 {
     try
     {
         foreach (var command in Globals.Commands)
         {
             if (command.Key == c.Key)
             {
                 command.ProcessCommand(c.Value, Globals.Ynote);
                 break;
             }
         }
         if (c.Key == "SetSyntax")
         {
             LangMenu.Text = c.Value;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error Running Command!\n" + ex.Message);
     }
     completemenu.Items = null;
     if (!IsDisposed)
     {
         Close();
     }
 }
Esempio n. 3
0
 private void textBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         RunCommand(YnoteCommand.FromString(tbcommand.Text));
     }
     else if (e.KeyCode == Keys.Escape)
     {
         completemenu.Items = null;
         Close();
     }
 }
Esempio n. 4
0
        public static void RunCommand(IYnote ynote, string commandstr)
        {
            var command = YnoteCommand.FromString(commandstr);

            if (Commands == null)
            {
                ReloadCommands();
            }
            foreach (var cmd in Commands)
            {
                if (cmd.Key == command.Key)
                {
                    cmd.ProcessCommand(command.Value, ynote);
                    break;
                }
            }
        }
Esempio n. 5
0
        internal static IDictionary <string, string> GenerateDictionary(string manifest)
        {
            IDictionary <string, string> dic = new Dictionary <string, string>();
            var lines = File.ReadAllLines(manifest);

            foreach (var line in lines)
            {
                var command = YnoteCommand.FromString(line);
                command.Value = command.Value.Replace("$ynotedata", GlobalSettings.SettingsDir);
                if (command.Value.IndexOf("$ynotedir") != -1)
                {
                    command.Value = command.Value.Replace("$ynotedir", Application.StartupPath);
                }
                dic.Add(command.Key, command.Value);
            }
            return(dic);
        }
Esempio n. 6
0
        internal static IDictionary <string, string> GenerateDictionary(string manifest)
        {
            IDictionary <string, string> dic = new Dictionary <string, string>();
            var lines = File.ReadAllLines(manifest);

            foreach (
                var command in
                lines.Select(
                    line =>
                    YnoteCommand.FromString(line.Replace("$ynotedata", GlobalSettings.SettingsDir)
                                            .Replace("$ynotedir", Application.StartupPath))))
            {
                dic.Add(command.Key, command.Value);
            }
            //foreach (var line in lines)
            //{
            //    var command = Parse(line.Replace("$ynotedir", Application.StartupPath));
            //    dic.Add(command.Key, command.Value);
            //}
            return(dic);
        }
Esempio n. 7
0
 private void RunCommand(YnoteCommand c)
 {
     try
     {
         foreach (var command in Globals.Commands)
         {
             if (command.Key == c.Key)
             {
                 command.ProcessCommand(c.Value, Globals.Ynote);
                 break;
             }
         }
         if (c.Key == "SetSyntax")
             LangMenu.Text = c.Value;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error Running Command!\n" + ex.Message);
     }
     completemenu.Items = null;
     if (!IsDisposed)
         Close();
 }