public void RefreshData(string s) { short foodindex = 0, i = 0, j = 0; string[] datas = s.Split(';'); string[] buffer; cEffect = new int[11]; cStuff = new String[3]; int[] intbuffer = new int[3]; try { for (j = 0; j < cEffect.Length; j++) cEffect[j] = 0; while (i < 5) { switch (i) { // Food case 0: cNumber = foodindex; cName = datas[i]; break; // Rank case 1: cRank = datas[i]; break; // Stuff case 2: cStuff = datas[i].Split(','); break; // Effect case 3: // 091120 Fix : Data File 구조 변경 buffer = datas[i].Split(','); for (j = 0; j < buffer.Length; j++) { string[] parsebuffer = buffer[j].Split(':'); int parsemode = int.Parse(parsebuffer[0]); if (parsemode == 0) { if (parsebuffer[1].Equals("1")) { cSpecialEffect += CookImplement.Properties.Resources.StrStuff; cEffect[parsemode] += 1; } else { cSpecialEffect += parsebuffer[1]; if (!parsebuffer[1].Contains(CookImplement.Properties.Resources.StrNothing)) cEffect[parsemode] += 2; else cEffect[parsemode] = -1; } } else if (parsemode == 10) { cEffect[parsemode] = int.Parse(parsebuffer[1]); cSpecialEffect += CookImplement.Properties.Resources.Effect10; } else { cEffect[parsemode] = int.Parse(parsebuffer[1]); } } break; // Detail case 4: buffer = datas[i].Split(','); j = 0; while (j < 3) { intbuffer[j] = int.Parse(buffer[j]); j++; } cStuffRatio = intbuffer; break; } i++; } } catch (Exception e) { ErrorDialog error = new ErrorDialog(s, e.StackTrace); error.ShowDialog(); } }
public void RefreshData(string s) { short foodindex = 0, i = 0, j = 0; string[] datas = s.Split(';'); string[] buffer; cEffect = new int[11]; int[] intbuffer = new int[3]; try { for (j = 0; j < cEffect.Length; j++) cEffect[j] = 0; while (i < 5) { switch (i) { case 0: cNumber = foodindex; cName = datas[i]; break; case 1: cRank = datas[i]; break; case 2: cStuff = datas[i].Split(','); break; case 3: // 091120 Fix : Data File 구조 변경 buffer = datas[i].Split(','); for (j = 0; j < buffer.Length; j++) { string[] parsebuffer = buffer[j].Split(':'); int parsemode = int.Parse(parsebuffer[0]); if (parsemode == 0) { if (parsebuffer[1].Equals("1")) { cSpecialEffect += "요리재료"; cEffect[parsemode] += 1; } else { cSpecialEffect += parsebuffer[1]; if (!parsebuffer[1].Contains("없음")) cEffect[parsemode] += 2; else cEffect[parsemode] = -1; } } else if (parsemode == 10) { cEffect[parsemode] = int.Parse(parsebuffer[1]); cSpecialEffect += "다이어트 효과"; } else { cEffect[parsemode] = int.Parse(parsebuffer[1]); } } break; case 4: buffer = datas[i].Split(','); j = 0; while (j < 3) { intbuffer[j] = int.Parse(buffer[j]); j++; } cStuffRatio = intbuffer; break; } i++; } } catch (IndexOutOfRangeException e) { ErrorDialog error = new ErrorDialog(s, e.StackTrace); error.ShowDialog(); } }