Skip to content

Commit 1d4c884

Browse files
committed
v1.2.2 initial commit
1 parent 80d49db commit 1d4c884

29 files changed

+216
-380
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Advanced Installer/Advanced Installer.aip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
<ROW Property="BannerBitmap" Value="banner" MultiBuildValue="DefaultBuild:banner.png" Type="1" MsiKey="BannerBitmap"/>
3838
<ROW Property="DialogBitmap" Value="dialog" MultiBuildValue="DefaultBuild:dialogbitmap.png" Type="1" MsiKey="DialogBitmap"/>
3939
<ROW Property="Manufacturer" Value="Albert MN."/>
40-
<ROW Property="ProductCode" Value="1033:{746F29C3-0D9F-4DF7-8FBF-E2A90D5A103E} " Type="16"/>
40+
<ROW Property="ProductCode" Value="1033:{6A723DD4-5278-4D60-8A57-361116141F86} " Type="16"/>
4141
<ROW Property="ProductLanguage" Value="1033"/>
4242
<ROW Property="ProductName" Value="AssistantComputerControl"/>
43-
<ROW Property="ProductVersion" Value="1.2.1.0" Type="32"/>
43+
<ROW Property="ProductVersion" Value="1.2.2.0" Type="32"/>
4444
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/>
4545
<ROW Property="UpgradeCode" Value="{8E6F4399-B513-420B-8E11-36837A8550EE}"/>
4646
<ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>

Advanced Installer/Advanced Installer.aiproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,9 @@
3535
</Target>
3636
<Import Project="$(AdvancedInstallerMSBuildTargets)\AdvInstExtTasks.Targets" Condition="'$(AdvancedInstallerMSBuildTargets)' != ''" />
3737
<Import Project="$(MSBuildExtensionsPath32)\Caphyon\Advanced Installer\AdvInstExtTasks.Targets" Condition="('$(AdvancedInstallerMSBuildTargets)' == '') And (Exists('$(MSBuildExtensionsPath32)\Caphyon\Advanced Installer\AdvInstExtTasks.Targets'))" />
38+
<Target Name="Rebuild">
39+
<Error Text="This project requires Advanced Installer tool. Please download it from https://www.advancedinstaller.com/download.html" />
40+
</Target>
41+
<Target Name="Clean" />
42+
<Target Name="ResolveAssemblyReferences" />
3843
</Project>

AssistantComputerControl/ACC_Updater.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* AssistantComputerControl
33
* Made by Albert MN.
4-
* Updated: v1.2.0, 05-01-2019
4+
* Updated: v1.2.2, 06-01-2019
55
*
66
* Use:
77
* - Checks for updates
@@ -19,6 +19,7 @@
1919
namespace AssistantComputerControl {
2020
class ACC_Updater {
2121
private const string releaseJsonUrl = "https://assistantcomputercontrol.com/versions/latest_version.php?type=release";
22+
//private const string releaseJsonUrl = "https://assistantcomputercontrol.com/versions/latest_version.php?type=release&dev_test";
2223
private const string betaJsonUrl = "https://assistantcomputercontrol.com/versions/latest_version.php?type=beta";
2324

2425
public bool Check(bool debug = false) {
@@ -194,6 +195,7 @@ private static void FileDownloadedCallback(object sender, AsyncCompletedEventArg
194195
//Download success
195196
Process.Start(targetLocation);
196197
MainProgram.DoDebug("New installer successfully downloaded and opened.");
198+
Application.Exit();
197199
} else {
198200
MainProgram.DoDebug("Failed to download new version of ACC. Error; " + e.Error);
199201
MessageBox.Show("Failed to download new version. Try again later!", "Error | " + MainProgram.messageBoxTitle);

AssistantComputerControl/Actions.cs

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public void Shutdown(string parameter) {
5454
if (parameter == "abort") {
5555
shutdownParameters = "abort";
5656
} else {
57-
if (parameter.Contains("/t")) {
58-
shutdownParameters = !parameter.Contains("/s") ? "/s " : "" + parameter;
57+
if (parameter.Contains("/t") || parameter.Contains("-t")) {
58+
shutdownParameters = !parameter.Contains("/s") && !parameter.Contains("-s") ? "/s " : "" + parameter;
5959
} else {
60-
shutdownParameters = !parameter.Contains("/s") ? "/s " : "" + parameter + " /t 0";
60+
shutdownParameters = !parameter.Contains("/s") && !parameter.Contains("-s") ? "/s " : "" + parameter + " /t 0";
6161
}
6262
}
6363
}
@@ -86,10 +86,10 @@ public void Restart(string parameter) {
8686
if (parameter == "abort") {
8787
restartParameters = "abort";
8888
} else {
89-
if (parameter.Contains("/t")) {
90-
restartParameters = !parameter.Contains("/r") ? "/s " : "" + parameter;
89+
if (parameter.Contains("/t") || parameter.Contains("-t")) {
90+
restartParameters = !parameter.Contains("/r") && !parameter.Contains("-r") ? "/r " : "" + parameter;
9191
} else {
92-
restartParameters = !parameter.Contains("/r") ? "/s " : "" + parameter + " /t 0";
92+
restartParameters = !parameter.Contains("/r") && !parameter.Contains("-r") ? "/r " : "" + parameter + " /t 0";
9393
}
9494
}
9595
}
@@ -194,7 +194,7 @@ public void Lock(string parameter) {
194194
successMessage = "Simulated PC lock";
195195
} else {
196196
MainProgram.DoDebug("Locking computer...");
197-
//wasFatal = true;
197+
wasFatal = true;
198198
LockWorkStation();
199199
successMessage = "Locked pc";
200200
}
@@ -204,7 +204,12 @@ public void Mute(string parameter) {
204204

205205
if (parameter == null) {
206206
//No parameter - toggle
207-
doMute = !AudioManager.GetMasterVolumeMute();
207+
try {
208+
doMute = !AudioManager.GetMasterVolumeMute();
209+
} catch {
210+
MainProgram.DoDebug("No volume object (most likely)");
211+
MainProgram.errorMessage = "Failed to mute; no volume object.";
212+
}
208213
} else {
209214
//Parameter set;
210215
switch (parameter) {
@@ -247,15 +252,25 @@ public void SetVolume(string parameter) {
247252
MainProgram.errorMessage = "Failed to unmute PC";
248253
}
249254
}
250-
AudioManager.SetMasterVolume((float)volumeLevel);
255+
try {
256+
AudioManager.SetMasterVolume((float)volumeLevel);
257+
} catch {
258+
//Might not have an audio device...
259+
MainProgram.DoDebug("Failed to set PC volume. Exception caught.");
260+
MainProgram.errorMessage = "Failed to set PC volume";
261+
}
251262
}
252263
if (!MainProgram.testingAction) {
253-
if ((int)AudioManager.GetMasterVolume() != (int)volumeLevel) {
254-
//Something went wrong... Audio not set to parameter-level
255-
MainProgram.DoDebug("ERROR: Volume was not set properly. Master volume is " + AudioManager.GetMasterVolume() + ", not " + volumeLevel);
256-
MainProgram.errorMessage = "Something went wrong when setting the volume";
257-
} else {
258-
successMessage = "Set volume to " + volumeLevel + "%";
264+
try {
265+
if ((int)AudioManager.GetMasterVolume() != (int)volumeLevel) {
266+
//Something went wrong... Audio not set to parameter-level
267+
MainProgram.DoDebug("ERROR: Volume was not set properly. Master volume is " + AudioManager.GetMasterVolume() + ", not " + volumeLevel);
268+
MainProgram.errorMessage = "Something went wrong when setting the volume";
269+
} else {
270+
successMessage = "Set volume to " + volumeLevel + "%";
271+
}
272+
} catch {
273+
MainProgram.errorMessage = "Failed to check volume";
259274
}
260275
} else {
261276
successMessage = "Simulated setting system volume to " + volumeLevel + "%";
@@ -313,16 +328,21 @@ public void Music(string parameter) {
313328
}
314329
public void Open(string parameter) {
315330
string location = ActionChecker.GetSecondaryParam(parameter)[0], arguments = (ActionChecker.GetSecondaryParam(parameter).Length > 1 ? ActionChecker.GetSecondaryParam(parameter)[1] : null);
316-
string fileLocation = (!location.Contains(@":\")) ? Path.Combine(MainProgram.shortcutLocation, location) : location;
331+
string fileLocation = (!location.Contains(@":\") || !location.Contains(@":/")) ? Path.Combine(MainProgram.shortcutLocation, location) : location;
317332

318333
if (File.Exists(fileLocation) || Directory.Exists(fileLocation) || Uri.IsWellFormedUriString(fileLocation, UriKind.Absolute)) {
319334
if (!MainProgram.testingAction) {
320-
Process p = new Process();
321-
p.StartInfo.FileName = fileLocation;
322-
if (arguments != null)
323-
p.StartInfo.Arguments = arguments;
324-
p.Start();
325-
successMessage = "OPEN: opened file/url; " + fileLocation;
335+
try {
336+
Process p = new Process();
337+
p.StartInfo.FileName = fileLocation;
338+
if (arguments != null)
339+
p.StartInfo.Arguments = arguments;
340+
p.Start();
341+
successMessage = "OPEN: opened file/url; " + fileLocation;
342+
} catch {
343+
MainProgram.DoDebug("Failed to open file at " + fileLocation + "");
344+
MainProgram.errorMessage = "Failed to open file (" + fileLocation + ")";
345+
}
326346
} else {
327347
successMessage = "OPEN: simulated opening file; " + fileLocation;
328348
}
@@ -332,7 +352,7 @@ public void Open(string parameter) {
332352
}
333353
}
334354
public void OpenAll(string parameter) {
335-
string fileLocation = (!parameter.Contains(@":\")) ? Path.Combine(MainProgram.shortcutLocation, parameter) : parameter;
355+
string fileLocation = (!parameter.Contains(@":\") || !parameter.Contains(@":/")) ? Path.Combine(MainProgram.shortcutLocation, parameter) : parameter;
336356

337357
if (Directory.Exists(fileLocation) || Uri.IsWellFormedUriString(fileLocation, UriKind.Absolute)) {
338358
DirectoryInfo d = new DirectoryInfo(fileLocation);

AssistantComputerControl/AssistantComputerControl.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{404B42F4-E135-4D2F-8FD0-20A590814930}</ProjectGuid>
8-
<OutputType>WinExe</OutputType>
8+
<OutputType>Exe</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>AssistantComputerControl</RootNamespace>
1111
<AssemblyName>AssistantComputerControl</AssemblyName>
@@ -35,7 +35,7 @@
3535
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
3636
<WebPage>publish.htm</WebPage>
3737
<ApplicationRevision>0</ApplicationRevision>
38-
<ApplicationVersion>1.2.1.%2a</ApplicationVersion>
38+
<ApplicationVersion>1.2.2.%2a</ApplicationVersion>
3939
<UseApplicationTrust>false</UseApplicationTrust>
4040
<CreateDesktopShortcut>true</CreateDesktopShortcut>
4141
<PublishWizardCompleted>true</PublishWizardCompleted>

AssistantComputerControl/GettingStarted.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,15 @@ public void CloudServiceChosen(string service = "") {
149149
MainProgram.DoDebug("Cloud service " + backgroundCheckerServiceName + " is installed");
150150
if (backgroundCheckerServiceName == "googledrive") {
151151
bool partial = MainProgram.GetGoogleDriveFolder() != String.Empty;
152-
theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[2] { true, partial });
152+
if (theWebBrowser != null)
153+
if (theWebBrowser.Handle != null)
154+
theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[2] { true, partial });
153155
if (partial)
154156
CheckLocalGoogleDrive();
155157
} else {
156-
theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[1] { true });
158+
if (theWebBrowser != null)
159+
if (theWebBrowser.Handle != null)
160+
theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[1] { true });
157161
}
158162
} else {
159163
//Not found
@@ -174,17 +178,21 @@ public void CloudServiceChosen(string service = "") {
174178

175179
//Cloud service has been installed since we last checked!
176180
MainProgram.DoDebug("Cloud service has been installed since last check. Proceed.");
177-
178-
theWebBrowser.Invoke(new Action(() => {
179-
if (backgroundCheckerServiceName == "googledrive") {
180-
bool partial = MainProgram.GetGoogleDriveFolder() != String.Empty;
181-
theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[2] { true, partial });
182-
if (partial)
183-
CheckLocalGoogleDrive();
184-
} else {
185-
theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[1] { true });
181+
182+
if (theWebBrowser != null) {
183+
if (theWebBrowser.Handle != null) {
184+
theWebBrowser.Invoke(new Action(() => {
185+
if (backgroundCheckerServiceName == "googledrive") {
186+
bool partial = MainProgram.GetGoogleDriveFolder() != String.Empty;
187+
theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[2] { true, partial });
188+
if (partial)
189+
CheckLocalGoogleDrive();
190+
} else {
191+
theWebBrowser.Document.InvokeScript("CloudServiceInstalled", new Object[1] { true });
192+
}
193+
}));
186194
}
187-
}));
195+
}
188196
}).Start();
189197
}
190198
}

0 commit comments

Comments
 (0)