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 


Get PID ( C# )
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ZenX
Grandmaster Cheater Supreme
Reputation: 1

Joined: 26 May 2007
Posts: 1021
Location: ">>Pointer<<" : Address 00400560 Offset :1FE

PostPosted: Sun Nov 18, 2007 10:04 pm    Post subject: Reply with quote

samuri25404 wrote:
Code:

//using System.IO

FileStream file = null;
StreamReader reader = null;

try
{
    file = new FileStream("c:\\verify.ini", FileMode.Open);
    reader = new StreamReader(file);
    if (reader.ReadLine() == "0x00456")
    {
        MessageBox.show("j00 Failz");
    }
}

finally
{
    reader.Close();
    file.Close();
}


Two things:

1)

Code:

file = new FileStream("c:\\verify.ini", FileMode.Open);


You can do better than that, right?

Code:

file = new FileStream(@"c:\verify.ini", FileMode.Open);


Nobody likes to see a bunch of slashes when they don't need to. =)

2)

I understand what try-catch-finally is, but why use finally?

You could just

Code:

try
{
    file = new FileStream("c:\\verify.ini", FileMode.Open);
    reader = new StreamReader(file);
    if (reader.ReadLine() == "0x00456")
    {
        MessageBox.show("j00 Failz");
    }
}

reader.Close();
file.Close();


Is it supposed to be good practice or something?[/quote]

Well, No one will see the slashes, considering the Bypass Source Code won't be for the public.

_________________
CEF Moderator since 2007 ^_^
ZenX-Engine
Back to top
View user's profile Send private message Yahoo Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

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

PostPosted: Sun Nov 18, 2007 10:14 pm    Post subject: Reply with quote

The Source Code, I mean, and I've debugged before with like:

Code:

C:\\Documents and Settings\\s\\fgaw\\ge\\\\asd\\


And it gets REALLY confusing after a while--especially after your eyes have been staring at the screen for who knows how long--I like to limit the ammount that I have to see that.

~~

Btw, you may want to use the obfuscator, if you don't want the source to be public and you're doing C#.

~~

@Appal

So the code won't continue if the try throws an error without the finally?

I never knew that--you learn something every day! =)
Back to top
View user's profile Send private message
ZenX
Grandmaster Cheater Supreme
Reputation: 1

Joined: 26 May 2007
Posts: 1021
Location: ">>Pointer<<" : Address 00400560 Offset :1FE

PostPosted: Sun Nov 18, 2007 10:52 pm    Post subject: Reply with quote

obfuscator?
What is that?Some sort of Application protection?

_________________
CEF Moderator since 2007 ^_^
ZenX-Engine
Back to top
View user's profile Send private message Yahoo Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

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

PostPosted: Mon Nov 19, 2007 9:47 am    Post subject: Reply with quote

Basically.

It makes your source code in the ILASM (Intermediate Language Assembly--what all .NET source code turns into) completely unreadable.

If you don't have Visual Studio (i.e., you're using C# Express), I don't think you can use the obfuscator, but I'd be willing to do it for you. (I don't even play Lunia, I'm just a little curious about what your program's doing.)

If you don't believe me, I'll show you this:

http://img517.imageshack.us/my.php?image=comparecl0.png

(P.S., don't rag on me about the handwriting, I'm left-handed)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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