Example #1
0
        //public static BitTemplate.Bit_Specific[] GetBINARYpecificArray(string filename)
        //{
        //  SoapFormatter soapFormatter = new SoapFormatter();
        //  FileStream fileStream = new FileStream(filename, FileMode.Open);
        //  BitTemplate.Bit_Specific[] bitSpecificArray = soapFormatter.Deserialize((Stream) fileStream) as BitTemplate.Bit_Specific[];
        //  fileStream.Close();
        //  return bitSpecificArray;
        //}

        //public static void WriteBitArributeArray(BitTemplate.Bit_Specific[] _input, string filename)
        //{
        //  SoapFormatter soapFormatter = new SoapFormatter();
        //  FileStream fileStream = new FileStream(filename, FileMode.Create);
        //  soapFormatter.Serialize((Stream) fileStream, (object) _input);
        //  fileStream.Close();
        //}

        public static BitAttribute[] GetBitAttributeArray(BitTemplate.Bit_Specific[] BINARY)
        {
            BitAttribute[] bitAttributeArray = new BitAttribute[128];
            for (int index = 0; index < BINARY.Length; ++index)
            {
                bitAttributeArray[(int)BINARY[index].bitNumber - 1] = new BitAttribute();
                bitAttributeArray[(int)BINARY[index].bitNumber - 1].LengthAttribute = BINARY[index].bitLength;
                bitAttributeArray[(int)BINARY[index].bitNumber - 1].TypeAtribute    = BINARY[index].bitType;
                bitAttributeArray[(int)BINARY[index].bitNumber - 1].MaxLength       = BINARY[index].maxLength;
                bitAttributeArray[(int)BINARY[index].bitNumber - 1].AddtionalOption = BINARY[index].addtionalOption;
            }
            for (int index = 0; index < 128; ++index)
            {
                if (bitAttributeArray[index] == null)
                {
                    bitAttributeArray[index] = new BitAttribute();
                    bitAttributeArray[index].TypeAtribute = BitType.NOT_SPECIFIC;
                }
            }
            return(bitAttributeArray);
        }
Example #2
0
 public BitAttribute this[int bitnumber]
 {
     get
     {
         return(this.m_BitAttributes[bitnumber - 1]);
     }
     set
     {
         if (value == null)
         {
             return;
         }
         BitAttribute bitAttribute = this.m_BitAttributes[bitnumber - 1];
         if (value.Data != null)
         {
             bitAttribute.Data = (byte[])value.Data.Clone();
         }
         bitAttribute.Length          = value.Length;
         bitAttribute.LengthAttribute = value.LengthAttribute;
         bitAttribute.MaxLength       = value.MaxLength;
         bitAttribute.TypeAtribute    = value.TypeAtribute;
     }
 }