Exemplo n.º 1
0
        public void IncrementValueBy(string folderId, PerFolderProtocolLoggerData dataType, int incBy)
        {
            if (folderId == null)
            {
                folderId = "null";
            }
            Hashtable hashtable;

            if (!this.storedFolders.TryGetValue(folderId, out hashtable))
            {
                hashtable = new Hashtable();
                this.storedFolders[folderId] = hashtable;
            }
            if (incBy == 0)
            {
                return;
            }
            object obj = hashtable[dataType];

            if (obj == null)
            {
                hashtable[dataType] = incBy;
                return;
            }
            if (obj is int)
            {
                hashtable[dataType] = (int)obj + incBy;
                return;
            }
            throw new ArgumentException("The dataType is not an integer");
        }
Exemplo n.º 2
0
        public int GetIntegerValue(string folderId, PerFolderProtocolLoggerData dataType)
        {
            if (folderId == null)
            {
                folderId = "null";
            }
            Hashtable hashtable;

            if (!this.storedFolders.TryGetValue(folderId, out hashtable))
            {
                hashtable = new Hashtable();
                this.storedFolders[folderId] = hashtable;
            }
            object obj = hashtable[dataType];

            if (obj == null)
            {
                return(0);
            }
            if (obj is int)
            {
                return((int)obj);
            }
            throw new ArgumentException("The dataType is not an integer");
        }
Exemplo n.º 3
0
        private object GetIntegerValueAsObject(string folderId, PerFolderProtocolLoggerData dataType)
        {
            Hashtable hashtable;

            if (!this.storedFolders.TryGetValue(folderId, out hashtable))
            {
                return(ProtocolLogger.PreBoxedZero);
            }
            object obj = hashtable[dataType];

            if (obj == null)
            {
                return(ProtocolLogger.PreBoxedZero);
            }
            return(obj);
        }
Exemplo n.º 4
0
        private void InternalSetValue(string folderId, PerFolderProtocolLoggerData dataType, object value)
        {
            if (folderId == null)
            {
                folderId = "null";
            }
            if (value == null)
            {
                return;
            }
            Hashtable hashtable;

            if (!this.storedFolders.TryGetValue(folderId, out hashtable))
            {
                hashtable = new Hashtable();
                this.storedFolders[folderId] = hashtable;
            }
            hashtable[dataType] = value;
        }
Exemplo n.º 5
0
 public void IncrementValue(string folderId, PerFolderProtocolLoggerData dataType)
 {
     this.IncrementValueBy(folderId, dataType, 1);
 }
Exemplo n.º 6
0
 public void SetValue(string folderId, PerFolderProtocolLoggerData dataType, string value)
 {
     this.InternalSetValue(folderId, dataType, value);
 }