static void Main(string[] args) { MeshServerShell Dispatch = new MeshServerShell (); if (args.Length == 0) { throw new ParserException ("No command specified"); } if (IsFlag(args[0][0])) { switch (args[0].Substring(1).ToLower()) { case "mathematical mesh server" : { Usage (); break; } case "start" : { Handle_Start (Dispatch, args, 1); break; } case "about" : { Handle_About (Dispatch, args, 1); break; } default: { throw new ParserException("Unknown Command: " + args[0]); } } } else { Handle_Start (Dispatch, args, 0); } } // Main
private static void Handle_Start ( MeshServerShell Dispatch, string[] args, int index) { Start Options = new Start (); var Registry = new Goedel.Registry.Registry (); Options.Address.Register ("address", Registry, (int) TagType_Start.Address); Options.MeshStore.Register ("mesh", Registry, (int) TagType_Start.MeshStore); Options.PortalStore.Register ("mesh", Registry, (int) TagType_Start.PortalStore); Options.Verify.Register ("verify", Registry, (int) TagType_Start.Verify); // looking for parameter Param.Name} if (index < args.Length && !IsFlag (args [index][0] )) { // Have got the parameter, call the parameter value method Options.Address.Parameter (args [index]); index++; } #pragma warning disable 162 for (int i = index; i< args.Length; i++) { if (!IsFlag (args [i][0] )) { throw new System.Exception ("Unexpected parameter: " + args[i]);} string Rest = args [i].Substring (1); TagType_Start TagType = (TagType_Start) Registry.Find (Rest); // here have the cases for what to do with it. switch (TagType) { case TagType_Start.MeshStore : { int OptionParams = Options.MeshStore.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.MeshStore.Parameter (args[i]); } } break; } case TagType_Start.PortalStore : { int OptionParams = Options.PortalStore.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.PortalStore.Parameter (args[i]); } } break; } case TagType_Start.Verify : { int OptionParams = Options.Verify.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.Verify.Parameter (args[i]); } } break; } default : throw new System.Exception ("Internal error"); } } #pragma warning restore 162 Dispatch.Start (Options); }
private static void Handle_About ( MeshServerShell Dispatch, string[] args, int index) { About Options = new About (); var Registry = new Goedel.Registry.Registry (); #pragma warning disable 162 for (int i = index; i< args.Length; i++) { if (!IsFlag (args [i][0] )) { throw new System.Exception ("Unexpected parameter: " + args[i]);} string Rest = args [i].Substring (1); TagType_About TagType = (TagType_About) Registry.Find (Rest); // here have the cases for what to do with it. switch (TagType) { default : throw new System.Exception ("Internal error"); } } #pragma warning restore 162 Dispatch.About (Options); }