Skip to content

Commit

Permalink
Merge pull request #106 from AlbertMN/devel
Browse files Browse the repository at this point in the history
Update master to v1.4.4
  • Loading branch information
AlbertMN authored May 19, 2021
2 parents ee73e58 + bf98264 commit d3a5cb9
Show file tree
Hide file tree
Showing 30 changed files with 302 additions and 116 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

Advanced Installer/

# User-specific files
*.suo
*.user
Expand Down
Binary file modified Advanced Installer/Advanced Installer-SetupFiles/ACCsetup.exe
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions Advanced Installer/Advanced Installer.aip
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,17 @@
<ROW Property="ARPCOMMENTS" Value="The software that lets you control your computer using your personal assistants (Amazon Alexa or Google Assistant)" ValueLocId="*"/>
<ROW Property="ARPCONTACT" Value="https://twitter.com/ACC_HomeAlexa"/>
<ROW Property="ARPHELPLINK" Value="https://assistantcomputercontrol.com/#get-in-touch"/>
<ROW Property="ARPNOMODIFY" MultiBuildValue="DefaultBuild:1"/>
<ROW Property="ARPNOREPAIR" MultiBuildValue="DefaultBuild:1"/>
<ROW Property="ARPPRODUCTICON" Value="logo_ico.exe" Type="8"/>
<ROW Property="ARPURLINFOABOUT" Value="https://assistantcomputercontrol.com/"/>
<ROW Property="ARPURLUPDATEINFO" Value="https://assistantcomputercontrol.com/"/>
<ROW Property="BannerBitmap" Value="banner" MultiBuildValue="DefaultBuild:banner.png" Type="1" MsiKey="BannerBitmap"/>
<ROW Property="DialogBitmap" Value="dialog" MultiBuildValue="DefaultBuild:dialogbitmap.png" Type="1" MsiKey="DialogBitmap"/>
<ROW Property="Manufacturer" Value="Albert MN."/>
<ROW Property="ProductCode" Value="1033:{1AE13B1D-FE8D-4745-98E8-98C9B5DFCF38} " Type="16"/>
<ROW Property="ProductCode" Value="1033:{2280A735-687B-4D3D-9313-02E3041F56A6} " Type="16"/>
<ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="AssistantComputerControl"/>
<ROW Property="ProductVersion" Value="1.4.2" Type="32"/>
<ROW Property="ProductVersion" Value="1.4.4" Type="32"/>
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/>
<ROW Property="UpgradeCode" Value="{8E6F4399-B513-420B-8E11-36837A8550EE}"/>
<ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
Expand Down Expand Up @@ -141,6 +140,7 @@
<ROW File="Spanish.json" Component_="Danish.json" FileName="SPANIS~1.JSO|Spanish.json" Attributes="0" SourcePath="..\AssistantComputerControl\Translations\Spanish.json" SelfReg="false"/>
<ROW File="PortugueseBrasil.json" Component_="Danish.json" FileName="PORTUG~1.JSO|Portuguese - Brasil.json" Attributes="0" SourcePath="..\AssistantComputerControl\Translations\Portuguese - Brasil.json" SelfReg="false"/>
<ROW File="Dutch.json" Component_="Danish.json" FileName="DUTCH~1.JSO|Dutch.json" Attributes="0" SourcePath="..\AssistantComputerControl\Translations\Dutch.json" SelfReg="false"/>
<ROW File="ActionTester.html" Component_="AboutVersion.html" FileName="ACTION~1.HTM|ActionTester.html" Attributes="0" SourcePath="..\AssistantComputerControl\WebFiles\ActionTester.html" SelfReg="false"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.AppPathsComponent">
<ROW Name="AI_APPPATH_PERBUILD_AssistantComputerControl.exe" Path="[|AI_PROPPATH_DIR_PERBUILD_AssistantComputerControl.exe]\[|AI_PROPPATH_FILENAME_PERBUILD_AssistantComputerControl.exe]" Type="2" Content="0"/>
Expand Down
32 changes: 19 additions & 13 deletions AssistantComputerControl/ActionMods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,28 @@ class ActionMods {
//Check mod folder and init mods
public static void CheckMods() {
try {
modActions = new Dictionary<string, string>();
string[] dirs = Directory.GetDirectories(MainProgram.actionModsPath, "*", SearchOption.TopDirectoryOnly);

foreach (string dir in dirs) {
string theFile = Path.Combine(dir, "info.json");
if (File.Exists(theFile)) {
//Info file exists - read it
string fileContent = ReadInfoFile(theFile);
if (fileContent != null) {
ValidateAddMod(fileContent, dir);
if (Directory.Exists(MainProgram.actionModsPath)) {
//Action mods path exists
modActions = new Dictionary<string, string>();
string[] dirs = Directory.GetDirectories(MainProgram.actionModsPath, "*", SearchOption.TopDirectoryOnly);

foreach (string dir in dirs) {
string theFile = Path.Combine(dir, "info.json");
if (File.Exists(theFile)) {
//Info file exists - read it
string fileContent = ReadInfoFile(theFile);
if (fileContent != null) {
ValidateAddMod(fileContent, dir);
} else {
MainProgram.DoDebug("Failed to read info.json file at; " + dir);
}
} else {
MainProgram.DoDebug("Failed to read info.json file at; " + dir);
MainProgram.DoDebug("Invalid folder in action mods; '" + dir + "'. Doesn't contain an info.json file.");
}
} else {
MainProgram.DoDebug("Invalid folder in action mods; '" + dir + "'. Doesn't contain an info.json file.");
}
} else {
//Mod directory doesn't exist
MainProgram.DoDebug("Can't check for mods as the folder doesn't exist");
}
} catch (Exception e) {
Console.WriteLine("The process failed: {0}", e.ToString());
Expand Down
20 changes: 14 additions & 6 deletions AssistantComputerControl/Actions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* AssistantComputerControl
* Made by Albert MN.
* Updated: v1.4.2, 12-12-2020
* Updated: v1.4.4, 19-05-2021
*
* Use:
* - Functions for all the actions
Expand Down Expand Up @@ -1051,20 +1051,23 @@ public void MoveMouse(String parameter) {
public const int MOUSEEVENTF_MIDDLEDOWN = 0x20;
public const int MOUSEEVENTF_MIDDLEUP = 0x40;

public void MouseClick(string parameter = "", string secondaryParameter = "") {
public void MouseClick(string parameter = "") {
/*
* Action made by community member Joshua Miller (modified by Albert)
*/

string firstParameter = parameter != null && parameter != String.Empty ? ActionChecker.GetSecondaryParam(parameter)[0] : "",
secondParameter = parameter != null && parameter != String.Empty ? (ActionChecker.GetSecondaryParam(parameter).Length > 1 ? ActionChecker.GetSecondaryParam(parameter)[1] : null) : "";

int timesToClick = 1;
string type = "left";
string type = firstParameter;

if (parameter == String.Empty) {
if (firstParameter == String.Empty) {
type = "left";
}

if (secondaryParameter != String.Empty) {
if (Int32.TryParse(secondaryParameter, out int repeatAmount)) {
if (secondParameter != String.Empty && secondParameter != null) {
if (Int32.TryParse(secondParameter, out int repeatAmount)) {
timesToClick = repeatAmount;
} else {
Error("Secondary parameter (how many times to click) is not a valid number");
Expand Down Expand Up @@ -1129,6 +1132,11 @@ public void Wait(string parameter) {
}
}

//Fix for shortcuts; don't show an error
public void IgnoreMe() {
successMessage = "Ignoring filename";
}

/* End of actions */
}
}
3 changes: 3 additions & 0 deletions AssistantComputerControl/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
<setting name="AutoFileMarginFixer" serializeAs="String">
<value>0</value>
</setting>
<setting name="StartsUsingRegistry" serializeAs="String">
<value>False</value>
</setting>
</AssistantComputerControl.Properties.Settings>
</userSettings>
<runtime>
Expand Down
3 changes: 2 additions & 1 deletion AssistantComputerControl/AssistantComputerControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.4.2.%2a</ApplicationVersion>
<ApplicationVersion>1.4.4.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
Expand Down Expand Up @@ -332,6 +332,7 @@
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings1.Designer.cs</LastGenOutput>
</None>
<None Include="Resources\ACC_icon.ico" />
</ItemGroup>
Expand Down
29 changes: 18 additions & 11 deletions AssistantComputerControl/CleanupService.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* AssistantComputerControl
* Made by Albert MN.
* Updated: v1.4.0, 15-01-2020
* Updated: v1.4.4, 08-05-2021
*
* Use:
* - Cleans action files up after they've been processed
Expand Down Expand Up @@ -69,7 +69,7 @@ void ExtraCleanup() {

Process p = new Process();
p.StartInfo.FileName = "powershell.exe";
p.StartInfo.Arguments = $"-WindowStyle Hidden -file \"{ps1File}\" \"{Path.Combine(MainProgram.CheckPath(), "*")}\" \"*.{Properties.Settings.Default.ActionFileExtension}\"";
p.StartInfo.Arguments = $"-WindowStyle Hidden -file \"{ps1File}\" \"{Path.Combine(MainProgram.CheckPath(true), "*")}\" \"*.{Properties.Settings.Default.ActionFileExtension}\"";
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.Start();
Expand All @@ -89,29 +89,36 @@ void ExtraCleanup() {
}

private bool EmptyCheck() {
return Directory.GetFiles(MainProgram.CheckPath()).Length > 0;
return Directory.GetFiles(MainProgram.CheckPath(true)).Length > 0;
}

private int AllHiddenCheck() {
int count = 0;
foreach (string file in Directory.GetFiles(MainProgram.CheckPath(), "*." + Properties.Settings.Default.ActionFileExtension)) {
bool hidden = (File.GetAttributes(file) & FileAttributes.Hidden) == FileAttributes.Hidden;
if (!hidden || file.Contains("computerAction")) {
//MainProgram.DoDebug("[CLEANUP] Found file; " + file);
count++;
foreach (string file in Directory.GetFiles(MainProgram.CheckPath(true), "*." + Properties.Settings.Default.ActionFileExtension)) {
if (File.Exists(file)) {
try {
//Shouldn't think it'd be needed, but it is
bool hidden = (File.GetAttributes(file) & FileAttributes.Hidden) == FileAttributes.Hidden;
if (!hidden || file.Contains("computerAction")) {
//MainProgram.DoDebug("[CLEANUP] Found file; " + file);
count++;
}
} catch {
//Probably failed to get attribute
}
}
}
return count;
}

private bool Check() {
if (EmptyCheck()) {
DirectoryInfo di = new DirectoryInfo(MainProgram.CheckPath());
DirectoryInfo di = new DirectoryInfo(MainProgram.CheckPath(true));

int numFiles = 0;

try {
foreach (string file in Directory.GetFiles(MainProgram.CheckPath(), "*." + Properties.Settings.Default.ActionFileExtension)) {
foreach (string file in Directory.GetFiles(MainProgram.CheckPath(true), "*." + Properties.Settings.Default.ActionFileExtension)) {
//if (cleanedFiles.Contains(file)) continue;

bool hidden = (File.GetAttributes(file) & FileAttributes.Hidden) == FileAttributes.Hidden;
Expand All @@ -126,7 +133,7 @@ private bool Check() {

//string newFilename = Path.Combine(Path.GetDirectoryName(file), "action_" + DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString() + "_" + Guid.NewGuid() + "." + Properties.Settings.Default.ActionFileExtension);
//string newFilename = Path.Combine(tmpFolder, "action_" + DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString() + "_" + Guid.NewGuid() + "." + Properties.Settings.Default.ActionFileExtension);
//string newFilename = Path.Combine(Path.Combine(MainProgram.CheckPath(), "used_actions"), "action_" + DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString() + "_" + Guid.NewGuid() + "." + Properties.Settings.Default.ActionFileExtension);
//string newFilename = Path.Combine(Path.Combine(MainProgram.CheckPath(true), "used_actions"), "action_" + DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString() + "_" + Guid.NewGuid() + "." + Properties.Settings.Default.ActionFileExtension);
//File.Move(file, newFilename);
//File.Delete(newFilename);
File.Delete(file);
Expand Down
Loading

0 comments on commit d3a5cb9

Please sign in to comment.