示例#1
0
        string CommandSet(string name, string input)
        {
            var path = IniAdapter.NameToPath(input);

            if (path == null)
            {
                return("ERROR Invalid Option path");
            }

            var value = IniAdapter.GetValue(input);

            if (value == null)
            {
                return("ERROR Invalid Option value");
            }

            var option = RuntimeProfile.Main.GetOption(path);

            if (option == null)
            {
                return("ERROR Option not found");
            }

            option.Load(value);
            option.ApplyFromRoot();

            return(option.Save());
        }
示例#2
0
文件: Prompt.cs 项目: sttz/trimmer
        protected void ExecutePrompt()
        {
            // Enter on empty prompt closes it
            if (input.Length == 0)
            {
                StopPrompt();

                // Set a option value
            }
            else if (input.Contains("="))
            {
                var path = IniAdapter.NameToPath(input);
                if (path != null)
                {
                    var option = RuntimeProfile.Main.GetOption(path);
                    var value  = IniAdapter.GetValue(input);
                    if (option != null && value != null)
                    {
                        option.Load(value);
                        option.ApplyFromRoot();
                        input = "";
                    }
                }

                // Enter on an option shows it's value
            }
            else
            {
                var path = IniAdapter.NameToPath(input);
                if (path != null)
                {
                    var option = RuntimeProfile.Main.GetOption(path);
                    if (option != null)
                    {
                        input += " = " + option.Save();
                    }
                }
            }
        }