MeshServerShell.MeshServerShell.Start C# (CSharp) Method

Start() public method

Start the mesh server
public Start ( Start Options ) : void
Options Start
return void
        public override void Start(Start Options) {

            // Create the provider object.
            var MeshServiceProvider = new PublicMeshServiceProvider(Options.Address.Value, 
                Options.MeshStore.Value, Options.PortalStore.Value);


            // Create the server, add the provider, create service port.
            var Server = new JPCServer();
            var HostReg = Server.Add(MeshServiceProvider);

            // Create the interface dispatcher for the provider.
            var Interface = new PublicMeshService(MeshServiceProvider, null);
            var InterfaceReg = HostReg.Add (Interface);

            // Register the network port.
            InterfaceReg.AddService(Options.Address.Value);

            // Run until abort
            Server.RunBlocking();
            }

Usage Example

		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);

			}
MeshServerShell