//============================================================================*
        // VerifyFirearmAccessory()
        //============================================================================*

        public bool VerifyFirearmAccessory(cGear Gear)
        {
            //----------------------------------------------------------------------------*
            // Check Filters
            //----------------------------------------------------------------------------*

            if (!m_afFilters[(int)Gear.GearType])
            {
                return(false);
            }

            //----------------------------------------------------------------------------*
            // If firearm  is null, it's good to go
            //----------------------------------------------------------------------------*

            if (m_Firearm == null)
            {
                return(true);
            }

            //----------------------------------------------------------------------------*
            // Otherwise, only  gear  for the specified firearm is ok
            //----------------------------------------------------------------------------*

            cFirearm Firearm = (cFirearm)Gear.Parent;

            if (Firearm == null || Firearm.CompareTo(m_Firearm) != 0)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public int CompareTo(cBatchTest BatchTest)
        {
            if (BatchTest == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Compare Batch
            //----------------------------------------------------------------------------*

            int rc = m_Batch.CompareTo(BatchTest.m_Batch);

            //----------------------------------------------------------------------------*
            // Firearm
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                rc = m_Firearm.CompareTo(BatchTest.m_Firearm);

                //----------------------------------------------------------------------------*
                // NumRounds
                //----------------------------------------------------------------------------*

                if (rc == 0)
                {
                    rc = m_nNumRounds.CompareTo(BatchTest.m_nNumRounds);
                }
            }

            return(rc);
        }
Exemplo n.º 3
0
        //============================================================================*
        // Synch() - Firearm
        //============================================================================*

        public bool Synch(cFirearm Firearm)
        {
            if (Firearm != null && Firearm.CompareTo(m_Firearm) == 0)
            {
                m_Firearm = Firearm;

                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        //============================================================================*
        // Synch() - Firearm
        //============================================================================*

        public void Synch(cFirearm Firearm)
        {
            if (Firearm != null)
            {
                foreach (cAmmoTest AmmoTest in m_TestList)
                {
                    if (Firearm.CompareTo(AmmoTest.Firearm) == 0)
                    {
                        AmmoTest.Firearm = Firearm;
                    }
                }
            }
        }
Exemplo n.º 5
0
        //============================================================================*
        // Comparer()
        //============================================================================*

        public static int Comparer(cFirearm Firearm1, cFirearm Firearm2)
        {
            if (Firearm1 == null)
            {
                if (Firearm2 != null)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                if (Firearm2 == null)
                {
                    return(1);
                }
            }

            return(Firearm1.CompareTo(Firearm2));
        }
Exemplo n.º 6
0
        //============================================================================*
        // ResolveIdentities()
        //============================================================================*

        public bool ResolveIdentities(cDataFiles DataFiles)
        {
            bool fChanged = false;

            if (m_Firearm != null && m_Firearm.Identity)
            {
                foreach (cFirearm Firearm in DataFiles.FirearmList)
                {
                    if (!Firearm.Identity && m_Firearm.CompareTo(Firearm) == 0)
                    {
                        m_Firearm = Firearm;

                        fChanged = true;

                        break;
                    }
                }
            }

            if (m_Load != null && m_Load.Identity)
            {
                foreach (cLoad Load in DataFiles.LoadList)
                {
                    if (!Load.Identity && m_Load.CompareTo(Load) == 0)
                    {
                        m_Load = Load;

                        fChanged = true;

                        break;
                    }
                }
            }

            return(fChanged);
        }
Exemplo n.º 7
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public int CompareTo(cChargeTest ChargeTest)
        {
            if (ChargeTest == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Date
            //----------------------------------------------------------------------------*

            int rc = m_TestDate.CompareTo(ChargeTest.m_TestDate);

            // Sort Latest to Oldest

            if (rc != 0)
            {
                return(rc < 0 ? 1 : -1);
            }

            //----------------------------------------------------------------------------*
            // Source
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                rc = m_strSource.ToUpper().CompareTo(ChargeTest.m_strSource.ToUpper());

                //----------------------------------------------------------------------------*
                // Firearm
                //----------------------------------------------------------------------------*

                if (rc == 0)
                {
                    if (m_Firearm != null)
                    {
                        rc = m_Firearm.CompareTo(ChargeTest.m_Firearm);
                    }

                    //----------------------------------------------------------------------------*
                    // Barrel Length
                    //----------------------------------------------------------------------------*

                    if (rc == 0)
                    {
                        rc = m_dBarrelLength.CompareTo(ChargeTest.m_dBarrelLength);

                        //----------------------------------------------------------------------------*
                        // Twist
                        //----------------------------------------------------------------------------*

                        if (rc == 0)
                        {
                            rc = m_dTwist.CompareTo(ChargeTest.m_dTwist);

                            //----------------------------------------------------------------------------*
                            // Muzzle Velocity
                            //----------------------------------------------------------------------------*

                            if (rc == 0)
                            {
                                rc = m_nMuzzleVelocity.CompareTo(ChargeTest.m_nMuzzleVelocity);

                                //----------------------------------------------------------------------------*
                                // Pressure
                                //----------------------------------------------------------------------------*

                                if (rc == 0)
                                {
                                    rc = m_nPressure.CompareTo(ChargeTest.m_nPressure);
                                }
                            }
                        }
                    }
                }
            }

            //----------------------------------------------------------------------------*
            // Return results
            //----------------------------------------------------------------------------*

            return(rc);
        }
Exemplo n.º 8
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public int CompareTo(cAmmoTest AmmoTest)
        {
            if (AmmoTest == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Date
            //----------------------------------------------------------------------------*

            int rc = m_TestDate.CompareTo(AmmoTest.m_TestDate);

            //----------------------------------------------------------------------------*
            // Firearm
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                if (m_Firearm == null)
                {
                    if (AmmoTest.m_Firearm != null)
                    {
                        rc = -1;
                    }
                    else
                    {
                        rc = 0;
                    }
                }
                else
                {
                    if (AmmoTest.m_Firearm == null)
                    {
                        rc = 1;
                    }
                    else
                    {
                        rc = m_Firearm.CompareTo(AmmoTest.m_Firearm);
                    }
                }

                //----------------------------------------------------------------------------*
                // NumRounds
                //----------------------------------------------------------------------------*

                if (rc == 0)
                {
                    rc = m_nNumRounds.CompareTo(AmmoTest.m_nNumRounds);

                    //----------------------------------------------------------------------------*
                    // Detail Data
                    //----------------------------------------------------------------------------*

                    if (rc == 0)
                    {
                        rc = m_nMuzzleVelocity.CompareTo(AmmoTest.m_nMuzzleVelocity);

                        if (rc == 0)
                        {
                            rc = m_dBarrelLength.CompareTo(AmmoTest.m_dBarrelLength);

                            if (rc == 0)
                            {
                                rc = m_dTwist.CompareTo(AmmoTest.m_dTwist);

                                if (rc == 0)
                                {
                                    rc = m_dBestGroup.CompareTo(AmmoTest.m_dBestGroup);

                                    if (rc == 0)
                                    {
                                        rc = m_dBestGroupRange.CompareTo(AmmoTest.m_dBestGroupRange);

                                        if (rc == 0)
                                        {
                                            if (m_strNotes == null)
                                            {
                                                m_strNotes = "";
                                            }

                                            rc = m_strNotes.CompareTo(AmmoTest.m_strNotes);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(rc);
        }