Skip to content

Commit

Permalink
fixed several issues, add pre-launch/finalize steps to game presets
Browse files Browse the repository at this point in the history
  • Loading branch information
Maassoft committed Nov 13, 2022
1 parent 4522067 commit dc2f7f4
Show file tree
Hide file tree
Showing 12 changed files with 296 additions and 136 deletions.
4 changes: 2 additions & 2 deletions ColorControl/ColorControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<PublisherName>Maassoft</PublisherName>
<Company>Maassoft</Company>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>8.0.0.0</ApplicationVersion>
<Version>8.0.0.0</Version>
<ApplicationVersion>8.1.0.0</ApplicationVersion>
<Version>8.1.0.0</Version>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>false</BootstrapperEnabled>
Expand Down
16 changes: 15 additions & 1 deletion ColorControl/Common/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ public static async Task<List<PnpDev>> GetPnpDevices(string deviceName)

public static T WaitForTask<T>(Task<T> task)
{
if (ConsoleOpened)
{
task.Wait();
return task.Result;
}

while (task != null && (task.Status < TaskStatus.WaitingForChildrenToComplete))
{
Thread.Sleep(10);
Expand All @@ -436,6 +442,12 @@ public static T WaitForTask<T>(Task<T> task)

public static void WaitForTask(System.Threading.Tasks.Task task)
{
if (ConsoleOpened)
{
task.Wait();
return;
}

while (task != null && (task.Status < TaskStatus.WaitingForChildrenToComplete))
{
Thread.Sleep(10);
Expand Down Expand Up @@ -733,7 +745,7 @@ public static Process GetProcessByName(string name, bool skipCurrent = true)
return null;
}

public static void StartProcess(string fileName, string arguments = null, bool hidden = false, bool wait = false, bool setWorkingDir = false, bool elevate = false, uint affinityMask = 0, uint priorityClass = 0)
public static Process StartProcess(string fileName, string arguments = null, bool hidden = false, bool wait = false, bool setWorkingDir = false, bool elevate = false, uint affinityMask = 0, uint priorityClass = 0)
{
var process = Process.Start(new ProcessStartInfo(fileName, arguments)
{
Expand All @@ -757,6 +769,8 @@ public static void StartProcess(string fileName, string arguments = null, bool h
{
process.WaitForExit();
}

return process;
}

internal static void SetProcessAffinity(int processId, uint affinityMask)
Expand Down
4 changes: 3 additions & 1 deletion ColorControl/Forms/ListViewColumnSorter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public int Compare(object x, object y)
else
{
// Compare the two items
compareResult = ObjectCompare.Compare(listviewX.SubItems[ColumnToSort].Text, listviewY.SubItems[ColumnToSort].Text);
var subItemTextX = listviewX.SubItems.Count > ColumnToSort ? listviewX.SubItems[ColumnToSort].Text : string.Empty;
var subItemTextY = listviewY.SubItems.Count > ColumnToSort ? listviewY.SubItems[ColumnToSort].Text : string.Empty;
compareResult = ObjectCompare.Compare(subItemTextX, subItemTextY);
}

// Calculate correct return value based on object comparison
Expand Down
2 changes: 1 addition & 1 deletion ColorControl/Forms/MessageForms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public static List<FieldDefinition> ShowDialog(string caption, IEnumerable<Field

if (field.Values != null && field.Values.Any())
{
var compoundValue = field.Value is int ? (int)field.Value : (int)((uint)field.Value);
var compoundValue = field.Value is uint ? (int)(uint)field.Value : (int)field.Value;
var enumValue = 1;
foreach (var value in field.Values)
{
Expand Down
63 changes: 34 additions & 29 deletions ColorControl/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dc2f7f4

Please sign in to comment.