コード例 #1
0
        bool ParseClasses(string iFileName)

        {
            int          num1 = 0;
            StreamReader iStream;

            try
            {
                iStream = new StreamReader(iFileName);
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                int num2 = (int)Interaction.MsgBox(ex.Message, MsgBoxStyle.Critical, "Power CSV Not Opened");
                ProjectData.ClearProjectError();
                return(false);
            }
            int num3 = 0;
            int num4 = 0;
            int num5 = 0;

            _importBuffer = new List <EffectData>();
            int    num6   = 0;
            int    num7   = -1;
            int    num8   = 0;
            int    index1 = -1;
            string iString;

            do
            {
                iString = FileIO.ReadLineUnlimited(iStream, char.MinValue);
                if (iString == null || iString.StartsWith("#"))
                {
                    continue;
                }
                ++num6;
                if (num6 >= 99)
                {
                    BusyMsg(Strings.Format(num3, "###,##0") + " records parsed.");
                    Application.DoEvents();
                    num6 = 0;
                }
                ++index1;
                _importBuffer.Add(new EffectData(iString));
                ++num3;
                if (!_importBuffer[index1].IsValid)
                {
                    ++num4;
                }
                else
                {
                    ++num1;
                    EffectData effectData = _importBuffer[index1];
                    if (num7 != effectData.Index)
                    {
                        num7 = effectData.Index;
                        num8 = 0;
                        num5 = 0;
                    }
                    else
                    {
                        ++num8;
                    }
                    effectData.Data.nID = num8;
                    effectData.Nid      = num8;
                    if (effectData.Data.nID > DatabaseAPI.Database.Power[effectData.Index].Effects.Length - 1)
                    {
                        effectData.IsNew = true;
                    }
                    else
                    {
                        int index2 = effectData.Nid - num5;
                        if (effectData.CheckSimilar(ref DatabaseAPI.Database.Power[effectData.Index].Effects[index2]))
                        {
                            effectData.Nid      = index2;
                            effectData.Data.nID = index2;
                            effectData.IsNew    = false;
                            if (num5 > 0)
                            {
                                effectData.IndexChanged = true;
                            }
                        }
                        else
                        {
                            effectData.IsNew = true;
                            int num2 = DatabaseAPI.Database.Power[effectData.Index].Effects.Length - 1;
                            for (int index3 = 0; index3 <= num2; ++index3)
                            {
                                bool flag = index3 <= effectData.Nid && _importBuffer[index1 - effectData.Nid + index3].Nid == index3;
                                if (!flag)
                                {
                                    int nid = effectData.Nid;
                                    for (int index4 = 0; index4 <= nid; ++index4)
                                    {
                                        if (_importBuffer[index1 - effectData.Nid + index4].Nid != index3)
                                        {
                                            continue;
                                        }
                                        flag = true;
                                        break;
                                    }
                                }

                                if (flag || !effectData.CheckSimilar(ref DatabaseAPI.Database.Power[effectData.Index].Effects[index3]))
                                {
                                    continue;
                                }
                                effectData.Nid          = index3;
                                effectData.Data.nID     = index3;
                                effectData.IndexChanged = true;
                                effectData.IsNew        = false;
                                break;
                            }
                        }
                    }
                    if (effectData.IsNew)
                    {
                        ++num5;
                    }
                }
            }while (iString != null);
            iStream.Close();
            int num9 = (int)Interaction.MsgBox(("Parse Completed!\r\nTotal Records: " + Convert.ToString(num3) + "\r\nGood: " + Convert.ToString(num1) + "\r\nRejected: " + Convert.ToString(num4)), MsgBoxStyle.Information, "File Parsed");

            return(true);
        }
コード例 #2
0
        bool ParseClasses(string iFileName)
        {
            int          num = 0;
            StreamReader iStream;

            try
            {
                iStream = new StreamReader(iFileName);
            }
            catch (Exception ex)
            {
                Exception ex2 = ex;
                Interaction.MsgBox(ex2.Message, MsgBoxStyle.Critical, "Power CSV Not Opened");
                return(false);
            }
            int num2 = 0;
            int num3 = 0;
            int num4 = 0;

            this._importBuffer = new List <EffectData>();
            int    num5  = 0;
            int    num6  = -1;
            int    num7  = 0;
            int    index = -1;
            string iString;

            do
            {
                iString = FileIO.ReadLineUnlimited(iStream, '\0');
                if (iString != null && !iString.StartsWith("#"))
                {
                    num5++;
                    if (num5 >= 99)
                    {
                        this.BusyMsg(Strings.Format(num2, "###,##0") + " records parsed.");
                        Application.DoEvents();
                        num5 = 0;
                    }
                    index++;
                    this._importBuffer.Add(new EffectData(iString));
                    num2++;
                    if (!this._importBuffer[index].IsValid)
                    {
                        num3++;
                    }
                    else
                    {
                        num++;
                        EffectData effectData = this._importBuffer[index];
                        if (num6 != effectData.Index)
                        {
                            num6 = effectData.Index;
                            num7 = 0;
                            num4 = 0;
                        }
                        else
                        {
                            num7++;
                        }
                        effectData.Data.nID = num7;
                        effectData.Nid      = num7;
                        if (effectData.Data.nID > DatabaseAPI.Database.Power[effectData.Index].Effects.Length - 1)
                        {
                            effectData.IsNew = true;
                        }
                        else
                        {
                            int index2 = effectData.Nid - num4;
                            if (effectData.CheckSimilar(ref DatabaseAPI.Database.Power[effectData.Index].Effects[index2]))
                            {
                                effectData.Nid      = index2;
                                effectData.Data.nID = index2;
                                effectData.IsNew    = false;
                                if (num4 > 0)
                                {
                                    effectData.IndexChanged = true;
                                }
                            }
                            else
                            {
                                effectData.IsNew = true;
                                int num8 = DatabaseAPI.Database.Power[effectData.Index].Effects.Length - 1;
                                for (int index3 = 0; index3 <= num8; index3++)
                                {
                                    bool flag = false;
                                    if (index3 <= effectData.Nid && this._importBuffer[index - effectData.Nid + index3].Nid == index3)
                                    {
                                        flag = true;
                                    }
                                    if (!flag)
                                    {
                                        int nid = effectData.Nid;
                                        for (int index4 = 0; index4 <= nid; index4++)
                                        {
                                            if (this._importBuffer[index - effectData.Nid + index4].Nid == index3)
                                            {
                                                flag = true;
                                                break;
                                            }
                                        }
                                    }
                                    if (!flag && effectData.CheckSimilar(ref DatabaseAPI.Database.Power[effectData.Index].Effects[index3]))
                                    {
                                        effectData.Nid          = index3;
                                        effectData.Data.nID     = index3;
                                        effectData.IndexChanged = true;
                                        effectData.IsNew        = false;
                                        break;
                                    }
                                }
                            }
                        }
                        if (effectData.IsNew)
                        {
                            num4++;
                        }
                    }
                }
            }while (iString != null);
            iStream.Close();
            Interaction.MsgBox(string.Concat(new string[]
            {
                "Parse Completed!\r\nTotal Records: ",
                Conversions.ToString(num2),
                "\r\nGood: ",
                Conversions.ToString(num),
                "\r\nRejected: ",
                Conversions.ToString(num3)
            }), MsgBoxStyle.Information, "File Parsed");
            return(true);
        }