|
You last visited: Today at 02:46
Advertisement
[Help]Read .ini from a website
Discussion on [Help]Read .ini from a website within the CO2 Private Server forum part of the Conquer Online 2 category.
08/28/2009, 21:23
|
#1
|
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
|
[Help]Read .ini from a website
Source: LOTF v2
Need Help With:
Since the database is being read from a .ini, I was hoping I could make it read the .ini from a website (e.g. localhost/co/servername/config.ini (I know localhost isn't a good example)).
I have no idea how to make this, I know this seems kinda useless, but there is a reason I'm using for something, which I is private for now. I think I will release it after finishing it 100%.
~Bas
|
|
|
08/28/2009, 23:35
|
#2
|
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
|
You would have to download the .ini file, then read it, then delete it.
|
|
|
08/28/2009, 23:40
|
#3
|
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
|
Err okay, but how to?
|
|
|
08/29/2009, 00:16
|
#4
|
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
|
Code:
WebClient Downloader = new WebClient();
Downloader.DownloadFile("localhost/co/servername/config.ini", "config.ini");
Then read the Database and load what you need.
Then Delete:
Code:
File.Delete(Application.StartupPath + @"/config.ini");
Something like that.
|
|
|
08/29/2009, 11:43
|
#5
|
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
|
Quote:
Originally Posted by kinshi88
Code:
WebClient Downloader = new WebClient();
Downloader.DownloadFile("localhost/co/servername/config.ini", "config.ini");
Then read the Database and load what you need.
Then Delete:
Code:
File.Delete(Application.StartupPath + @"/config.ini");
Something like that.
|
Except for the save location, it worked, however the File.Delete didn't work, but I figured out how to add it.
Thanks a lot, this really helped me out.
#request close
|
|
|
08/29/2009, 21:35
|
#6
|
elite*gold: 20
Join Date: Jun 2005
Posts: 1,013
Received Thanks: 381
|
Bit of a backwards solution. Ideally you should create an Ini reading class which takes a System.IO.Stream argument rather then using those unmanaged imports. The GetPrivateProfileString etc are really Windows Registry functions, but luckily compatible with COs ini files.
There are already some other managed Ini reading libraries that will take a stream. Quick google search should find one. Using a managed ini reader has plenty of advantages, such as exception handling, where you can actually see what a problem is, rather then obtaining a "0" meaning error, with no explanation.
If you do grab one, you could use a HttpWebRequest and HttpWebResponse to collect the file, use response.GetStream() to get a stream you can pass to the ini reader. This also has the advantage that you can do it asynchronously.
|
|
|
09/02/2009, 06:36
|
#7
|
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
|
#Moved
|
|
|
09/02/2009, 11:22
|
#8
|
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
|
Kinshi's solution was fine, I've got it working, it just takes some time to load the ini, but that doesn't matter since I never use it myself, it's a security thing.
|
|
|
09/03/2009, 06:19
|
#9
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
|
Wait, May i know the reason why you are doing this?
|
|
|
09/03/2009, 11:15
|
#10
|
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
|
As I said before, this is private, and I probably won't release it.
|
|
|
09/03/2009, 11:16
|
#11
|
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
|
#request close
|
|
|
09/04/2009, 03:25
|
#12
|
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
|
#Closed
|
|
|
Similar Threads
|
Erstelle eure WebSite / Create your Website
10/20/2010 - elite*gold Trading - 39 Replies
Hallo Community,
Aktuelle Treasures
No permission - GEKAUFT
No permission - OFFEN
Da ich genügend Zeit habe, und neben nach neuen Herrausforderungen suche, bietet ich ab heute meinen Website Service an.
|
READ READ READ !!! LORDYK93 SCAMMER
10/11/2009 - Silkroad Online Trading - 1 Replies
he scammed a ecsro vip account from me ... he wanna give a lvl 90 sjsro account he change the pw of my account and said i have to wait ... now hes on at epvpers and on in msn but he didnt answer me anymore
if you answer me and give me my vip account back i will delete this.!
|
[request] website coding help Read!
02/12/2009 - CO2 Private Server - 20 Replies
heey I have an question can somone make an config and reg page for TQ binarys in html coding becouse the .php is released already.
if somone can help me add me on msn or leave an replay
my mail is [email protected]
|
All times are GMT +1. The time now is 02:46.
|
|