Ejemplo n.º 1
0
		private static void Handle_Device (
					Shell Dispatch, string[] args, int index) {
			Device		Options = new Device ();

			var Registry = new Goedel.Registry.Registry ();

			Options.DeviceID.Register ("id", Registry, (int) TagType_Device.DeviceID);
			Options.DeviceDescription.Register ("dd", Registry, (int) TagType_Device.DeviceDescription);
			Options.Default.Register ("default", Registry, (int) TagType_Device.Default);

			// looking for parameter Param.Name}
			if (index < args.Length && !IsFlag (args [index][0] )) {
				// Have got the parameter, call the parameter value method
				Options.DeviceID.Parameter (args [index]);
				index++;
				}
			// looking for parameter Param.Name}
			if (index < args.Length && !IsFlag (args [index][0] )) {
				// Have got the parameter, call the parameter value method
				Options.DeviceDescription.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_Device TagType = (TagType_Device) Registry.Find (Rest);

				// here have the cases for what to do with it.

				switch (TagType) {
					case TagType_Device.Default : {
						int OptionParams = Options.Default.Tag (Rest);
						
						if (OptionParams>0 && ((i+1) < args.Length)) {
							if 	(!IsFlag (args [i+1][0] )) {
								i++;								
								Options.Default.Parameter (args[i]);
								}
							}
						break;
						}
					default : throw new System.Exception ("Internal error");
					}
				}

#pragma warning restore 162
			Dispatch.Device (Options);

			}