Nov 13, 2017 06:21 PM
(This post was last modified: Nov 13, 2017 06:25 PM by gigajew.)
Here's a new installation class I wrote. It supports installing as hidden or normal, and a really great thing about it, is that you can natively pass string paths with environment variables, such as: %appdata%\file.exe which is a thing a lot of crypter-developers may find useful. Example usage is in the paste, but here it is too:
Code // normal, passed with app title
var settings = new InstallerSettings("Windows Update", "%AppData%\\MyFile.exe");
if (!Installer.IsInstalled(settings)) {
Installer.Install(settings);
}
// hidden, no app title neccessary
var settings = new InstallerSettings("%AppData%\\MyFile.exe") { Hidden = true };
if (!Installer.IsInstalled(settings)) {
Installer.Install(settings);
}
DO NOT DEAL WITH THIS MEMBER
Nov 14, 2017 05:20 PM
(This post was last modified: Nov 14, 2017 05:24 PM by cocaine_monkey.)
As im learning i would like to hear your opinion on get set properties, in installersettings why you choose to use them like that? do you use them always like that? i tend to use them only if i need some checks in there or i want to limit it to just get only. Also why use private then public property on that class? wouldnt public get set work just fine? Is it stupid to create get set functions like in c++? i think c++ way looks more sexy but is it stupid?
Nov 14, 2017 05:22 PM
(This post was last modified: Nov 14, 2017 05:22 PM by gigajew.)
(Nov 14, 2017 05:20 PM)cocaine_monkey Wrote: As im learning i would like to hear your opinion on get set properties, in installersettings why you choose to use them like that? do you use them always like that? i tend to use them only if i need some checks in there or i want to limit it to just get only
You used to always have to do it that way. I keep doing it for backwards compability and because of habit
DO NOT DEAL WITH THIS MEMBER
(Nov 14, 2017 05:22 PM)gigajew Wrote: You used to always have to do it that way. I keep doing it for backwards compability and because of habit Ok yes its new feature also i edited my post if you could share your opinion
(Nov 14, 2017 05:27 PM)cocaine_monkey Wrote: Ok yes its new feature also i edited my post if you could share your opinion
The things you see that are private are fields and hold the actual values. The properties are like methods that expose them.
DO NOT DEAL WITH THIS MEMBER
Nov 15, 2017 04:08 AM
(This post was last modified: Nov 15, 2017 04:10 AM by cocaine_monkey.)
(Nov 14, 2017 06:11 PM)gigajew Wrote: The things you see that are private are fields and hold the actual values. The properties are like methods that expose them.
Yes i know that
Just so you can learn something new too in c++
Code private int value;
public void SetValue(int value)
{
this.value = value;
}
same with get and why _ prefix instead of this? this. Is feature?
(Nov 15, 2017 04:08 AM)cocaine_monkey Wrote: Yes i know that
Just so you can learn something new too in c++
Code private int value;
public void SetValue(int value)
{
this.value = value;
}
same with get and why _ prefix instead of this? this. Is feature?
Oh I didn't know you meant that part, that's just preference
DO NOT DEAL WITH THIS MEMBER
(Nov 15, 2017 06:17 AM)gigajew Wrote: Oh I didn't know you meant that part, that's just preference
Yes im trying to learn how to write "clean" code and saw your properties usage so was interested
DO NOT DEAL WITH THIS MEMBER
Why not use auto properties? They are one of the things that make C# great.
How could we use this with programs that require admin permissions? Like we run the program initially as admin but once its copied to startup would it fail to run properly without running as admin?
|