예제 #1
0
        public void ConvertParameters(ref DataGridView Grid, ref Skills S, FillComboModes SourceMode, FillComboModes ObrazMode, ref Form Form, ref ToolStripStatusLabel Status)
        {
            int    i;
            int    j;
            int    k;
            var    SourceField = default(int);
            var    ObrazField  = default(int);
            Skill  tempSkill;
            var    CurP = default(int);
            string Points;

            Status.Text = "Parameter analyzing";
            Form.Update();
            var loopTo = pSkills.GetUpperBound(0);

            for (i = 1; i <= loopTo; i++)
            {
                if (S.get_SkillByID(pSkills[i].ID, pSkills[i].Level) == null)
                {
                }
                else if (string.IsNullOrEmpty(pSkills[i].FileString) | (Strings.Trim(pSkills[i].FileString).Substring(0, 2) ?? "") == "//")
                {
                }
                else
                {
                    var loopTo1 = Grid.Rows.Count - 2;
                    for (j = 0; j <= loopTo1; j++)
                    {
                        if ((int)SourceMode == (int)FillComboModes.ByName)
                        {
                            SourceField = 0;
                            var loopTo2 = pSkills[i].FieldsCount;
                            for (k = 1; k <= loopTo2; k++)
                            {
                                if ((Convert.ToString(pSkills[i].get_FieldName(k)) ?? "") == (Convert.ToString(Grid.Rows[j].Cells[0].Value) ?? ""))
                                {
                                    SourceField = k;
                                    break;
                                }
                            }
                        }
                        else if ((int)SourceMode == (int)FillComboModes.ByNumber)
                        {
                            if (pSkills[i].FieldsCount < Convert.ToDouble(Grid.Rows[j].Cells[2].Value))
                            {
                                SourceField = 0;
                            }
                            else
                            {
                                SourceField = Convert.ToInt32(Grid.Rows[j].Cells[2].Value);
                            }
                        }
                        if (SourceField > 0)
                        {
                            tempSkill = S.get_SkillByID(pSkills[i].ID, pSkills[i].Level);
                            if ((int)ObrazMode == (int)FillComboModes.ByName)
                            {
                                ObrazField = 0;
                                var loopTo3 = tempSkill.FieldsCount;
                                for (k = 1; k <= loopTo3; k++)
                                {
                                    if ((tempSkill.get_FieldName(k) ?? "") == (Convert.ToString(Grid.Rows[j].Cells[1].Value) ?? ""))
                                    {
                                        ObrazField = k;
                                        break;
                                    }
                                }
                            }
                            else if ((int)ObrazMode == (int)FillComboModes.ByNumber)
                            {
                                if (tempSkill.FieldsCount < Convert.ToInt32(Grid.Rows[j].Cells[3].Value))
                                {
                                    ObrazField = 0;
                                }
                                else
                                {
                                    ObrazField = Convert.ToInt32(Grid.Rows[j].Cells[3].Value);
                                }
                            }
                            if (ObrazField > 0)
                            {
                                pSkills[i].set_FieldValue(SourceField, tempSkill.get_FieldValue(ObrazField));
                            }
                        }
                    }
                }
                if (i / (double)300 == Convert.ToInt32(i / (double)300))
                {
                    if (CurP == 5)
                    {
                        CurP = 0;
                    }
                    Points = "";
                    var loopTo4 = CurP;
                    for (j = 0; j <= loopTo4; j++)
                    {
                        Points = Points + ".";
                    }
                    Status.Text = "Parameter analyzing" + Points;
                    Form.Update();
                }
            }

            Status.Text = "Ready";
            Form.Update();
        }
예제 #2
0
        public void FillConvertCombo(FillComboModes Mode, DataGridViewComboBoxColumn Combo)
        {
            int i;
            int j;
            int k;
            var Str           = new string[1];
            var Flag          = default(bool);
            int MinFieldCount = 1000000;

            Combo.Items.Clear();

            if ((int)Mode == (int)FillComboModes.ByName)
            {
                var loopTo = pSkills.GetUpperBound(0);
                for (i = 1; i <= loopTo; i++)
                {
                    var loopTo1 = pSkills[i].FieldsCount;
                    for (j = 1; j <= loopTo1; j++)
                    {
                        if (pSkills[i].get_FieldName(j).Length >= 5)
                        {
                            if ((pSkills[i].get_FieldName(j).Substring(0, 5) ?? "") != "Field")
                            {
                                if (Str.GetUpperBound(0) > 0)
                                {
                                    var loopTo2 = Str.GetUpperBound(0);
                                    for (k = 1; k <= loopTo2; k++)
                                    {
                                        Flag = false;
                                        if ((pSkills[i].get_FieldName(j) ?? "") == (Str[k] ?? ""))
                                        {
                                            Flag = true;
                                            break;
                                        }
                                    }
                                    if (Flag == false)
                                    {
                                        var oldStr = Str;
                                        Str = new string[Str.GetUpperBound(0) + 1 + 1];
                                        if (oldStr != null)
                                        {
                                            Array.Copy(oldStr, Str, Math.Min(Str.GetUpperBound(0) + 1 + 1, oldStr.Length));
                                        }
                                        Str[Str.GetUpperBound(0)] = pSkills[i].get_FieldName(j);
                                    }
                                }
                                else
                                {
                                    var oldStr1 = Str;
                                    Str = new string[Str.GetUpperBound(0) + 1 + 1];
                                    if (oldStr1 != null)
                                    {
                                        Array.Copy(oldStr1, Str, Math.Min(Str.GetUpperBound(0) + 1 + 1, oldStr1.Length));
                                    }
                                    Str[Str.GetUpperBound(0)] = pSkills[i].get_FieldName(j);
                                }
                            }
                        }
                    }
                }

                var loopTo3 = Str.GetUpperBound(0);
                for (i = 1; i <= loopTo3; i++)
                {
                    Combo.Items.Add(Str[i]);
                }
            }

            if ((int)Mode == (int)FillComboModes.ByNumber)
            {
                var loopTo4 = pSkills.GetUpperBound(0);
                for (i = 1; i <= loopTo4; i++)
                {
                    if (pSkills[i].FieldsCount < MinFieldCount)
                    {
                        MinFieldCount = pSkills[i].FieldsCount;
                    }
                }

                var loopTo5 = MinFieldCount;
                for (i = 1; i <= loopTo5; i++)
                {
                    Combo.Items.Add("Field" + Conversions.ToString(i) + " (" + pSkills[1].get_FieldValue(i) + ")");
                }
            }
        }