private void ParseControlerResponse(string ControlerResponse) { string [] splitControlerResponse = ControlerResponse.Split(new Char[] {}); for (int j = 0; j < ControllerDictionaryList.Count; j++) { for (int i = 0; i < ControllerDictionaryList.Count; i++) { string ID = splitControlerResponse[i].Substring(6, 4); if (ID == ControllerDictionaryList[j].ID.ToString("0000")) { string Value = splitControlerResponse[i].Substring(13); double DecimalValue = Convert.ToDouble(Value) / 10; ControllerDictionaryList[j] = new ControllerEntry(ControllerDictionaryList[j], DecimalValue); } } } }
public void SetValue(ControllerEntry ce) { if (Convert.ToBoolean(ConfigurationManager.AppSettings["ControlerIsReadonly"])) { throw new Exception(@"Controler is read only (Chack configureaion)"); } else { int intValue = Convert.ToInt32(ce.EntryValue * 10); foreach (ControllerEntry maince in ControllerDictionaryList) { if (ce.Name == maince.Name) { ce = new ControllerEntry(maince, ce.EntryValue); } } string url = @"http://" + ConfigurationManager.AppSettings["ControllerIP"] + ConfigurationManager.AppSettings["SetValuesURI"] + "R" + ce.ID.ToString("000") + @"%2CD+" + intValue.ToString("000"); byte[] myDataBuffer = WC.DownloadData(url); } }