예제 #1
0
파일: Bucket.cs 프로젝트: hpinsley/DiskView
        public void AddOtherBucket(Bucket OtherBucket)
        {
            if (!OtherBucket.FileType.Equals(this.FileType))
                throw new ApplicationException(string.Format("Cannot add bucket for type {0} into one for type {1}", OtherBucket.FileType, this.FileType));

            this.FileCount += OtherBucket.FileCount;
            this.FileSize += OtherBucket.FileSize;
        }
예제 #2
0
파일: Bucket.cs 프로젝트: hpinsley/DiskView
        public object Clone()
        {
            Bucket	Other = new Bucket(this.FileType);
            Other.FileCount = this.FileCount;
            Other.FileSize = this.FileSize;
            Other.IncludedInTotals = this.IncludedInTotals;

            return Other;
        }
예제 #3
0
 public Bucket ComputeTotalsBucket()
 {
     Bucket B;
     Bucket	Totals = new Bucket("");		//The type is not used for a totals buket
     foreach(DictionaryEntry Entry in this._buckets) {
         B = (Bucket) Entry.Value;
         if (B.IncludedInTotals) {
             Totals.FileCount += B.FileCount;
             Totals.FileSize += B.FileSize;
         }
     }
     return Totals;
 }
예제 #4
0
        /// <summary>
        /// Return the bucket for this type.  If it is not found, add it.
        /// </summary>
        /// <param name="FileType"></param>
        /// <returns></returns>
        public Bucket FindOrAddBucket(string FileType)
        {
            Bucket	b;
            string	NormalizedFileType;

            b = this.FindBucket(FileType);
            //Add new bucket for new file type
            if (b == null) {
                NormalizedFileType = this.NormalizedFileType(FileType);
                b = new Bucket(NormalizedFileType);
                this._buckets.Add(NormalizedFileType, b);
            }

            return b;
        }
예제 #5
0
 /// <summary>
 /// This method will clear our totals bucket so that it can be recomputed
 /// (and recreated) on demand the next time.
 /// </summary>
 public void ClearTotals()
 {
     this._totalsBucket = null;
 }