Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
Initial Commit
Some basic things working
  • Loading branch information
MageSneaky committed Jan 4, 2022
0 parents commit 02e39ec
Show file tree
Hide file tree
Showing 24 changed files with 1,570 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.vs

/Updater/.vs
/Updater/bin
/Updater/obj

/SteamSwitcher/.vs
/SteamSwitcher/bin
/SteamSwitcher/obj
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions Requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Installation:
This copy is a portable version. Just extract the entire folder into a place you won't delete it.
You'll have the option to create a Desktop/Start menu shortcuts in the options menu.

Find more information on GitHub: https://github.com/MageSneaky/SteamAccountSwitcherCMD

To use the program, you need the corresponding .NET Framework runtime. Those can be found below:

.NET 6 Desktop Runtime:
- x64: https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-6.0.1-windows-x64-installer
49 changes: 49 additions & 0 deletions SteamSwitcher/IniFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;


class IniFile
{
string Path;
string EXE = Assembly.GetExecutingAssembly().GetName().Name;

[DllImport("kernel32", CharSet = CharSet.Unicode)]
static extern long WritePrivateProfileString(string Section, string Key, string Value, string FilePath);

[DllImport("kernel32", CharSet = CharSet.Unicode)]
static extern int GetPrivateProfileString(string Section, string Key, string Default, StringBuilder RetVal, int Size, string FilePath);

public IniFile(string IniPath = null)
{
Path = new FileInfo(IniPath ?? EXE + ".ini").FullName;
}

public string Read(string Key, string Section = null)
{
var RetVal = new StringBuilder(255);
GetPrivateProfileString(Section ?? EXE, Key, "", RetVal, 255, Path);
return RetVal.ToString();
}

public void Write(string Key, string Value, string Section = null)
{
WritePrivateProfileString(Section ?? EXE, Key, Value, Path);
}

public void DeleteKey(string Key, string Section = null)
{
Write(Key, null, Section ?? EXE);
}

public void DeleteSection(string Section = null)
{
Write(null, null, Section ?? EXE);
}

public bool KeyExists(string Key, string Section = null)
{
return Read(Key, Section).Length > 0;
}
}
Loading

0 comments on commit 02e39ec

Please sign in to comment.