Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 13:48

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] C# Pk2 Reader (Including sourcecode)

Discussion on [Release] C# Pk2 Reader (Including sourcecode) within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old 03/25/2013, 22:09   #16
 
elite*gold: 0
Join Date: Mar 2009
Posts: 5
Received Thanks: 3
Found Bugs FileExists functions not working properly because ToLower() command not support Turkish chars.
solution
add
Quote:
private System.Globalization.CultureInfo CultureInf = new System.Globalization.CultureInfo("en-US", false);
and change ToLower() = ToLower(CultureInf)
sorry ı know litte english :/
djbm is offline  
Thanks
1 User
Old 03/28/2013, 20:09   #17
 
elite*gold: 0
Join Date: Mar 2013
Posts: 55
Received Thanks: 4
Talking

Quote:
Originally Posted by Phoenix 1337 View Post
A noob , as you've said , at least he's helping people . Unless your worthless comment which creating a false point 100%. If he's a noob , we should teach him how to manage these ***** , To become a pro.
"we should teach him how to manage these *****, to become a pro..." xDDD WE SHOULD xDDD No you wont. Coz youre a little soft rabbit too. ^^
miamidolphin is offline  
Old 04/01/2013, 00:57   #18
 
elite*gold: 0
Join Date: Aug 2009
Posts: 152
Received Thanks: 11
hi , i have 2 problems
1st : "System.OverflowException: Arithmetic operation resulted in an overflow." , at "private uint bf_F(uint x)" in "Blowfish"

2nd : what is the "Key"parameter in this function "public Reader(string FileName, string Key)"? , what it is depends on?
tarek1500 is offline  
Old 04/01/2013, 07:29   #19
 
3DProgrammer's Avatar
 
elite*gold: 0
Join Date: Feb 2012
Posts: 133
Received Thanks: 98
Quote:
Originally Posted by tarek1500 View Post
hi , i have 2 problems
1st : "System.OverflowException: Arithmetic operation resulted in an overflow." , at "private uint bf_F(uint x)" in "Blowfish"

2nd : what is the "Key"parameter in this function "public Reader(string FileName, string Key)"? , what it is depends on?
1: I think you wrote a wrong blowfish key.

Code:
PK2Reader.Reader m_Reader = new PK2Reader.Reader("MediaPk2Path", "Blowfish key");
Key: is the blowfish key for the client e.g.
Code:
PK2Reader.Reader m_Reader = new PK2Reader.Reader("E:\\Testserver\\Media.pk2", "169841");
169841 is for the most of sro's
3DProgrammer is offline  
Old 04/01/2013, 14:08   #20
 
elite*gold: 0
Join Date: Aug 2009
Posts: 152
Received Thanks: 11
Quote:
Originally Posted by 3DProgrammer View Post
1: I think you wrote a wrong blowfish key.

Code:
PK2Reader.Reader m_Reader = new PK2Reader.Reader("MediaPk2Path", "Blowfish key");
Key: is the blowfish key for the client e.g.
Code:
PK2Reader.Reader m_Reader = new PK2Reader.Reader("E:\\Testserver\\Media.pk2", "169841");
169841 is for the most of sro's
still have the same error , i changed the "uint" to "ulong" and works good thx , but anyone the the edxloader in c#?
tarek1500 is offline  
Old 02/07/2018, 19:46   #21
 
elite*gold: 53
Join Date: Sep 2014
Posts: 308
Received Thanks: 88
Reupload?
Mr.Awesome1337 is offline  
Thanks
1 User
Old 09/03/2019, 03:37   #22
 
Munderstand's Avatar
 
elite*gold: 0
Join Date: Jun 2015
Posts: 64
Received Thanks: 63
Reupload please
Munderstand is offline  
Old 09/03/2019, 07:57   #23
 
JellyBitz's Avatar
 
elite*gold: 0
Join Date: Sep 2018
Posts: 419
Received Thanks: 941
I think it's the same..

You will have troubles if there are multiple files with the same name and taking count that his searching method for a single file it's too slow O(n) everytime.
Attached Files
File Type: rar PK2Reader.rar (24.8 KB, 118 views)
JellyBitz is offline  
Old 02/13/2021, 15:05   #24
 
elite*gold: 0
Join Date: Apr 2018
Posts: 15
Received Thanks: 1
Bro can i import txt file in media.pk with this project?
Is any know?
risesun97 is offline  
Old 04/26/2024, 06:47   #25
Chat Killer In Duty


 
PortalDark's Avatar
 
elite*gold: 5
Join Date: May 2008
Posts: 16,390
Received Thanks: 6,507
we are getting reports that the files were infected on the new version, so for transparency reasons, im restoring the old links and files and removing the new one that REALLY didnt need to get updated
PortalDark is offline  
Old 04/27/2024, 09:59   #26
 
JellyBitz's Avatar
 
elite*gold: 0
Join Date: Sep 2018
Posts: 419
Received Thanks: 941
I have written a better implementation for READING and WRITING into a Pk2 Stream directly from C#, it's faster for searching although it does a lot initializing because of the writing stuffs. I sliced a bit of my time to fix everything a few hours ago, so everyone is able to be use it without worries.

Not sure if I should make a new thread just for this library so I'm just leaving a reference to the and a little code example for a full usage:
PHP Code:
using (var pk2 = new Pk2Stream("C:\\Silkroad\\VSRO_Client\\Media.pk2""169841"FileMode.Open))
{
    
// File content
    
var file pk2.GetFile("Type.txt");
    var 
bytes file.GetContent();
    
Console.WriteLine(Encoding.UTF8.GetString(bytes) + Environment.NewLine);

    
// List files from root folder
    
var root pk2.GetFolder("");
    
Console.WriteLine("Files:");
    foreach (var 
path in root.Files.Keys)
    {
        
Console.WriteLine(" - " path);
    }
    
// List folders from root folder
    
Console.WriteLine("Folders:");
    foreach (var 
path in root.Folders.Keys)
    {
        
Console.WriteLine(" - " path);
    }

    
// Add & remove folder
    
pk2.AddFolder("test/new folder");
    
pk2.RemoveFolder("test/new folder");

    
// Add & remove file
    
pk2.AddFile("test/new file.txt", new byte[] { 0x480x650x6c0x6c0x6f0x200x570x6f0x720x6c0x64 }); //Hello World
    
pk2.RemoveFile("test/new file.txt");

JellyBitz is offline  
Thanks
3 Users
Reply


Similar Threads Similar Threads
[Release] Der Reader
12/22/2013 - Metin2 PServer Guides & Strategies - 130 Replies
Guten Abend Volk. Ich Präsentiere euch heute Der Reader. Was zum Teufel ist Der Reader?! Der Reader ist ein Tool was euch hilft Archiver für fremde Client´s zu erstellen. Was ließt er aus? Er ließt folgendes aus:
[Release]Base Reader
02/27/2013 - Last Chaos - 39 Replies
Hey, Ich hatte mir gestern die Engine.dll mal genaue angeschaut und einige interessante Funktionen gefunden! Gleich mal ein kleines Tool gebastelt das die besagten Funktionen ausliest. Screenshot : http://grabilla.com/02b03-725bc792-1eca-43e3-bc45 -68b3e31abc17.png Download
[Release] Compose Log Reader - PHP
09/28/2012 - EO PServer Guides & Releases - 9 Replies
Since alot of servers lately that I have seen are over ran with auto composing, I figured I would create something that allows server owners and their staff to check the compose logs easier than using notepad. What this does: Owners put their compose logs in the folder, and go to the index.php page, enter the name of the file, example: sacrifice 2012-9-20.log Then hit the "Run" buttonNote: if your compose log is huge, this may take some time to insert the data. The script goes through...
[Release] IniFile Reader!
02/27/2012 - CO2 PServer Guides & Releases - 15 Replies
Greetings Guys, I was bored so I made a dll to read your Ini files. all you need is to add the dll as a reference to your project and start using it. an example: using System; using System.Collections.Generic; using System.Linq; using System.Text;



All times are GMT +1. The time now is 13:48.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.