Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[Release] Installer.cs | Hidden/Normal startup | Supports environment variables+++

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);
   }

[Image: Syr3DlV.png]
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: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
[Image: Syr3DlV.png]
(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.
[Image: Syr3DlV.png]
(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
[Image: Syr3DlV.png]
(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
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?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by HackersFeb 28, 2024 09:00 AM 4 215 Feb 28, 2024 09:00 AM
Last Post: Hackers
by webdev77Nov 28, 2023 10:10 AM 16 367 Nov 28, 2023 10:10 AM
Last Post: Mald0r0r
[Javascript]  by Z3R00NDATOct 16, 2023 01:24 PM 3 132 Oct 16, 2023 01:24 PM
Last Post: Disease