Exemplo n.º 1
0
        private static int FindPowerSetAdvanced(
            string sSetType,
            Enums.ePowerSetType nSetType,
            int nAT,
            string[] haystack)
        {
            for (var index1 = 0; index1 <= haystack.Length - 1; ++index1)
            {
                if (haystack[index1].IndexOf(sSetType, StringComparison.OrdinalIgnoreCase) <= -1)
                {
                    continue;
                }
                var powersetIndexes = DatabaseAPI.GetPowersetIndexes(nAT, nSetType);
                for (var index2 = 0; index2 <= powersetIndexes.Length - 1; ++index2)
                {
                    if (haystack[index1].IndexOf(powersetIndexes[index2].DisplayName,
                                                 StringComparison.OrdinalIgnoreCase) > -1)
                    {
                        return(powersetIndexes[index2].nID);
                    }
                }
            }

            return(-1);
        }
Exemplo n.º 2
0
        private void List_Sets()
        {
            var iSet          = Enums.ePowerSetType.None;
            var cbSet1        = this.cbSet1;
            var cbType1       = this.cbType1;
            var selectedIndex = cbAT1.SelectedIndex;

            iSet = cbType1.SelectedIndex switch
            {
                0 => Enums.ePowerSetType.Primary,
                1 => Enums.ePowerSetType.Secondary,
                2 => Enums.ePowerSetType.Ancillary,
                _ => iSet
            };
            cbSet1.BeginUpdate();
            cbSet1.Items.Clear();
            var powersetIndexes = DatabaseAPI.GetPowersetIndexes(selectedIndex, iSet);
            var num             = powersetIndexes.Length - 1;

            for (var index = 0; index <= num; ++index)
            {
                cbSet1.Items.Add(powersetIndexes[index].DisplayName);
            }
            if (cbSet1.Items.Count > 0)
            {
                cbSet1.SelectedIndex = 0;
            }
            cbSet1.EndUpdate();
        }
        static clsUniversalImport.SetPair FindPower(string iName, int nAT)
        {
            IPowerset[] powersetIndexes2 = new IPowerset[2];
            clsUniversalImport.SetPair setPair3;
            if (MidsContext.Character != null)
            {
                powersetIndexes2[0] = MidsContext.Character.Powersets[0];
                powersetIndexes2[1] = MidsContext.Character.Powersets[1];
                clsUniversalImport.SetPair setPair2 = clsUniversalImport.ScanSetArray(iName, powersetIndexes2);
                if (setPair2.Powerset > -1)
                {
                    setPair3 = setPair2;
                    return(setPair3);
                }
            }
            int powerByName = DatabaseAPI.GetPowerByName(iName, nAT);

            if (powerByName < 0)
            {
                powerByName = DatabaseAPI.GetPowerByName(iName.Replace("'", ""), nAT);
            }
            if (powerByName > -1)
            {
                setPair3 = new clsUniversalImport.SetPair(DatabaseAPI.Database.Power[powerByName].PowerSetID, DatabaseAPI.Database.Power[powerByName].PowerSetIndex);
            }
            else
            {
                powersetIndexes2 = DatabaseAPI.GetPowersetIndexes(nAT, Enums.ePowerSetType.Ancillary);
                clsUniversalImport.SetPair setPair2 = clsUniversalImport.ScanSetArray(iName, powersetIndexes2);
                if (setPair2.Powerset > -1)
                {
                    setPair3 = setPair2;
                }
                else
                {
                    powersetIndexes2 = DatabaseAPI.GetPowersetIndexes(nAT, Enums.ePowerSetType.Pool);
                    setPair2         = clsUniversalImport.ScanSetArray(iName, powersetIndexes2);
                    if (setPair2.Powerset > -1)
                    {
                        setPair3 = setPair2;
                    }
                    else
                    {
                        setPair3 = new clsUniversalImport.SetPair(-1, -1);
                    }
                }
            }
            return(setPair3);
        }
        static int FindPowerSetAdvanced(string sSetType, Enums.ePowerSetType nSetType, int nAT, string[] haystack)
        {
            int num = haystack.Length - 1;

            for (int index = 0; index <= num; index++)
            {
                if (haystack[index].IndexOf(sSetType, StringComparison.OrdinalIgnoreCase) > -1)
                {
                    IPowerset[] powersetIndexes = DatabaseAPI.GetPowersetIndexes(nAT, nSetType);
                    int         num2            = powersetIndexes.Length - 1;
                    for (int index2 = 0; index2 <= num2; index2++)
                    {
                        if (haystack[index].IndexOf(powersetIndexes[index2].DisplayName, StringComparison.OrdinalIgnoreCase) > -1)
                        {
                            return(powersetIndexes[index2].nID);
                        }
                    }
                }
            }
            return(-1);
        }
Exemplo n.º 5
0
        private static SetPair FindPower(string iName, int nAT)
        {
            var sets = new IPowerset[2];

            if (MidsContext.Character != null)
            {
                sets[0] = MidsContext.Character.Powersets[0];
                sets[1] = MidsContext.Character.Powersets[1];
                var setPair = ScanSetArray(iName, sets);
                if (setPair.Powerset > -1)
                {
                    return(setPair);
                }
            }

            var powerByName = DatabaseAPI.GetPowerIndexByDisplayName(iName, nAT);

            if (powerByName < 0)
            {
                powerByName = DatabaseAPI.GetPowerIndexByDisplayName(iName.Replace("'", ""), nAT);
            }
            if (powerByName > -1)
            {
                return(new SetPair(DatabaseAPI.Database.Power[powerByName].PowerSetID,
                                   DatabaseAPI.Database.Power[powerByName].PowerSetIndex));
            }

            var powersetIndexes1 = DatabaseAPI.GetPowersetIndexes(nAT, Enums.ePowerSetType.Ancillary);
            var setPair2         = ScanSetArray(iName, powersetIndexes1);

            if (setPair2.Powerset > -1)
            {
                return(setPair2);
            }

            var powersetIndexes2 = DatabaseAPI.GetPowersetIndexes(nAT, Enums.ePowerSetType.Pool);

            setPair2 = ScanSetArray(iName, powersetIndexes2);
            return(setPair2.Powerset <= -1 ? new SetPair(-1, -1) : setPair2);
        }
        public void List_Sets()
        {
            Enums.ePowerSetType iSet    = Enums.ePowerSetType.None;
            ComboBox            cbSet1  = this.cbSet1;
            ComboBox            cbType1 = this.cbType1;
            int selectedIndex           = cbAT1.SelectedIndex;

            switch (cbType1.SelectedIndex)
            {
            case 0:
                iSet = Enums.ePowerSetType.Primary;
                break;

            case 1:
                iSet = Enums.ePowerSetType.Secondary;
                break;

            case 2:
                iSet = Enums.ePowerSetType.Ancillary;
                break;
            }
            cbSet1.BeginUpdate();
            cbSet1.Items.Clear();
            IPowerset[] powersetIndexes = DatabaseAPI.GetPowersetIndexes(selectedIndex, iSet);
            int         num             = powersetIndexes.Length - 1;

            for (int index = 0; index <= num; ++index)
            {
                cbSet1.Items.Add(powersetIndexes[index].DisplayName);
            }
            if (cbSet1.Items.Count > 0)
            {
                cbSet1.SelectedIndex = 0;
            }
            cbSet1.EndUpdate();
        }
Exemplo n.º 7
0
 private int getSetIndex()
 {
     return(DatabaseAPI.GetPowersetIndexes(getAT(), getSetType())[cbSet1.SelectedIndex].nID);
 }
        public int getSetIndex()
        {
            ComboBox cbSet = this.cbSet1;

            return(DatabaseAPI.GetPowersetIndexes(this.getAT(), this.getSetType())[cbSet.SelectedIndex].nID);
        }
 public int getSetIndex()
 {
     return(DatabaseAPI.GetPowersetIndexes(this.getAT(), this.getSetType())[this.cbSet1.SelectedIndex].nID);
 }