File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
source/Reloaded.Mod.Launcher.Lib/Utility Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -43,16 +43,19 @@ public static bool TryIt(string exePath)
43
43
44
44
// Execute the script in game context where we have perms to access the files.
45
45
var scriptPath = Path . Combine ( tempDir . FolderPath , "files.txt" ) ;
46
+ var scriptFile = Path . Combine ( tempDir . FolderPath , "script.ps1" ) ;
47
+ var scriptContents = $ "Invoke-CommandInDesktopPackage -PackageFamilyName '{ packageFamilyName } ' -AppId '{ appId } ' -Command '{ compressedLoaderPath } ' -Args \" `\" { scriptPath } `\" \" ";
46
48
File . WriteAllLines ( scriptPath , exeFiles , Encoding . UTF8 ) ;
49
+ File . WriteAllText ( scriptFile , scriptContents , Encoding . UTF8 ) ;
47
50
48
51
// Run the script
49
- var command = $ "-NoProfile -ExecutionPolicy ByPass -Command \" Invoke-CommandInDesktopPackage -PackageFamilyName ' { packageFamilyName } ' -AppId ' { appId } ' -Command ' { compressedLoaderPath } ' -Args ' { scriptPath } ' \" ";
52
+ var command = $ "-NoProfile -ExecutionPolicy ByPass -File \" { scriptFile } \" ";
50
53
var processStartInfo = new ProcessStartInfo
51
54
{
52
55
FileName = @"powershell" ,
53
56
Arguments = command ,
54
57
CreateNoWindow = true ,
55
- WindowStyle = ProcessWindowStyle . Hidden ,
58
+ WindowStyle = ProcessWindowStyle . Hidden
56
59
} ;
57
60
58
61
using var process = Process . Start ( processStartInfo ) ;
@@ -62,7 +65,7 @@ public static bool TryIt(string exePath)
62
65
var processName = "replace-files-with-itself" ;
63
66
while ( Process . GetProcessesByName ( processName ) . Length > 0 )
64
67
Thread . Sleep ( 1 ) ;
65
-
68
+
66
69
return true ;
67
70
}
68
71
You can’t perform that action at this time.
0 commit comments