static public void GetMenu() { FridgeCommand cmd = new FridgeCommand("cd", "создать девайс", "name"); }
static bool SetArguments(FridgeCommand fc, string[] arr) { bool res = true; if ( (fc.Parameters.Count > 0 && arr.Length == 1) || (fc.Parameters.Count == 0 && arr.Length > 1) ) { return(false); } if (fc.Parameters.Count == 0 && arr.Length == 1) { return(true); } int ind = 1; foreach (ItemParamers p in fc.Parameters) { if (!res) { break; } if (!p.mandatory) { ind++; } if (ind >= arr.Length) { if (p.mandatory) { res = false; } break; } string curValue = arr[ind].Trim(); if (curValue == String.Empty) { ind++; continue; } if (!p.mandatory) { if (arr[ind - 1] != p.keycmd) { res = false; break; } } object tmp; int tmpint; switch (p.type) { case "int": if (!int.TryParse(curValue, out tmpint)) { res = false; } else { tmp = tmpint; } break; default: res = false; break; } ind++; } return(res); }