ExampleMenu.Examples.Procedures.ProcManager.AddProc C# (CSharp) Method

AddProc() public method

public AddProc ( string name, IEnumerable content ) : void
name string
content IEnumerable
return void
        public void AddProc(string name, IEnumerable<string> content)
        {
            if (name == null) {
                throw new ArgumentNullException ("name");
            }
            if (content == null) {
                throw new ArgumentNullException ("content");
            }

            if (_Procs.ContainsKey (name)) {
                Console.WriteLine ("Procedure \"" + name + "\" is already defined.");
                return;
            }

            var proc = new Proc (content);
            _Procs.Add (name, proc);
        }

Usage Example

Exemplo n.º 1
0
        public override void Execute(string arg)
        {
            if (string.IsNullOrWhiteSpace(arg))
            {
                OnWriteLine("You must enter a name to identify this proc.");
                return;
            }

            OnWriteLine("Recording started. Enter \"" + EndRecordCommand + "\" to finish.");
            _Lines = new List <string> ();
            Run();
            _Mgr.AddProc(arg, _Lines);
            _Lines = null;
        }