Example #1
0
        /// <summary>
        /// Formats the contents of a caliber object
        /// </summary>
        /// <returns></returns>
        public string CaliberToString(Caliber cal)
        {
            StringBuilder sb        = new StringBuilder();
            int           numBrands = cal.Brands.Count();

            sb.Append(cal.CaliberFName + " --> ");

            for (int i = 0; i < numBrands; ++i)
            {
                int numBulletBrands = cal.Brands[i].Bullets.Count();
                sb.Append(cal.Brands[i].BrandName + " --> ");

                for (int j = 0; j < numBulletBrands; ++j)
                {
                    int numBulletTypes = cal.Brands[i].Bullets[j].Powders.Count();
                    sb.Append(cal.Brands[i].Bullets[j].BulletDescription + ":\nPowder\t");

                    for (int k = 0; k < numBulletTypes; ++k)
                    {
                        int numDataEntries = cal.Brands[i].Bullets[j].Powders.Count();
                        sb.Append(cal.Brands[i].Bullets[j].Powders[k].PowderName + ":\t");

                        for (int l = 0; l < numDataEntries; ++l)
                        {
                        }
                    }
                }
            }

            return("");
        }
Example #2
0
 /// <summary>
 /// Finds if the caliber object already exists in the list
 /// </summary>
 /// <param name="cal"> Takes a Caliber object to see if exists </param>
 /// <returns> Returns the index at which the object resides, else -1 </returns>
 public int FindCaliber(Caliber cal)
 {
     for (int i = 0; i < Calibers.Count; ++i)
     {
         if (Calibers[i] == cal)
         {
             return(i);
         }
     }
     return(-1);
 }
Example #3
0
        public void AddCaliber(Caliber cal)
        {
            // Check if caliber exists in the List, if so then append data to current caliber
            // else add the whole data structure to the list of calibers
            int index = FindCaliber(cal);

            // If < 0 then not found, add to List, else add to existing object
            if (index < 0)
            {
                Calibers.Add(cal);
            }
            else // add data to existing object at index "index"
            {
                // TODO
            }
        }