Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void bOpenFile_Click(object sender, EventArgs e)
- {
- if (openFileDialog1.ShowDialog() == DialogResult.OK)
- {
- string fileName = openFileDialog1.FileName;
- FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.Read);
- StreamReader reader = new StreamReader(fileName);
- string[] fileText = File.ReadAllLines(fileName);
- string[] filterText = new string[fileText.Length];
- string[] tempText = new string[fileText.Length];
- tSQL.Clear();
- tSQL.Text = "replace into creature_difficulty_stat(entry, difficulty, dmg_multiplier, HealthModifier) values";
- for (int i = 0; i < fileText.Length; ++i)
- {
- if (fileText[i].Contains((@"""health""")))
- filterText[i] = fileText[i] + "\r\n";
- if (fileText[i].Contains(@"""level"""))
- filterText[i] = fileText[i] + "\r\n";
- if (fileText[i].Contains(@"""id"""))
- {
- filterText[i] = fileText[i] + "\r\n";
- filterText[i] += "\r\n";
- }
- }
- int lenghID = 1;
- foreach (string s in filterText)
- {
- if (s == null)
- continue;
- tFilter.Text += s;
- for (int i = 0; i < s.Length; ++i)
- {
- if (Char.IsPunctuation(s, i))
- if (s[i] == ',')
- {
- tempText[lenghID] += "\r\n";
- break;
- }
- if (Char.IsNumber(s, i))
- tempText[lenghID] += s[i];
- }
- if (lenghID % 3 == 0)
- {
- tempText[lenghID] += "\r\n";
- int h = 0;
- int l = 0;
- int id = 0;
- id = int.Parse(tempText[lenghID]);
- l = int.Parse(tempText[lenghID - 1]);
- h = int.Parse(tempText[lenghID - 2]);
- ToFormQuery(h, l, id);
- }
- ++lenghID;
- }
- }
- void ToFormQuery(int health, int level, int id)
- {
- tSQL.Text += "\r\n";
- tSQL.Text += "(" + id + ", 8, 1, " + GetModify(health, GetHeath(false, level)).ToString("f2") + ")," + " (" + id + ", 23, 1, " + GetModify(health, GetHeath(false, level)).ToString("f2") + "),";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement