Exemple #1
0
 public GNIData SetData(string key, string value)
 {
     this.Initialize();
     this.keyType     = GNIDataType.String;
     this.keyString   = key;
     this.valueType   = GNIDataType.String;
     this.valueString = value;
     return(this);
 }
Exemple #2
0
 public GNIData SetData(byte[] key, byte[] value)
 {
     this.Initialize();
     this.keyType    = GNIDataType.ByteArray;
     this.keyBytes   = key;
     this.valueType  = GNIDataType.ByteArray;
     this.valueBytes = value;
     return(this);
 }
Exemple #3
0
 //Set functions
 public GNIData SetData(int key, int value)
 {
     this.Initialize();
     this.keyType   = GNIDataType.Short;
     this.keyInt    = key;
     this.valueType = GNIDataType.Short;
     this.valueInt  = value;
     return(this);
 }
Exemple #4
0
 public static int GetLengthLength(GNIDataType type)
 {
     switch (type)
     {
         case GNIDataType.None: return 0;
         case GNIDataType.Short: return 0;
         case GNIDataType.String: return 2;
         case GNIDataType.ByteArray: return 4;
     }
     return 1;
 }
Exemple #5
0
 public void Initialize()
 {
     keyType     = GNIDataType.Short;
     valueType   = GNIDataType.Short;
     encoding    = GNIEncoding.ASCII;
     keyInt      = -1;
     keyString   = "";
     keyBytes    = new byte[0];
     valueInt    = 0;
     valueString = "";
     valueBytes  = new byte[0];
 }
Exemple #6
0
 public GNIData(string key, string value)
 {
     keyType = GNIDataType.String;
     valueType = GNIDataType.String;
     encoding = GNIEncoding.ASCII;
     keyInt = -1;
     keyString = key;
     keyBytes = new byte[0];
     valueInt = 0;
     valueString = value;
     valueBytes = new byte[0];
 }
Exemple #7
0
 public GNIData(bool empty)
 {
     keyType = GNIDataType.Short;
     valueType = GNIDataType.Short;
     encoding = GNIEncoding.ASCII;
     keyInt = -1;
     keyString = "";
     keyBytes = new byte[0];
     valueInt = 0;
     valueString = "";
     valueBytes = new byte[0];
 }
Exemple #8
0
        public static int GetLengthLength(GNIDataType type)
        {
            switch (type)
            {
            case GNIDataType.None: return(0);

            case GNIDataType.Short: return(0);

            case GNIDataType.String: return(2);

            case GNIDataType.ByteArray: return(4);
            }
            return(1);
        }
Exemple #9
0
 public GNIData(string key, int value)
 {
     keyType = GNIDataType.String;
     valueType = GNIDataType.Short;
     encoding = GNIEncoding.ASCII;
     keyInt = -1;
     keyString = key;
     keyBytes = new byte[0];
     valueInt = value;
     valueString = Convert.ToString(value);
     valueBytes = new byte[0];
 }
Exemple #10
0
 public GNIData SetData(byte[] key, byte[] value)
 {
     this.Initialize();
     this.keyType = GNIDataType.ByteArray;
     this.keyBytes = key;
     this.valueType = GNIDataType.ByteArray;
     this.valueBytes = value;
     return this;
 }
Exemple #11
0
 public GNIData SetData(string key, string value)
 {
     this.Initialize();
     this.keyType = GNIDataType.String;
     this.keyString = key;
     this.valueType = GNIDataType.String;
     this.valueString = value;
     return this;
 }
Exemple #12
0
 //Set functions
 public GNIData SetData(int key, int value)
 {
     this.Initialize();
     this.keyType = GNIDataType.Short;
     this.keyInt = key;
     this.valueType = GNIDataType.Short;
     this.valueInt = value;
     return this;
 }
Exemple #13
0
 public void Initialize()
 {
     keyType = GNIDataType.Short;
     valueType = GNIDataType.Short;
     encoding = GNIEncoding.ASCII;
     keyInt = -1;
     keyString = "";
     keyBytes = new byte[0];
     valueInt = 0;
     valueString = "";
     valueBytes = new byte[0];
 }