Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declaration:
- [DllImport("pk2.dll")]
- private extern bool Initialize();
- [DllImport("pk2.dll")]
- private extern bool Open(string path);
- [DllImport("pk2.dll")]
- private extern bool Extract(string filename,string path,string newfilename);
- ------------------------------------------------------------------------------------------
- private void button2_Click_1(object sender, EventArgs e)
- {
- if (Initialize())
- {
- if (Open(@"E:\Games\Srrrrrrr\Media.pk2"))
- {
- if (Extract(@"earring_01.ddj", "icon\\item\\china\\acc\\",""))
- {
- //string s = System.Reflection.Assembly.GetExecutingAssembly().Location + "\\A_0.tmp";
- string s = Application.StartupPath + "\\temp\\A_0.tmp";
- Bitmap a = DevIL.DevIL.LoadBitmap(s);
- pictureBox1.Image = a;
- Extract("itemdata_5000.txt", "server_dep\\silkroad\\textdata\\", "ID_0.tmp");
- Extract("itemdata_10000.txt", "server_dep\\silkroad\\textdata\\", "ID_1.tmp");
- Extract("itemdata_15000.txt", "server_dep\\silkroad\\textdata\\", "ID_2.tmp");
- Extract("itemdata_20000.txt", "server_dep\\silkroad\\textdata\\","ID_3.tmp");
- Extract("itemdata_25000.txt", "server_dep\\silkroad\\textdata\\", "ID_4.tmp");
- System.IO.StreamReader r = new System.IO.StreamReader("temp\\ID_0.tmp");
- //MessageBox.Show("Success");
- }
- else MessageBox.Show("Fail Extract");
- }
- else MessageBox.Show("Fail Open");
- }
- else MessageBox.Show("fail Initialize");
- }
- -------------------------------------------------------------------------------------------------------
- private IEnumerable<string> ReadLines(StreamReader reader)
- {
- while (!reader.EndOfStream)
- {
- yield return reader.ReadLine();
- }
- }
- private void Filter1(string filename)
- {
- using(var writer = File.CreateText(Application.StartupPath + "\\temp\\test.txt"))
- {
- using (var reader = File.OpenText(filename))
- {
- int[] Ids = { 14652, 14653, 14654, 14655, 14656, 14657, 14658, 14659, 14660 };
- var myLine = from line in ReadLines(reader)
- where line.Length > 1
- let id = int.Parse(line.Split('\t')[1])
- where Ids.Contains(id)
- let m = Regex.Match(line, @"^\d+\t\d+\t.+?\t(item\\[^\t]+\.ddj)")
- where m.Success == true
- select new { Text = line, ItemId = id, Path = m.Groups[1].Value };
- foreach (var id in myLine)
- {
- writer.WriteLine("Item Id = " + id.ItemId);
- writer.WriteLine("Path = " + id.Path);
- writer.WriteLine("\n");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment