Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Question] in C#

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Fri Nov 09, 2007 1:18 am    Post subject: [Question] in C# Reply with quote

well.. sometime when i'm doing some programs that checking if some file is exist in some location i'm doing in the Main method the searching
but it's taking very large space and i wanna do it in other method that comes before the Main method and i want that method will return me the location of the file for exemple:
to search gta at drivers: C,D,E
what i do is
Code:

File.Exist("<path at C>");
File.Exist("<path at D>");
File.Exist("<path at E>");

and after that i'm asking about them and if one of the is true it says he found GTA at the exect Driver.. how do i do it in method that return the location instad of doing it in the Main method?
some1 please?[/code]

_________________
Stylo
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Fri Nov 09, 2007 1:51 am    Post subject: Reply with quote

Well, I don't know any other methods than using System.IO;
but why don't you use the '%HOMEDRIVE%' variable, instead of trying different drive letters?

_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Fri Nov 09, 2007 2:27 am    Post subject: Reply with quote

what do u mean by '%HOMEDRIVE%'?
i didnt understand what does it do?

_________________
Stylo
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Fri Nov 09, 2007 2:33 am    Post subject: Reply with quote

1qaz wrote:
what do u mean by '%HOMEDRIVE%'?
i didnt understand what does it do?

Actually, the 'Program Files' variable would do.
Though it's not good to hardcode it. Smile

Code:
            if (System.IO.File.Exists("%PROGRAMFILES%\\Rockstar Games\\GTA San Andreas") == true)
            {
                MessageBox.Show("GTA SA was found.", this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("GTA SA was not found.", this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

By the way, the use of double slashes was intentional.

_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Fri Nov 09, 2007 2:49 am    Post subject: Reply with quote

but when i write %PROGRAMFILES% it searches in all drivers or just in driver C???
and other thing i asked about how can i bring this location / information about location in the name of the method how can i do it?

_________________
Stylo
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Fri Nov 09, 2007 2:52 am    Post subject: Reply with quote

1qaz wrote:
but when i write %PROGRAMFILES% it searches in all drivers or just in driver C???
and other thing i asked about how can i bring this location / information about location in the name of the method how can i do it?

'%PROGRAMFILES%' is a replacement for writing 'C:\Program Files' (Except, it works for all drive letters.) So there's no need to try searching for the file in C, D, E, Etc.

_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Fri Nov 09, 2007 2:55 am    Post subject: Reply with quote

well it's still says he didnt find the expect file :/
_________________
Stylo
Back to top
View user's profile Send private message
Noodlez
<3
Reputation: 1

Joined: 27 Oct 2007
Posts: 744
Location: Hyrule

PostPosted: Fri Nov 09, 2007 4:25 am    Post subject: Reply with quote

Soz cant help But umm Iqaz may have it covered
Back to top
View user's profile Send private message Send e-mail
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Fri Nov 09, 2007 6:20 am    Post subject: Reply with quote

That's cool; I didn't realize you could use those variables in C#.

Back on topic, I think Xenephobe has it covered.

Though, you might ask the user to input the path for his GTA thing.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Fri Nov 09, 2007 6:22 am    Post subject: Reply with quote

but when i run the file it says gta was not found.. i didnt understand what is this %PROGRAMFILES% thing Confused
_________________
Stylo
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Nov 09, 2007 7:51 am    Post subject: Reply with quote

1qaz wrote:
but when i run the file it says gta was not found.. i didnt understand what is this %PROGRAMFILES% thing Confused


It's a system environment variable. Theres quiet a few of them like that.
http://en.wikipedia.org/wiki/Environment_variables

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites