示例#1
0
        public static void OIDIndexEntryParser(CustomPair <string, IList <EnumSNMPOIDIndexType> > IndexOIDSetting, ISNMPRawEntryDTO RawEntry, IList <string> IndexData)
        {
            List <int> indexValues = RawEntry.OID.Replace(IndexOIDSetting.First + ".", "").Split('.').Select(x => int.Parse(x)).ToList();

            foreach (EnumSNMPOIDIndexType IndexType in IndexOIDSetting.Second)
            {
                switch (IndexType)
                {
                case EnumSNMPOIDIndexType.Number:
                    IndexData.Add(indexValues[0].ToString());
                    indexValues.RemoveAt(0);

                    break;

                case EnumSNMPOIDIndexType.MacAddress:
                    IndexData.Add(string.Join(" ", indexValues.Take(6).Select(x => x.ToString("X").PadLeft(2, '0'))));
                    indexValues.RemoveRange(0, 6);

                    break;

                case EnumSNMPOIDIndexType.IP:
                    break;

                case EnumSNMPOIDIndexType.Date:
                    break;

                case EnumSNMPOIDIndexType.ByteString:
                    break;

                case EnumSNMPOIDIndexType.Oid:
                    break;

                default:
                    break;
                }
            }
        }
示例#2
0
        public static void OIDEntryParser(IList <ISNMPRawEntryDTO> SelectedDeviceOID, CustomPair <string, IList <EnumSNMPOIDIndexType> > IndexOIDSetting, object StrategyDTOobject, Action <IList <string>, string, object> MappingHandler)
        {
            IList <string> IndexData = new List <string>();

            //Iterate on selected data for parsing possible indexes --> Not apliying here
            foreach (ISNMPRawEntryDTO RawEntry in SelectedDeviceOID)
            {
                OIDIndexEntryParser(IndexOIDSetting, RawEntry, IndexData);

                //Save results and clean decoded index list
                if (MappingHandler != null)
                {
                    MappingHandler(IndexData, RawEntry.ValueData, StrategyDTOobject);
                }

                IndexData.Clear();
            }
        }