Skip to content

Commit 69d7e76

Browse files
committed
v1.4.0 first commit
1 parent f1d5494 commit 69d7e76

35 files changed

+678
-321
lines changed
622 KB
Binary file not shown.
-8.34 MB
Binary file not shown.
621 KB
Binary file not shown.
1020 Bytes
Binary file not shown.

Advanced Installer/Advanced Installer.aip

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
<COMPONENT cid="caphyon.advinst.msicomp.MsiPropsComponent">
77
<ROW Property="AI_BITMAP_DISPLAY_MODE" Value="0"/>
88
<ROW Property="AI_FINDEXE_TITLE" Value="Select the installation package for [|ProductName]" ValueLocId="AI.Property.FindExeTitle"/>
9-
<ROW Property="AI_PROPPATH_DIR_PERBUILD_AssistantComputerControl.exe" Value="..\AssistantComputerControl\bin\Release"/>
10-
<ROW Property="AI_PROPPATH_DIR_PERBUILD_AssistantComputerControl.exe.config" Value="..\AssistantComputerControl\bin\Release"/>
9+
<ROW Property="AI_PROPPATH_DIR_PERBUILD_AssistantComputerControl.exe" Value="..\AssistantComputerControl\bin\Debug"/>
10+
<ROW Property="AI_PROPPATH_DIR_PERBUILD_AssistantComputerControl.exe.config" Value="..\AssistantComputerControl\bin\Debug"/>
1111
<ROW Property="AI_PROPPATH_DIR_PERBUILD_Microsoft.WindowsAPICodePack.Shell.dll" Value="..\packages\Microsoft.WindowsAPICodePack.Shell.1.1.0\lib"/>
1212
<ROW Property="AI_PROPPATH_DIR_PERBUILD_Microsoft.WindowsAPICodePack.dll" Value="..\packages\Microsoft.WindowsAPICodePack.Core.1.1.0\lib"/>
13+
<ROW Property="AI_PROPPATH_DIR_PERBUILD_NLog.dll" Value="..\packages\NLog.4.6.8\lib\net45"/>
1314
<ROW Property="AI_PROPPATH_DIR_PERBUILD_Newtonsoft.Json.dll" Value="..\packages\Newtonsoft.Json.12.0.1\lib\net45"/>
1415
<ROW Property="AI_PROPPATH_DIR_PERBUILD_Sentry.PlatformAbstractions.dll" Value="..\packages\Sentry.PlatformAbstractions.1.0.0\lib\net45"/>
1516
<ROW Property="AI_PROPPATH_DIR_PERBUILD_Sentry.Protocol.dll" Value="..\packages\Sentry.Protocol.1.0.4\lib\net46"/>
@@ -19,6 +20,7 @@
1920
<ROW Property="AI_PROPPATH_FILENAME_PERBUILD_AssistantComputerControl.exe.config" Value="AssistantComputerControl.exe.config"/>
2021
<ROW Property="AI_PROPPATH_FILENAME_PERBUILD_Microsoft.WindowsAPICodePack.Shell.dll" Value="Microsoft.WindowsAPICodePack.Shell.dll"/>
2122
<ROW Property="AI_PROPPATH_FILENAME_PERBUILD_Microsoft.WindowsAPICodePack.dll" Value="Microsoft.WindowsAPICodePack.dll"/>
23+
<ROW Property="AI_PROPPATH_FILENAME_PERBUILD_NLog.dll" Value="NLog.dll"/>
2224
<ROW Property="AI_PROPPATH_FILENAME_PERBUILD_Newtonsoft.Json.dll" Value="Newtonsoft.Json.dll"/>
2325
<ROW Property="AI_PROPPATH_FILENAME_PERBUILD_Sentry.PlatformAbstractions.dll" Value="Sentry.PlatformAbstractions.dll"/>
2426
<ROW Property="AI_PROPPATH_FILENAME_PERBUILD_Sentry.Protocol.dll" Value="Sentry.Protocol.dll"/>
@@ -59,6 +61,7 @@
5961
<ROW Directory="PersonalFolder" Directory_Parent="TARGETDIR" DefaultDir="PERSON~1|PersonalFolder" IsPseudoRoot="1"/>
6062
<ROW Directory="SHORTCUTDIR" Directory_Parent="TARGETDIR" DefaultDir="SHORTC~1|SHORTCUTDIR" IsPseudoRoot="1"/>
6163
<ROW Directory="TARGETDIR" DefaultDir="SourceDir"/>
64+
<ROW Directory="Translations_Dir" Directory_Parent="APPDIR" DefaultDir="TRANSL~1|Translations"/>
6265
<ROW Directory="WebFiles_Dir" Directory_Parent="APPDIR" DefaultDir="WebFiles"/>
6366
<ROW Directory="assets_Dir" Directory_Parent="WebFiles_Dir" DefaultDir="assets"/>
6467
<ROW Directory="cloud_services_Dir" Directory_Parent="assets_Dir" DefaultDir="CLOUD_~1|cloud_services"/>
@@ -72,6 +75,7 @@
7275
<ROW Component="APPDIR" ComponentId="{583DE5B3-916B-4FB0-9F45-FA5EE335BBD3}" Directory_="APPDIR" Attributes="0"/>
7376
<ROW Component="AboutVersion.html" ComponentId="{0A203C51-FFCA-4640-B9DF-80AA6D0BA39A}" Directory_="WebFiles_Dir" Attributes="0" KeyPath="AboutVersion.html" Type="0"/>
7477
<ROW Component="AssistantComputerControl_PrimaryOutput" ComponentId="{6D6B0D60-588B-4115-BB23-8350BF6AD151}" Directory_="APPDIR" Attributes="0" KeyPath="AssistantComputerControl.exe.config"/>
78+
<ROW Component="Danish.json" ComponentId="{30B39B19-7135-43EE-8834-50F0A05D5851}" Directory_="Translations_Dir" Attributes="0" KeyPath="Danish.json" Type="0"/>
7579
<ROW Component="ProductInformation" ComponentId="{72E5C433-D45C-45F4-AF47-0DD66CC8E52E}" Directory_="APPDIR" Attributes="4" KeyPath="Version"/>
7680
<ROW Component="SHORTCUTDIR" ComponentId="{4405308F-0979-4250-8A8D-0622FA7AF17C}" Directory_="SHORTCUTDIR" Attributes="0"/>
7781
<ROW Component="acc_logo.png" ComponentId="{8C4579C2-A784-48B9-81E4-D8568978ED90}" Directory_="assets_Dir" Attributes="0" KeyPath="acc_logo.png" Type="0"/>
@@ -113,12 +117,16 @@
113117
<ROW File="sweetalert2.min.css" Component_="acc_logo.png" FileName="SWEETA~1.CSS|sweetalert2.min.css" Attributes="0" SourcePath="..\AssistantComputerControl\WebFiles\assets\sweetalert2.min.css" SelfReg="false"/>
114118
<ROW File="sweetalert2.min.js" Component_="acc_logo.png" FileName="SWEETA~1.JS|sweetalert2.min.js" Attributes="0" SourcePath="..\AssistantComputerControl\WebFiles\assets\sweetalert2.min.js" SelfReg="false"/>
115119
<ROW File="IECheck.html" Component_="AboutVersion.html" FileName="IECHEC~1.HTM|IECheck.html" Attributes="0" SourcePath="..\AssistantComputerControl\WebFiles\IECheck.html" SelfReg="false"/>
120+
<ROW File="NLog.dll" Component_="AI_PROPPATH_FILENAME_PERBUILD_Microsoft.WindowsAPICodePack.dll" FileName="[|AI_PROPPATH_FILENAME_PERBUILD_NLog.dll]" Attributes="0" SourcePath="&lt;AI_APPPATH_PERBUILD_NLog.dll&gt;" SelfReg="false"/>
121+
<ROW File="Danish.json" Component_="Danish.json" FileName="DANISH~1.JSO|Danish.json" Attributes="0" SourcePath="..\AssistantComputerControl\Translations\Danish.json" SelfReg="false"/>
122+
<ROW File="English.json" Component_="Danish.json" FileName="ENGLIS~1.JSO|English.json" Attributes="0" SourcePath="..\AssistantComputerControl\Translations\English.json" SelfReg="false"/>
116123
</COMPONENT>
117124
<COMPONENT cid="caphyon.advinst.msicomp.AppPathsComponent">
118125
<ROW Name="AI_APPPATH_PERBUILD_AssistantComputerControl.exe" Path="[|AI_PROPPATH_DIR_PERBUILD_AssistantComputerControl.exe]\[|AI_PROPPATH_FILENAME_PERBUILD_AssistantComputerControl.exe]" Type="2" Content="0"/>
119126
<ROW Name="AI_APPPATH_PERBUILD_AssistantComputerControl.exe.config" Path="[|AI_PROPPATH_DIR_PERBUILD_AssistantComputerControl.exe.config]\[|AI_PROPPATH_FILENAME_PERBUILD_AssistantComputerControl.exe.config]" Type="2" Content="0"/>
120127
<ROW Name="AI_APPPATH_PERBUILD_Microsoft.WindowsAPICodePack.Shell.dll" Path="[|AI_PROPPATH_DIR_PERBUILD_Microsoft.WindowsAPICodePack.Shell.dll]\[|AI_PROPPATH_FILENAME_PERBUILD_Microsoft.WindowsAPICodePack.Shell.dll]" Type="2" Content="0"/>
121128
<ROW Name="AI_APPPATH_PERBUILD_Microsoft.WindowsAPICodePack.dll" Path="[|AI_PROPPATH_DIR_PERBUILD_Microsoft.WindowsAPICodePack.dll]\[|AI_PROPPATH_FILENAME_PERBUILD_Microsoft.WindowsAPICodePack.dll]" Type="2" Content="0"/>
129+
<ROW Name="AI_APPPATH_PERBUILD_NLog.dll" Path="[|AI_PROPPATH_DIR_PERBUILD_NLog.dll]\[|AI_PROPPATH_FILENAME_PERBUILD_NLog.dll]" Type="2" Content="0"/>
122130
<ROW Name="AI_APPPATH_PERBUILD_Newtonsoft.Json.dll" Path="[|AI_PROPPATH_DIR_PERBUILD_Newtonsoft.Json.dll]\[|AI_PROPPATH_FILENAME_PERBUILD_Newtonsoft.Json.dll]" Type="2" Content="0"/>
123131
<ROW Name="AI_APPPATH_PERBUILD_Sentry.PlatformAbstractions.dll" Path="[|AI_PROPPATH_DIR_PERBUILD_Sentry.PlatformAbstractions.dll]\[|AI_PROPPATH_FILENAME_PERBUILD_Sentry.PlatformAbstractions.dll]" Type="2" Content="0"/>
124132
<ROW Name="AI_APPPATH_PERBUILD_Sentry.Protocol.dll" Path="[|AI_PROPPATH_DIR_PERBUILD_Sentry.Protocol.dll]\[|AI_PROPPATH_FILENAME_PERBUILD_Sentry.Protocol.dll]" Type="2" Content="0"/>
@@ -238,6 +246,7 @@
238246
<ROW Feature_="MainFeature" Component_="onedrive_howto.gif"/>
239247
<ROW Feature_="MainFeature" Component_="shortcuts"/>
240248
<ROW Feature_="MainFeature" Component_="APPDIR"/>
249+
<ROW Feature_="MainFeature" Component_="Danish.json"/>
241250
</COMPONENT>
242251
<COMPONENT cid="caphyon.advinst.msicomp.MsiIconsComponent">
243252
<ROW Name="logo_ico.exe" SourcePath="..\..\ACC stuff\Images\Icons\logo_ico.ico" Index="0"/>
@@ -307,5 +316,6 @@
307316
<ROW ProjectId="{404b42f4-e135-4d2f-8fd0-20a590814930}" ProjectName="AssistantComputerControl" OutputGroup="References" OutputFile="Sentry.PlatformAbstractions.dll"/>
308317
<ROW ProjectId="{404b42f4-e135-4d2f-8fd0-20a590814930}" ProjectName="AssistantComputerControl" OutputGroup="References" OutputFile="Sentry.Protocol.dll"/>
309318
<ROW ProjectId="{404b42f4-e135-4d2f-8fd0-20a590814930}" ProjectName="AssistantComputerControl" OutputGroup="References" OutputFile="System.Collections.Immutable.dll"/>
319+
<ROW ProjectId="{404b42f4-e135-4d2f-8fd0-20a590814930}" ProjectName="AssistantComputerControl" OutputGroup="References" OutputFile="NLog.dll"/>
310320
</COMPONENT>
311321
</DOCUMENT>

AssistantComputerControl/Actions.cs

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
namespace AssistantComputerControl {
2222
class Actions {
2323
public bool wasFatal = false;
24-
public string successMessage;
24+
public string successMessage, errorMessage;
2525

2626
//Logout
2727
[DllImport("user32.dll", SetLastError = true)]
@@ -105,7 +105,8 @@ class Actions {
105105
//Baisc things
106106
private void Error(string errorMsg, string debugMsg = null) {
107107
MainProgram.DoDebug("ERROR: " + (String.IsNullOrEmpty(debugMsg) ? errorMsg : debugMsg));
108-
MainProgram.errorMessage = errorMsg;
108+
//MainProgram.errorMessage = errorMsg;
109+
errorMessage = errorMsg;
109110
}
110111

111112
/*
@@ -642,7 +643,7 @@ public void DeleteFile(string parameter) {
642643
MainProgram.DoDebug("Deleted directory at " + fileLocation);
643644
}
644645
} else {
645-
MainProgram.errorMessage = "";
646+
Error("");
646647
}
647648
} else {
648649
//Is file
@@ -794,33 +795,68 @@ public void KillProcess(string parameter) {
794795
}
795796

796797
public void MoveSubject(string parameter) {
797-
/* Doesn't seem to be halfway finished ._. [TODO] */
798-
799798
string theSubject = ActionChecker.GetSecondaryParam(parameter)[0]
800799
, moveTo = (ActionChecker.GetSecondaryParam(parameter).Length > 1 ? ActionChecker.GetSecondaryParam(parameter)[1] : null);
801800

802801
FileAttributes attr = File.GetAttributes(theSubject);
803802
if (attr.HasFlag(FileAttributes.Directory)) {
804803
//Is directory
805-
if (Directory.Exists(theSubject)) {
806-
if (Directory.Exists(moveTo)) {
807-
//Move subject to folder
808-
} else {
809-
if (Directory.Exists(Path.GetDirectoryName(moveTo))) {
810-
//Move subject folder and rename it to x
804+
805+
bool isPath = true;
806+
try {
807+
Path.GetFullPath(moveTo);
808+
} catch {
809+
isPath = false;
810+
}
811+
if (isPath) {
812+
if (Directory.Exists(theSubject)) {
813+
if (Directory.Exists(moveTo)) {
814+
//Dest is a folder
815+
string newMoveTo = Path.Combine(theSubject, Path.GetFileName(Path.GetDirectoryName(moveTo)));
816+
try {
817+
Directory.Move(theSubject, newMoveTo);
818+
} catch (Exception e) {
819+
Error("[Move action] Couldn't move folder (" + theSubject + ") to path; '" + newMoveTo + "'. Got error; " + e.Message);
820+
}
811821
} else {
812-
//error
822+
//Dest is a new folder name!
823+
try {
824+
Directory.Move(theSubject, moveTo);
825+
} catch (Exception e) {
826+
Error("[Move action] Couldn't move folder (" + theSubject + "); " + e.Message);
827+
}
813828
}
829+
} else {
830+
Error("[Move action] Subject folder doesn't exist");
814831
}
815832
} else {
816-
Error("Directory doesn't exist");
833+
Error("[Move action] To move a folder, the destination (secondary parameter) must be the path to a folder");
817834
}
818835
} else {
819836
//Is file
820837
if (File.Exists(theSubject)) {
821-
838+
attr = File.GetAttributes(moveTo);
839+
if (attr.HasFlag(FileAttributes.Directory)) {
840+
//Desination is a folder
841+
if (Directory.Exists(moveTo)) {
842+
try {
843+
File.Move(theSubject, moveTo);
844+
} catch (Exception e) {
845+
Error("[Move action] Couldn't move file to folder; " + e.Message);
846+
}
847+
} else {
848+
Error("[Move action] Desination folder doesn't exist");
849+
}
850+
} else {
851+
//Desination is a file - either overwrite existing file, or "rename" file to dest
852+
try {
853+
File.Move(theSubject, moveTo);
854+
} catch (Exception e) {
855+
Error("[Move action] Couldn't move file; " + e.Message);
856+
}
857+
}
822858
} else {
823-
Error("File doesn't exist");
859+
Error("[Move action] Subject file doesn't exist");
824860
}
825861
}
826862

AssistantComputerControl/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
<setting name="ActiveLanguage" serializeAs="String">
7878
<value />
7979
</setting>
80+
<setting name="LastActionFileUid" serializeAs="String">
81+
<value>0</value>
82+
</setting>
8083
</AssistantComputerControl.Properties.Settings>
8184
</userSettings>
8285
<runtime>

AssistantComputerControl/AssistantComputerControl.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@
105105
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
106106
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
107107
</Reference>
108+
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
109+
<HintPath>..\packages\NLog.4.6.8\lib\net45\NLog.dll</HintPath>
110+
</Reference>
108111
<Reference Include="PresentationCore" />
109112
<Reference Include="PresentationFramework" />
110113
<Reference Include="Sentry, Version=1.1.2.0, Culture=neutral, PublicKeyToken=fba2ec45388e2af0, processorArchitecture=MSIL">
@@ -125,12 +128,16 @@
125128
<Reference Include="System.Core" />
126129
<Reference Include="System.DirectoryServices" />
127130
<Reference Include="System.Drawing" />
131+
<Reference Include="System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
128132
<Reference Include="System.Messaging" />
129133
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
130134
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
131135
<Private>True</Private>
132136
<Private>True</Private>
133137
</Reference>
138+
<Reference Include="System.Runtime.Serialization" />
139+
<Reference Include="System.ServiceModel" />
140+
<Reference Include="System.Transactions" />
134141
<Reference Include="System.Web.Extensions" />
135142
<Reference Include="System.Windows.Forms" />
136143
<Reference Include="System.Windows.Forms.DataVisualization" />

AssistantComputerControl/CleanupService.cs

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public void Start() {
1515
new Thread(() => {
1616
Thread.CurrentThread.IsBackground = true;
1717
MainProgram.DoDebug("[CLEANUP] Service started");
18+
Thread.Sleep(150);
1819

1920
if (isCleaning) {
2021
MainProgram.DoDebug("[CLEANUP] Another cleanup service in progress. Waiting...");
@@ -25,20 +26,25 @@ public void Start() {
2526
}
2627
isCleaning = true;
2728

28-
int tries = 0;
29-
while (!Check() && tries <= 10) {
30-
tries++;
31-
Thread.Sleep(1000);
32-
}
29+
if (AllHiddenCheck() != 0 && EmptyCheck()) {
30+
int tries = 0;
31+
while (!Check() && tries <= 10) {
32+
tries++;
33+
Thread.Sleep(1000);
34+
}
3335

34-
if (tries >= 10) {
35-
MainProgram.DoDebug("[CLEANUP] Timeout. Failed to remove files in action folder.");
36-
} else {
37-
if (!AllHiddenCheck()) {
38-
MainProgram.DoDebug("[CLEANUP] Did not timeout, but action folder is still not empty - not supposed to happen");
36+
if (tries >= 10) {
37+
MainProgram.DoDebug("[CLEANUP] Timeout. Failed to remove files in action folder.");
3938
} else {
40-
MainProgram.DoDebug("[CLEANUP] Successful");
39+
int filesAmount = AllHiddenCheck();
40+
if (filesAmount != 0) {
41+
MainProgram.DoDebug("[CLEANUP] Did not timeout, but action folder is still not empty (" + filesAmount.ToString() + " non-hidden files in folder) - not supposed to happen Emtpy check returns " + (EmptyCheck() ? "true" : "false"));
42+
} else {
43+
MainProgram.DoDebug("[CLEANUP] Successful");
44+
}
4145
}
46+
} else {
47+
MainProgram.DoDebug("[CLEANUP] Action folder is completely empty");
4248
}
4349
isCleaning = false;
4450
}).Start();
@@ -48,15 +54,16 @@ private bool EmptyCheck() {
4854
return Directory.GetFiles(MainProgram.CheckPath()).Length > 0;
4955
}
5056

51-
private bool AllHiddenCheck() {
57+
private int AllHiddenCheck() {
5258
int count = 0;
5359
foreach (string file in Directory.GetFiles(MainProgram.CheckPath(), "*." + Properties.Settings.Default.ActionFileExtension)) {
5460
bool hidden = (File.GetAttributes(file) & FileAttributes.Hidden) == FileAttributes.Hidden;
5561
if (!hidden || file.Contains("computerAction")) {
62+
//MainProgram.DoDebug("[CLEANUP] Found file; " + file);
5663
count++;
5764
}
5865
}
59-
return count == 0;
66+
return count;
6067
}
6168

6269
private bool Check() {
@@ -80,10 +87,11 @@ private bool Check() {
8087
}
8188

8289
//string newFilename = Path.Combine(Path.GetDirectoryName(file), "action_" + DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString() + "_" + Guid.NewGuid() + "." + Properties.Settings.Default.ActionFileExtension);
83-
//string newFilename = Path.Combine(tmpFolder, "action_" + DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString() + "_" + Guid.NewGuid() + "." + Properties.Settings.Default.ActionFileExtension);
84-
string newFilename = Path.Combine(Path.Combine(MainProgram.CheckPath(), "used_actions"), "action_" + DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString() + "_" + Guid.NewGuid() + "." + Properties.Settings.Default.ActionFileExtension);
90+
string newFilename = Path.Combine(tmpFolder, "action_" + DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString() + "_" + Guid.NewGuid() + "." + Properties.Settings.Default.ActionFileExtension);
91+
//string newFilename = Path.Combine(Path.Combine(MainProgram.CheckPath(), "used_actions"), "action_" + DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString() + "_" + Guid.NewGuid() + "." + Properties.Settings.Default.ActionFileExtension);
8592
File.Move(file, newFilename);
8693
//File.Delete(newFilename);
94+
//File.Delete(file);
8795
//cleanedFiles.Add(newFilename);
8896
numFiles++;
8997
}

0 commit comments

Comments
 (0)