FromString() public static method

Creates a YnoteCommand from String
public static FromString ( string command ) : YnoteCommand,
command string
return YnoteCommand,
Example #1
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();
     }
 }
Example #2
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;
                }
            }
        }
Example #3
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);
        }
Example #4
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);
        }