/*---------------------------------------------------------------------------------------------------*/ void ensureAction() { byte[] splitArr = new byte[16]; for (int i = 0; i < canSet.Count; i++) { DISCRETEID dcID = discreteIDs.Find(x => x.obj.ID.Equals(canSet[i].ID)); if (dcID == null) { continue; } //拆分 for (int s = 0; s < canSet[i].DataLen; s++) { splitArr[2 * s] = (byte)(canSet[i].Data[s] >> 4); splitArr[2 * s + 1] = (byte)(canSet[i].Data[s] & 0x0f); } // for (int index = 0; index < dcID.obj.DataLen * 2; index++) { int dcIDindexIndex = dcID.idIndexs.FindIndex(x => x.index.Equals(index)); if (dcIDindexIndex == -1) { continue; } DISCRETEIDINDEX dcIDindex = dcID.idIndexs[dcIDindexIndex]; List <VALUECOUNT> silences = dcIDindex.silenceValueCount; List <VALUECOUNT> actions = dcIDindex.actionValueCount; VALUECOUNT valcnt; valcnt = silences.Find(x => x.value.Equals(splitArr[index])); if (valcnt != null) { valcnt.count++; } else { valcnt = actions.Find(x => x.value.Equals(splitArr[index])); if (valcnt != null) { valcnt.count++; } else { if (actions.Count < ACTIONUPPER) { actions.Add(new VALUECOUNT(splitArr[index])); } else { dcID.idIndexs.RemoveAt(dcIDindexIndex); } } } } } }
/*---------------------------------------------------------------------------------------------------*/ void removeActionListNone() { for (int i = 0; i < discreteIDs.Count; i++) { List <DISCRETEIDINDEX> dcIDIndexes = discreteIDs[i].idIndexs; for (int index = 0; index < dcIDIndexes.Count;) { DISCRETEIDINDEX dcIndex = dcIDIndexes[index]; if (dcIndex.actionValueCount.Count == 0) { dcIDIndexes.RemoveAt(index); } else { index++; } } } }