public void FillComboBoxes() { Enums.eSetType eSetType = Enums.eSetType.Untyped; string[] names = Enum.GetNames(eSetType.GetType()); this.cbSetType.BeginUpdate(); this.cbSetType.Items.Clear(); this.cbSetType.Items.AddRange(names); this.cbSetType.EndUpdate(); }
bool ParseClasses(string iFileName) { int num1 = 0; Enums.eSetType eSetType = Enums.eSetType.Untyped; StreamReader iStream; try { iStream = new StreamReader(iFileName); } catch (Exception ex) { ProjectData.SetProjectError(ex); int num2 = (int)Interaction.MsgBox(ex.Message, MsgBoxStyle.Critical, "IO CSV Not Opened"); bool flag = false; ProjectData.ClearProjectError(); return(flag); } int num3 = 0; int num4 = 0; int num5 = 0; bool[] flagArray = new bool[Enum.GetValues(eSetType.GetType()).Length - 1 + 1]; int index1 = -1; int num6 = DatabaseAPI.Database.Power.Length - 1; for (int index2 = 0; index2 <= num6; ++index2) { DatabaseAPI.Database.Power[index2].SetTypes = new Enums.eSetType[0]; } try { string iLine; do { iLine = FileIO.ReadLineUnlimited(iStream, char.MinValue); if (iLine != null && !iLine.StartsWith("#")) { ++num5; if (num5 >= 9) { this.BusyMsg(Strings.Format(num3, "###,##0") + " records parsed."); num5 = 0; } string[] array = CSV.ToArray(iLine); if (array.Length > 1) { int num2 = DatabaseAPI.NidFromUidioSet(array[0]); if (num2 != index1 & index1 > -1) { flagArray[(int)DatabaseAPI.Database.EnhancementSets[index1].SetType] = true; } index1 = num2; if (index1 > -1 && !flagArray[(int)DatabaseAPI.Database.EnhancementSets[index1].SetType]) { int nIDPower = DatabaseAPI.NidFromUidPower(array[1]); if (nIDPower > -1) { this.AddSetType(nIDPower, DatabaseAPI.Database.EnhancementSets[index1].SetType); } } ++num1; } else { ++num4; } ++num3; } }while (iLine != null); } catch (Exception ex) { ProjectData.SetProjectError(ex); Exception exception = ex; iStream.Close(); int num2 = (int)Interaction.MsgBox(exception.Message, MsgBoxStyle.Critical, "IO CSV Parse Error"); bool flag = false; ProjectData.ClearProjectError(); return(flag); } iStream.Close(); DatabaseAPI.Database.IOAssignmentVersion.SourceFile = this.dlgBrowse.FileName; DatabaseAPI.Database.IOAssignmentVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.IOAssignmentVersion.Revision = Convert.ToInt32(this.udRevision.Value); var serializer = My.MyApplication.GetSerializer(); DatabaseAPI.SaveMainDatabase(serializer); this.DisplayInfo(); int num7 = (int)Interaction.MsgBox(("Parse Completed!\r\nTotal Records: " + Conversions.ToString(num3) + "\r\nGood: " + Conversions.ToString(num1) + "\r\nRejected: " + Conversions.ToString(num4)), MsgBoxStyle.Information, "File Parsed"); return(true); }
bool ParseClasses(string iFileName) { int num = 0; Enums.eSetType eSetType = Enums.eSetType.Untyped; StreamReader iStream; try { iStream = new StreamReader(iFileName); } catch (Exception ex) { Exception ex3 = ex; Interaction.MsgBox(ex3.Message, MsgBoxStyle.Critical, "IO CSV Not Opened"); return(false); } int num2 = 0; int num3 = 0; int num4 = 0; bool[] flagArray = new bool[Enum.GetValues(eSetType.GetType()).Length - 1 + 1]; int index = -1; int num5 = DatabaseAPI.Database.Power.Length - 1; for (int index2 = 0; index2 <= num5; index2++) { DatabaseAPI.Database.Power[index2].SetTypes = new Enums.eSetType[0]; } try { string iLine; do { iLine = FileIO.ReadLineUnlimited(iStream, '\0'); if (iLine != null && !iLine.StartsWith("#")) { num4++; if (num4 >= 9) { this.BusyMsg(Strings.Format(num2, "###,##0") + " records parsed."); num4 = 0; } string[] array = CSV.ToArray(iLine); if (array.Length > 1) { int num6 = DatabaseAPI.NidFromUidioSet(array[0]); if (num6 != index & index > -1) { flagArray[(int)DatabaseAPI.Database.EnhancementSets[index].SetType] = true; } index = num6; if (index > -1 && !flagArray[(int)DatabaseAPI.Database.EnhancementSets[index].SetType]) { int nIDPower = DatabaseAPI.NidFromUidPower(array[1]); if (nIDPower > -1) { this.AddSetType(nIDPower, DatabaseAPI.Database.EnhancementSets[index].SetType); } } num++; } else { num3++; } num2++; } }while (iLine != null); } catch (Exception ex2) { Exception exception = ex2; iStream.Close(); Interaction.MsgBox(exception.Message, MsgBoxStyle.Critical, "IO CSV Parse Error"); return(false); } iStream.Close(); DatabaseAPI.Database.IOAssignmentVersion.SourceFile = this.dlgBrowse.FileName; DatabaseAPI.Database.IOAssignmentVersion.RevisionDate = DateTime.Now; DatabaseAPI.Database.IOAssignmentVersion.Revision = Convert.ToInt32(this.udRevision.Value); DatabaseAPI.SaveMainDatabase(); this.DisplayInfo(); 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); }