private static void Main(string[] args) { if (args.Length == 1) { ProgramManager pm = new ProgramManager(args[0]); Console.WriteLine("Model loaded successfully"); pm.Execute(); } else { Console.WriteLine("Error in parameters"); } Console.WriteLine("Press any key to contiue..."); Console.ReadKey(); }
public abstract void Execute(ProgramManager pm);
protected abstract RWSection GetNewSection(ProgramManager pm);
public override void Execute(ProgramManager pm) { Console.WriteLine("Unknown command"); }
public override void Execute(ProgramManager pm) { foreach (RWSection section in pm.Current.Childs) { Console.WriteLine(section.Header); } }
public override void Execute(ProgramManager pm) { pm.Current = GetNewSection(pm); }
protected override RWSection GetNewSection(ProgramManager pm) { return pm.Root; }
protected override RWSection GetNewSection(ProgramManager pm) { if (pm.Current != pm.Root) { return pm.Current.Parent; } else throw new Exception("You are already in the root section"); }
protected override RWSection GetNewSection(ProgramManager pm) { RWSection[] childSections = (from c in pm.Current.Childs where (int)c.Header.Id == this.NewSectionType select c).ToArray() as RWSection[]; if (this.NewSectionNumber < childSections.Length) { return childSections[NewSectionNumber]; } else { throw new Exception(String.Format("There is no child section {O}[{1}]", this.NewSectionType, this.NewSectionNumber)); } }
public override void Execute(ProgramManager pm) { Console.WriteLine("Goodbye!"); }
public override void Execute(ProgramManager pm) { // Пустой метод. }