Skip to content

Commit

Permalink
Change to updater
Browse files Browse the repository at this point in the history
- No longer renames folder just to update it. Renaming is now done on build instead of on update - every time.
  • Loading branch information
TCNOco committed Jun 28, 2021
1 parent 5d3cf2e commit b4146cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 4 additions & 0 deletions TcNo-Acc-Switcher-Client/PostBuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RMDIR /Q/S "runtimes\win-arm64"
RMDIR /Q x64
RMDIR /Q x86
copy /B /Y "..\..\..\Installer\_First_Run_Installer.exe" "_First_Run_Installer.exe"
REN "wwwroot" "originalwwwroot"
cd %origDir%
GOTO end

Expand Down Expand Up @@ -75,6 +76,7 @@ RMDIR /Q/S "runtimes\win-arm64"
RMDIR /Q x64
RMDIR /Q x86
copy /B /Y "..\..\..\Installer\_First_Run_Installer.exe" "_First_Run_Installer.exe"
REN "wwwroot" "originalwwwroot"
cd %origDir%
GOTO end

Expand Down Expand Up @@ -114,6 +116,7 @@ RMDIR /Q/S "bin\Debug\net5.0-windows\runtimes\win-arm64"
RMDIR /Q "bin\Release\net5.0-windows\x64"
RMDIR /Q "bin\Release\net5.0-windows\x86"
copy /B /Y "..\..\Installer\_First_Run_Installer.exe" "_First_Run_Installer.exe"
REN "wwwroot" "originalwwwroot"
cd %origDir%
GOTO end

Expand Down Expand Up @@ -151,6 +154,7 @@ RMDIR /Q/S "bin\Release\net5.0-windows\runtimes\win-arm64"
RMDIR /Q "bin\Release\net5.0-windows\x64"
RMDIR /Q "bin\Release\net5.0-windows\x86"
copy /B /Y "..\..\Installer\_First_Run_Installer.exe" "_First_Run_Installer.exe"
REN "wwwroot" "originalwwwroot"
cd %origDir%
GOTO end

Expand Down
2 changes: 1 addition & 1 deletion TcNo-Acc-Switcher-Globals/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Globals
#pragma warning disable CA2211 // Non-constant fields should not be visible - This is necessary due to it being a launch parameter.
public static bool VerboseMode;
#pragma warning restore CA2211 // Non-constant fields should not be visible
public static readonly string Version = "2021-06-28_00";
public static readonly string Version = "2021-06-28_01";
public static readonly string[] PlatformList = {"Steam", "Origin", "Ubisoft", "BattleNet", "Epic", "Riot"};

#region LOGGER
Expand Down
12 changes: 3 additions & 9 deletions TcNo-Acc-Switcher-Updater/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ private void DoUpdate()
// Check if files are in use
CloseIfRunning(_currentDir);

if (Directory.Exists("originalwwwroot"))
if (Directory.Exists("wwwroot"))
{
if (Directory.Exists("wwwroot")) RecursiveDelete(new DirectoryInfo("wwwroot"), false);
Directory.Move("originalwwwroot", "wwwroot");
if (Directory.Exists("originalwwwroot")) RecursiveDelete(new DirectoryInfo("originalwwwroot"), false);
Directory.Move("wwwroot", "originalwwwroot");
}

// APPLY UPDATE
Expand Down Expand Up @@ -509,11 +509,6 @@ private void DoUpdate()
}

SetStatusAndLog("Updating files in Documents!");
if (Directory.Exists("originalwwwroot"))
{
RecursiveDelete(new DirectoryInfo("originalwwwroot"), false);
Directory.Move("wwwroot", "originalwwwroot");
}
InitWwwroot(true);
InitFolder("themes", true);

Expand Down Expand Up @@ -569,7 +564,6 @@ private void VerifyFiles()
{
var key = oKey;
if (key.StartsWith("updater")) continue; // Ignore own files >> Otherwise IOException
if (key.StartsWith("wwwroot")) key = key.Replace("wwwroot", "originalwwwroot");
cur++;
UpdateProgress(cur * 100 / verifyDictTotal);
if (!File.Exists(key))
Expand Down

0 comments on commit b4146cc

Please sign in to comment.