public DataCollect(string path) { para = new Para(path); for (int i = 0; i < Para.PLCNUM; i++) { pLocker[i] = new object(); fins[i] = new FinsProxy(para.IpConfig[i]); bool connected = fins[i].Connect(); } for (int i = 0; i < Para.OPNUM; i++) { aLocker[i] = new object(); rLocker[i] = new object(); } for (int i = 0; i < Para.PLCBUFNUM; i++) { bytes[i] = new byte[Para.PLCBUFLEN]; } m_client = new Client("192.168.51.220", 1000); //连接 m_client.Connect(); StringCollection data = new StringCollection(); string s = string.Join(",", data.OfType <string>()); m_client.SendMsg("123456"); // 加载历史数据 para.LoadYeildData(alCount, okCount); }
internal static void AddIfMissing(this StringCollection c, string value, StringComparer comparer) { if (!c.OfType <string>().Contains(value, comparer)) { c.Add(value); } }
private void UpdateBinding() { StringCollection listOfFavouriteJobs = Properties.Settings.Default.ListOfFavouriteJobs; this.FavouriteJobsGridView.DataSource = listOfFavouriteJobs.OfType <String>().Select(s => new { Filename = s }).ToList(); }
public void onSendWeb(StringCollection data) { //data.Add("111"); //data.Add("2"); //data.Add("33"); string s = string.Join(",", data.OfType <string>()); m_client.SendMsg(s); }
/// <summary> /// Adds a assembly location to a string collection of the collection does not already has it. /// Note: Case insensitive /// </summary> /// <param name="stringCollection"></param> /// <param name="assemblyLocation"></param> /// <exclude /> public static void AddIfNotContained(this StringCollection stringCollection, string assemblyLocation) { string assemblyFileName = Path.GetFileName(assemblyLocation); bool isContained = stringCollection. OfType <string>(). Where(f => f.IndexOf(assemblyFileName, StringComparison.InvariantCultureIgnoreCase) >= 0). Any(); if (!isContained) { stringCollection.Add(assemblyLocation); } }
private void ResourcePaste() { try { this.Enabled = false; if (Clipboard.ContainsData(MainForm.DataFormatSingleFile)) { IFormatter formatter = new BinaryFormatter(); Stream stream = Clipboard.GetData(MainForm.DataFormatSingleFile) as MemoryStream; MyDataFormat d = (MyDataFormat)formatter.Deserialize(stream); stream.Close(); this.ImportSingle(d); } else if (Clipboard.ContainsData(MainForm.DataFormatBatch)) { IFormatter formatter = new BinaryFormatter(); Stream stream = Clipboard.GetData(MainForm.DataFormatBatch) as MemoryStream; List <MyDataFormat> l = (List <MyDataFormat>)formatter.Deserialize(stream); stream.Close(); this.ImportBatch(l); } else if (Clipboard.ContainsFileDropList()) { StringCollection fileDrop = Clipboard.GetFileDropList(); if (fileDrop.Count == 0) { return; } if (fileDrop.Count == 1) { this.ImportSingle(fileDrop[0], "Resource->Paste"); } else { string[] batch = fileDrop.OfType <string>().ToArray(); this.ImportBatch(batch, "Resource->Paste"); } } } finally { this.Enabled = true; } }
internal XmlSchema GetQuerySchema() { var schema = new XmlSchema { TargetNamespace = QuerySpace }; schema.Namespaces.Add("", QuerySpace); var allParameters = new StringCollection(); foreach (var queriesForResourceType in _baseQueries.GroupBy(k => k.ResourceKey) .Where(k => _registrationStorage.IsResourceRegistered(k.Key))) { var group = new XmlSchemaAttributeGroup(); group.Name = _registrationStorage[queriesForResourceType.Key].ResourceName.Replace(" ", "_"); var parameters = queriesForResourceType.SelectMany(k => k.Arguments) .Distinct(_parameterComparer) .ToArray(); allParameters.AddRange(parameters); foreach (var attr in parameters.Select(k => new XmlSchemaAttribute { RefName = new XmlQualifiedName(k, QuerySpace) })) { group.Attributes.Add(attr); } schema.Items.Add(group); } foreach (var attr in allParameters.OfType <string>().Distinct().Select( k => new XmlSchemaAttribute { Name = k, SchemaType = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.String) })) { schema.Items.Add(attr); } return(schema); }
private static IEnumerable <IErrorInfo> ParseErrorOutput(StringCollection error) { return(error.OfType <string>().Select(e => new ErrorInfo(0, 0, e))); }
public void SaveResultData(StringCollection data) { dataManger.WriteString("DATA", "R", string.Join(",", data.OfType <string>())); }