Skip to content
This repository has been archived by the owner on May 15, 2022. It is now read-only.

Commit

Permalink
Patch loading css files for friends list and library
Browse files Browse the repository at this point in the history
steamui\css\main.css is editable via steamui\main.custom.css

clientui\css\friends.css is editable via clientui\ofriends.custom.css

code is spaghetti, I should clean this later
  • Loading branch information
PhantomGamers committed Jun 12, 2020
1 parent bd24aee commit 31034be
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,54 @@ public static void PatchLibrary()
File.Create(Path.Combine(LibraryUIDir, "libraryroot.custom.css")).Dispose();
}
File.WriteAllText(LibraryCSS, librarycss);

string maincss = File.ReadAllText(Path.Combine(LibraryUIDir, "css", "main.css"));
bool maincsspatched = false;
if(maincss.StartsWith(patchedText))
{
Print("Library main.css already patched.", LogLevel.Debug);
maincsspatched = true;
}
if(!maincsspatched)
{
if(File.Exists(Path.Combine(LibraryUIDir, "main.original.css")))
{
File.Delete(Path.Combine(LibraryUIDir, "main.original.css"));
}
if(!File.Exists(Path.Combine(LibraryUIDir, "main.custom.css")))
{
File.Create(Path.Combine(LibraryUIDir, "main.custom.css")).Dispose();
}
File.Copy(Path.Combine(LibraryUIDir, "css", "main.css"), Path.Combine(LibraryUIDir, "main.original.css"));
int originalmaincsslength = maincss.Length;
maincss = patchedText + "\n@import url(\"https://steamloopback.host/main.original.css\");\n@import url(\"https://steamloopback.host/main.custom.css\");\n";
maincss += new string('\t', originalmaincsslength - maincss.Length);
File.WriteAllText(Path.Combine(LibraryUIDir, "css", "main.css"), maincss);
}

string ofriendscss = File.ReadAllText(steamDir + "\\clientui\\css\\friends.css");
bool ofriendscsspatched = false;
if(ofriendscss.StartsWith(patchedText))
{
Print("Offline friends.css already patched.", LogLevel.Debug);
ofriendscsspatched = true;
}
if(!ofriendscsspatched)
{
if(File.Exists(steamDir + "\\clientui\\ofriends.original.css"))
{
File.Delete(steamDir + "\\clientui\\ofriends.original.css");
}
if(!File.Exists(steamDir + "\\clientui\\ofriends.custom.css"))
{
File.Create(steamDir + "\\clientui\\ofriends.custom.css").Dispose();
}
File.Copy(steamDir + "\\clientui\\css\\friends.css", steamDir + "\\clientui\\ofriends.original.css");
int originalofriendscsslength = ofriendscss.Length;
ofriendscss = patchedText + "\n@import url(\"https://steamloopback.host/ofriends.original.css\");\n@import url(\"https://steamloopback.host/ofriends.custom.css\");\n";
ofriendscss += new string('\t', originalofriendscsslength - ofriendscss.Length);
File.WriteAllText(steamDir + "\\clientui\\css\\friends.css", ofriendscss);
}

Print("Library patched! [BETA]");
Print("Put custom library css in " + Path.Combine(LibraryUIDir, "libraryroot.custom.css"));
Expand Down

0 comments on commit 31034be

Please sign in to comment.