public int CompareTo(ConfigSection other)
 {
     return(this.Id - other.Id);
 }
예제 #2
0
        public override ConfigItem ReadItem(BinaryReader reader, int tlvVersion, int contentVersion, ref ConfigSection currentSection)
        {
            int num = reader.PeekChar();

            if (num < 0)
            {
                return(null);
            }
            num &= 0xff;
            if (tlvVersion == -1)
            {
                int section = num >> 4;
                if (((currentSection == null) || (currentSection.Id != section)) || ((num & 15) == 0))
                {
                    currentSection = this.CreateSection(section);
                }
            }
            else
            {
                if (tlvVersion != 0)
                {
                    throw new NotSupportedException("TLV version not supported");
                }
                while (num == 0xff)
                {
                    reader.ReadByte();
                    int num3 = ConfigItem.ReadEncodedInt(reader);
                    currentSection = this.CreateSection(num3);
                    num            = reader.PeekChar();
                    if (num < 0)
                    {
                        return(null);
                    }
                    num &= 0xff;
                }
            }
            return(this.ReadItem(reader, tlvVersion, contentVersion));
        }
예제 #3
0
        protected override IEnumerable <ConfigSection> SaveToList()
        {
            List <ConfigSection> section    = new List <ConfigSection>();
            ConfigSection        SectionAdd = new ConfigSection(0);
            ConfigItem           ItemInsert = new ConfigItem(0, true);

            section.Add(SectionAdd);
            SectionAdd.Add(ItemInsert);

            foreach (ConfigSection sec in section)
            {
                if (sec.Id == 0)
                {
                    foreach (ConfigItem itemsave in sec)
                    {
                        switch (itemsave.Tag)
                        {
                        case 0:
                        {
                            timeStamp = DateTime.Now;
                            continue;
                        }

                        case 1:
                        {
                            this.comment = "IMEI";
                            continue;
                        }

                        case 2:
                        {
                            this.customerId = 1;
                            continue;
                        }

                        case 3:
                        {
                            //-----------Set unique id ----------- //
                            this.deviceId = "";
                            continue;
                        }

                        case 4:
                        {
                            this.systemId = 2797;
                            continue;
                        }

                        case 5:
                        {
                            //---------- RSA need to sign data --------//

                            continue;
                        }
                        }
                    }
                }
                else
                {
                    LicenseOption option = new LicenseOption((LicenseOptionName)sec.Id);

                    foreach (ConfigItem ItemName in sec)
                    {
                        switch (ItemName.Tag)
                        {
                        case 0:
                        {
                            option.StartDate = DateTime.Now;
                            continue;
                        }

                        case 1:
                        {
                            option.EndDate = DateTime.MaxValue;
                            continue;
                        }
                        }
                    }
                    addOption(option);
                    section.Add(sec);
                }
            }
            return(SaveToList());
            // throw new Exception("generate license not support");
        }
예제 #4
0
 public virtual ConfigItem ReadItem(BinaryReader reader, int tlvVersion, int contentVersion, ref ConfigSection currentSection)
 {
     if (reader.PeekChar() < 0)
     {
         return(null);
     }
     return(this.ReadItem(reader, tlvVersion, contentVersion));
 }