Skip to content

Commit

Permalink
v1.5 - separated projects GUI / CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
SiL3NC3 committed Apr 12, 2023
1 parent ad4ba8c commit 75c45e2
Show file tree
Hide file tree
Showing 46 changed files with 525 additions and 233 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,6 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

RELEASE
19 changes: 0 additions & 19 deletions GUIConsoleWriter.cs

This file was deleted.

25 changes: 22 additions & 3 deletions PortableRegistrator.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32126.315
# Visual Studio Version 17
VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortableRegistrator", "PortableRegistrator.csproj", "{EBF39CB6-DB81-42D4-A9F6-5D1C09582D5F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortableRegistrator", "PortableRegistrator\PortableRegistrator.csproj", "{EBF39CB6-DB81-42D4-A9F6-5D1C09582D5F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortableRegistratorCLI", "PortableRegistratorCLI\PortableRegistratorCLI.csproj", "{59E1E757-BA3C-48C3-B64D-ECEDDDFD3AF1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortableRegistratorCommon", "PortableRegistratorCommon\PortableRegistratorCommon.csproj", "{A1648ECD-BFEF-43CF-9884-656EBAE5F7DC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BADCD287-1933-435E-AED5-83F01134FA1B}"
ProjectSection(SolutionItems) = preProject
make_release.bat = make_release.bat
PortableRegistrator\Resources\Wallpaperfx-3d-Bluefx-Desktop-Usb.ico = PortableRegistrator\Resources\Wallpaperfx-3d-Bluefx-Desktop-Usb.ico
PortableRegistrator\Resources\Wallpaperfx-3d-Bluefx-Desktop-Usb.png = PortableRegistrator\Resources\Wallpaperfx-3d-Bluefx-Desktop-Usb.png
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +26,14 @@ Global
{EBF39CB6-DB81-42D4-A9F6-5D1C09582D5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBF39CB6-DB81-42D4-A9F6-5D1C09582D5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EBF39CB6-DB81-42D4-A9F6-5D1C09582D5F}.Release|Any CPU.Build.0 = Release|Any CPU
{59E1E757-BA3C-48C3-B64D-ECEDDDFD3AF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59E1E757-BA3C-48C3-B64D-ECEDDDFD3AF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59E1E757-BA3C-48C3-B64D-ECEDDDFD3AF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59E1E757-BA3C-48C3-B64D-ECEDDDFD3AF1}.Release|Any CPU.Build.0 = Release|Any CPU
{A1648ECD-BFEF-43CF-9884-656EBAE5F7DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1648ECD-BFEF-43CF-9884-656EBAE5F7DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1648ECD-BFEF-43CF-9884-656EBAE5F7DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1648ECD-BFEF-43CF-9884-656EBAE5F7DC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PortableRegistrator.Models;
using PortableRegistratorCommon;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
88 changes: 46 additions & 42 deletions Form1.Designer.cs → PortableRegistrator/Form1.Designer.cs

Large diffs are not rendered by default.

15 changes: 4 additions & 11 deletions Form1.cs → PortableRegistrator/Form1.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
using Microsoft.Win32;
using PortableRegistrator.Controls;
using PortableRegistrator.Helper;
using PortableRegistrator.Models;
using PortableRegistrator.Controls;
using PortableRegistratorCommon;
using PortableRegistratorCommon.Helper;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net.Configuration;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PortableRegistrator
Expand All @@ -23,7 +17,6 @@ public partial class Form1 : Form
private Configuration _config;
private AppType _selectedAppType;
private bool _removePortableSuffix = false;
private SimpleLogger _logger = new SimpleLogger();

// CONSTRUCTOR
public Form1()
Expand Down Expand Up @@ -252,7 +245,7 @@ private void Unregister()
private void ProcessError(Exception ex)
{
var msg = ex.Message + Environment.NewLine + ex.StackTrace;
_logger.Error(msg);
SimpleLogger.Instance.Error(msg);
MessageBox.Show(msg, "An Error occurred :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
#endregion
Expand Down
2 changes: 1 addition & 1 deletion Form1.resx → PortableRegistrator/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<value>157, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>83</value>
<value>65</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CLI.cs" />
<Compile Include="Controls\DialogAdd.cs">
<SubType>Form</SubType>
</Compile>
Expand All @@ -75,13 +74,7 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="GUIConsoleWriter.cs" />
<Compile Include="Helper\RegistryHelper.cs" />
<Compile Include="Helper\SimpleLogger.cs" />
<Compile Include="Helper\XMLSerializer.cs" />
<Compile Include="Controls\MessageBoxEx.cs" />
<Compile Include="Models\AppType.cs" />
<Compile Include="Models\Configuration.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Controls\DialogAdd.resx">
Expand All @@ -101,7 +94,6 @@
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.manifest" />
<None Include="Assets\Default_Config_generated.conf" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand All @@ -125,9 +117,13 @@
<ItemGroup>
<None Include="Resources\Wallpaperfx-3d-Bluefx-Desktop-Usb.ico" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Assets\Holgi_Config.xml" />
<ProjectReference Include="..\PortableRegistratorCommon\PortableRegistratorCommon.csproj">
<Project>{a1648ecd-bfef-43cf-9884-656ebae5f7dc}</Project>
<Name>PortableRegistratorCommon</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="ReleaseNotes.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
88 changes: 88 additions & 0 deletions PortableRegistrator/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PortableRegistrator
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
try
{
//string[] args = Environment.GetCommandLineArgs();

//// If no parameters given, start with admin permissions and option '-gui'
//if ((args.Length == 1))
//{
// RestartWithAdmin();
//}
//else
//{
// var option = args[1].ToLower();
// if (option == "-gui")
// {
// RunGUI();
// }
// else
// {
// CLI.Run(args);
// }
//}
RunGUI();
}
catch (Exception ex)
{
SimpleLogger.Instance.Error(ex);
}

}

//private static void RestartWithAdmin()
//{
// WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
// bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator);
// if (!hasAdministrativeRight)
// {
// // relaunch the application with admin rights
// string fileName = Assembly.GetExecutingAssembly().Location;
// ProcessStartInfo processInfo = new ProcessStartInfo();
// processInfo.Verb = "runas";
// processInfo.FileName = fileName;
// processInfo.Arguments = "-gui";

// try
// {
// Process.Start(processInfo);
// }
// catch (Win32Exception)
// {
// // This will be thrown if the user cancels the prompt
// }
// return;
// }
//}

private static void RunGUI()
{
Console.WriteLine("Starting GUI!");
// Start GUI
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ebf39cb6-db81-42d4-a9f6-5d1c09582d5f")]
[assembly: Guid("ebf39cb6-db81-42d4-a9f6-5d1c09582fff")]

// Version information for an assembly consists of the following four values:
//
Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions ReleaseNotes.txt → PortableRegistrator/ReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
================================================================================================


2023-04-12 - v1.5

- More error handling added
- Fixed XMLSerialization error
(https://stackoverflow.com/questions/1127431/xmlserializer-giving-filenotfoundexception-at-constructor)
- Some GUI improvements
- Changed Unicode Icon to default "X"... ;)
- Changed label for extensions to a scrollable textbox, when extensions are overlapping
- Separated CLI Interface from GUI (causing issues)


2023-04-02 - v1.4

- Added SimpleLogger for figuring out starting problems (issues), post the log files to
Expand Down
2 changes: 1 addition & 1 deletion app.manifest → PortableRegistrator/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
Expand Down
File renamed without changes.
Loading

0 comments on commit 75c45e2

Please sign in to comment.