Skip to content

Commit b04a925

Browse files
committed
Closes #22
1 parent 78ed8b3 commit b04a925

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

SuperGrate/Classes/Misc.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static Task DeleteFromStore(string[] SIDs)
167167
}
168168
});
169169
}
170-
public static Task DeleteFromTarget(string Target, string[] SIDs)
170+
public static Task DeleteFromSource(string Target, string[] SIDs)
171171
{
172172
ShouldCancelRemoteProfileDelete = false;
173173
return Task.Run(async () =>
@@ -183,6 +183,7 @@ public static Task DeleteFromTarget(string Target, string[] SIDs)
183183
Properties.Resources.SuperGrateProfileDelete.Length
184184
);
185185
SuperGratePD.Close();
186+
int count = 0;
186187
foreach (string SID in SIDs)
187188
{
188189
if (ShouldCancelRemoteProfileDelete) break;
@@ -193,6 +194,9 @@ await Remote.StartProcess(
193194
@"C:\ProgramData\SuperGratePD.exe " + SID,
194195
@"C:\ProgramData\"
195196
);
197+
Main.Progress.Invoke(new Action(() => {
198+
Main.Progress.Value = (int)((++count - 0.5) / SIDs.Length * 100);
199+
}));
196200
await Remote.WaitForProcessExit(Target, "SuperGratePD");
197201
}
198202
Logger.Information("Removing Daemon...");

SuperGrate/Main.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,11 @@ private void Main_Load(object sender, EventArgs e)
3333
Logger.Success("Welcome to Super Grate! v" + Application.ProductVersion);
3434
Logger.Information("Enter some information to get started!");
3535
UpdateFormRestrictions();
36-
37-
38-
3936
/*
4037
Logger.Information("Downloading...");
4138
await new Download("https://github.com/belowaverage-org/SuperGrate/raw/master/USMT/x64.zip", @".\asdf.zip").Start();
4239
Logger.Success("Done!");
4340
*/
44-
4541
}
4642
private RunningTask Running {
4743
get {
@@ -102,15 +98,20 @@ private async void BtStartStop_Click(object sender, EventArgs e)
10298
{
10399
SIDs[count++] = ((string[])lbxUsers.Tag)[index];
104100
}
101+
bool setting;
102+
bool success;
105103
if (CurrentListSource == ListSources.SourceComputer)
106104
{
107-
await USMT.Do(USMTMode.ScanState, SIDs);
105+
success = await USMT.Do(USMTMode.ScanState, SIDs);
106+
if (bool.TryParse(Config.Settings["AutoDeleteFromSource"], out setting) && setting && success)
107+
{
108+
await Misc.DeleteFromSource(SourceComputer, SIDs);
109+
}
108110
}
109111
if (tbDestinationComputer.Text != "" && Running == RunningTask.USMT)
110112
{
111-
await USMT.Do(USMTMode.LoadState, SIDs);
112-
bool setting;
113-
if (bool.TryParse(Config.Settings["AutoDeleteFromStore"], out setting) && setting)
113+
success = await USMT.Do(USMTMode.LoadState, SIDs);
114+
if (bool.TryParse(Config.Settings["AutoDeleteFromStore"], out setting) && setting && success)
114115
{
115116
await Misc.DeleteFromStore(SIDs);
116117
}
@@ -238,7 +239,7 @@ private async void BtnDelete_Click(object sender, EventArgs e)
238239
}
239240
else if(CurrentListSource == ListSources.SourceComputer)
240241
{
241-
await Misc.DeleteFromTarget(SourceComputer, SIDs.ToArray());
242+
await Misc.DeleteFromSource(SourceComputer, SIDs.ToArray());
242243
Running = RunningTask.None;
243244
btnListSource.PerformClick();
244245
}

0 commit comments

Comments
 (0)