diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..361484f1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.ico filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/CheckPullRequest.yml b/.github/workflows/CheckPullRequest.yml index d236df3b..9675f5bd 100644 --- a/.github/workflows/CheckPullRequest.yml +++ b/.github/workflows/CheckPullRequest.yml @@ -3,28 +3,14 @@ name: Check pull request on: [pull_request] jobs: - checkWinFormsBuild: - name: Check windows forms build - runs-on: windows-latest - steps: - - name: Clone repository - uses: actions/checkout@v2 - - name: Install nuget - uses: nuget/setup-nuget@v1 - - name: Nuget restore - run: nuget restore - shell: powershell - - name: Setup msbuild - uses: microsoft/setup-msbuild@v1.0.2 - - name: Build project - run: msbuild .\src\XmlFormatter\XmlFormatter.csproj /t:Build /p:Configuration=Release - shell: powershell checkAvaloniaBuild: name: Check Avalonia build runs-on: windows-latest steps: - name: Clone repository uses: actions/checkout@v2 + with: + lfs: true - name: Restore run: dotnet restore shell: powershell diff --git a/.github/workflows/CreateLiveBuild.yml b/.github/workflows/CreateLiveBuild.yml index 9d313a0c..ab3fa205 100644 --- a/.github/workflows/CreateLiveBuild.yml +++ b/.github/workflows/CreateLiveBuild.yml @@ -6,56 +6,14 @@ on: - '*.*.*' jobs: - createWinFormsBuild: - name: Create Windows forms build - runs-on: windows-latest - steps: - - name: Clone repository - uses: actions/checkout@v2 - - name: Get release tag - run: echo "RELEASE_VERSION=$(($env:GITHUB_REF -split '/')[-1] -replace ' ','')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - - name: Check release version - run: echo ${{ env.RELEASE_VERSION }} - - name: Install nuget - uses: nuget/setup-nuget@v1 - - name: Nuget restore - run: nuget restore - shell: powershell - - name: Setup msbuild - uses: microsoft/setup-msbuild@v1.0.2 - - name: Prepare version - run: echo ${{ env.RELEASE_VERSION }} | Out-File -FilePath .\src\XmlFormatter\Version.txt -Encoding utf8 - - name: Check version file - run: Get-Content -Path .\src\XmlFormatter\Version.txt - - name: Build project - run: | - msbuild .\src\XmlFormatter\XmlFormatter.csproj /t:Build /p:Configuration=Release - msbuild .\src\JsonPlugin\JsonPlugin.csproj /t:Build /p:Configuration=Release - msbuild .\src\CorePlugin\CorePlugin.csproj /t:Build /p:Configuration=Release - shell: powershell - - name: Move artifact files - run: | - mkdir upload-artifacts\ - mkdir plugins\ - mv .\src\CorePlugin\bin\Release\netstandard2.0\CorePlugin.dll plugins\ - mv .\src\JsonPlugin\bin\Release\netstandard2.0\JsonPlugin.dll plugins\ - mv .\src\JsonPlugin\bin\Release\netstandard2.0\Newtonsoft.Json.dll plugins\ - mv .\src\XmlFormatter\bin\Release\** upload-artifacts\ - mv LICENSE upload-artifacts\ - mv README.md upload-artifacts\ - - name: Upload build artifact - uses: actions/upload-artifact@v2 - with: - name: WinFormBuildArtifact - path: | - upload-artifacts/ - plugins/ createAvaloniaBuildWindows: name: Create Avalonia build for Windows runs-on: windows-latest steps: - name: Clone repository uses: actions/checkout@v2 + with: + lfs: true - name: Get release tag run: echo "RELEASE_VERSION=$(($env:GITHUB_REF -split '/')[-1] -replace ' ','')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - name: Check release version @@ -93,6 +51,8 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v2 + with: + lfs: true - name: Get release tag run: echo "RELEASE_VERSION=$(($env:GITHUB_REF -split '/')[-1] -replace ' ','')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - name: Check release version @@ -130,6 +90,8 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v2 + with: + lfs: true - name: Get release tag run: echo "RELEASE_VERSION=$(($env:GITHUB_REF -split '/')[-1] -replace ' ','')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - name: Check release version @@ -161,37 +123,6 @@ jobs: path: | upload-artifacts/ plugins/ - createWinFormsZip: - name: Create WinForm zip - needs: ["createWinFormsBuild"] - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v2 - with: - name: WinFormBuildArtifact - path: dist - - name: Prepare Formatter - run: | - mkdir dist/upload-artifacts/Plugins - mv dist/plugins/CorePlugin.dll dist/upload-artifacts/Plugins - - name: Create zips - run: | - cd dist/upload-artifacts - zip -r LatestDevelopment_WinFormsXmlFormatter.zip . - cd ../plugins/ - zip -r LatestDevelopment_WinFormsJsonPlugin.zip . - - name: Move artifact - run: | - mkdir upload-artifacts/ - mv dist/upload-artifacts/LatestDevelopment_WinFormsXmlFormatter.zip upload-artifacts/ - mv dist/plugins/LatestDevelopment_WinFormsJsonPlugin.zip upload-artifacts/ - - name: Upload WinForms build artifact - uses: actions/upload-artifact@v2 - with: - name: WinFormZipArtifact - path: | - upload-artifacts/ createAvaloniaZipWindows: name: Create Avalonia Windows zip needs: ["createAvaloniaBuildWindows"] @@ -287,7 +218,7 @@ jobs: upload-artifacts/ uploadRelease: name: Upload releases - needs: ["createWinFormsZip", "createAvaloniaZipWindows", "createAvaloniaZipLinux", "createAvaloniaZipDarwin"] + needs: ["createAvaloniaZipWindows", "createAvaloniaZipLinux", "createAvaloniaZipDarwin"] runs-on: ubuntu-latest steps: - name: Download artifacts @@ -309,16 +240,6 @@ jobs: body: You cannot update this version from within the application! draft: true prerelease: true - - name: Upload WinForm XmlFormatter zip - id: upload-win-form-formatter-zip - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: dist/WinFormZipArtifact/LatestDevelopment_WinFormsXmlFormatter.zip - asset_name: LatestDevelopment_WinFormsXmlFormatter.zip - asset_content_type: application/zip - name: Upload WinForm JsonPlugin zip id: upload-win-form-json-plugin-zip uses: actions/upload-release-asset@v1 diff --git a/.github/workflows/LatestBuild.yml b/.github/workflows/LatestBuild.yml index 04f312e4..3dafa43f 100644 --- a/.github/workflows/LatestBuild.yml +++ b/.github/workflows/LatestBuild.yml @@ -17,6 +17,8 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v2 + with: + lfs: true - name: Install nuget uses: nuget/setup-nuget@v1 - name: Nuget restore @@ -53,6 +55,8 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v2 + with: + lfs: true - name: Build project run: | dotnet publish .\src\XmlFormatterOsIndependent\ -c Release -r win-x64 --self-contained true @@ -82,6 +86,8 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v2 + with: + lfs: true - name: Build project run: | dotnet publish .\src\XmlFormatterOsIndependent\ -c Release -r linux-x64 --self-contained true @@ -111,6 +117,8 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v2 + with: + lfs: true - name: Build project run: | dotnet publish .\src\XmlFormatterOsIndependent\ -c Release -r osx-x64 --self-contained true @@ -266,6 +274,7 @@ jobs: - uses: actions/checkout@v3 with: ref: ${{ env.REF_CHECKOUT_BRANCH }} + lfs: true - name: Download artifacts uses: actions/download-artifact@v2 with: diff --git a/XmlFormatter.sln b/XmlFormatter.sln index 1cfe41bb..df7b7ca6 100644 --- a/XmlFormatter.sln +++ b/XmlFormatter.sln @@ -3,12 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.5.33414.496 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlFormatter", "src\XmlFormatter\XmlFormatter.csproj", "{0EAED5C3-DAB2-4919-9C26-EAD4D8222BD0}" - ProjectSection(ProjectDependencies) = postProject - {4FC9F80F-73AB-4647-8A7D-0F6284CD9258} = {4FC9F80F-73AB-4647-8A7D-0F6284CD9258} - {CF65B491-2BA5-4F7A-968F-35E21DE5CC7D} = {CF65B491-2BA5-4F7A-968F-35E21DE5CC7D} - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XmlFormatterModel", "src\XMLFormatterModel\XmlFormatterModel.csproj", "{F2245AAE-DFAF-41CC-8AF2-D3836B558847}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonPlugin", "src\JsonPlugin\JsonPlugin.csproj", "{CF65B491-2BA5-4F7A-968F-35E21DE5CC7D}" diff --git a/src/CorePlugin/CorePlugin.csproj b/src/CorePlugin/CorePlugin.csproj index 606bb156..cbdd4728 100644 --- a/src/CorePlugin/CorePlugin.csproj +++ b/src/CorePlugin/CorePlugin.csproj @@ -1,7 +1,8 @@ - netstandard2.0 + net6.0 + enable @@ -18,4 +19,8 @@ + + + + diff --git a/src/JsonPlugin/JsonFormatter.cs b/src/JsonPlugin/JsonFormatter.cs index 503dc654..7d41e66a 100644 --- a/src/JsonPlugin/JsonFormatter.cs +++ b/src/JsonPlugin/JsonFormatter.cs @@ -1,8 +1,8 @@ -using Newtonsoft.Json; -using PluginFramework.DataContainer; +using PluginFramework.DataContainer; using PluginFramework.Formatter; using System; using System.IO; +using System.Text.Json; using System.Threading.Tasks; namespace JsonPlugin @@ -34,14 +34,14 @@ public JsonFormatter() /// public override bool ConvertToFlat(string filePath, string outputName) { - FormatFile(filePath, outputName, Formatting.None); + FormatFile(filePath, outputName, false); return true; } /// public override bool ConvertToFormatted(string filePath, string outputName) { - FormatFile(filePath, outputName, Formatting.Indented); + FormatFile(filePath, outputName, true); return true; } @@ -51,7 +51,7 @@ public override bool ConvertToFormatted(string filePath, string outputName) /// The input file to convert /// The output file to generate /// The save options to use - private async void FormatFile(string inputFilePath, string outputName, Formatting formatting) + private async void FormatFile(string inputFilePath, string outputName, bool indent) { if (!IsFileReadableWriteable(inputFilePath, outputName)) { @@ -60,13 +60,12 @@ private async void FormatFile(string inputFilePath, string outputName, Formattin } FireEvent("Loading", "Loading ..."); - object data = await Task.Run(() => + dynamic? data = await Task.Run(() => { - object returnData = null; + dynamic? returnData = null; try { - - returnData = JsonConvert.DeserializeObject(File.ReadAllText(inputFilePath)); + returnData = JsonSerializer.Deserialize(File.ReadAllText(inputFilePath)); } catch (Exception) { @@ -76,7 +75,7 @@ private async void FormatFile(string inputFilePath, string outputName, Formattin return returnData; }); - if (data == null) + if (data is null) { return; } @@ -86,7 +85,7 @@ private async void FormatFile(string inputFilePath, string outputName, Formattin { try { - string writeableData = JsonConvert.SerializeObject(data, formatting); + string writeableData = JsonSerializer.Serialize(data, new JsonSerializerOptions { WriteIndented = indent }); File.WriteAllText(outputName, writeableData); return true; } diff --git a/src/JsonPlugin/JsonPlugin.csproj b/src/JsonPlugin/JsonPlugin.csproj index b53cdac7..05a003b0 100644 --- a/src/JsonPlugin/JsonPlugin.csproj +++ b/src/JsonPlugin/JsonPlugin.csproj @@ -1,8 +1,9 @@  - netstandard2.0 + net6.0 true + enable @@ -13,12 +14,12 @@ - - - - + + + + diff --git a/src/PluginFramework/PluginFramework.csproj b/src/PluginFramework/PluginFramework.csproj index ab269c06..d7bc2835 100644 --- a/src/PluginFramework/PluginFramework.csproj +++ b/src/PluginFramework/PluginFramework.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0 diff --git a/src/XMLFormatterModel/XmlFormatterModel.csproj b/src/XMLFormatterModel/XmlFormatterModel.csproj index d8f5c61d..e194a16f 100644 --- a/src/XMLFormatterModel/XmlFormatterModel.csproj +++ b/src/XMLFormatterModel/XmlFormatterModel.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0 XmlFormatterModel diff --git a/src/XmlFormatter/App.config b/src/XmlFormatter/App.config deleted file mode 100644 index f5448674..00000000 --- a/src/XmlFormatter/App.config +++ /dev/null @@ -1,55 +0,0 @@ - - - - -
- - -
- - - - - - - - - - - - True - - - False - - - True - - - False - - - 0.0.0 - - - False - - - XmlFormatter.src.Update.Strategies.OpenGitHubReleasesStrategy - - - - - - False - - - - - - - 0.0.6 - - - - \ No newline at end of file diff --git a/src/XmlFormatter/DataContainer/ComboboxPluginItem.cs b/src/XmlFormatter/DataContainer/ComboboxPluginItem.cs deleted file mode 100644 index 40fa23d5..00000000 --- a/src/XmlFormatter/DataContainer/ComboboxPluginItem.cs +++ /dev/null @@ -1,49 +0,0 @@ -using PluginFramework.DataContainer; -using System; - -namespace XmlFormatter.DataContainer -{ - /// - /// A class to use with the combobox - /// - public class ComboboxPluginItem - { - /// - /// The plugin information to display - /// - public PluginInformation Information => metaData.Information; - - /// - /// The id of the plugin - /// - public int Id => metaData.Id; - - /// - /// The type of the plugin - /// - public Type Type => metaData.Type; - - /// - /// The meta data of the plugin - /// - private readonly PluginMetaData metaData; - - /// - /// Create a new instance of this class - /// - /// The meta data to use - public ComboboxPluginItem(PluginMetaData metaData) - { - this.metaData = metaData; - } - - /// - /// Overriding the to string method - /// - /// The name of the plugin - public override string ToString() - { - return Information.Name; - } - } -} diff --git a/src/XmlFormatter/DataContainer/VersionCompare.cs b/src/XmlFormatter/DataContainer/VersionCompare.cs deleted file mode 100644 index 9347ae44..00000000 --- a/src/XmlFormatter/DataContainer/VersionCompare.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Octokit; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace XmlFormatter.src.DataContainer -{ - /// - /// This data container class which will combine different informations. - /// This class will tell you which version is newer and what versions are present - /// - class VersionCompare - { - /// - /// Is the GitHub version newer - /// - private readonly bool gitHubIsNewer; - - /// - /// Readonly acces if the GitHub version is newer - /// - public bool GitHubIsNewer => gitHubIsNewer; - - /// - /// The version of the current client application - /// - private readonly Version clientVersion; - - /// - /// Readonly access to the current client version of this application - /// - public Version LocalVersion => clientVersion; - - /// - /// The version on GitHub - /// - private readonly Version gitHubVersion; - - /// - /// Readonly access to the GitHub version - /// - public Version GitHubVersion => gitHubVersion; - - /// - /// The newest release which can be found on GitHub - /// - private readonly Release lastestRelease; - - /// - /// Readonly access to the newest release on GitHub - /// - public Release LatestRelease => lastestRelease; - - /// - /// A readonly list of all the assets in the release build - /// - private readonly List assets; - - /// - /// Public access to the assets in the release build - /// - public List Assets => assets; - - /// - /// Create an new instance of this class - /// - /// Is the version on GitHub newer - /// The local version number - /// The GitHub version number - /// The latest release - public VersionCompare(bool gitHubIsNewer, Version localVersion, Version gitHubVersion, Release latestRelease) - { - this.gitHubIsNewer = gitHubIsNewer; - this.clientVersion = localVersion; - this.gitHubVersion = gitHubVersion; - this.lastestRelease = latestRelease; - this.assets = latestRelease.Assets.ToList(); - } - - } -} diff --git a/src/XmlFormatter/EventMessages/BaseEventArgs.cs b/src/XmlFormatter/EventMessages/BaseEventArgs.cs deleted file mode 100644 index 2e6e539a..00000000 --- a/src/XmlFormatter/EventMessages/BaseEventArgs.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; - -namespace XmlFormatter.EventMessages -{ - /// - /// This class is a simple event data container - /// - public class BaseEventArgs : EventArgs - { - /// - /// The title of the event - /// - private readonly string title; - - /// - /// Readonly access to the event title - /// - public string Title => title; - - /// - /// The message of the event - /// - private readonly string message; - - /// - /// Readonly access to the event message - /// - public string Message => message; - - /// - /// This will create a basic event data container - /// - /// The title of the event - /// The message of the event - public BaseEventArgs(string title, string message) - { - this.title = title; - this.message = message; - } - } -} diff --git a/src/XmlFormatter/Program.cs b/src/XmlFormatter/Program.cs deleted file mode 100644 index 52c65706..00000000 --- a/src/XmlFormatter/Program.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Windows.Forms; -using XmlFormatter.Windows; - -namespace XmlFormatter -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - if (Environment.OSVersion.Version.Major >= 6) - { - SetProcessDPIAware(); - } - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - [System.Runtime.InteropServices.DllImport("user32.dll")] - private static extern bool SetProcessDPIAware(); - } -} diff --git a/src/XmlFormatter/Properties/AssemblyInfo.cs b/src/XmlFormatter/Properties/AssemblyInfo.cs deleted file mode 100644 index c7702e82..00000000 --- a/src/XmlFormatter/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("XmlFormatter")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("XmlFormatter")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("0eaed5c3-dab2-4919-9c26-ead4d8222bd0")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// 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.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/XmlFormatter/Properties/Resources.Designer.cs b/src/XmlFormatter/Properties/Resources.Designer.cs deleted file mode 100644 index 018bbc7e..00000000 --- a/src/XmlFormatter/Properties/Resources.Designer.cs +++ /dev/null @@ -1,174 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace XmlFormatter.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("XmlFormatter.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to If this option is active the application will ask you before closing.. - /// - internal static string Settings_CB_AskBeforeClose_Message { - get { - return ResourceManager.GetString("Settings_CB_AskBeforeClose_Message", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Ask before closing. - /// - internal static string Settings_CB_AskBeforeClose_Title { - get { - return ResourceManager.GetString("Settings_CB_AskBeforeClose_Title", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to If you activate this option the application will search for updates on startup. - /// - internal static string Settings_CB_CheckUpdatesOnStartup_Message { - get { - return ResourceManager.GetString("Settings_CB_CheckUpdatesOnStartup_Message", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Search for updates on startup. - /// - internal static string Settings_CB_CheckUpdatesOnStartup_Title { - get { - return ResourceManager.GetString("Settings_CB_CheckUpdatesOnStartup_Title", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This setting will only be activated after saving and closing the setting window. - ///Any changes to the configuration will take place after saving and closing the settings window.. - /// - internal static string Settings_CB_Hotfolder_Message { - get { - return ResourceManager.GetString("Settings_CB_Hotfolder_Message", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Hotfolder is active. - /// - internal static string Settings_CB_Hotfolder_Title { - get { - return ResourceManager.GetString("Settings_CB_Hotfolder_Title", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to If you tick this box logging will be active after saving the settings. - ///The logging can be used to track down errors with the hotfolder.. - /// - internal static string Settings_CB_LoggingActive_Message { - get { - return ResourceManager.GetString("Settings_CB_LoggingActive_Message", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Is logging active. - /// - internal static string Settings_CB_LoggingActive_Title { - get { - return ResourceManager.GetString("Settings_CB_LoggingActive_Title", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This option will change the minimize behavior of the main window - ///If this is set the application will be minimized to an tray icon instead of the task bar.. - /// - internal static string Settings_CB_MinimizeToTray_Message { - get { - return ResourceManager.GetString("Settings_CB_MinimizeToTray_Message", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Minimize to tray. - /// - internal static string Settings_CB_MinimizeToTray_Title { - get { - return ResourceManager.GetString("Settings_CB_MinimizeToTray_Title", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to You can choose a strategy for updating this application in the dropdown below.. - /// - internal static string Settings_L_UpdateStrategy_Message { - get { - return ResourceManager.GetString("Settings_L_UpdateStrategy_Message", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The strategy to use for updating. - /// - internal static string Settings_L_UpdateStrategy_Title { - get { - return ResourceManager.GetString("Settings_L_UpdateStrategy_Title", resourceCulture); - } - } - } -} diff --git a/src/XmlFormatter/Properties/Resources.resx b/src/XmlFormatter/Properties/Resources.resx deleted file mode 100644 index 3795c216..00000000 --- a/src/XmlFormatter/Properties/Resources.resx +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - If this option is active the application will ask you before closing. - - - Ask before closing - - - If you activate this option the application will search for updates on startup - - - Search for updates on startup - - - This setting will only be activated after saving and closing the setting window. -Any changes to the configuration will take place after saving and closing the settings window. - - - Hotfolder is active - - - If you tick this box logging will be active after saving the settings. -The logging can be used to track down errors with the hotfolder. - - - Is logging active - - - This option will change the minimize behavior of the main window -If this is set the application will be minimized to an tray icon instead of the task bar. - - - Minimize to tray - - - You can choose a strategy for updating this application in the dropdown below. - - - The strategy to use for updating - - \ No newline at end of file diff --git a/src/XmlFormatter/Properties/Settings.Designer.cs b/src/XmlFormatter/Properties/Settings.Designer.cs deleted file mode 100644 index 2ece5a31..00000000 --- a/src/XmlFormatter/Properties/Settings.Designer.cs +++ /dev/null @@ -1,143 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace XmlFormatter.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool MinimizeToTray { - get { - return ((bool)(this["MinimizeToTray"])); - } - set { - this["MinimizeToTray"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool AskBeforeClosing { - get { - return ((bool)(this["AskBeforeClosing"])); - } - set { - this["AskBeforeClosing"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool FirstTimeTray { - get { - return ((bool)(this["FirstTimeTray"])); - } - set { - this["FirstTimeTray"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool SearchUpdateOnStartup { - get { - return ((bool)(this["SearchUpdateOnStartup"])); - } - set { - this["SearchUpdateOnStartup"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0.0.0")] - public string ApplicationVersion { - get { - return ((string)(this["ApplicationVersion"])); - } - set { - this["ApplicationVersion"] = value; - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0.0.6")] - public string LowestSupportedVersion { - get { - return ((string)(this["LowestSupportedVersion"])); - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool HotfolderActive { - get { - return ((bool)(this["HotfolderActive"])); - } - set { - this["HotfolderActive"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("XmlFormatter.src.Update.Strategies.OpenGitHubReleasesStrategy")] - public string UpdateStrategy { - get { - return ((string)(this["UpdateStrategy"])); - } - set { - this["UpdateStrategy"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string LoggingFolder { - get { - return ((string)(this["LoggingFolder"])); - } - set { - this["LoggingFolder"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool LoggingEnabled { - get { - return ((bool)(this["LoggingEnabled"])); - } - set { - this["LoggingEnabled"] = value; - } - } - } -} diff --git a/src/XmlFormatter/Properties/Settings.settings b/src/XmlFormatter/Properties/Settings.settings deleted file mode 100644 index e49889f8..00000000 --- a/src/XmlFormatter/Properties/Settings.settings +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - True - - - False - - - True - - - False - - - 0.0.0 - - - 0.0.6 - - - False - - - XmlFormatter.src.Update.Strategies.OpenGitHubReleasesStrategy - - - - - - False - - - \ No newline at end of file diff --git a/src/XmlFormatter/Settings/Adapter/PropertyAdapter.cs b/src/XmlFormatter/Settings/Adapter/PropertyAdapter.cs deleted file mode 100644 index f06f7e15..00000000 --- a/src/XmlFormatter/Settings/Adapter/PropertyAdapter.cs +++ /dev/null @@ -1,164 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using XmlFormatterModel.Setting; - -namespace XmlFormatter.Settings.Adapter -{ - /// - /// This class is a adapter between the new setting methods and the old resource based - /// - class PropertyAdapter : ISettingScope - { - /// - /// The name of this scope - /// - private string name; - - /// - /// Readonly access to the scope name - /// - public string Name => name; - - /// - /// Create a new instance of this adapter which will always use "Default" as scope name - /// - public PropertyAdapter() - { - SetName("Default"); - } - - /// - /// Set the name of this adapter - /// - /// The new name to use - public void SetName(string name) - { - this.name = name; - } - - /// - /// Add a new setting to the resource file. - /// This will only work if the setting is already defined - /// - /// The setting to add - public void AddSetting(ISettingPair setting) - { - try - { - Type type = Properties.Settings.Default[setting.Name].GetType(); - if (type == setting.Type) - { - Properties.Settings.Default[setting.Name] = setting.Value; - } - } - catch (Exception) - { - - } - } - - /// - /// Get a setting from the resource file - /// - /// The name of the setting to get - /// A instance of the setting or null if nothing was present - public ISettingPair GetSetting(string name) - { - ISettingPair returnValue = null; - try - { - var propertyValue = Properties.Settings.Default[name]; - returnValue = new SettingPair(name); - returnValue.SetValue(propertyValue); - } - catch (Exception) - { - //Not important since we can return an empty value - } - - return returnValue; - } - - /// - /// Get all the settings stored in the resource file - /// - /// All the settings present in the resource file - public List GetSettings() - { - List settingPairs = new List(); - foreach (SettingsProperty property in Properties.Settings.Default.Properties) - { - if (property.Attributes.Contains(typeof(ApplicationScopedSettingAttribute))) - { - continue; - } - SettingPair settingPair = new SettingPair(property.Name); - settingPair.SetValue(Properties.Settings.Default[property.Name]); - settingPairs.Add(settingPair); - } - return settingPairs; - } - - /// - /// This method is not working for this adapter - /// - /// The scope to add - public void AddSubScope(ISettingScope scope) - { - } - - /// - /// This method is not working for this adapter - /// - /// A new empty list - public List GetSubScopes() - { - return new List(); - } - - /// - /// This method is not working for this adapter - /// - /// The name of the sub scope to get - /// null - public ISettingScope GetSubScope(string name) - { - return null; - } - - /// - /// This method is not supported by this adapter - /// - /// The name of the scope to remove - /// Always true - public bool RemoveSubScope(string name) - { - return true; - } - - /// - /// Method is not supported by the adapter - /// - public void ClearSubScopes() - { - } - - /// - /// This method is not supported by this adapter - /// - /// The name of the setting to remove - /// Always true - public bool RemoveSetting(string name) - { - return true; - } - - /// - /// Method is not supported by the adapter - /// - public void RemoveSettings() - { - } - } -} diff --git a/src/XmlFormatter/Update/LocalVersionReciever.cs b/src/XmlFormatter/Update/LocalVersionReciever.cs deleted file mode 100644 index 757bee2b..00000000 --- a/src/XmlFormatter/Update/LocalVersionReciever.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Reflection; -using XmlFormatterModel.Update.Adapter; - -namespace XmlFormatter.Update -{ - /// - /// Get the local version - /// - class LocalVersionReciever : LocalResourceVersionReciever - { - /// - protected override Assembly GetAssembly() - { - return Assembly.GetExecutingAssembly(); - } - - /// - protected override string GetResourcePath() - { - return "XmlFormatter.Version.txt"; - } - } -} diff --git a/src/XmlFormatter/Update/VersionManagerFactory.cs b/src/XmlFormatter/Update/VersionManagerFactory.cs deleted file mode 100644 index 3d86b47f..00000000 --- a/src/XmlFormatter/Update/VersionManagerFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -using XmlFormatterModel.Update; -using XmlFormatterModel.Update.Strategies; - -namespace XmlFormatter.Update -{ - /// - /// Create a new version manager to use - /// - internal class VersionManagerFactory : IVersionManagerFactory - { - /// - /// The version manager to use - /// - private IVersionManager manager; - - /// - /// Create a new instance of this class - /// - public VersionManagerFactory() - { - manager = null; - } - - /// - public IVersionManager GetVersionManager() - { - manager = manager ?? new VersionManager( - new DefaultStringConvertStrategy(), - new LocalVersionReciever(), - new GitHubVersionRecieverStrategy()); - - return manager; - } - } -} diff --git a/src/XmlFormatter/Version.txt b/src/XmlFormatter/Version.txt deleted file mode 100644 index 917008ed..00000000 --- a/src/XmlFormatter/Version.txt +++ /dev/null @@ -1 +0,0 @@ -0.0.0 \ No newline at end of file diff --git a/src/XmlFormatter/Windows/HotfolderEditor.Designer.cs b/src/XmlFormatter/Windows/HotfolderEditor.Designer.cs deleted file mode 100644 index 51abc498..00000000 --- a/src/XmlFormatter/Windows/HotfolderEditor.Designer.cs +++ /dev/null @@ -1,336 +0,0 @@ -namespace XmlFormatter.Windows -{ - partial class HotfolderEditor - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HotfolderEditor)); - this.GB_General = new System.Windows.Forms.GroupBox(); - this.CB_Mode = new System.Windows.Forms.ComboBox(); - this.L_Mode = new System.Windows.Forms.Label(); - this.L_Provider = new System.Windows.Forms.Label(); - this.CB_Formatter = new System.Windows.Forms.ComboBox(); - this.GB_Folders = new System.Windows.Forms.GroupBox(); - this.TB_OutputFileScheme = new System.Windows.Forms.TextBox(); - this.L_OutputScheme = new System.Windows.Forms.Label(); - this.L_Filter = new System.Windows.Forms.Label(); - this.TB_Filter = new System.Windows.Forms.TextBox(); - this.B_OutputFolder = new System.Windows.Forms.Button(); - this.TB_OutputFolder = new System.Windows.Forms.TextBox(); - this.L_OutputFolder = new System.Windows.Forms.Label(); - this.B_OpenWatchFolder = new System.Windows.Forms.Button(); - this.TB_WatchedFolder = new System.Windows.Forms.TextBox(); - this.L_WatchedFolder = new System.Windows.Forms.Label(); - this.GB_Triggers = new System.Windows.Forms.GroupBox(); - this.CB_RemoveOld = new System.Windows.Forms.CheckBox(); - this.CB_OnRename = new System.Windows.Forms.CheckBox(); - this.B_Save = new System.Windows.Forms.Button(); - this.B_Cancel = new System.Windows.Forms.Button(); - this.GB_General.SuspendLayout(); - this.GB_Folders.SuspendLayout(); - this.GB_Triggers.SuspendLayout(); - this.SuspendLayout(); - // - // GB_General - // - this.GB_General.Controls.Add(this.CB_Mode); - this.GB_General.Controls.Add(this.L_Mode); - this.GB_General.Controls.Add(this.L_Provider); - this.GB_General.Controls.Add(this.CB_Formatter); - this.GB_General.Location = new System.Drawing.Point(18, 18); - this.GB_General.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_General.Name = "GB_General"; - this.GB_General.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_General.Size = new System.Drawing.Size(519, 177); - this.GB_General.TabIndex = 0; - this.GB_General.TabStop = false; - this.GB_General.Text = "General"; - // - // CB_Mode - // - this.CB_Mode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CB_Mode.FormattingEnabled = true; - this.CB_Mode.Location = new System.Drawing.Point(9, 115); - this.CB_Mode.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_Mode.Name = "CB_Mode"; - this.CB_Mode.Size = new System.Drawing.Size(499, 28); - this.CB_Mode.TabIndex = 3; - // - // L_Mode - // - this.L_Mode.AutoSize = true; - this.L_Mode.Location = new System.Drawing.Point(4, 91); - this.L_Mode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Mode.Name = "L_Mode"; - this.L_Mode.Size = new System.Drawing.Size(49, 20); - this.L_Mode.TabIndex = 2; - this.L_Mode.Text = "Mode"; - // - // L_Provider - // - this.L_Provider.AutoSize = true; - this.L_Provider.Location = new System.Drawing.Point(4, 25); - this.L_Provider.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Provider.Name = "L_Provider"; - this.L_Provider.Size = new System.Drawing.Size(66, 20); - this.L_Provider.TabIndex = 1; - this.L_Provider.Text = "Provider"; - // - // CB_Formatter - // - this.CB_Formatter.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CB_Formatter.FormattingEnabled = true; - this.CB_Formatter.Location = new System.Drawing.Point(9, 54); - this.CB_Formatter.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_Formatter.Name = "CB_Formatter"; - this.CB_Formatter.Size = new System.Drawing.Size(499, 28); - this.CB_Formatter.TabIndex = 0; - // - // GB_Folders - // - this.GB_Folders.Controls.Add(this.TB_OutputFileScheme); - this.GB_Folders.Controls.Add(this.L_OutputScheme); - this.GB_Folders.Controls.Add(this.L_Filter); - this.GB_Folders.Controls.Add(this.TB_Filter); - this.GB_Folders.Controls.Add(this.B_OutputFolder); - this.GB_Folders.Controls.Add(this.TB_OutputFolder); - this.GB_Folders.Controls.Add(this.L_OutputFolder); - this.GB_Folders.Controls.Add(this.B_OpenWatchFolder); - this.GB_Folders.Controls.Add(this.TB_WatchedFolder); - this.GB_Folders.Controls.Add(this.L_WatchedFolder); - this.GB_Folders.Location = new System.Drawing.Point(18, 205); - this.GB_Folders.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_Folders.Name = "GB_Folders"; - this.GB_Folders.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_Folders.Size = new System.Drawing.Size(519, 278); - this.GB_Folders.TabIndex = 1; - this.GB_Folders.TabStop = false; - this.GB_Folders.Text = "Folders"; - // - // TB_OutputFileScheme - // - this.TB_OutputFileScheme.Location = new System.Drawing.Point(9, 229); - this.TB_OutputFileScheme.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TB_OutputFileScheme.Name = "TB_OutputFileScheme"; - this.TB_OutputFileScheme.Size = new System.Drawing.Size(454, 26); - this.TB_OutputFileScheme.TabIndex = 11; - // - // L_OutputScheme - // - this.L_OutputScheme.AutoSize = true; - this.L_OutputScheme.Location = new System.Drawing.Point(4, 205); - this.L_OutputScheme.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_OutputScheme.Name = "L_OutputScheme"; - this.L_OutputScheme.Size = new System.Drawing.Size(142, 20); - this.L_OutputScheme.TabIndex = 10; - this.L_OutputScheme.Text = "Output file scheme"; - // - // L_Filter - // - this.L_Filter.AutoSize = true; - this.L_Filter.Location = new System.Drawing.Point(4, 85); - this.L_Filter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Filter.Name = "L_Filter"; - this.L_Filter.Size = new System.Drawing.Size(44, 20); - this.L_Filter.TabIndex = 9; - this.L_Filter.Text = "Filter"; - // - // TB_Filter - // - this.TB_Filter.Location = new System.Drawing.Point(9, 109); - this.TB_Filter.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TB_Filter.Name = "TB_Filter"; - this.TB_Filter.Size = new System.Drawing.Size(454, 26); - this.TB_Filter.TabIndex = 8; - // - // B_OutputFolder - // - this.B_OutputFolder.Location = new System.Drawing.Point(474, 169); - this.B_OutputFolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_OutputFolder.Name = "B_OutputFolder"; - this.B_OutputFolder.Size = new System.Drawing.Size(36, 31); - this.B_OutputFolder.TabIndex = 5; - this.B_OutputFolder.Text = "..."; - this.B_OutputFolder.UseVisualStyleBackColor = true; - this.B_OutputFolder.Click += new System.EventHandler(this.B_OutputFolder_Click); - // - // TB_OutputFolder - // - this.TB_OutputFolder.Location = new System.Drawing.Point(9, 169); - this.TB_OutputFolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TB_OutputFolder.Name = "TB_OutputFolder"; - this.TB_OutputFolder.Size = new System.Drawing.Size(454, 26); - this.TB_OutputFolder.TabIndex = 4; - // - // L_OutputFolder - // - this.L_OutputFolder.AutoSize = true; - this.L_OutputFolder.Location = new System.Drawing.Point(4, 145); - this.L_OutputFolder.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_OutputFolder.Name = "L_OutputFolder"; - this.L_OutputFolder.Size = new System.Drawing.Size(102, 20); - this.L_OutputFolder.TabIndex = 3; - this.L_OutputFolder.Text = "Output folder"; - // - // B_OpenWatchFolder - // - this.B_OpenWatchFolder.Location = new System.Drawing.Point(474, 49); - this.B_OpenWatchFolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_OpenWatchFolder.Name = "B_OpenWatchFolder"; - this.B_OpenWatchFolder.Size = new System.Drawing.Size(36, 31); - this.B_OpenWatchFolder.TabIndex = 2; - this.B_OpenWatchFolder.Text = "..."; - this.B_OpenWatchFolder.UseVisualStyleBackColor = true; - this.B_OpenWatchFolder.Click += new System.EventHandler(this.B_OpenWatchFolder_Click); - // - // TB_WatchedFolder - // - this.TB_WatchedFolder.Location = new System.Drawing.Point(9, 49); - this.TB_WatchedFolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TB_WatchedFolder.Name = "TB_WatchedFolder"; - this.TB_WatchedFolder.Size = new System.Drawing.Size(454, 26); - this.TB_WatchedFolder.TabIndex = 1; - // - // L_WatchedFolder - // - this.L_WatchedFolder.AutoSize = true; - this.L_WatchedFolder.Location = new System.Drawing.Point(4, 25); - this.L_WatchedFolder.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_WatchedFolder.Name = "L_WatchedFolder"; - this.L_WatchedFolder.Size = new System.Drawing.Size(118, 20); - this.L_WatchedFolder.TabIndex = 0; - this.L_WatchedFolder.Text = "Folder to watch"; - // - // GB_Triggers - // - this.GB_Triggers.Controls.Add(this.CB_RemoveOld); - this.GB_Triggers.Controls.Add(this.CB_OnRename); - this.GB_Triggers.Location = new System.Drawing.Point(18, 492); - this.GB_Triggers.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_Triggers.Name = "GB_Triggers"; - this.GB_Triggers.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_Triggers.Size = new System.Drawing.Size(519, 71); - this.GB_Triggers.TabIndex = 2; - this.GB_Triggers.TabStop = false; - this.GB_Triggers.Text = "Trigger"; - // - // CB_RemoveOld - // - this.CB_RemoveOld.AutoSize = true; - this.CB_RemoveOld.Location = new System.Drawing.Point(348, 29); - this.CB_RemoveOld.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_RemoveOld.Name = "CB_RemoveOld"; - this.CB_RemoveOld.Size = new System.Drawing.Size(157, 24); - this.CB_RemoveOld.TabIndex = 1; - this.CB_RemoveOld.Text = "Remove input file"; - this.CB_RemoveOld.UseVisualStyleBackColor = true; - // - // CB_OnRename - // - this.CB_OnRename.AutoSize = true; - this.CB_OnRename.Location = new System.Drawing.Point(9, 29); - this.CB_OnRename.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_OnRename.Name = "CB_OnRename"; - this.CB_OnRename.Size = new System.Drawing.Size(105, 24); - this.CB_OnRename.TabIndex = 0; - this.CB_OnRename.Text = "Renamed"; - this.CB_OnRename.UseVisualStyleBackColor = true; - // - // B_Save - // - this.B_Save.Location = new System.Drawing.Point(18, 572); - this.B_Save.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_Save.Name = "B_Save"; - this.B_Save.Size = new System.Drawing.Size(112, 35); - this.B_Save.TabIndex = 3; - this.B_Save.Text = "Save"; - this.B_Save.UseVisualStyleBackColor = true; - this.B_Save.Click += new System.EventHandler(this.B_Save_Click); - // - // B_Cancel - // - this.B_Cancel.Location = new System.Drawing.Point(424, 572); - this.B_Cancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_Cancel.Name = "B_Cancel"; - this.B_Cancel.Size = new System.Drawing.Size(112, 35); - this.B_Cancel.TabIndex = 4; - this.B_Cancel.Text = "Cancel"; - this.B_Cancel.UseVisualStyleBackColor = true; - this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); - // - // HotfolderEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(555, 618); - this.Controls.Add(this.B_Cancel); - this.Controls.Add(this.B_Save); - this.Controls.Add(this.GB_Triggers); - this.Controls.Add(this.GB_Folders); - this.Controls.Add(this.GB_General); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.Name = "HotfolderEditor"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Hotfolder Editor"; - this.Load += new System.EventHandler(this.HotfolderEditor_Load); - this.GB_General.ResumeLayout(false); - this.GB_General.PerformLayout(); - this.GB_Folders.ResumeLayout(false); - this.GB_Folders.PerformLayout(); - this.GB_Triggers.ResumeLayout(false); - this.GB_Triggers.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox GB_General; - private System.Windows.Forms.ComboBox CB_Formatter; - private System.Windows.Forms.Label L_Provider; - private System.Windows.Forms.ComboBox CB_Mode; - private System.Windows.Forms.Label L_Mode; - private System.Windows.Forms.GroupBox GB_Folders; - private System.Windows.Forms.Button B_OpenWatchFolder; - private System.Windows.Forms.TextBox TB_WatchedFolder; - private System.Windows.Forms.Label L_WatchedFolder; - private System.Windows.Forms.Button B_OutputFolder; - private System.Windows.Forms.TextBox TB_OutputFolder; - private System.Windows.Forms.Label L_OutputFolder; - private System.Windows.Forms.TextBox TB_OutputFileScheme; - private System.Windows.Forms.Label L_OutputScheme; - private System.Windows.Forms.Label L_Filter; - private System.Windows.Forms.TextBox TB_Filter; - private System.Windows.Forms.GroupBox GB_Triggers; - private System.Windows.Forms.CheckBox CB_RemoveOld; - private System.Windows.Forms.CheckBox CB_OnRename; - private System.Windows.Forms.Button B_Save; - private System.Windows.Forms.Button B_Cancel; - } -} \ No newline at end of file diff --git a/src/XmlFormatter/Windows/HotfolderEditor.cs b/src/XmlFormatter/Windows/HotfolderEditor.cs deleted file mode 100644 index 4358383d..00000000 --- a/src/XmlFormatter/Windows/HotfolderEditor.cs +++ /dev/null @@ -1,242 +0,0 @@ -using PluginFramework.DataContainer; -using PluginFramework.Enums; -using PluginFramework.Interfaces.Manager; -using PluginFramework.Interfaces.PluginTypes; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Windows.Forms; -using XmlFormatter.DataContainer; -using XMLFormatterModel.Hotfolder; - -namespace XmlFormatter.Windows -{ - /// - /// This Window is used to create or edit a hotfolder configuration - /// - public partial class HotfolderEditor : Form - { - /// - /// Is the editor in the hotfolder edit mode - /// - private readonly bool editMode; - - /// - /// Readonly access if something was saved - /// - public bool Saved { get; private set; } - - /// - /// Readonly access to the hotfolder configuration - /// - public IHotfolder Hotfolder { get; private set; } - - /// - /// The plugin manager to use - /// - private readonly IPluginManager PluginManager; - - /// - /// Create a new instance of the editor - /// - /// The hotfolder configuration to use for editing - public HotfolderEditor(IPluginManager pluginManager) : this(null, pluginManager) - { - - } - - /// - /// Create a new instance of the editor - /// - /// The hotfolder configuration to use for editing - public HotfolderEditor(IHotfolder hotfolder, IPluginManager pluginManager) - { - editMode = hotfolder != null; - - InitializeComponent(); - - CB_Formatter.Enabled = !editMode; - Hotfolder = hotfolder; - PluginManager = pluginManager; - } - - - /// - /// Loading the window - /// - /// Sender of the event - /// Event arguments - private void HotfolderEditor_Load(object sender, EventArgs e) - { - List pluginsMetaData = PluginManager.ListPlugins().ToList(); - - foreach (PluginMetaData metaData in pluginsMetaData) - { - CB_Formatter.Items.Add(new ComboboxPluginItem(metaData)); - } - - foreach (ModesEnum mode in Enum.GetValues(typeof(ModesEnum))) - { - CB_Mode.Items.Add(mode.ToString()); - } - - FillSettingWindow(); - - } - - /// - /// Fill in the data of the hotfolder configuration - /// - private void FillSettingWindow() - { - TB_Filter.Text = "*.*"; - TB_OutputFileScheme.Text = "{inputfile}_{format}.{extension}"; - - CB_Formatter.SelectedIndex = 0; - CB_Mode.SelectedIndex = 0; - if (editMode) - { - bool foundEntry = false; - for (int i = 0; i < CB_Formatter.Items.Count; i++) - { - if (CB_Formatter.Items[i] is ComboboxPluginItem item) - { - if (item.Type.FullName == Hotfolder.FormatterToUse.GetType().FullName) - { - CB_Formatter.SelectedIndex = i; - foundEntry = true; - break; - } - } - - } - - for (int i = 0; i < CB_Mode.Items.Count; i++) - { - string item = CB_Mode.Items[i].ToString(); - if (item == Hotfolder.Mode.ToString()) - { - CB_Mode.SelectedIndex = i; - break; - } - } - - TB_WatchedFolder.Text = Hotfolder.WatchedFolder; - TB_Filter.Text = Hotfolder.Filter; - TB_OutputFolder.Text = Hotfolder.OutputFolder; - TB_OutputFileScheme.Text = Hotfolder.OutputFileScheme; - - CB_OnRename.Checked = Hotfolder.OnRename; - CB_RemoveOld.Checked = Hotfolder.RemoveOld; - - if (!foundEntry) - { - CB_Formatter.Enabled = true; - MessageBox.Show( - "Missing type " + Hotfolder.FormatterToUse.GetType().FullName + " did you delete the plugin?", - "Missing formatter", - MessageBoxButtons.OK, - MessageBoxIcon.Error - ); - } - } - } - - /// - /// Folder selector if we want to set a folder to watch - /// - /// Sender of the event - /// Event arguments - private void B_OpenWatchFolder_Click(object sender, EventArgs e) - { - GetFolderPath(TB_WatchedFolder); - if (TB_OutputFolder.Text == String.Empty) - { - TB_OutputFolder.Text = TB_WatchedFolder.Text + "\\output"; - } - } - - /// - /// Folder selecton if we want to set the folder for output - /// - /// Sender of the event - /// Event arguments - private void B_OutputFolder_Click(object sender, EventArgs e) - { - GetFolderPath(TB_OutputFolder); - } - - /// - /// Get the folder path from a folder selector - /// - /// The text box to write the result into - private void GetFolderPath(TextBox targetBox) - { - FolderBrowserDialog folderBrowser = new FolderBrowserDialog(); - DialogResult result = folderBrowser.ShowDialog(); - if (result != DialogResult.OK) - { - return; - } - - targetBox.Text = folderBrowser.SelectedPath; - } - - /// - /// Save the current configuration as hotfolder - /// - /// Sender of the event - /// Event arguments - private void B_Save_Click(object sender, EventArgs e) - { - if (!Directory.Exists(TB_WatchedFolder.Text)) - { - return; - } - if (TB_Filter.Text == String.Empty) - { - return; - } - if (TB_OutputFolder.Text == String.Empty) - { - return; - } - if (TB_WatchedFolder.Text == TB_OutputFolder.Text) - { - MessageBox.Show( - "Watched folder and output folder must differ!", - "Same folder selected", - MessageBoxButtons.OK, - MessageBoxIcon.Error - ); - return; - } - if (CB_Formatter.SelectedItem is ComboboxPluginItem selectedItem) - { - IFormatter plugin = PluginManager.LoadPlugin(selectedItem.Id); - Hotfolder = new HotfolderContainer(plugin, TB_WatchedFolder.Text) - { - Mode = (ModesEnum)Enum.Parse(typeof(ModesEnum), CB_Mode.SelectedItem.ToString()), - Filter = TB_Filter.Text, - OutputFolder = TB_OutputFolder.Text, - OnRename = CB_OnRename.Checked, - RemoveOld = CB_RemoveOld.Checked - }; - } - - Saved = true; - B_Cancel.PerformClick(); - } - - /// - /// Close this window without saving anything - /// - /// Sender of the event - /// Event arguments - private void B_Cancel_Click(object sender, EventArgs e) - { - this.Close(); - } - } -} diff --git a/src/XmlFormatter/Windows/HotfolderEditor.resx b/src/XmlFormatter/Windows/HotfolderEditor.resx deleted file mode 100644 index 1630aa4f..00000000 --- a/src/XmlFormatter/Windows/HotfolderEditor.resx +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - AAABAAEAICAAAAEAGACoDAAAFgAAACgAAAAgAAAAQAAAAAEAGAAAAAAAqAwAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AA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AAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD/////////////////////AAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAA - AAcAAAAHAAAABwAAAAcAAAADAAAAAwAAAAMAAAADAAAAAQAAAAEAAAABAAAADwAAAA8AAAAPAAAADwAP - //+AH////////////////////////w== - - - \ No newline at end of file diff --git a/src/XmlFormatter/Windows/MainForm.Designer.cs b/src/XmlFormatter/Windows/MainForm.Designer.cs deleted file mode 100644 index 90da09a3..00000000 --- a/src/XmlFormatter/Windows/MainForm.Designer.cs +++ /dev/null @@ -1,260 +0,0 @@ -namespace XmlFormatter.Windows -{ - partial class MainForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - this.B_Select = new System.Windows.Forms.Button(); - this.TB_SelectedXml = new System.Windows.Forms.TextBox(); - this.B_Save = new System.Windows.Forms.Button(); - this.L_SelectedPath = new System.Windows.Forms.Label(); - this.CB_Mode = new System.Windows.Forms.ComboBox(); - this.MI_MainMenu = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.MI_HideToTray = new System.Windows.Forms.ToolStripMenuItem(); - this.MI_Settings = new System.Windows.Forms.ToolStripMenuItem(); - this.MI_Help = new System.Windows.Forms.ToolStripMenuItem(); - this.MI_CheckForUpdate = new System.Windows.Forms.ToolStripMenuItem(); - this.pluginsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.MI_About = new System.Windows.Forms.ToolStripMenuItem(); - this.MI_ReportIssue = new System.Windows.Forms.ToolStripMenuItem(); - this.L_Status = new System.Windows.Forms.Label(); - this.NI_Notification = new System.Windows.Forms.NotifyIcon(this.components); - this.CB_Formatter = new System.Windows.Forms.ComboBox(); - this.MI_MainMenu.SuspendLayout(); - this.SuspendLayout(); - // - // B_Select - // - this.B_Select.Location = new System.Drawing.Point(15, 69); - this.B_Select.Name = "B_Select"; - this.B_Select.Size = new System.Drawing.Size(96, 23); - this.B_Select.TabIndex = 0; - this.B_Select.Text = "B_Select"; - this.B_Select.UseVisualStyleBackColor = true; - this.B_Select.Click += new System.EventHandler(this.B_Select_Click); - // - // TB_SelectedXml - // - this.TB_SelectedXml.Location = new System.Drawing.Point(15, 42); - this.TB_SelectedXml.Name = "TB_SelectedXml"; - this.TB_SelectedXml.Size = new System.Drawing.Size(773, 20); - this.TB_SelectedXml.TabIndex = 1; - // - // B_Save - // - this.B_Save.Location = new System.Drawing.Point(713, 69); - this.B_Save.Name = "B_Save"; - this.B_Save.Size = new System.Drawing.Size(75, 21); - this.B_Save.TabIndex = 2; - this.B_Save.Text = "Save formatted"; - this.B_Save.UseVisualStyleBackColor = true; - this.B_Save.Click += new System.EventHandler(this.B_Save_Click); - // - // L_SelectedPath - // - this.L_SelectedPath.AutoSize = true; - this.L_SelectedPath.Location = new System.Drawing.Point(12, 25); - this.L_SelectedPath.Name = "L_SelectedPath"; - this.L_SelectedPath.Size = new System.Drawing.Size(83, 13); - this.L_SelectedPath.TabIndex = 3; - this.L_SelectedPath.Text = "L_SelectedPath"; - // - // CB_Mode - // - this.CB_Mode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CB_Mode.FormattingEnabled = true; - this.CB_Mode.Items.AddRange(new object[] { - "Formatted", - "Flat"}); - this.CB_Mode.Location = new System.Drawing.Point(586, 70); - this.CB_Mode.Name = "CB_Mode"; - this.CB_Mode.Size = new System.Drawing.Size(121, 21); - this.CB_Mode.TabIndex = 4; - // - // MI_MainMenu - // - this.MI_MainMenu.ImageScalingSize = new System.Drawing.Size(24, 24); - this.MI_MainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem, - this.MI_Help, - this.MI_ReportIssue}); - this.MI_MainMenu.Location = new System.Drawing.Point(0, 0); - this.MI_MainMenu.Name = "MI_MainMenu"; - this.MI_MainMenu.Padding = new System.Windows.Forms.Padding(4, 1, 0, 1); - this.MI_MainMenu.Size = new System.Drawing.Size(800, 24); - this.MI_MainMenu.TabIndex = 5; - this.MI_MainMenu.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.MI_HideToTray, - this.MI_Settings}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 22); - this.fileToolStripMenuItem.Text = "File"; - // - // MI_HideToTray - // - this.MI_HideToTray.Name = "MI_HideToTray"; - this.MI_HideToTray.Size = new System.Drawing.Size(136, 22); - this.MI_HideToTray.Text = "Hide to tray"; - this.MI_HideToTray.Click += new System.EventHandler(this.MI_HideToTray_Click); - // - // MI_Settings - // - this.MI_Settings.Name = "MI_Settings"; - this.MI_Settings.Size = new System.Drawing.Size(136, 22); - this.MI_Settings.Text = "Settings"; - this.MI_Settings.Click += new System.EventHandler(this.MI_Settings_Click); - // - // MI_Help - // - this.MI_Help.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.MI_CheckForUpdate, - this.pluginsToolStripMenuItem, - this.toolStripSeparator1, - this.MI_About}); - this.MI_Help.Name = "MI_Help"; - this.MI_Help.Size = new System.Drawing.Size(44, 22); - this.MI_Help.Text = "Help"; - // - // MI_CheckForUpdate - // - this.MI_CheckForUpdate.Name = "MI_CheckForUpdate"; - this.MI_CheckForUpdate.Size = new System.Drawing.Size(165, 22); - this.MI_CheckForUpdate.Text = "Check for update"; - this.MI_CheckForUpdate.Click += new System.EventHandler(this.MI_CheckForUpdate_Click); - // - // pluginsToolStripMenuItem - // - this.pluginsToolStripMenuItem.Name = "pluginsToolStripMenuItem"; - this.pluginsToolStripMenuItem.Size = new System.Drawing.Size(165, 22); - this.pluginsToolStripMenuItem.Text = "Plugins"; - this.pluginsToolStripMenuItem.Click += new System.EventHandler(this.pluginsToolStripMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(162, 6); - // - // MI_About - // - this.MI_About.Name = "MI_About"; - this.MI_About.Size = new System.Drawing.Size(165, 22); - this.MI_About.Text = "About"; - this.MI_About.Click += new System.EventHandler(this.MI_About_Click); - // - // MI_ReportIssue - // - this.MI_ReportIssue.Name = "MI_ReportIssue"; - this.MI_ReportIssue.Size = new System.Drawing.Size(83, 22); - this.MI_ReportIssue.Text = "Report Issue"; - this.MI_ReportIssue.Click += new System.EventHandler(this.MI_ReportIssue_Click); - // - // L_Status - // - this.L_Status.AutoSize = true; - this.L_Status.Location = new System.Drawing.Point(117, 74); - this.L_Status.Name = "L_Status"; - this.L_Status.Size = new System.Drawing.Size(49, 13); - this.L_Status.TabIndex = 7; - this.L_Status.Text = "L_Status"; - // - // NI_Notification - // - this.NI_Notification.Icon = ((System.Drawing.Icon)(resources.GetObject("NI_Notification.Icon"))); - this.NI_Notification.Text = "notifyIcon1"; - this.NI_Notification.Click += new System.EventHandler(this.NI_Notification_Click); - // - // CB_Formatter - // - this.CB_Formatter.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CB_Formatter.FormattingEnabled = true; - this.CB_Formatter.Location = new System.Drawing.Point(436, 70); - this.CB_Formatter.Name = "CB_Formatter"; - this.CB_Formatter.Size = new System.Drawing.Size(144, 21); - this.CB_Formatter.TabIndex = 8; - this.CB_Formatter.SelectedIndexChanged += new System.EventHandler(this.CB_Formatter_SelectedIndexChanged); - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(800, 101); - this.Controls.Add(this.CB_Formatter); - this.Controls.Add(this.L_Status); - this.Controls.Add(this.CB_Mode); - this.Controls.Add(this.L_SelectedPath); - this.Controls.Add(this.B_Save); - this.Controls.Add(this.TB_SelectedXml); - this.Controls.Add(this.B_Select); - this.Controls.Add(this.MI_MainMenu); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MainMenuStrip = this.MI_MainMenu; - this.Name = "MainForm"; - this.Text = "XML Formatter"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); - this.Load += new System.EventHandler(this.MainForm_Load); - this.DragDrop += new System.Windows.Forms.DragEventHandler(this.MainForm_DragDrop); - this.DragEnter += new System.Windows.Forms.DragEventHandler(this.MainForm_DragEnter); - this.Resize += new System.EventHandler(this.MainForm_Resize); - this.MI_MainMenu.ResumeLayout(false); - this.MI_MainMenu.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button B_Select; - private System.Windows.Forms.TextBox TB_SelectedXml; - private System.Windows.Forms.Button B_Save; - private System.Windows.Forms.Label L_SelectedPath; - private System.Windows.Forms.ComboBox CB_Mode; - private System.Windows.Forms.MenuStrip MI_MainMenu; - private System.Windows.Forms.ToolStripMenuItem MI_Help; - private System.Windows.Forms.ToolStripMenuItem MI_CheckForUpdate; - private System.Windows.Forms.ToolStripMenuItem MI_About; - private System.Windows.Forms.Label L_Status; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.NotifyIcon NI_Notification; - private System.Windows.Forms.ToolStripMenuItem MI_HideToTray; - private System.Windows.Forms.ToolStripMenuItem MI_Settings; - private System.Windows.Forms.ToolStripMenuItem MI_ReportIssue; - private System.Windows.Forms.ComboBox CB_Formatter; - private System.Windows.Forms.ToolStripMenuItem pluginsToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - } -} - diff --git a/src/XmlFormatter/Windows/MainForm.cs b/src/XmlFormatter/Windows/MainForm.cs deleted file mode 100644 index 9dffb935..00000000 --- a/src/XmlFormatter/Windows/MainForm.cs +++ /dev/null @@ -1,654 +0,0 @@ -using PluginFramework.DataContainer; -using PluginFramework.Enums; -using PluginFramework.EventMessages; -using PluginFramework.Interfaces.Manager; -using PluginFramework.Interfaces.PluginTypes; -using PluginFramework.LoadStrategies; -using PluginFramework.Manager; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows.Forms; -using XmlFormatter.DataContainer; -using XmlFormatter.Settings.Adapter; -using XmlFormatter.Update; -using XmlFormatterModel.Enums; -using XmlFormatterModel.Hotfolder; -using XmlFormatterModel.Logging; -using XmlFormatterModel.Logging.Strategy; -using XmlFormatterModel.Logging.Strategy.Format; -using XmlFormatterModel.Setting; -using XmlFormatterModel.Setting.Hotfolder; -using XmlFormatterModel.Update; -using XMLFormatterModel.Hotfolder; -using XMLFormatterModel.Setting.InputOutput; - -namespace XmlFormatter.Windows -{ - /// - /// This class is representing the main form of the application - /// - public partial class MainForm : Form - { - /// - /// The default status to display at the end of the main window - /// - private readonly string defaultStatus; - - /// - /// Path to the folder to save settings in - /// - private readonly string settingPath; - - /// - /// Path to the default settings file - /// - private readonly string settingFile; - - /// - /// Instance for managing the settings - /// - private readonly ISettingsManager settingManager; - - /// - /// Instance of the update manager - /// - private readonly IUpdater updateManager; - - /// - /// Instance to manage plugins - /// - private readonly IPluginManager pluginManager; - - /// - /// The formatter to use - /// - private IFormatter formatterToUse; - - /// - /// Instance of the hotfolder manager - /// - private IHotfolderManager hotfolderManager; - - /// - /// Instance of the logging manager to use - /// - private ILoggingManager loggingManager; - - /// - /// New delegate to set a label text from another thread - /// - /// The label to change - /// The new text to use - private delegate void UpdateThreadSafeConvertStatus( - Label label, - string newText - ); - - /// - /// Constructor - /// - public MainForm() - { - InitializeComponent(); - defaultStatus = "Status: "; - IVersionManagerFactory factory = new VersionManagerFactory(); - IVersionManager versionManager = factory.GetVersionManager(); - TaskAwaiter currentVersion = versionManager.GetLocalVersionAsync().GetAwaiter(); - currentVersion.OnCompleted(() => - { - string stringVersion = versionManager.GetStringVersion(currentVersion.GetResult()); - Properties.Settings.Default.ApplicationVersion = stringVersion; - settingManager.Load(settingFile); - settingManager.Save(settingFile); - }); - - NI_Notification.Text = this.Text; - - settingPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + "XmlFormatter\\"; - settingFile = settingPath + "settings.set"; - Properties.Settings.Default.LoggingFolder = settingPath + "logs\\"; - if (!Directory.Exists(Properties.Settings.Default.LoggingFolder)) - { - Directory.CreateDirectory(Properties.Settings.Default.LoggingFolder); - } - - settingManager = new SettingsManager(); - settingManager.SetPersistendFactory(new XmlProviderFactory()); - settingManager.Load(settingFile); - - SetupLogging(); - - ISettingScope resourceScope = settingManager.GetScope("Default"); - if (resourceScope == null) - { - resourceScope = new PropertyAdapter(); - settingManager.AddScope(resourceScope); - } - - foreach (SettingPair settingPair in resourceScope.GetSettings()) - { - try - { - Properties.Settings.Default[settingPair.Name] = settingPair.Value; - } - catch (Exception) - { - // Prevent crash even if shit happens - } - - } - - pluginManager = new DefaultManager(); - pluginManager.SetDefaultLoadStrategy(new PluginFolder(AppDomain.CurrentDomain.BaseDirectory + "\\Plugins")); - - settingManager.Save(settingFile); - updateManager = new UpdateManager(); - SetUpdateStrategy(); - } - - /// - /// Setup the logging manager - /// - private void SetupLogging() - { - if (loggingManager != null && !Properties.Settings.Default.LoggingEnabled) - { - loggingManager.Dispose(); - loggingManager = null; - } - if (loggingManager == null && Properties.Settings.Default.LoggingEnabled) - { - loggingManager = new LoggingManager(); - string timeStamp = DateTime.Now.ToString("yyyyMMdd"); - string logFile = Properties.Settings.Default.LoggingFolder + timeStamp + "_hotfolder.log"; - ILogger hotfolderLogger = new Logger( - new SimpleFileLogStrategy(logFile, true), - new SimpleFileFormatStrategy(50) - ); - hotfolderLogger.AddScope(LogScopesEnum.Hotfolder); - loggingManager.AddLogger(hotfolderLogger); - } - } - - /// - /// Set the strategy to use for updating - /// - private void SetUpdateStrategy() - { - IUpdateStrategy updateStrategy = null; - try - { - string type = Properties.Settings.Default.UpdateStrategy; - updateStrategy = pluginManager.LoadPlugin(type); - } - catch (Exception) - { - } - updateManager.SetStrategy(updateStrategy); - } - - /// - /// Loading the form event - /// - /// The control triggering the method - /// The event arguments - private void MainForm_Load(object sender, EventArgs e) - { - CB_Mode.SelectedIndex = 0; - AllowDrop = true; - MaximizeBox = false; - L_Status.Text = defaultStatus; - - if (Properties.Settings.Default.SearchUpdateOnStartup) - { - CheckForUpdatedVersion(true); - } - - SetupHotFolder(); - SetupFormatterSelection(); - } - - /// - /// Setup the formatter selection combobox - /// - private void SetupFormatterSelection() - { - CB_Formatter.Items.Clear(); - List formatters = pluginManager.ListPlugins().ToList(); - foreach (PluginMetaData metaData in formatters) - { - CB_Formatter.Items.Add(new ComboboxPluginItem(metaData)); - } - if (CB_Formatter.Items.Count > 0) - { - CB_Formatter.SelectedIndex = 0; - ComboboxPluginItem item = CB_Formatter.SelectedItem as ComboboxPluginItem; - SetFormatter(pluginManager.LoadPlugin(item.Id)); - } - if (CB_Formatter.Items.Count == 1) - { - CB_Formatter.Visible = false; - } - } - - /// - /// Setup the hot folder - /// - private void SetupHotFolder() - { - if (!Properties.Settings.Default.HotfolderActive) - { - if (hotfolderManager != null) - { - hotfolderManager.ResetManager(); - hotfolderManager = null; - } - - return; - } - hotfolderManager = hotfolderManager ?? new HotfolderManager(); - if (hotfolderManager is ILoggable loggable) - { - loggable.SetLoggingManager(loggingManager); - } - hotfolderManager.ResetManager(); - - HotfolderExtension hotfolderExtension = new HotfolderExtension(settingManager, pluginManager); - foreach (IHotfolder hotfolder in hotfolderExtension.GetHotFoldersFromSettings()) - { - hotfolderManager.AddHotfolder(hotfolder); - } - } - - /// - /// Set the formatter for the main application - /// - /// The new formatter to use - private void SetFormatter(IFormatter formatter) - { - if (formatterToUse != null) - { - formatterToUse.StatusChanged -= FormatterToUse_StatusChanged; - } - formatterToUse = formatter; - formatterToUse.StatusChanged += FormatterToUse_StatusChanged; - L_SelectedPath.Text = "Selected " + formatterToUse.Extension.ToUpper() + "-file path"; - B_Select.Text = "Select " + formatterToUse.Extension.ToUpper(); - } - - /// - /// Status of the formatting did change - /// - /// The sender of the message - /// The new status - private void FormatterToUse_StatusChanged(object sender, PluginFramework.EventMessages.BaseEventArgs e) - { - UpdateLabelTextThreadSafe(L_Status, e.Message); - } - - /// - /// Update the text of a given label thread safe - /// - /// The label to update - /// The text to set the label text to - public void UpdateLabelTextThreadSafe(Label label, string newText) - { - string textToUse = defaultStatus + newText; - if (label.InvokeRequired) - { - label.Invoke(new UpdateThreadSafeConvertStatus(UpdateLabelTextThreadSafe), new object[] { label, textToUse }); - return; - } - - label.Text = textToUse; - } - - /// - /// This method will allow you to select the xml file you want to convert - /// - /// Which control did call this method - /// The event args given by the control - private void B_Select_Click(object sender, EventArgs e) - { - OpenFileDialog dialog = new OpenFileDialog - { - Filter = formatterToUse.Extension.ToUpper() + " files (*." + formatterToUse.Extension + ")|*." + formatterToUse.Extension - }; - DialogResult result = dialog.ShowDialog(); - - if (result != DialogResult.OK || !File.Exists(dialog.FileName)) - { - return; - } - - TB_SelectedXml.Text = dialog.FileName; - } - - /// - /// This method will load the xml mentioned in the textbox and save it to a given location - /// - /// Which control did call this method - /// The event args given by the control - private void B_Save_Click(object sender, EventArgs e) - { - if (TB_SelectedXml.Text == String.Empty) - { - return; - } - if (!File.Exists(TB_SelectedXml.Text)) - { - MessageBox.Show( - "Could not find or read file " + TB_SelectedXml.Text, - "Could not find file", - MessageBoxButtons.OK, - MessageBoxIcon.Error - ); - return; - - } - - SaveFileDialog saveFile = new SaveFileDialog(); - FileInfo fi = new FileInfo(TB_SelectedXml.Text); - string name = fi.Name.Replace(fi.Extension, ""); - saveFile.FileName = name + "_" + CB_Mode.SelectedItem.ToString() + fi.Extension; - - saveFile.Filter = formatterToUse.Extension.ToUpper() + " files (*." + formatterToUse.Extension + ")|*." + formatterToUse.Extension; - DialogResult result = saveFile.ShowDialog(); - - if (result != DialogResult.OK) - { - return; - } - - - SwitchFormMode(false); - string inputFile = TB_SelectedXml.Text; - bool formattedMode = CB_Mode.SelectedIndex == 0; - SaveFormattedFile(inputFile, saveFile.FileName, formattedMode); - } - - /// - /// This method will async save the file given input file to the given output file - /// - /// The path to the input file - /// The path to the output file - /// Should be formatted (true) or flat (false) - /// - private async Task SaveFormattedFile(string inputFilePath, string outputFilePath, bool formatted) - { - ModesEnum currentEnum = formatted ? ModesEnum.Formatted : ModesEnum.Flat; - - bool success = formatterToUse.ConvertToFormat(inputFilePath, outputFilePath, currentEnum); - - SwitchFormMode(true); - return success; - } - - /// - /// This method will switch the form to a different state - /// - /// The state is either true for useable or false for blocked - private void SwitchFormMode(bool enabled) - { - B_Save.Enabled = enabled; - TB_SelectedXml.Enabled = enabled; - B_Select.Enabled = enabled; - AllowDrop = enabled; - } - - /// - /// This method is the drag enter event - /// - /// The control sending the drag enter event - /// The event arguments - private void MainForm_DragEnter(object sender, DragEventArgs e) - { - string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); - if (files.Length != 1) - { - return; - } - string fileName = files[0]; - FileInfo fi = new FileInfo(fileName); - if (e.Data.GetDataPresent(DataFormats.FileDrop) && fi.Extension.ToLower() == "." + formatterToUse.Extension) - { - e.Effect = DragDropEffects.Copy; - } - } - - /// - /// This event will allow you to drag and drop a file - /// - /// The control sending the drag and drop event - /// The event arguments - private void MainForm_DragDrop(object sender, DragEventArgs e) - { - string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); - if (files.Length != 1) - { - return; - } - TB_SelectedXml.Text = files[0]; - } - - /// - /// This method is the click event for the about menu - /// - /// The control sending the click event - /// The event arguments - private void MI_About_Click(object sender, EventArgs e) - { - VersionInformation versionInformation = new VersionInformation(); - versionInformation.ShowDialog(); - } - - /// - /// This method will check if there is newer version for download - /// - /// The control triggering the event - /// The event data - private void MI_CheckForUpdate_Click(object sender, EventArgs e) - { - CheckForUpdatedVersion(); - } - - /// - /// This method will check if there is an updated version available and show an text box if there is something new. - /// - private async void CheckForUpdatedVersion() - { - CheckForUpdatedVersion(false); - } - - /// - /// This method will check if there is an updated version available and shouw you the information as text box - /// - /// If this is active there will be no text box if the version is up to date - private async void CheckForUpdatedVersion(bool onlyShowNewBox) - { - IVersionManagerFactory factory = new VersionManagerFactory(); - IVersionManager manager = factory.GetVersionManager(); - manager.Error += Manager_Error; - VersionCompare versionCompare = await manager.RemoteVersionIsNewerAsync(); - - bool forceShow = false; - - string text = "Your version is up to date"; - MessageBoxButtons buttons = MessageBoxButtons.OK; - if (versionCompare.GitHubIsNewer) - { - text = "There is a newer version available"; - - text += "\n\nYour version: " + manager.GetStringVersion(versionCompare.LocalVersion); - text += "\nGitHub version: " + manager.GetStringVersion(versionCompare.GitHubVersion); - - if (updateManager.IsStrategySet) - { - text += "\n\nDo you want to upgrade now?"; - buttons = MessageBoxButtons.YesNo; - forceShow = true; - } - } - - if (forceShow || !onlyShowNewBox) - { - DialogResult result = MessageBox.Show(text, "Version status", buttons, MessageBoxIcon.Information); - if (result == DialogResult.Yes) - { - if (!updateManager.UpdateApplication(versionCompare, (asset) => asset.Name.Contains("WinForms"))) - { - //@TODO: Show some kind of error message - } - } - } - } - - /// - /// Manage the error throwen by the version manager - /// - /// The sender of the event - /// The arguments provided by the sender - private void Manager_Error(object sender, BaseEventArgs e) - { - MessageBox.Show(e.Message, e.Title, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - /// - /// Click on the report bug button - /// - /// The sender of the event - /// The arguments from the sender - private void MI_ReportIssue_Click(object sender, EventArgs e) - { - Process.Start("https://github.com/XanatosX/XmlFormatter/issues"); - } - - /// - /// The close event of the form - /// - /// The sender of the event - /// The arguments from the sender - private void MainForm_FormClosing(object sender, FormClosingEventArgs e) - { - if (Properties.Settings.Default.AskBeforeClosing) - { - DialogResult result = MessageBox.Show( - "Do you really want to close this application?", - "Close the application", - MessageBoxButtons.YesNo, - MessageBoxIcon.Question - ); - - if (result != DialogResult.Yes) - { - e.Cancel = true; - } - } - } - - /// - /// Hide the application if the setting to minimize it is set - /// - /// The sender of the event - /// The arguments from the sender - private void MainForm_Resize(object sender, EventArgs e) - { - if (WindowState == FormWindowState.Minimized && Properties.Settings.Default.MinimizeToTray) - { - HideToTray(); - } - } - - /// - /// Hide the application to the tray icon - /// - private void HideToTray() - { - WindowState = FormWindowState.Minimized; - ShowInTaskbar = false; - NI_Notification.Visible = true; - if (Properties.Settings.Default.FirstTimeTray) - { - NI_Notification.ShowBalloonTip( - 5000, - "Application in tray", - "The application got minimized to the tray icon, click on it to reopen", - ToolTipIcon.Info - ); - - Properties.Settings.Default.FirstTimeTray = false; - settingManager.Save(settingFile); - } - TopMost = true; - TopMost = false; - } - - /// - /// Clicking the notification Icon - /// - /// The sender of the event - /// The arguments sendet by the event caller - private void NI_Notification_Click(object sender, EventArgs e) - { - ShowInTaskbar = true; - NI_Notification.Visible = false; - WindowState = FormWindowState.Normal; - } - - /// - /// The click on the hide button - /// - /// The sender of the event - /// The arguments provided by the sender - private void MI_HideToTray_Click(object sender, EventArgs e) - { - HideToTray(); - } - - /// - /// Event for clicking the settings button - /// - /// The sender of the event - /// The arguments provided by the sender - private void MI_Settings_Click(object sender, EventArgs e) - { - Settings settings = new Settings(settingManager, settingFile, pluginManager); - settings.ShowDialog(); - SetupLogging(); - SetupHotFolder(); - SetUpdateStrategy(); - } - - /// - /// Selected formatter did change - /// - /// - /// - private void CB_Formatter_SelectedIndexChanged(object sender, EventArgs e) - { - if (sender is ComboBox box && box.SelectedItem is ComboboxPluginItem item) - { - IFormatter formatter = pluginManager.LoadPlugin(item.Id); - SetFormatter(formatter); - TB_SelectedXml.Text = string.Empty; - } - } - - /// - /// Event if plugin dialog is clicked - /// - /// The sender of the event - /// The event arguments - private void pluginsToolStripMenuItem_Click(object sender, EventArgs e) - { - PluginManager pluginManagerWindow = new PluginManager(pluginManager, settingManager, settingFile); - pluginManagerWindow.ShowDialog(); - - } - } -} diff --git a/src/XmlFormatter/Windows/MainForm.resx b/src/XmlFormatter/Windows/MainForm.resx deleted file mode 100644 index 9a4f21af..00000000 --- a/src/XmlFormatter/Windows/MainForm.resx +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 132, 17 - - - - - AAABAAEAICAAAAEAGACoDAAAFgAAACgAAAAgAAAAQAAAAAEAGAAAAAAAqAwAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAADflCbflCbflCbflCbflCbflCbf - lCbflCbflCbflCYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAADflCbflCbflCbflCbflCbflCbflCbflCbflCbflCYAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyMqwAAAAAAAAAAAAAAAAAAAAAAAAAAADflCYAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAADflCYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAyMqwyMqwyMqwAAAAAAAAAAAAAAAAAAAAAAADflCbflCbflCbflCbflCbflCbflCbflCbflCbflCYA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyMqwAAAAyMqwAAAAyMqwAAAAAAAAAAAAA - AAAAAADflCYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADflCYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAyMqwAAAAAAAAyMqwAAAAAAAAyMqwAAAAAAAAAAAAAAADflCbflCbflCbflCbflCbflCbf - lCbflCbflCbflCYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyMqwAAAAA - AAAAAAAAAAAAAAAAAAAAAADflCYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADflCYAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyMqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADflCbflCbf - lCbflCbflCbflCbflCbflCbflCbflCYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAyMqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADflCbflCbflCbflCbflCbflCbflCbflCbflCbflCYA - A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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD////////4Af//+AH///gB//AYAf/P+AH/v/gB/3/4Af7/+AH+//gB/f/4Ae2/ - +AH1f/gB+P/4A/3/+Af///gPgB///4Af/7+AH/8fgB/+r4Af/beAH/+/gB//f4Af/3+AH/7/gB/9/4Af - 8/+AGA//gD///4B///+A/////////w== - - - \ No newline at end of file diff --git a/src/XmlFormatter/Windows/PluginManager.Designer.cs b/src/XmlFormatter/Windows/PluginManager.Designer.cs deleted file mode 100644 index 6870ffa9..00000000 --- a/src/XmlFormatter/Windows/PluginManager.Designer.cs +++ /dev/null @@ -1,173 +0,0 @@ -namespace XmlFormatter.Windows -{ - partial class PluginManager - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PluginManager)); - this.TV_Plugins = new System.Windows.Forms.TreeView(); - this.panel1 = new System.Windows.Forms.Panel(); - this.TC_PluginData = new System.Windows.Forms.TabControl(); - this.TP_GeneralInformation = new System.Windows.Forms.TabPage(); - this.TB_Description = new System.Windows.Forms.TextBox(); - this.L_Description = new System.Windows.Forms.Label(); - this.L_Version = new System.Windows.Forms.Label(); - this.L_Author = new System.Windows.Forms.Label(); - this.L_Name = new System.Windows.Forms.Label(); - this.panel1.SuspendLayout(); - this.TC_PluginData.SuspendLayout(); - this.TP_GeneralInformation.SuspendLayout(); - this.SuspendLayout(); - // - // TV_Plugins - // - this.TV_Plugins.Location = new System.Drawing.Point(18, 18); - this.TV_Plugins.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TV_Plugins.Name = "TV_Plugins"; - this.TV_Plugins.Size = new System.Drawing.Size(214, 653); - this.TV_Plugins.TabIndex = 0; - this.TV_Plugins.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TV_Plugins_AfterSelect); - // - // panel1 - // - this.panel1.Controls.Add(this.TC_PluginData); - this.panel1.Location = new System.Drawing.Point(243, 18); - this.panel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(939, 655); - this.panel1.TabIndex = 1; - // - // TC_PluginData - // - this.TC_PluginData.Controls.Add(this.TP_GeneralInformation); - this.TC_PluginData.Location = new System.Drawing.Point(4, 5); - this.TC_PluginData.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TC_PluginData.Name = "TC_PluginData"; - this.TC_PluginData.SelectedIndex = 0; - this.TC_PluginData.Size = new System.Drawing.Size(930, 646); - this.TC_PluginData.TabIndex = 0; - // - // TP_GeneralInformation - // - this.TP_GeneralInformation.Controls.Add(this.TB_Description); - this.TP_GeneralInformation.Controls.Add(this.L_Description); - this.TP_GeneralInformation.Controls.Add(this.L_Version); - this.TP_GeneralInformation.Controls.Add(this.L_Author); - this.TP_GeneralInformation.Controls.Add(this.L_Name); - this.TP_GeneralInformation.Location = new System.Drawing.Point(4, 29); - this.TP_GeneralInformation.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_GeneralInformation.Name = "TP_GeneralInformation"; - this.TP_GeneralInformation.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_GeneralInformation.Size = new System.Drawing.Size(922, 613); - this.TP_GeneralInformation.TabIndex = 0; - this.TP_GeneralInformation.Text = "General Information"; - this.TP_GeneralInformation.UseVisualStyleBackColor = true; - // - // TB_Description - // - this.TB_Description.Location = new System.Drawing.Point(14, 108); - this.TB_Description.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TB_Description.Multiline = true; - this.TB_Description.Name = "TB_Description"; - this.TB_Description.Size = new System.Drawing.Size(894, 487); - this.TB_Description.TabIndex = 4; - // - // L_Description - // - this.L_Description.AutoSize = true; - this.L_Description.Location = new System.Drawing.Point(9, 83); - this.L_Description.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Description.Name = "L_Description"; - this.L_Description.Size = new System.Drawing.Size(89, 20); - this.L_Description.TabIndex = 3; - this.L_Description.Text = "Description"; - // - // L_Version - // - this.L_Version.AutoSize = true; - this.L_Version.Location = new System.Drawing.Point(9, 58); - this.L_Version.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Version.Name = "L_Version"; - this.L_Version.Size = new System.Drawing.Size(67, 20); - this.L_Version.TabIndex = 2; - this.L_Version.Text = "Version:"; - // - // L_Author - // - this.L_Author.AutoSize = true; - this.L_Author.Location = new System.Drawing.Point(9, 9); - this.L_Author.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Author.Name = "L_Author"; - this.L_Author.Size = new System.Drawing.Size(61, 20); - this.L_Author.TabIndex = 1; - this.L_Author.Text = "Author:"; - // - // L_Name - // - this.L_Name.AutoSize = true; - this.L_Name.Location = new System.Drawing.Point(9, 34); - this.L_Name.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Name.Name = "L_Name"; - this.L_Name.Size = new System.Drawing.Size(55, 20); - this.L_Name.TabIndex = 0; - this.L_Name.Text = "Name:"; - // - // PluginManager - // - this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(1200, 692); - this.Controls.Add(this.panel1); - this.Controls.Add(this.TV_Plugins); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.Name = "PluginManager"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "PluginManager"; - this.Load += new System.EventHandler(this.PluginManager_Load); - this.panel1.ResumeLayout(false); - this.TC_PluginData.ResumeLayout(false); - this.TP_GeneralInformation.ResumeLayout(false); - this.TP_GeneralInformation.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TreeView TV_Plugins; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.TabControl TC_PluginData; - private System.Windows.Forms.TabPage TP_GeneralInformation; - private System.Windows.Forms.TextBox TB_Description; - private System.Windows.Forms.Label L_Description; - private System.Windows.Forms.Label L_Version; - private System.Windows.Forms.Label L_Author; - private System.Windows.Forms.Label L_Name; - } -} \ No newline at end of file diff --git a/src/XmlFormatter/Windows/PluginManager.cs b/src/XmlFormatter/Windows/PluginManager.cs deleted file mode 100644 index 965004cd..00000000 --- a/src/XmlFormatter/Windows/PluginManager.cs +++ /dev/null @@ -1,232 +0,0 @@ -using PluginFramework.DataContainer; -using PluginFramework.Interfaces.Manager; -using PluginFramework.Interfaces.PluginTypes; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Windows.Forms; -using XmlFormatterModel.Setting; - -namespace XmlFormatter.Windows -{ - /// - /// Window to manage the plugins - /// - public partial class PluginManager : Form - { - /// - /// Instance of the plugin manager to use - /// - private readonly IPluginManager pluginManager; - - /// - /// Instance of the settings manager to use - /// - private readonly ISettingsManager settingsManager; - - /// - /// Path where the settings file is stored - /// - private readonly string settingFile; - - /// - /// Current plugin which was selected - /// - private IPluginOverhead currentPlugin; - - /// - /// Current panel to put the plugin settings into - /// - private Panel currentSettingsPanel; - - /// - /// Create a new instance of the plugin manager window - /// - /// The plugin manager to use - /// The settings manager to use - /// The file to save the settings in - public PluginManager(IPluginManager pluginManager, ISettingsManager settingsManager, string settingsFileName) - { - InitializeComponent(); - this.pluginManager = pluginManager; - this.settingsManager = settingsManager; - this.settingFile = settingsFileName; - - currentSettingsPanel = null; - - TC_PluginData.Enabled = false; - L_Name.Tag = L_Name.Text; - L_Version.Tag = L_Version.Text; - L_Author.Tag = L_Author.Text; - TB_Description.ReadOnly = true; - } - - /// - /// Load event of the plugin window - /// - /// Sender of the event - /// The event arguments - private void PluginManager_Load(object sender, EventArgs e) - { - TreeNode root = new TreeNode("Plugins"); - TreeNode formatter = new TreeNode("Formatter"); - AddPluginsOfType(formatter); - root.Nodes.Add(formatter); - - TreeNode updater = new TreeNode("Updater"); - AddPluginsOfType(updater); - root.Nodes.Add(updater); - - TV_Plugins.Nodes.Add(root); - } - - /// - /// Add new plugins to the tree view of a given type - /// - /// The plugin type - /// The root node to create the plugins in - private void AddPluginsOfType(TreeNode node) where T : IPluginOverhead - { - List pluginMetas = pluginManager.ListPlugins().ToList(); - foreach (PluginMetaData metaData in pluginMetas) - { - TreeNode selectedPlugin = new TreeNode(metaData.Information.Name) - { - Tag = metaData - }; - node.Nodes.Add(selectedPlugin); - } - } - - /// - /// After item was selected in the tree view - /// - /// The sender of the event - /// The arguments of the evend - private void TV_Plugins_AfterSelect(object sender, TreeViewEventArgs e) - { - currentPlugin = null; - RemoveSettingsTab(); - if (sender is TreeView treeView) - { - if (treeView.SelectedNode is TreeNode node && node.Tag is PluginMetaData metaData) - { - L_Name.Text = L_Name.Tag.ToString() + " " + metaData.Information.Name; - L_Author.Text = L_Author.Tag.ToString() + " " + metaData.Information.Author; - L_Version.Text = L_Version.Tag.ToString() + " " + metaData.Information.Version; - TB_Description.Text = metaData.Information.Description; - TC_PluginData.Enabled = true; - - currentPlugin = pluginManager.LoadPlugin(metaData.Id); - ISettingScope settings = settingsManager.GetScope(GetScopeName()); - if (settings != null) - { - currentPlugin.ChangeSettings(ConvertToPluginSettings(settings)); - } - } - } - } - - /// - /// Convert ISettingScope to plugin settings - /// - /// The settings scope to convert - /// The plugin settings ready to use - private PluginSettings ConvertToPluginSettings(ISettingScope settingScope) - { - PluginSettings returnSettings = new PluginSettings(); - foreach (SettingPair settingPair in settingScope.GetSettings()) - { - returnSettings.AddValue(settingPair.Name, settingPair.Value); - } - - return returnSettings; - } - - /// - /// Save the plugin settings - /// - /// Sender of the event - /// Arguments of the event - private void B_Save_Click(object sender, EventArgs e) - { - if (currentPlugin != null) - { - PluginSettings settings = currentPlugin.Settings; - string scopeName = GetScopeName(); - ISettingScope scope = new SettingScope(scopeName); - foreach (KeyValuePair settingPair in settings.Settings) - { - ISettingPair pair = new SettingPair(settingPair.Key); - pair.SetValue(settingPair.Value); - scope.AddSetting(pair); - } - - settingsManager.AddScope(scope); - settingsManager.Save(settingFile); - } - } - - /// - /// Add the settings tab to the tab control - /// - private void AddSettingsTab() - { - if (TC_PluginData.TabPages.Count < 2) - { - TabPage settings = new TabPage("Settings"); - TC_PluginData.TabPages.Add(settings); - - currentSettingsPanel = new Panel - { - Width = settings.Width, - Height = settings.Height - 31 - }; - - Button button = new Button - { - Text = "Save settings", - Location = new Point(5, settings.Height - 27), - Height = 23, - Width = 87 - }; - button.Click += B_Save_Click; - - settings.Controls.Add(button); - settings.Controls.Add(currentSettingsPanel); - } - } - - /// - /// Remove the settings tab from the tab control - /// - private void RemoveSettingsTab() - { - if (TC_PluginData.TabPages.Count == 2) - { - TC_PluginData.TabPages.RemoveAt(1); - currentSettingsPanel = null; - } - } - - /// - /// Get the name of the scope to save the settings to - /// - /// Name of the scope to use - private string GetScopeName() - { - string returnString = string.Empty; - if (currentPlugin != null) - { - returnString = "plugin_"; - returnString += currentPlugin.Information.Author; - returnString += "_"; - returnString += currentPlugin.Information.Name; - returnString = returnString.Replace(" ", ""); - } - - return returnString; - } - } -} \ No newline at end of file diff --git a/src/XmlFormatter/Windows/PluginManager.resx b/src/XmlFormatter/Windows/PluginManager.resx deleted file mode 100644 index 8bb5947a..00000000 --- a/src/XmlFormatter/Windows/PluginManager.resx +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - AAABAAEAICAAAAEAGACoDAAAFgAAACgAAAAgAAAAQAAAAAEAGAAAAAAAqAwAAAAAAAAAAAAAAAAAAAAA - AACHfoRAPD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAPD6HfoRAPD4AAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAABAPD6HfoRAPD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAPD6H - foRAPD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAPD6HfoRAPD4AAAAAAABAPD4AAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAABAPD5pYmZAPD5APD6HfoRAPD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAPD5APD6H - foSHfoSHfoRAPD4AAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAABAPD6HfoRAPD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAABAPD6HfoQ/////H////4/////H////43////A////4HP//+Ah///AAP//4AB///AAP//4D - B///Bo///gxd//wYOP/8EBB//ggAP/8EAD//ggB//8cA///uAH///AA///gAH//8AA///hAf//84H/// - /A////7H////4/////H////4/////A== - - - \ No newline at end of file diff --git a/src/XmlFormatter/Windows/Settings.Designer.cs b/src/XmlFormatter/Windows/Settings.Designer.cs deleted file mode 100644 index acf70d4e..00000000 --- a/src/XmlFormatter/Windows/Settings.Designer.cs +++ /dev/null @@ -1,515 +0,0 @@ -namespace XmlFormatter.Windows -{ - partial class Settings - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Settings)); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.CB_AskBeforeClose = new System.Windows.Forms.CheckBox(); - this.CB_MinimizeToTray = new System.Windows.Forms.CheckBox(); - this.CB_CheckUpdatesOnStartup = new System.Windows.Forms.CheckBox(); - this.B_SaveAndClose = new System.Windows.Forms.Button(); - this.B_Cancel = new System.Windows.Forms.Button(); - this.MI_SettingsMenu = new System.Windows.Forms.MenuStrip(); - this.exportSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.TC_SettingTabs = new System.Windows.Forms.TabControl(); - this.TP_Application = new System.Windows.Forms.TabPage(); - this.GB_Update = new System.Windows.Forms.GroupBox(); - this.L_UpdateStrategy = new System.Windows.Forms.Label(); - this.CB_UpdateStrategy = new System.Windows.Forms.ComboBox(); - this.TP_Logging = new System.Windows.Forms.TabPage(); - this.B_OpenFolder = new System.Windows.Forms.Button(); - this.B_DeleteLog = new System.Windows.Forms.Button(); - this.LV_logFiles = new System.Windows.Forms.ListView(); - this.CH_logFiles = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.RTB_loggingText = new System.Windows.Forms.RichTextBox(); - this.CB_LoggingActive = new System.Windows.Forms.CheckBox(); - this.TP_Hotfolder = new System.Windows.Forms.TabPage(); - this.GB_Hotfolder = new System.Windows.Forms.GroupBox(); - this.B_RemoveHotfolder = new System.Windows.Forms.Button(); - this.B_EditHotfolder = new System.Windows.Forms.Button(); - this.B_AddHotfolder = new System.Windows.Forms.Button(); - this.LV_Hotfolders = new System.Windows.Forms.ListView(); - this.CH_Formatter = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.CH_Mode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.CH_watchedFolder = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.CH_filter = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.CH_OutputFolder = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.CH_OutputFileScheme = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.CH_OnRename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.CH_RemoveOld = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.CB_Hotfolder = new System.Windows.Forms.CheckBox(); - this.groupBox1.SuspendLayout(); - this.MI_SettingsMenu.SuspendLayout(); - this.TC_SettingTabs.SuspendLayout(); - this.TP_Application.SuspendLayout(); - this.GB_Update.SuspendLayout(); - this.TP_Logging.SuspendLayout(); - this.TP_Hotfolder.SuspendLayout(); - this.GB_Hotfolder.SuspendLayout(); - this.SuspendLayout(); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.CB_AskBeforeClose); - this.groupBox1.Controls.Add(this.CB_MinimizeToTray); - this.groupBox1.Location = new System.Drawing.Point(12, 9); - this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.groupBox1.Size = new System.Drawing.Size(1050, 105); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Application settings"; - // - // CB_AskBeforeClose - // - this.CB_AskBeforeClose.AutoSize = true; - this.CB_AskBeforeClose.Location = new System.Drawing.Point(9, 65); - this.CB_AskBeforeClose.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_AskBeforeClose.Name = "CB_AskBeforeClose"; - this.CB_AskBeforeClose.Size = new System.Drawing.Size(165, 24); - this.CB_AskBeforeClose.TabIndex = 1; - this.CB_AskBeforeClose.Text = "Ask before closing"; - this.CB_AskBeforeClose.UseVisualStyleBackColor = true; - // - // CB_MinimizeToTray - // - this.CB_MinimizeToTray.AutoSize = true; - this.CB_MinimizeToTray.Location = new System.Drawing.Point(9, 29); - this.CB_MinimizeToTray.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_MinimizeToTray.Name = "CB_MinimizeToTray"; - this.CB_MinimizeToTray.Size = new System.Drawing.Size(144, 24); - this.CB_MinimizeToTray.TabIndex = 0; - this.CB_MinimizeToTray.Text = "Minimize to tray"; - this.CB_MinimizeToTray.UseVisualStyleBackColor = true; - // - // CB_CheckUpdatesOnStartup - // - this.CB_CheckUpdatesOnStartup.AutoSize = true; - this.CB_CheckUpdatesOnStartup.Location = new System.Drawing.Point(9, 22); - this.CB_CheckUpdatesOnStartup.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_CheckUpdatesOnStartup.Name = "CB_CheckUpdatesOnStartup"; - this.CB_CheckUpdatesOnStartup.Size = new System.Drawing.Size(241, 24); - this.CB_CheckUpdatesOnStartup.TabIndex = 2; - this.CB_CheckUpdatesOnStartup.Text = "Check for updates on startup"; - this.CB_CheckUpdatesOnStartup.UseVisualStyleBackColor = true; - // - // B_SaveAndClose - // - this.B_SaveAndClose.Location = new System.Drawing.Point(18, 422); - this.B_SaveAndClose.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_SaveAndClose.Name = "B_SaveAndClose"; - this.B_SaveAndClose.Size = new System.Drawing.Size(156, 35); - this.B_SaveAndClose.TabIndex = 1; - this.B_SaveAndClose.Text = "Save and close"; - this.B_SaveAndClose.UseVisualStyleBackColor = true; - this.B_SaveAndClose.Click += new System.EventHandler(this.B_SaveAndClose_Click); - // - // B_Cancel - // - this.B_Cancel.Location = new System.Drawing.Point(956, 422); - this.B_Cancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_Cancel.Name = "B_Cancel"; - this.B_Cancel.Size = new System.Drawing.Size(112, 35); - this.B_Cancel.TabIndex = 2; - this.B_Cancel.Text = "Cancel"; - this.B_Cancel.UseVisualStyleBackColor = true; - this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); - // - // MI_SettingsMenu - // - this.MI_SettingsMenu.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2); - this.MI_SettingsMenu.ImageScalingSize = new System.Drawing.Size(24, 24); - this.MI_SettingsMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.exportSettingsToolStripMenuItem, - this.importSettingsToolStripMenuItem}); - this.MI_SettingsMenu.Location = new System.Drawing.Point(0, 0); - this.MI_SettingsMenu.Name = "MI_SettingsMenu"; - this.MI_SettingsMenu.Size = new System.Drawing.Size(1101, 36); - this.MI_SettingsMenu.TabIndex = 3; - this.MI_SettingsMenu.Text = "menuStrip1"; - // - // exportSettingsToolStripMenuItem - // - this.exportSettingsToolStripMenuItem.Name = "exportSettingsToolStripMenuItem"; - this.exportSettingsToolStripMenuItem.Size = new System.Drawing.Size(146, 30); - this.exportSettingsToolStripMenuItem.Text = "Export settings"; - this.exportSettingsToolStripMenuItem.Click += new System.EventHandler(this.ExportSettingsToolStripMenuItem_Click); - // - // importSettingsToolStripMenuItem - // - this.importSettingsToolStripMenuItem.Name = "importSettingsToolStripMenuItem"; - this.importSettingsToolStripMenuItem.Size = new System.Drawing.Size(150, 30); - this.importSettingsToolStripMenuItem.Text = "Import settings"; - this.importSettingsToolStripMenuItem.Click += new System.EventHandler(this.ImportSettingsToolStripMenuItem_Click); - // - // TC_SettingTabs - // - this.TC_SettingTabs.Controls.Add(this.TP_Application); - this.TC_SettingTabs.Controls.Add(this.TP_Logging); - this.TC_SettingTabs.Controls.Add(this.TP_Hotfolder); - this.TC_SettingTabs.Location = new System.Drawing.Point(0, 42); - this.TC_SettingTabs.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TC_SettingTabs.Name = "TC_SettingTabs"; - this.TC_SettingTabs.SelectedIndex = 0; - this.TC_SettingTabs.Size = new System.Drawing.Size(1083, 377); - this.TC_SettingTabs.TabIndex = 3; - // - // TP_Application - // - this.TP_Application.Controls.Add(this.GB_Update); - this.TP_Application.Controls.Add(this.groupBox1); - this.TP_Application.Location = new System.Drawing.Point(4, 29); - this.TP_Application.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_Application.Name = "TP_Application"; - this.TP_Application.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_Application.Size = new System.Drawing.Size(1075, 344); - this.TP_Application.TabIndex = 0; - this.TP_Application.Text = "Application"; - this.TP_Application.UseVisualStyleBackColor = true; - // - // GB_Update - // - this.GB_Update.Controls.Add(this.CB_CheckUpdatesOnStartup); - this.GB_Update.Controls.Add(this.L_UpdateStrategy); - this.GB_Update.Controls.Add(this.CB_UpdateStrategy); - this.GB_Update.Location = new System.Drawing.Point(12, 123); - this.GB_Update.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_Update.Name = "GB_Update"; - this.GB_Update.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_Update.Size = new System.Drawing.Size(1050, 106); - this.GB_Update.TabIndex = 1; - this.GB_Update.TabStop = false; - this.GB_Update.Text = "Updating"; - // - // L_UpdateStrategy - // - this.L_UpdateStrategy.AutoSize = true; - this.L_UpdateStrategy.Location = new System.Drawing.Point(4, 62); - this.L_UpdateStrategy.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_UpdateStrategy.Name = "L_UpdateStrategy"; - this.L_UpdateStrategy.Size = new System.Drawing.Size(123, 20); - this.L_UpdateStrategy.TabIndex = 4; - this.L_UpdateStrategy.Text = "Update strategy"; - // - // CB_UpdateStrategy - // - this.CB_UpdateStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CB_UpdateStrategy.FormattingEnabled = true; - this.CB_UpdateStrategy.Location = new System.Drawing.Point(136, 57); - this.CB_UpdateStrategy.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_UpdateStrategy.Name = "CB_UpdateStrategy"; - this.CB_UpdateStrategy.Size = new System.Drawing.Size(242, 28); - this.CB_UpdateStrategy.TabIndex = 3; - // - // TP_Logging - // - this.TP_Logging.Controls.Add(this.B_OpenFolder); - this.TP_Logging.Controls.Add(this.B_DeleteLog); - this.TP_Logging.Controls.Add(this.LV_logFiles); - this.TP_Logging.Controls.Add(this.RTB_loggingText); - this.TP_Logging.Controls.Add(this.CB_LoggingActive); - this.TP_Logging.Location = new System.Drawing.Point(4, 29); - this.TP_Logging.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_Logging.Name = "TP_Logging"; - this.TP_Logging.Size = new System.Drawing.Size(1075, 344); - this.TP_Logging.TabIndex = 2; - this.TP_Logging.Text = "Logging"; - this.TP_Logging.UseVisualStyleBackColor = true; - // - // B_OpenFolder - // - this.B_OpenFolder.Location = new System.Drawing.Point(98, 294); - this.B_OpenFolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_OpenFolder.Name = "B_OpenFolder"; - this.B_OpenFolder.Size = new System.Drawing.Size(138, 35); - this.B_OpenFolder.TabIndex = 6; - this.B_OpenFolder.Text = "Open folder"; - this.B_OpenFolder.UseVisualStyleBackColor = true; - this.B_OpenFolder.Click += new System.EventHandler(this.B_OpenFolder_Click); - // - // B_DeleteLog - // - this.B_DeleteLog.Location = new System.Drawing.Point(12, 294); - this.B_DeleteLog.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_DeleteLog.Name = "B_DeleteLog"; - this.B_DeleteLog.Size = new System.Drawing.Size(76, 35); - this.B_DeleteLog.TabIndex = 5; - this.B_DeleteLog.Text = "Delete"; - this.B_DeleteLog.UseVisualStyleBackColor = true; - this.B_DeleteLog.Click += new System.EventHandler(this.B_DeleteLog_Click); - // - // LV_logFiles - // - this.LV_logFiles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.CH_logFiles}); - this.LV_logFiles.HideSelection = false; - this.LV_logFiles.Location = new System.Drawing.Point(4, 40); - this.LV_logFiles.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.LV_logFiles.Name = "LV_logFiles"; - this.LV_logFiles.Size = new System.Drawing.Size(222, 242); - this.LV_logFiles.TabIndex = 4; - this.LV_logFiles.UseCompatibleStateImageBehavior = false; - this.LV_logFiles.View = System.Windows.Forms.View.Details; - this.LV_logFiles.SelectedIndexChanged += new System.EventHandler(this.LV_logFiles_SelectedIndexChanged); - // - // CH_logFiles - // - this.CH_logFiles.Text = "Log files"; - // - // RTB_loggingText - // - this.RTB_loggingText.Location = new System.Drawing.Point(237, 40); - this.RTB_loggingText.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.RTB_loggingText.Name = "RTB_loggingText"; - this.RTB_loggingText.ReadOnly = true; - this.RTB_loggingText.Size = new System.Drawing.Size(828, 242); - this.RTB_loggingText.TabIndex = 3; - this.RTB_loggingText.Text = ""; - // - // CB_LoggingActive - // - this.CB_LoggingActive.AutoSize = true; - this.CB_LoggingActive.Location = new System.Drawing.Point(12, 5); - this.CB_LoggingActive.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_LoggingActive.Name = "CB_LoggingActive"; - this.CB_LoggingActive.Size = new System.Drawing.Size(137, 24); - this.CB_LoggingActive.TabIndex = 0; - this.CB_LoggingActive.Text = "Logging active"; - this.CB_LoggingActive.UseVisualStyleBackColor = true; - // - // TP_Hotfolder - // - this.TP_Hotfolder.Controls.Add(this.GB_Hotfolder); - this.TP_Hotfolder.Controls.Add(this.CB_Hotfolder); - this.TP_Hotfolder.Location = new System.Drawing.Point(4, 29); - this.TP_Hotfolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_Hotfolder.Name = "TP_Hotfolder"; - this.TP_Hotfolder.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_Hotfolder.Size = new System.Drawing.Size(1075, 344); - this.TP_Hotfolder.TabIndex = 1; - this.TP_Hotfolder.Text = "Hotfolder"; - this.TP_Hotfolder.UseVisualStyleBackColor = true; - // - // GB_Hotfolder - // - this.GB_Hotfolder.Controls.Add(this.B_RemoveHotfolder); - this.GB_Hotfolder.Controls.Add(this.B_EditHotfolder); - this.GB_Hotfolder.Controls.Add(this.B_AddHotfolder); - this.GB_Hotfolder.Controls.Add(this.LV_Hotfolders); - this.GB_Hotfolder.Location = new System.Drawing.Point(12, 45); - this.GB_Hotfolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_Hotfolder.Name = "GB_Hotfolder"; - this.GB_Hotfolder.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.GB_Hotfolder.Size = new System.Drawing.Size(1050, 283); - this.GB_Hotfolder.TabIndex = 1; - this.GB_Hotfolder.TabStop = false; - this.GB_Hotfolder.Text = "Hotfolder"; - // - // B_RemoveHotfolder - // - this.B_RemoveHotfolder.Location = new System.Drawing.Point(928, 240); - this.B_RemoveHotfolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_RemoveHotfolder.Name = "B_RemoveHotfolder"; - this.B_RemoveHotfolder.Size = new System.Drawing.Size(112, 35); - this.B_RemoveHotfolder.TabIndex = 3; - this.B_RemoveHotfolder.Text = "Remove"; - this.B_RemoveHotfolder.UseVisualStyleBackColor = true; - this.B_RemoveHotfolder.Click += new System.EventHandler(this.B_RemoveHotfolder_Click); - // - // B_EditHotfolder - // - this.B_EditHotfolder.Location = new System.Drawing.Point(130, 240); - this.B_EditHotfolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_EditHotfolder.Name = "B_EditHotfolder"; - this.B_EditHotfolder.Size = new System.Drawing.Size(112, 35); - this.B_EditHotfolder.TabIndex = 2; - this.B_EditHotfolder.Text = "Edit"; - this.B_EditHotfolder.UseVisualStyleBackColor = true; - this.B_EditHotfolder.Click += new System.EventHandler(this.B_EditHotfolder_Click); - // - // B_AddHotfolder - // - this.B_AddHotfolder.Location = new System.Drawing.Point(9, 240); - this.B_AddHotfolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.B_AddHotfolder.Name = "B_AddHotfolder"; - this.B_AddHotfolder.Size = new System.Drawing.Size(112, 35); - this.B_AddHotfolder.TabIndex = 1; - this.B_AddHotfolder.Text = "Add"; - this.B_AddHotfolder.UseVisualStyleBackColor = true; - this.B_AddHotfolder.Click += new System.EventHandler(this.B_AddHotfolder_Click); - // - // LV_Hotfolders - // - this.LV_Hotfolders.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.CH_Formatter, - this.CH_Mode, - this.CH_watchedFolder, - this.CH_filter, - this.CH_OutputFolder, - this.CH_OutputFileScheme, - this.CH_OnRename, - this.CH_RemoveOld}); - this.LV_Hotfolders.FullRowSelect = true; - this.LV_Hotfolders.GridLines = true; - this.LV_Hotfolders.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.LV_Hotfolders.HideSelection = false; - this.LV_Hotfolders.Location = new System.Drawing.Point(9, 29); - this.LV_Hotfolders.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.LV_Hotfolders.Name = "LV_Hotfolders"; - this.LV_Hotfolders.Size = new System.Drawing.Size(1030, 199); - this.LV_Hotfolders.TabIndex = 0; - this.LV_Hotfolders.UseCompatibleStateImageBehavior = false; - this.LV_Hotfolders.View = System.Windows.Forms.View.Details; - this.LV_Hotfolders.SelectedIndexChanged += new System.EventHandler(this.LV_Hotfolders_SelectedIndexChanged); - // - // CH_Formatter - // - this.CH_Formatter.Text = "Formatter"; - // - // CH_Mode - // - this.CH_Mode.Text = "Mode"; - // - // CH_watchedFolder - // - this.CH_watchedFolder.Text = "Watched folder"; - // - // CH_filter - // - this.CH_filter.Text = "File filter"; - // - // CH_OutputFolder - // - this.CH_OutputFolder.Text = "Output folder"; - // - // CH_OutputFileScheme - // - this.CH_OutputFileScheme.Text = "Output file scheme"; - // - // CH_OnRename - // - this.CH_OnRename.Text = "Rename"; - // - // CH_RemoveOld - // - this.CH_RemoveOld.Text = "Remove old"; - // - // CB_Hotfolder - // - this.CB_Hotfolder.AutoSize = true; - this.CB_Hotfolder.Location = new System.Drawing.Point(12, 9); - this.CB_Hotfolder.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.CB_Hotfolder.Name = "CB_Hotfolder"; - this.CB_Hotfolder.Size = new System.Drawing.Size(146, 24); - this.CB_Hotfolder.TabIndex = 0; - this.CB_Hotfolder.Text = "Hotfolder active"; - this.CB_Hotfolder.UseVisualStyleBackColor = true; - this.CB_Hotfolder.Click += new System.EventHandler(this.CB_Hotfolder_Click); - // - // Settings - // - this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(1101, 469); - this.Controls.Add(this.TC_SettingTabs); - this.Controls.Add(this.B_Cancel); - this.Controls.Add(this.B_SaveAndClose); - this.Controls.Add(this.MI_SettingsMenu); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MainMenuStrip = this.MI_SettingsMenu; - this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "Settings"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Settings"; - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.MI_SettingsMenu.ResumeLayout(false); - this.MI_SettingsMenu.PerformLayout(); - this.TC_SettingTabs.ResumeLayout(false); - this.TP_Application.ResumeLayout(false); - this.GB_Update.ResumeLayout(false); - this.GB_Update.PerformLayout(); - this.TP_Logging.ResumeLayout(false); - this.TP_Logging.PerformLayout(); - this.TP_Hotfolder.ResumeLayout(false); - this.TP_Hotfolder.PerformLayout(); - this.GB_Hotfolder.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.CheckBox CB_MinimizeToTray; - private System.Windows.Forms.CheckBox CB_AskBeforeClose; - private System.Windows.Forms.Button B_SaveAndClose; - private System.Windows.Forms.Button B_Cancel; - private System.Windows.Forms.CheckBox CB_CheckUpdatesOnStartup; - private System.Windows.Forms.MenuStrip MI_SettingsMenu; - private System.Windows.Forms.ToolStripMenuItem exportSettingsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem importSettingsToolStripMenuItem; - private System.Windows.Forms.ToolTip toolTip1; - private System.Windows.Forms.TabControl TC_SettingTabs; - private System.Windows.Forms.TabPage TP_Application; - private System.Windows.Forms.TabPage TP_Hotfolder; - private System.Windows.Forms.GroupBox GB_Hotfolder; - private System.Windows.Forms.CheckBox CB_Hotfolder; - private System.Windows.Forms.ListView LV_Hotfolders; - private System.Windows.Forms.ColumnHeader CH_watchedFolder; - private System.Windows.Forms.ColumnHeader CH_filter; - private System.Windows.Forms.ColumnHeader CH_Formatter; - private System.Windows.Forms.ColumnHeader CH_OutputFolder; - private System.Windows.Forms.ColumnHeader CH_OutputFileScheme; - private System.Windows.Forms.ColumnHeader CH_OnRename; - private System.Windows.Forms.ColumnHeader CH_RemoveOld; - private System.Windows.Forms.Button B_RemoveHotfolder; - private System.Windows.Forms.Button B_EditHotfolder; - private System.Windows.Forms.Button B_AddHotfolder; - private System.Windows.Forms.ColumnHeader CH_Mode; - private System.Windows.Forms.GroupBox GB_Update; - private System.Windows.Forms.Label L_UpdateStrategy; - private System.Windows.Forms.ComboBox CB_UpdateStrategy; - private System.Windows.Forms.TabPage TP_Logging; - private System.Windows.Forms.RichTextBox RTB_loggingText; - private System.Windows.Forms.CheckBox CB_LoggingActive; - private System.Windows.Forms.ListView LV_logFiles; - private System.Windows.Forms.ColumnHeader CH_logFiles; - private System.Windows.Forms.Button B_OpenFolder; - private System.Windows.Forms.Button B_DeleteLog; - } -} \ No newline at end of file diff --git a/src/XmlFormatter/Windows/Settings.cs b/src/XmlFormatter/Windows/Settings.cs deleted file mode 100644 index 0aa47b05..00000000 --- a/src/XmlFormatter/Windows/Settings.cs +++ /dev/null @@ -1,530 +0,0 @@ -using PluginFramework.DataContainer; -using PluginFramework.Interfaces.Manager; -using PluginFramework.Interfaces.PluginTypes; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Windows.Forms; -using XmlFormatter.DataContainer; -using XmlFormatter.Update; -using XmlFormatterModel.Setting; -using XmlFormatterModel.Setting.Hotfolder; -using XmlFormatterModel.Update; -using XMLFormatterModel.Hotfolder; - -namespace XmlFormatter.Windows -{ - /// - /// Settings window - /// - public partial class Settings : Form - { - /// - /// The setting manager to user - /// - private readonly ISettingsManager settingManager; - - /// - /// The setting file to load - /// - private readonly string settingFile; - - /// - /// The plugin manager to use - /// - private readonly IPluginManager pluginManager; - - /// - /// Create a new settings window - /// - public Settings(ISettingsManager settingManager, string settingFile, IPluginManager pluginManager) - { - InitializeComponent(); - - this.settingManager = settingManager; - this.settingFile = settingFile; - this.pluginManager = pluginManager; - - SetupToolTip(CB_MinimizeToTray); - SetupToolTip(CB_AskBeforeClose); - SetupToolTip(CB_CheckUpdatesOnStartup); - SetupToolTip(CB_Hotfolder); - SetupToolTip(L_UpdateStrategy); - SetupToolTip(CB_LoggingActive); - B_EditHotfolder.Enabled = false; - B_RemoveHotfolder.Enabled = false; - B_RemoveHotfolder.Enabled = false; - - LV_Hotfolders.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); - settingManager.Load(settingFile); - - SetupControls(); - } - - /// - /// This method will set the matching tool tip for the control - /// - /// The control to set the tip to - private void SetupToolTip(Control control) - { - ToolTip toolTip = new ToolTip(); - this.components.Add(toolTip); - SetupToolTip(toolTip, control); - } - - /// - /// This method will set the matching tool tip for the control - /// - /// The tool tip provider to use - /// The control to set the tip to - private void SetupToolTip(ToolTip toolTip, Control control) - { - string baseName = this.Name + "_" + control.Name; - toolTip.ToolTipTitle = Properties.Resources.ResourceManager.GetString(baseName + "_Title"); - toolTip.SetToolTip( - control, - Properties.Resources.ResourceManager.GetString(baseName + "_Message") - ); - } - - /// - /// This method will setup the controls - /// - private void SetupControls() - { - CB_MinimizeToTray.Checked = Properties.Settings.Default.MinimizeToTray; - CB_AskBeforeClose.Checked = Properties.Settings.Default.AskBeforeClosing; - CB_CheckUpdatesOnStartup.Checked = Properties.Settings.Default.SearchUpdateOnStartup; - CB_Hotfolder.Checked = Properties.Settings.Default.HotfolderActive; - GB_Hotfolder.Enabled = CB_Hotfolder.Checked; - CB_LoggingActive.Checked = Properties.Settings.Default.LoggingEnabled; - - LV_Hotfolders.Items.Clear(); - HotfolderExtension hotfolderExtension = new HotfolderExtension(settingManager, pluginManager); - foreach (IHotfolder hotfolder in hotfolderExtension.GetHotFoldersFromSettings()) - { - ListViewItem item = HotfolderToListView(hotfolder); - LV_Hotfolders.Items.Add(item); - } - - List updatePlugins = pluginManager.ListPlugins().ToList(); - - foreach (PluginMetaData metaData in updatePlugins) - { - try - { - CB_UpdateStrategy.Items.Add(new ComboboxPluginItem(metaData)); - if (metaData.Type.ToString() == Properties.Settings.Default.UpdateStrategy) - { - CB_UpdateStrategy.SelectedIndex = CB_UpdateStrategy.Items.Count - 1; - } - } - catch (Exception) - { - continue; - } - } - - FillLogFolderView(); - LV_logFiles.Columns[0].Width = LV_logFiles.Width; - if (CB_UpdateStrategy.SelectedIndex == -1 && CB_UpdateStrategy.Items.Count > 0) - { - CB_UpdateStrategy.SelectedIndex = 0; - } - } - - /// - /// Fill in the list with all the log files - /// - private void FillLogFolderView() - { - LV_logFiles.Items.Clear(); - foreach (string file in Directory.GetFiles(Properties.Settings.Default.LoggingFolder)) - { - FileInfo fileInfo = new FileInfo(file); - if (fileInfo.Extension != ".log") - { - continue; - } - ListViewItem listViewItem = new ListViewItem(fileInfo.Name) - { - Tag = file - }; - LV_logFiles.Items.Add(listViewItem); - } - } - - /// - /// The event for saving and closing the application - /// - /// The sender of the event - /// The arguments of the sendfer - private void B_SaveAndClose_Click(object sender, EventArgs e) - { - WriteSettings(); - settingManager.Save(settingFile); - B_Cancel.PerformClick(); - } - - /// - /// Write the settings into the property container - /// - private void WriteSettings() - { - Properties.Settings.Default.MinimizeToTray = CB_MinimizeToTray.Checked; - Properties.Settings.Default.AskBeforeClosing = CB_AskBeforeClose.Checked; - Properties.Settings.Default.SearchUpdateOnStartup = CB_CheckUpdatesOnStartup.Checked; - Properties.Settings.Default.HotfolderActive = CB_Hotfolder.Checked; - Properties.Settings.Default.LoggingEnabled = CB_LoggingActive.Checked; - - if (CB_UpdateStrategy.SelectedItem is ComboboxPluginItem updateItem) - { - Properties.Settings.Default.UpdateStrategy = updateItem.Type.ToString(); - } - - ISettingScope hotfolderScope = settingManager.GetScope("Hotfolder"); - if (hotfolderScope == null) - { - hotfolderScope = new SettingScope("Hotfolder"); - settingManager.AddScope(hotfolderScope); - } - hotfolderScope.ClearSubScopes(); - foreach (ListViewItem item in LV_Hotfolders.Items) - { - if (item.Tag is IHotfolder) - { - string hotfolderName = "Hotfolder_" + hotfolderScope.GetSubScopes().Count + 1; - ISettingScope hotfolderSubScope = CreateHotfolderScope(hotfolderName, (IHotfolder)item.Tag); - hotfolderScope.AddSubScope(hotfolderSubScope); - } - } - } - - /// - /// The event to cancel the settings changes - /// - /// The sender of the event - /// The arguments of the sendfer - private void B_Cancel_Click(object sender, EventArgs e) - { - this.Close(); - } - - /// - /// This method will export the settings of the application so you can use it on another computer - /// - /// The sender wo called the event - /// The arguments provided by the sender - private void ExportSettingsToolStripMenuItem_Click(object sender, EventArgs e) - { - string fileName = DateTime.Now.ToString("yyyyMMdd_HHmmss"); - fileName += "_"; - fileName += Application.ProductName; - fileName += "Settings"; - fileName += "_V"; - fileName += Properties.Settings.Default.ApplicationVersion; - SaveFileDialog saveFileDialog = new SaveFileDialog - { - Filter = "XML files(*.xml)| *.xml", - FileName = fileName - }; - - - DialogResult result = saveFileDialog.ShowDialog(); - - if (result != DialogResult.OK) - { - return; - } - - WriteSettings(); - settingManager.Save(saveFileDialog.FileName); - } - - /// - /// This method will allow you to import the exported settings back into the application - /// - /// The sender wo called the event - /// The arguments provided by the sender - private void ImportSettingsToolStripMenuItem_Click(object sender, EventArgs e) - { - OpenFileDialog openFileDialog = new OpenFileDialog - { - Filter = "XML files(*.xml)| *.xml" - }; - DialogResult result = openFileDialog.ShowDialog(); - if (result != DialogResult.OK) - { - return; - } - - settingManager.Load(openFileDialog.FileName); - ISettingScope scope = settingManager.GetScope("Default"); - if (scope == null) - { - return; - } - - string storedVersion = scope.GetSetting("ApplicationVersion").GetValue(); - IVersionManagerFactory factory = new VersionManagerFactory(); - IVersionManager versionManager = factory.GetVersionManager(); - - string lowestVersion = Properties.Settings.Default.LowestSupportedVersion; - - Version settingVersion = versionManager.ConvertStringToVersion(storedVersion); - Version lowVersion = versionManager.ConvertStringToVersion(lowestVersion); - TaskAwaiter awaiter = versionManager.GetLocalVersionAsync().GetAwaiter(); - awaiter.OnCompleted(() => - { - Version highVersion = awaiter.GetResult(); - if (highVersion < lowVersion) - { - highVersion = lowVersion; - } - - if (settingVersion < lowVersion || settingVersion > highVersion) - { - string message = "Import failed because setting file is not supported in this version"; - message += "\r\n\r\nLowest supported version: " + lowVersion; - message += "\r\nApplication version: " + highVersion; - message += "\r\nSetting version: " + settingVersion; - MessageBox.Show( - message, - "Not supported import", - MessageBoxButtons.OK, - MessageBoxIcon.Error - ); - - settingManager.Load(settingFile); - return; - } - - settingManager.Save(settingFile); - SetupControls(); - }); - } - - /// - /// Event that the hotfolders where activated or disabled - /// - /// The event sender - /// Event arguments - private void CB_Hotfolder_Click(object sender, EventArgs e) - { - GB_Hotfolder.Enabled = CB_Hotfolder.Checked; - } - - /// - /// Someone did select or deselect an item in the list view - /// Will change the enable state of the edit and remove button - /// - /// The event sender - /// Event arguments - private void LV_Hotfolders_SelectedIndexChanged(object sender, EventArgs e) - { - bool enabled = LV_Hotfolders.SelectedItems.Count > 0; - B_EditHotfolder.Enabled = enabled; - B_RemoveHotfolder.Enabled = enabled; - } - - /// - /// Create a new hotfolder configuration - /// - /// The event sender - /// Event arguments - private void B_AddHotfolder_Click(object sender, EventArgs e) - { - HotfolderEditor hotfolderEditor = new HotfolderEditor(pluginManager); - hotfolderEditor.ShowDialog(); - if (hotfolderEditor.Saved) - { - ISettingScope hotfolderScope = settingManager.GetScope("Hotfolder"); - if (hotfolderScope == null) - { - hotfolderScope = new SettingScope("Hotfolder"); - settingManager.AddScope(hotfolderScope); - } - IHotfolder hotfolder = hotfolderEditor.Hotfolder; - - LV_Hotfolders.Items.Add(HotfolderToListView(hotfolder)); - } - } - /// - /// Convert a hotfolder to a valid ListViewItem - /// - /// The hotfolder to convert - /// A valid ListViewItem - private ListViewItem HotfolderToListView(IHotfolder hotfolder) - { - ListViewItem listViewItem = new ListViewItem("Plugin not found!"); - if (hotfolder.FormatterToUse != null) - { - listViewItem = new ListViewItem(hotfolder.FormatterToUse.Information.Name) - { - Tag = hotfolder - }; - } - - listViewItem.SubItems.Add(hotfolder.Mode.ToString()); - listViewItem.SubItems.Add(hotfolder.WatchedFolder); - listViewItem.SubItems.Add(hotfolder.Filter); - listViewItem.SubItems.Add(hotfolder.OutputFolder); - listViewItem.SubItems.Add(hotfolder.OutputFileScheme); - listViewItem.SubItems.Add(hotfolder.OnRename.ToString()); - listViewItem.SubItems.Add(hotfolder.RemoveOld.ToString()); - return listViewItem; - } - - /// - /// Create hotfolder scope from name and hotfolder - /// - /// The name of the new hotfolder configuration - /// The hotfolder to convert - /// A valid scope for the setting manager - private ISettingScope CreateHotfolderScope(string name, IHotfolder hotfolder) - { - ISettingScope hotfolderConfig = new SettingScope(name); - - SettingPair typeSetting = new SettingPair("Type"); - typeSetting.SetValue(hotfolder.FormatterToUse.ToString()); - - SettingPair modeSetting = new SettingPair("Mode"); - modeSetting.SetValue(hotfolder.Mode.ToString()); - - SettingPair watchedFolder = new SettingPair("WatchedFolder"); - watchedFolder.SetValue(hotfolder.WatchedFolder); - - SettingPair filter = new SettingPair("Filter"); - filter.SetValue(hotfolder.Filter); - - SettingPair outputFolder = new SettingPair("OutputFolder"); - outputFolder.SetValue(hotfolder.OutputFolder); - - SettingPair scheme = new SettingPair("Scheme"); - scheme.SetValue(hotfolder.OutputFileScheme); - - SettingPair rename = new SettingPair("Rename"); - rename.SetValue(hotfolder.OnRename); - - SettingPair remove = new SettingPair("Remove"); - remove.SetValue(hotfolder.RemoveOld); - - hotfolderConfig.AddSetting(typeSetting); - hotfolderConfig.AddSetting(modeSetting); - hotfolderConfig.AddSetting(watchedFolder); - hotfolderConfig.AddSetting(filter); - hotfolderConfig.AddSetting(outputFolder); - hotfolderConfig.AddSetting(scheme); - hotfolderConfig.AddSetting(rename); - hotfolderConfig.AddSetting(remove); - - return hotfolderConfig; - } - - /// - /// Event to remove a hotfolder configuration - /// - /// The event sender - /// Event arguments - private void B_RemoveHotfolder_Click(object sender, EventArgs e) - { - ListViewItem itemToRemove = LV_Hotfolders.SelectedItems[0]; - LV_Hotfolders.Items.Remove(itemToRemove); - } - - /// - /// Event to change a hotfolder configuration - /// - /// The event sender - /// Event arguments - private void B_EditHotfolder_Click(object sender, EventArgs e) - { - if (LV_Hotfolders.SelectedItems[0] == null) - { - return; - } - ListViewItem selectedItem = LV_Hotfolders.SelectedItems[0]; - if (selectedItem.Tag is IHotfolder) - { - HotfolderEditor hotfolderEditor = new HotfolderEditor((IHotfolder)selectedItem.Tag, pluginManager); - hotfolderEditor.ShowDialog(); - if (hotfolderEditor.Saved) - { - int position = LV_Hotfolders.SelectedItems[0].Index; - LV_Hotfolders.Items.Remove(selectedItem); - ListViewItem itemToAdd = HotfolderToListView(hotfolderEditor.Hotfolder); - LV_Hotfolders.Items.Insert(position, itemToAdd); - LV_Hotfolders.Items[position].Selected = true; - } - } - } - - /// - /// Selected log file changed - /// - /// The sender ov the event - /// The arguments of the event - private void LV_logFiles_SelectedIndexChanged(object sender, EventArgs e) - { - if (LV_logFiles.SelectedItems.Count == 0) - { - B_RemoveHotfolder.Enabled = false; - return; - } - string file = LV_logFiles.SelectedItems[0].Tag.ToString(); - LoadLogFile(file); - } - - /// - /// Load the given log file and put it into the rich box - /// - /// The file to load - private void LoadLogFile(string file) - { - RTB_loggingText.Text = String.Empty; - FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Write); - using (StreamReader reader = new StreamReader(stream)) - { - RTB_loggingText.Text = reader.ReadToEnd(); - } - B_RemoveHotfolder.Enabled = true; - } - - /// - /// Delete the selected log file - /// - /// The sender ov the event - /// The arguments of the event - private void B_DeleteLog_Click(object sender, EventArgs e) - { - if (LV_logFiles.SelectedItems.Count == 0) - { - return; - } - try - { - File.Delete(LV_logFiles.SelectedItems[0].Tag.ToString()); - FillLogFolderView(); - } - catch (Exception ex) - { - string message = "Can't delete logfile " + LV_logFiles.SelectedItems[0].Tag.ToString(); - message += "\n\r" + ex.Message; - MessageBox.Show(message, "Delete log error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - /// - /// Open the log folder - /// - /// The sender of the event - /// The arguments of the event - private void B_OpenFolder_Click(object sender, EventArgs e) - { - Process.Start(Properties.Settings.Default.LoggingFolder); - } - } -} diff --git a/src/XmlFormatter/Windows/Settings.resx b/src/XmlFormatter/Windows/Settings.resx deleted file mode 100644 index 319a3813..00000000 --- a/src/XmlFormatter/Windows/Settings.resx +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 163, 17 - - - - - AAABAAEAICAAAAEAGACoDAAAFgAAACgAAAAgAAAAQAAAAAEAGAAAAAAAqAwAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD///////////////////////w///+4Hf//GBj//gAAf/wAAD/+AAB//wAA//8D - wP/+D/B/+A5wD/AcOA/wGBgP8BgYD/AcOA/4DnAP/g/wf/8DwP//AAD//gAAf/wAAH/+AAB//xgY//+4 - H///+B///////////////////////w== - - - \ No newline at end of file diff --git a/src/XmlFormatter/Windows/VersionInformation.Designer.cs b/src/XmlFormatter/Windows/VersionInformation.Designer.cs deleted file mode 100644 index 6725a1ac..00000000 --- a/src/XmlFormatter/Windows/VersionInformation.Designer.cs +++ /dev/null @@ -1,236 +0,0 @@ -namespace XmlFormatter.Windows -{ - partial class VersionInformation - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("Octokit"); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.TP_General = new System.Windows.Forms.TabPage(); - this.LL_MIT = new System.Windows.Forms.LinkLabel(); - this.L_VersionNumber = new System.Windows.Forms.Label(); - this.L_MaintainerName = new System.Windows.Forms.Label(); - this.L_Project = new System.Windows.Forms.Label(); - this.LL_Project = new System.Windows.Forms.LinkLabel(); - this.L_License = new System.Windows.Forms.Label(); - this.L_Maintainer = new System.Windows.Forms.Label(); - this.L_Version = new System.Windows.Forms.Label(); - this.TP_ThirdParty = new System.Windows.Forms.TabPage(); - this.LV_ThirdPartyLibraries = new System.Windows.Forms.ListView(); - this.CH_ThirdParty = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.tabControl1.SuspendLayout(); - this.TP_General.SuspendLayout(); - this.TP_ThirdParty.SuspendLayout(); - this.SuspendLayout(); - // - // tabControl1 - // - this.tabControl1.Controls.Add(this.TP_General); - this.tabControl1.Controls.Add(this.TP_ThirdParty); - this.tabControl1.Location = new System.Drawing.Point(18, 18); - this.tabControl1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(608, 166); - this.tabControl1.TabIndex = 1; - // - // TP_General - // - this.TP_General.Controls.Add(this.LL_MIT); - this.TP_General.Controls.Add(this.L_VersionNumber); - this.TP_General.Controls.Add(this.L_MaintainerName); - this.TP_General.Controls.Add(this.L_Project); - this.TP_General.Controls.Add(this.LL_Project); - this.TP_General.Controls.Add(this.L_License); - this.TP_General.Controls.Add(this.L_Maintainer); - this.TP_General.Controls.Add(this.L_Version); - this.TP_General.Location = new System.Drawing.Point(4, 29); - this.TP_General.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_General.Name = "TP_General"; - this.TP_General.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_General.Size = new System.Drawing.Size(600, 133); - this.TP_General.TabIndex = 0; - this.TP_General.Text = "General"; - this.TP_General.UseVisualStyleBackColor = true; - // - // LL_MIT - // - this.LL_MIT.AutoSize = true; - this.LL_MIT.Location = new System.Drawing.Point(106, 65); - this.LL_MIT.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.LL_MIT.Name = "LL_MIT"; - this.LL_MIT.Size = new System.Drawing.Size(36, 20); - this.LL_MIT.TabIndex = 8; - this.LL_MIT.TabStop = true; - this.LL_MIT.Tag = "https://github.com/XanatosX/XmlFormatter/blob/master/LICENSE"; - this.LL_MIT.Text = "MIT"; - this.LL_MIT.Click += new System.EventHandler(this.OpenLinkLabel_Click); - // - // L_VersionNumber - // - this.L_VersionNumber.AutoSize = true; - this.L_VersionNumber.Location = new System.Drawing.Point(106, 15); - this.L_VersionNumber.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_VersionNumber.Name = "L_VersionNumber"; - this.L_VersionNumber.Size = new System.Drawing.Size(44, 20); - this.L_VersionNumber.TabIndex = 7; - this.L_VersionNumber.Text = "0.0.0"; - // - // L_MaintainerName - // - this.L_MaintainerName.AutoSize = true; - this.L_MaintainerName.Location = new System.Drawing.Point(106, 40); - this.L_MaintainerName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_MaintainerName.Name = "L_MaintainerName"; - this.L_MaintainerName.Size = new System.Drawing.Size(80, 20); - this.L_MaintainerName.TabIndex = 6; - this.L_MaintainerName.Text = "XanatosX"; - // - // L_Project - // - this.L_Project.AutoSize = true; - this.L_Project.Location = new System.Drawing.Point(9, 89); - this.L_Project.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Project.Name = "L_Project"; - this.L_Project.Size = new System.Drawing.Size(62, 20); - this.L_Project.TabIndex = 4; - this.L_Project.Text = "Project:"; - // - // LL_Project - // - this.LL_Project.AutoSize = true; - this.LL_Project.Location = new System.Drawing.Point(106, 89); - this.LL_Project.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.LL_Project.Name = "LL_Project"; - this.LL_Project.Size = new System.Drawing.Size(311, 20); - this.LL_Project.TabIndex = 3; - this.LL_Project.TabStop = true; - this.LL_Project.Tag = "https://github.com/XanatosX/XmlFormatter"; - this.LL_Project.Text = "https://github.com/XanatosX/XmlFormatter"; - this.LL_Project.Click += new System.EventHandler(this.OpenLinkLabel_Click); - // - // L_License - // - this.L_License.AutoSize = true; - this.L_License.Location = new System.Drawing.Point(9, 65); - this.L_License.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_License.Name = "L_License"; - this.L_License.Size = new System.Drawing.Size(68, 20); - this.L_License.TabIndex = 2; - this.L_License.Text = "License:"; - // - // L_Maintainer - // - this.L_Maintainer.AutoSize = true; - this.L_Maintainer.Location = new System.Drawing.Point(9, 40); - this.L_Maintainer.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Maintainer.Name = "L_Maintainer"; - this.L_Maintainer.Size = new System.Drawing.Size(87, 20); - this.L_Maintainer.TabIndex = 1; - this.L_Maintainer.Text = "Maintainer:"; - // - // L_Version - // - this.L_Version.AutoSize = true; - this.L_Version.Location = new System.Drawing.Point(9, 15); - this.L_Version.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.L_Version.Name = "L_Version"; - this.L_Version.Size = new System.Drawing.Size(67, 20); - this.L_Version.TabIndex = 0; - this.L_Version.Text = "Version:"; - // - // TP_ThirdParty - // - this.TP_ThirdParty.Controls.Add(this.LV_ThirdPartyLibraries); - this.TP_ThirdParty.Location = new System.Drawing.Point(4, 29); - this.TP_ThirdParty.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_ThirdParty.Name = "TP_ThirdParty"; - this.TP_ThirdParty.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.TP_ThirdParty.Size = new System.Drawing.Size(600, 133); - this.TP_ThirdParty.TabIndex = 1; - this.TP_ThirdParty.Text = "Third Party"; - this.TP_ThirdParty.UseVisualStyleBackColor = true; - // - // LV_ThirdPartyLibraries - // - this.LV_ThirdPartyLibraries.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.CH_ThirdParty}); - this.LV_ThirdPartyLibraries.FullRowSelect = true; - this.LV_ThirdPartyLibraries.HideSelection = false; - listViewItem1.Tag = "https://github.com/octokit/octokit.net"; - this.LV_ThirdPartyLibraries.Items.AddRange(new System.Windows.Forms.ListViewItem[] { - listViewItem1}); - this.LV_ThirdPartyLibraries.Location = new System.Drawing.Point(9, 9); - this.LV_ThirdPartyLibraries.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.LV_ThirdPartyLibraries.Name = "LV_ThirdPartyLibraries"; - this.LV_ThirdPartyLibraries.Size = new System.Drawing.Size(576, 106); - this.LV_ThirdPartyLibraries.TabIndex = 0; - this.LV_ThirdPartyLibraries.UseCompatibleStateImageBehavior = false; - this.LV_ThirdPartyLibraries.View = System.Windows.Forms.View.Details; - this.LV_ThirdPartyLibraries.SelectedIndexChanged += new System.EventHandler(this.LV_ThirdPartyLibraries_SelectedIndexChanged); - // - // CH_ThirdParty - // - this.CH_ThirdParty.Text = "Third Party Libraries"; - // - // VersionInformation - // - this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(644, 194); - this.Controls.Add(this.tabControl1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; - this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.Name = "VersionInformation"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "VersionInformation"; - this.Load += new System.EventHandler(this.VersionInformation_Load); - this.tabControl1.ResumeLayout(false); - this.TP_General.ResumeLayout(false); - this.TP_General.PerformLayout(); - this.TP_ThirdParty.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage TP_General; - private System.Windows.Forms.TabPage TP_ThirdParty; - private System.Windows.Forms.ListView LV_ThirdPartyLibraries; - private System.Windows.Forms.ColumnHeader CH_ThirdParty; - private System.Windows.Forms.Label L_Project; - private System.Windows.Forms.LinkLabel LL_Project; - private System.Windows.Forms.Label L_License; - private System.Windows.Forms.Label L_Maintainer; - private System.Windows.Forms.Label L_Version; - private System.Windows.Forms.Label L_VersionNumber; - private System.Windows.Forms.Label L_MaintainerName; - private System.Windows.Forms.LinkLabel LL_MIT; - } -} \ No newline at end of file diff --git a/src/XmlFormatter/Windows/VersionInformation.cs b/src/XmlFormatter/Windows/VersionInformation.cs deleted file mode 100644 index 86a14973..00000000 --- a/src/XmlFormatter/Windows/VersionInformation.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Windows.Forms; -using XmlFormatter.Update; -using XmlFormatterModel.Update; - -namespace XmlFormatter.Windows -{ - /// - /// Version information windows - /// - public partial class VersionInformation : Form - { - /// - /// Index of the last selected third party - /// - private int lastSelectedThirdParty; - - /// - /// Creating a new instance of this window - /// - public VersionInformation() - { - InitializeComponent(); - lastSelectedThirdParty = -1; - MinimizeBox = false; - MaximizeBox = false; - Text = "Version Information"; - } - - /// - /// Load event - /// - /// Event sender - /// Event arguments - private void VersionInformation_Load(object sender, EventArgs e) - { - VersionManagerFactory factory = new VersionManagerFactory(); - IVersionManager manager = factory.GetVersionManager(); - TaskAwaiter awaiter = manager.GetLocalVersionAsync().GetAwaiter(); - awaiter.OnCompleted(() => - { - Version version = awaiter.GetResult(); - L_VersionNumber.Text = manager.GetStringVersion(version); - - LV_ThirdPartyLibraries.Columns[0].Width = LV_ThirdPartyLibraries.Width - 4; - }); - - } - - /// - /// List view selection changed - /// - /// Event sender - /// Event arguments - private void LV_ThirdPartyLibraries_SelectedIndexChanged(object sender, EventArgs e) - { - if (sender is ListView listView) - { - if (listView.SelectedItems.Count > 0 - && listView.SelectedItems[0] is ListViewItem listViewItem - && lastSelectedThirdParty != listView.SelectedIndices[0]) - { - Process.Start(listViewItem.Tag.ToString()); - lastSelectedThirdParty = listView.SelectedIndices[0]; - } - } - - } - - /// - /// Event if link was pressed - /// - /// The event sender - /// The event parameter - private void OpenLinkLabel_Click(object sender, EventArgs e) - { - if (sender is LinkLabel linkLabel) - { - Process.Start(linkLabel.Tag.ToString()); - } - } - } -} diff --git a/src/XmlFormatter/Windows/VersionInformation.resx b/src/XmlFormatter/Windows/VersionInformation.resx deleted file mode 100644 index 1af7de15..00000000 --- a/src/XmlFormatter/Windows/VersionInformation.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/XmlFormatter/XmlFormatter.csproj b/src/XmlFormatter/XmlFormatter.csproj deleted file mode 100644 index 9c1cba63..00000000 --- a/src/XmlFormatter/XmlFormatter.csproj +++ /dev/null @@ -1,159 +0,0 @@ - - - - - Debug - AnyCPU - {0EAED5C3-DAB2-4919-9C26-EAD4D8222BD0} - WinExe - XmlFormatter - XmlFormatter - v4.7.2 - 512 - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - none - true - bin\Release\ - TRACE - prompt - 4 - - - XmlFormatterIcon.ico - - - - ..\..\packages\Octokit.0.47.0\lib\net46\Octokit.dll - - - - - - - - - - - - - - - - - - - - - Form - - - HotfolderEditor.cs - - - Form - - - MainForm.cs - - - - - - Form - - - PluginManager.cs - - - Form - - - Settings.cs - - - Form - - - VersionInformation.cs - - - HotfolderEditor.cs - - - MainForm.cs - - - ResXFileCodeGenerator - Designer - Resources.Designer.cs - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - PluginManager.cs - - - Settings.cs - - - VersionInformation.cs - - - - - - - - - {9833586d-9807-4930-8540-3cf012a1bb59} - PluginFramework - - - {f2245aae-dfaf-41cc-8af2-d3836b558847} - XmlFormatterModel - - - - - if $(ConfigurationName) == Release ( - echo "Release build ignore post build!" - exit -) -mkdir "$(ProjectDir)\$(OutDir)\Plugins" -copy "$(ProjectDir)\..\CorePlugin\$(OutDir)\netstandard2.0\CorePlugin.dll" "$(ProjectDir)\$(OutDir)\Plugins" -copy "$(ProjectDir)\..\JsonPlugin\$(OutDir)\netstandard2.0\JsonPlugin.dll" "$(ProjectDir)\$(OutDir)\Plugins" -copy "$(ProjectDir)\..\JsonPlugin\$(OutDir)\netstandard2.0\Newtonsoft.Json.dll" "$(ProjectDir)\$(OutDir)\Plugins" - - \ No newline at end of file diff --git a/src/XmlFormatter/XmlFormatterIcon.ico b/src/XmlFormatter/XmlFormatterIcon.ico deleted file mode 100644 index 321fcce8..00000000 Binary files a/src/XmlFormatter/XmlFormatterIcon.ico and /dev/null differ diff --git a/src/XmlFormatter/packages.config b/src/XmlFormatter/packages.config deleted file mode 100644 index 3866a875..00000000 --- a/src/XmlFormatter/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/XmlFormatterOsIndependent/Assets/HotfolderIcon.ico b/src/XmlFormatterOsIndependent/Assets/HotfolderIcon.ico index 186a9080..ecd61ee3 100644 Binary files a/src/XmlFormatterOsIndependent/Assets/HotfolderIcon.ico and b/src/XmlFormatterOsIndependent/Assets/HotfolderIcon.ico differ diff --git a/src/XmlFormatterOsIndependent/Assets/PluginIcon.ico b/src/XmlFormatterOsIndependent/Assets/PluginIcon.ico index c0b14ea1..6fe62ce3 100644 Binary files a/src/XmlFormatterOsIndependent/Assets/PluginIcon.ico and b/src/XmlFormatterOsIndependent/Assets/PluginIcon.ico differ diff --git a/src/XmlFormatterOsIndependent/Assets/XmlFormatterIcon.ico b/src/XmlFormatterOsIndependent/Assets/XmlFormatterIcon.ico index 321fcce8..487a3ad2 100644 Binary files a/src/XmlFormatterOsIndependent/Assets/XmlFormatterIcon.ico and b/src/XmlFormatterOsIndependent/Assets/XmlFormatterIcon.ico differ diff --git a/src/XmlFormatterOsIndependent/Assets/XmlFormatterSettingsIcon.ico b/src/XmlFormatterOsIndependent/Assets/XmlFormatterSettingsIcon.ico index a3181c48..ed9619d4 100644 Binary files a/src/XmlFormatterOsIndependent/Assets/XmlFormatterSettingsIcon.ico and b/src/XmlFormatterOsIndependent/Assets/XmlFormatterSettingsIcon.ico differ diff --git a/src/XmlFormatterOsIndependent/Assets/avalonia-logo.ico b/src/XmlFormatterOsIndependent/Assets/avalonia-logo.ico index da8d49ff..b023aa24 100644 Binary files a/src/XmlFormatterOsIndependent/Assets/avalonia-logo.ico and b/src/XmlFormatterOsIndependent/Assets/avalonia-logo.ico differ diff --git a/src/XmlFormatterOsIndependent/DependencyInjection/DepenendyInjectionExtensions.cs b/src/XmlFormatterOsIndependent/DependencyInjection/DepenendyInjectionExtensions.cs index 4eac8920..873262e3 100644 --- a/src/XmlFormatterOsIndependent/DependencyInjection/DepenendyInjectionExtensions.cs +++ b/src/XmlFormatterOsIndependent/DependencyInjection/DepenendyInjectionExtensions.cs @@ -51,13 +51,14 @@ public static IServiceCollection AddServices(this IServiceCollection collection) .AddSingleton() .AddSingleton() .AddSingleton() - .AddSingleton(provider => new DependecyInjectionResolverService(provider)) + .AddSingleton(provider => new DependecyInjectionResolverService(provider)) .AddSingleton() .AddSingleton() .AddSingleton() .AddSingleton() .AddSingleton() - .AddSingleton(); + .AddSingleton() + .AddSingleton(); } /// @@ -70,7 +71,9 @@ public static IServiceCollection AddViews(this IServiceCollection collection) return collection.AddTransient() .AddTransient() .AddTransient() - .AddTransient(); + .AddTransient() + .AddTransient() + .AddTransient(); } /// @@ -83,6 +86,8 @@ public static IServiceCollection AddViewModels(this IServiceCollection collectio return collection.AddTransient() .AddTransient() .AddTransient() - .AddTransient(); + .AddTransient() + .AddTransient() + .AddTransient(); } } diff --git a/src/XmlFormatterOsIndependent/Model/ApplicationSettings.cs b/src/XmlFormatterOsIndependent/Model/ApplicationSettings.cs new file mode 100644 index 00000000..43523a4a --- /dev/null +++ b/src/XmlFormatterOsIndependent/Model/ApplicationSettings.cs @@ -0,0 +1,30 @@ +using PluginFramework.DataContainer; +using XmlFormatterOsIndependent.Enums; + +namespace XmlFormatterOsIndependent.Model; + +/// +/// Class to represent the baked settings for this application +/// +internal class ApplicationSettings +{ + /// + /// Should we check for updates on startup + /// + public bool CheckForUpdatesOnStartup; + + /// + /// Show a confirmation dialog if the application is getting closed + /// + public bool AskBeforeClosing; + + /// + /// The current updater to use with the application + /// + public PluginMetaData? Updater; + + /// + /// The current theme for the application + /// + public ThemeEnum Theme; +} diff --git a/src/XmlFormatterOsIndependent/Model/Messages/SaveSettingsWindowMessage.cs b/src/XmlFormatterOsIndependent/Model/Messages/SaveSettingsWindowMessage.cs new file mode 100644 index 00000000..527b0bcc --- /dev/null +++ b/src/XmlFormatterOsIndependent/Model/Messages/SaveSettingsWindowMessage.cs @@ -0,0 +1,13 @@ +using CommunityToolkit.Mvvm.Messaging.Messages; + +namespace XmlFormatterOsIndependent.Model.Messages; + +/// +/// Message to trigger a setting save +/// +internal class SaveSettingsWindowMessage : ValueChangedMessage +{ + public SaveSettingsWindowMessage(bool value) : base(value) + { + } +} diff --git a/src/XmlFormatterOsIndependent/Model/Messages/SettingsImportedMessage.cs b/src/XmlFormatterOsIndependent/Model/Messages/SettingsImportedMessage.cs new file mode 100644 index 00000000..5987b7b5 --- /dev/null +++ b/src/XmlFormatterOsIndependent/Model/Messages/SettingsImportedMessage.cs @@ -0,0 +1,13 @@ +using CommunityToolkit.Mvvm.Messaging.Messages; + +namespace XmlFormatterOsIndependent.Model.Messages; + +/// +/// Message if a new setting version was imported +/// +internal class SettingsImportedMessage : ValueChangedMessage +{ + internal SettingsImportedMessage(ApplicationSettings value) : base(value) + { + } +} \ No newline at end of file diff --git a/src/XmlFormatterOsIndependent/Properties/Properties.Designer.cs b/src/XmlFormatterOsIndependent/Properties/Properties.Designer.cs index 56e8eaf7..9ae8a453 100644 --- a/src/XmlFormatterOsIndependent/Properties/Properties.Designer.cs +++ b/src/XmlFormatterOsIndependent/Properties/Properties.Designer.cs @@ -104,5 +104,50 @@ public static string GitHub_Project { return ResourceManager.GetString("GitHub_Project", resourceCulture); } } + + /// + /// Looks up a localized string similar to AskBeforeClosing. + /// + public static string Setting_Ask_Before_Closing_Key { + get { + return ResourceManager.GetString("Setting_Ask_Before_Closing_Key", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Default. + /// + public static string Setting_Default_Scope { + get { + return ResourceManager.GetString("Setting_Default_Scope", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SearchUpdateOnStartup. + /// + public static string Setting_Search_Update_On_Startup_Key { + get { + return ResourceManager.GetString("Setting_Search_Update_On_Startup_Key", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Theme. + /// + public static string Setting_Theme_Key { + get { + return ResourceManager.GetString("Setting_Theme_Key", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to UpdateStrategy. + /// + public static string Setting_Update_Strategy_Key { + get { + return ResourceManager.GetString("Setting_Update_Strategy_Key", resourceCulture); + } + } } } diff --git a/src/XmlFormatterOsIndependent/Properties/Properties.resx b/src/XmlFormatterOsIndependent/Properties/Properties.resx index 47a85d1a..84afb871 100644 --- a/src/XmlFormatterOsIndependent/Properties/Properties.resx +++ b/src/XmlFormatterOsIndependent/Properties/Properties.resx @@ -132,4 +132,19 @@ https://github.com/XanatosX/XmlFormatter + + AskBeforeClosing + + + Default + + + SearchUpdateOnStartup + + + Theme + + + UpdateStrategy + \ No newline at end of file diff --git a/src/XmlFormatterOsIndependent/Properties/Resources.Designer.cs b/src/XmlFormatterOsIndependent/Properties/Resources.Designer.cs index a9a87b83..67153cca 100644 --- a/src/XmlFormatterOsIndependent/Properties/Resources.Designer.cs +++ b/src/XmlFormatterOsIndependent/Properties/Resources.Designer.cs @@ -60,6 +60,114 @@ internal Resources() { } } + /// + /// Looks up a localized string similar to Ask before closing. + /// + public static string ApplicationSettingsView_AskBeforeClosing { + get { + return ResourceManager.GetString("ApplicationSettingsView_AskBeforeClosing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Does show a confirmation popup if enabled and you want to close the application. + /// + public static string ApplicationSettingsView_AskBeforeClosing_Tip { + get { + return ResourceManager.GetString("ApplicationSettingsView_AskBeforeClosing_Tip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Check for updates on startup. + /// + public static string ApplicationSettingsView_CheckForUpdateOnStartup { + get { + return ResourceManager.GetString("ApplicationSettingsView_CheckForUpdateOnStartup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Does check if there is new version of the application available as soon as the application starts.. + /// + public static string ApplicationSettingsView_CheckForUpdateOnStartup_Tip { + get { + return ResourceManager.GetString("ApplicationSettingsView_CheckForUpdateOnStartup_Tip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Theme to display the application with. + /// + public static string ApplicationSettingsView_Theme_Tip { + get { + return ResourceManager.GetString("ApplicationSettingsView_Theme_Tip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The updater used to download the update for the application.. + /// + public static string ApplicationSettingsView_Updater_Tip { + get { + return ResourceManager.GetString("ApplicationSettingsView_Updater_Tip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Export Settings. + /// + public static string BackupSettingsView_Export { + get { + return ResourceManager.GetString("BackupSettingsView_Export", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Export failed, because no file was selected or the settings could not be loaded. + /// + public static string BackupSettingsView_ExportFailed { + get { + return ResourceManager.GetString("BackupSettingsView_ExportFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Exporting the settings was successful. + /// + public static string BackupSettingsView_ExportingSettingWasSuccessful { + get { + return ResourceManager.GetString("BackupSettingsView_ExportingSettingWasSuccessful", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Import Settings. + /// + public static string BackupSettingsView_Import { + get { + return ResourceManager.GetString("BackupSettingsView_Import", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not load setting for import, please check the selected file. + /// + public static string BackupSettingsView_ImportedSettingNotLoaded { + get { + return ResourceManager.GetString("BackupSettingsView_ImportedSettingNotLoaded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Importing the setting was successful. + /// + public static string BackupSettingsView_ImportingSettingWasSuccessful { + get { + return ResourceManager.GetString("BackupSettingsView_ImportingSettingWasSuccessful", resourceCulture); + } + } + /// /// Looks up a localized string similar to Load. /// @@ -212,5 +320,68 @@ public static string PluginManagerWindow_Title { return ResourceManager.GetString("PluginManagerWindow_Title", resourceCulture); } } + + /// + /// Looks up a localized string similar to Close. + /// + public static string SettingsWindow_Close { + get { + return ResourceManager.GetString("SettingsWindow_Close", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Save and Close. + /// + public static string SettingsWindow_SaveAndClose { + get { + return ResourceManager.GetString("SettingsWindow_SaveAndClose", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Application. + /// + public static string SettingsWindow_Tab_Application { + get { + return ResourceManager.GetString("SettingsWindow_Tab_Application", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Backup. + /// + public static string SettingsWindow_Tab_Backup { + get { + return ResourceManager.GetString("SettingsWindow_Tab_Backup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hotfolder. + /// + public static string SettingsWindow_Tab_Hotfolder { + get { + return ResourceManager.GetString("SettingsWindow_Tab_Hotfolder", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Logging. + /// + public static string SettingsWindow_Tab_Logging { + get { + return ResourceManager.GetString("SettingsWindow_Tab_Logging", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Settings. + /// + public static string SettingsWindow_Title { + get { + return ResourceManager.GetString("SettingsWindow_Title", resourceCulture); + } + } } } diff --git a/src/XmlFormatterOsIndependent/Properties/Resources.resx b/src/XmlFormatterOsIndependent/Properties/Resources.resx index e24dafd2..138b52e9 100644 --- a/src/XmlFormatterOsIndependent/Properties/Resources.resx +++ b/src/XmlFormatterOsIndependent/Properties/Resources.resx @@ -117,6 +117,30 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Ask before closing + + + Does show a confirmation popup if enabled and you want to close the application + + + Check for updates on startup + + + Does check if there is new version of the application available as soon as the application starts. + + + The Theme to display the application with + + + The updater used to download the update for the application. + + + Export Settings + + + Import Settings + Load @@ -168,4 +192,37 @@ Plugin Manager + + Close + + + Save and Close + + + Application + + + Backup + + + Hotfolder + + + Logging + + + Settings + + + The Export failed, because no file was selected or the settings could not be loaded + + + Could not load setting for import, please check the selected file + + + Exporting the settings was successful + + + Importing the setting was successful + \ No newline at end of file diff --git a/src/XmlFormatterOsIndependent/Services/DependecyInjectionResolverService.cs b/src/XmlFormatterOsIndependent/Services/DependecyInjectionResolverService.cs index 0e934b64..891cbdd2 100644 --- a/src/XmlFormatterOsIndependent/Services/DependecyInjectionResolverService.cs +++ b/src/XmlFormatterOsIndependent/Services/DependecyInjectionResolverService.cs @@ -7,7 +7,7 @@ namespace XmlFormatterOsIndependent.Services; /// /// Service to resolve dependencies /// -public class DependecyInjectionResolverService : IDependecyInjectionResolverService +public class DependecyInjectionResolverService : IDependencyInjectionResolverService { /// /// THe internal service provider diff --git a/src/XmlFormatterOsIndependent/Services/IDependecyInjectionResolverService.cs b/src/XmlFormatterOsIndependent/Services/IDependecyInjectionResolverService.cs index 0bbbd210..e6b81974 100644 --- a/src/XmlFormatterOsIndependent/Services/IDependecyInjectionResolverService.cs +++ b/src/XmlFormatterOsIndependent/Services/IDependecyInjectionResolverService.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; namespace XmlFormatterOsIndependent.Services; -public interface IDependecyInjectionResolverService +public interface IDependencyInjectionResolverService { /// /// Get a service from the service provider diff --git a/src/XmlFormatterOsIndependent/Services/SettingFacadeService.cs b/src/XmlFormatterOsIndependent/Services/SettingFacadeService.cs new file mode 100644 index 00000000..11f777df --- /dev/null +++ b/src/XmlFormatterOsIndependent/Services/SettingFacadeService.cs @@ -0,0 +1,195 @@ +using PluginFramework.DataContainer; +using PluginFramework.Interfaces.Manager; +using PluginFramework.Interfaces.PluginTypes; +using System; +using System.Linq; +using XmlFormatterModel.Setting; +using XmlFormatterOsIndependent.Enums; +using XmlFormatterOsIndependent.Model; + +namespace XmlFormatterOsIndependent.Services; + +/// +/// Facade class to simplify working with the fixed application settings +/// +internal class SettingFacadeService +{ + /// + /// The settings manager to use + /// + private readonly ISettingsManager settingsManager; + + /// + /// The path service used to get the path to the save file + /// + private readonly IPathService pathService; + + /// + /// The plugin manager used to load available plugins + /// + private readonly IPluginManager pluginManager; + + /// + /// Current instance of the application settings, + /// this is working as a cache + /// + private ApplicationSettings? settingsCache; + + /// + /// Create a new instance of this class + /// + /// The settings manager to use for saving and loading of settings + /// The path service to use which does provide the path to the settings file + /// The plugin manager used to check for loaded plugins + public SettingFacadeService( + ISettingsManager settingsManager, + IPathService pathService, + IPluginManager pluginManager) + { + this.settingsManager = settingsManager; + this.pathService = pathService; + this.pluginManager = pluginManager; + } + + /// + /// Get the current application settings, does return cache if data was already loaded + /// + /// The application settings or null if loading did fail + public ApplicationSettings? GetSettings() => GetSettings(false); + + /// + /// Get the current application settings, allows to force reload them from disc + /// + /// Should the settings be loaded even if the are loaded in the cache + /// The application settings or null if loading did fail + public ApplicationSettings? GetSettings(bool forceReload) + { + bool settingWasLoaded = settingsCache is not null; + settingsCache ??= LoadSettings(); + if (forceReload && settingWasLoaded) + { + settingsCache = LoadSettings(); + } + return settingsCache; + } + +/// + /// Get the current application settings, allows to force reload them from disc + /// + /// The path to load the settings from + /// The application settings or null if loading did fail + public ApplicationSettings? GetSettings(string path) + { + bool settingWasLoaded = settingsCache is not null; + return LoadSettings(path); + } + + /// + /// Load the settings and parse them into a application settings class + /// + /// If loading was successful a valid application settings class will be returned + private ApplicationSettings? LoadSettings() => LoadSettings(pathService.GetSettingsFile()); + + /// + /// Load the settings and parse them into a application settings class + /// + /// If loading was successful a valid application settings class will be returned + private ApplicationSettings? LoadSettings(string path) + { + settingsManager.Load(path); + ISettingScope? applicationScope = settingsManager.GetScope(Properties.Properties.Setting_Default_Scope); + if (applicationScope is null) + { + return null; + } + + bool askBeforeClosing = GetSettingsValue(applicationScope, Properties.Properties.Setting_Ask_Before_Closing_Key); + bool checkUpdateOnStart = GetSettingsValue(applicationScope, Properties.Properties.Setting_Search_Update_On_Startup_Key); + + string mode = applicationScope.GetSetting(Properties.Properties.Setting_Theme_Key)?.GetValue() ?? ThemeEnum.Light.ToString(); + Enum.TryParse(typeof(ThemeEnum), mode, out var theme); + + string storedUpdater = GetSettingsValue(applicationScope, Properties.Properties.Setting_Update_Strategy_Key); + PluginMetaData? updater = pluginManager.ListPlugins() + .OfType() + .ToList().FirstOrDefault(item => item.Type.ToString() == storedUpdater); + ThemeEnum realTheme = ThemeEnum.Light; + if (theme is ThemeEnum loadedTheme) + { + realTheme = loadedTheme; + } + + return new ApplicationSettings + { + AskBeforeClosing = askBeforeClosing, + CheckForUpdatesOnStartup = checkUpdateOnStart, + Theme = realTheme, + Updater = updater + }; + } + + /// + /// Get a specific settings value + /// + /// Type of the value to get + /// Name of the value to get + /// The value casted to the given type + private T GetSettingsValue(ISettingScope scope, string name) + { + ISettingPair settingPair = scope.GetSetting(name); + return settingPair == null ? default : settingPair.GetValue(); + } + + /// + /// Update the setting for the application + /// + /// The update action + /// The updated settings if saving was completed successfully + public ApplicationSettings? UpdateSettings(Action updateSettings) + { + ApplicationSettings? loadedSettings = GetSettings(true); + updateSettings(loadedSettings ?? new ApplicationSettings()); + if (loadedSettings is not null) + { + SaveSettings(loadedSettings); + } + + return loadedSettings; + } + + /// + /// Save the given settings to the disc + /// + /// The settings which should be saved + /// The newly saved settings + public ApplicationSettings SaveSettings(ApplicationSettings settings)=> SaveSettings(settings, pathService.GetSettingsFile()); + + /// + /// Save the given settings to the disc + /// + /// The settings which should be saved + /// The path to save the setting to + /// The newly saved settings + public ApplicationSettings SaveSettings(ApplicationSettings settings, string path) + { + ISettingPair askClose = new SettingPair(Properties.Properties.Setting_Ask_Before_Closing_Key); + ISettingPair searchUpdate = new SettingPair(Properties.Properties.Setting_Search_Update_On_Startup_Key); + ISettingPair updater = new SettingPair(Properties.Properties.Setting_Update_Strategy_Key); + ISettingPair themeMode = new SettingPair(Properties.Properties.Setting_Theme_Key); + askClose.SetValue(settings.AskBeforeClosing); + searchUpdate.SetValue(settings.CheckForUpdatesOnStartup); + updater.SetValue(settings.Updater?.Type.ToString()); + themeMode.SetValue(settings.Theme.ToString()); + + settingsManager.Load(pathService.GetSettingsFile()); + ISettingScope applicationScope = settingsManager.GetScope(Properties.Properties.Setting_Default_Scope); + applicationScope.AddSetting(askClose); + applicationScope.AddSetting(searchUpdate); + applicationScope.AddSetting(updater); + applicationScope.AddSetting(themeMode); + + settingsManager.Save(path); + return settings; + } + +} diff --git a/src/XmlFormatterOsIndependent/Services/WindowApplicationService.cs b/src/XmlFormatterOsIndependent/Services/WindowApplicationService.cs index d80a5aab..85186dc3 100644 --- a/src/XmlFormatterOsIndependent/Services/WindowApplicationService.cs +++ b/src/XmlFormatterOsIndependent/Services/WindowApplicationService.cs @@ -20,13 +20,13 @@ public class WindowApplicationService : IWindowApplicationService /// /// The resolver service used to load the windows /// - private readonly IDependecyInjectionResolverService injectionResolverService; + private readonly IDependencyInjectionResolverService injectionResolverService; /// /// Create a new instance of the service /// /// The resolver service used to load the windows - public WindowApplicationService(IDependecyInjectionResolverService injectionResolverService) + public WindowApplicationService(IDependencyInjectionResolverService injectionResolverService) { this.injectionResolverService = injectionResolverService; } diff --git a/src/XmlFormatterOsIndependent/ViewModels/ApplicationSettingsBackupViewModel.cs b/src/XmlFormatterOsIndependent/ViewModels/ApplicationSettingsBackupViewModel.cs new file mode 100644 index 00000000..56f0deb4 --- /dev/null +++ b/src/XmlFormatterOsIndependent/ViewModels/ApplicationSettingsBackupViewModel.cs @@ -0,0 +1,90 @@ +using Avalonia.Controls; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using System.Collections.Generic; +using XmlFormatterOsIndependent.Model.Messages; +using XmlFormatterOsIndependent.Services; + +namespace XmlFormatterOsIndependent.ViewModels; + +internal partial class ApplicationSettingsBackupViewModel : ObservableObject +{ + /// + /// The current message for the backup view + /// + [ObservableProperty] + private string currentMessage; + + /// + /// Service used to load and save settings + /// + private readonly SettingFacadeService settingFacade; + + /// + /// Service used to open save file or open file dialogs + /// + private readonly IWindowApplicationService windowService; + + public ApplicationSettingsBackupViewModel( + SettingFacadeService settingFacadeService, + IWindowApplicationService windowService) + { + CurrentMessage = string.Empty; + settingFacade = settingFacadeService; + this.windowService = windowService; + } + + /// + /// Method to export the settings from the application to the disc + /// + /// Nothing + [RelayCommand] + public async void ExportSettings() + { + var file = await windowService.SaveFileAsync(new List{ + new() { Name = "Xml", Extensions = new List{ "xml" } } + }); + var settings = settingFacade.GetSettings(); + if (string.IsNullOrEmpty(file) || settings is null) + { + CurrentMessage = Properties.Resources.BackupSettingsView_ExportFailed; + return; + } + + if (settingFacade.SaveSettings(settings, file) is not null) + { + CurrentMessage = Properties.Resources.BackupSettingsView_ExportingSettingWasSuccessful; + } + } + + /// + /// Method to import a given setting file into the application + /// + /// Nothing + [RelayCommand] + public async void ImportSettings() + { + var file = await windowService.OpenFileAsync(new List{ + new() { Name = "Xml", Extensions = new List{ "xml" } } + }); + if (file is null) + { + //@Todo popup would be nice + return; + } + var loadedSettings = settingFacade.GetSettings(file); + if (loadedSettings is null) + { + CurrentMessage = Properties.Resources.BackupSettingsView_ImportedSettingNotLoaded; + //@Todo popup would be nice + return; + } + if (settingFacade.SaveSettings(loadedSettings) is not null) + { + CurrentMessage = Properties.Resources.BackupSettingsView_ImportingSettingWasSuccessful; + WeakReferenceMessenger.Default.Send(new SettingsImportedMessage(loadedSettings)); + } + + } +} diff --git a/src/XmlFormatterOsIndependent/ViewModels/ApplicationSettingsViewModel.cs b/src/XmlFormatterOsIndependent/ViewModels/ApplicationSettingsViewModel.cs new file mode 100644 index 00000000..4aac3004 --- /dev/null +++ b/src/XmlFormatterOsIndependent/ViewModels/ApplicationSettingsViewModel.cs @@ -0,0 +1,134 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Messaging; +using PluginFramework.DataContainer; +using PluginFramework.Interfaces.Manager; +using PluginFramework.Interfaces.PluginTypes; +using System; +using System.Collections.Generic; +using System.Linq; +using XmlFormatterOsIndependent.Enums; +using XmlFormatterOsIndependent.Model; +using XmlFormatterOsIndependent.Model.Messages; +using XmlFormatterOsIndependent.Services; + +namespace XmlFormatterOsIndependent.ViewModels; +internal partial class ApplicationSettingsViewModel : ObservableObject +{ + /// + /// A list with all the available updaters + /// + [ObservableProperty] + private List availableUpdaters; + + /// + /// The currently selected updater + /// + [ObservableProperty] + private PluginMetaDataViewModel? updater; + + /// + /// A list with all the themes to choose from + /// + [ObservableProperty] + private List themes; + + /// + /// The currently selected theme + /// + [ObservableProperty] + private string selectedTheme; + + /// + /// Private acces for ask before closing setting + /// + [ObservableProperty] + private bool askBeforeClosing; + + /// + /// Private check for updates on start + /// + [ObservableProperty] + private bool checkUpdateOnStart; + private readonly IThemeService themeService; + private readonly SettingFacadeService settingFacadeService; + + public ApplicationSettingsViewModel( + IThemeService themeService, + IPluginManager pluginManager, + SettingFacadeService settingFacadeService) + { + this.themeService = themeService; + this.settingFacadeService = settingFacadeService; + + AvailableUpdaters = pluginManager.ListPlugins() + .OfType() + .Select(entry => new PluginMetaDataViewModel(entry)) + .ToList(); + Themes = Enum.GetValues() + .Select(theme => theme.ToString()) + .ToList(); + Updater = AvailableUpdaters.FirstOrDefault(); + PropertyChanged += (_, data) => + { + if (data.PropertyName == nameof(SelectedTheme)) + { + ThemeEnum currentTheme = ThemeEnum.Light; + Enum.TryParse(SelectedTheme, out currentTheme); + themeService.ChangeTheme(currentTheme); + } + }; + + SetSettingsFromApplicationSetting(settingFacadeService.GetSettings(true) ?? new ApplicationSettings()); + + WeakReferenceMessenger.Default.Register(this, (_, data) => SetSettingsFromApplicationSetting(data.Value)); + WeakReferenceMessenger.Default.Register(this, (_, _) => SaveSettings()); + } + + /// + /// This method will set all the setting entries into the correct field + /// + /// The application settings to load + private void SetSettingsFromApplicationSetting(ApplicationSettings applicationSettings) + { + if (applicationSettings is null) + { + return; + } + AskBeforeClosing = applicationSettings.AskBeforeClosing; + CheckUpdateOnStart = applicationSettings.CheckForUpdatesOnStartup; + SelectedTheme = applicationSettings.Theme.ToString(); + if (applicationSettings.Updater is not null) + { + Updater = AvailableUpdaters?.FirstOrDefault(item => item.UpdaterType == applicationSettings.Updater.Type); + } + } + + /// + /// Save the settings for the application data + /// + private void SaveSettings() + { + settingFacadeService.UpdateSettings(settings => + { + settings.AskBeforeClosing = AskBeforeClosing; + settings.CheckForUpdatesOnStartup = CheckUpdateOnStart; + ThemeEnum currentTheme = ThemeEnum.Light; + Enum.TryParse(SelectedTheme, out currentTheme); + settings.Theme = currentTheme; + settings.Updater = Updater?.MetaData; + }); + + ThemeEnum themeToUse = settingFacadeService.GetSettings()?.Theme ?? ThemeEnum.Light; + themeService.ChangeTheme(themeToUse); + } + + /// + /// Destructor for this user view, this is required to enforce unregister of message hook + /// + ~ApplicationSettingsViewModel() + { + WeakReferenceMessenger.Default.UnregisterAll(this); + } + + +} diff --git a/src/XmlFormatterOsIndependent/ViewModels/MainWindowViewModel.cs b/src/XmlFormatterOsIndependent/ViewModels/MainWindowViewModel.cs index d1cbd0d0..7bc56995 100644 --- a/src/XmlFormatterOsIndependent/ViewModels/MainWindowViewModel.cs +++ b/src/XmlFormatterOsIndependent/ViewModels/MainWindowViewModel.cs @@ -147,7 +147,7 @@ public MainWindowViewModel(ISettingsManager settingsManager, } settingsManager.Load(pathService.GetSettingsFile()); var settings = settingsManager.GetScope("Default"); - string themeString = settings.GetSetting("Theme").GetValue(); + string themeString = settings?.GetSetting("Theme")?.GetValue() ?? ThemeEnum.Light.ToString(); Enum.TryParse(themeString, out ThemeEnum value); themeService.ChangeTheme(value); StatusString = string.Format(Properties.Resources.MainWindow_Status_Template, string.Empty); diff --git a/src/XmlFormatterOsIndependent/ViewModels/PluginMetaDataViewModel.cs b/src/XmlFormatterOsIndependent/ViewModels/PluginMetaDataViewModel.cs new file mode 100644 index 00000000..901b9b50 --- /dev/null +++ b/src/XmlFormatterOsIndependent/ViewModels/PluginMetaDataViewModel.cs @@ -0,0 +1,35 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using PluginFramework.DataContainer; +using System; + +namespace XmlFormatterOsIndependent.ViewModels; + +/// +/// View model for a single plugin +/// +internal class PluginMetaDataViewModel : ObservableObject +{ + /// + /// The plugin meta data + /// + public PluginMetaData MetaData { get; } + + /// + /// The display name for the given entry + /// + public string DisplayName => MetaData.Information.Name; + + /// + /// The type of the updater to use + /// + public Type UpdaterType => MetaData.Type; + + /// + /// Create a new instance of this class + /// + /// The meta data to use as a base data set + public PluginMetaDataViewModel(PluginMetaData metaData) + { + MetaData = metaData; + } +} diff --git a/src/XmlFormatterOsIndependent/ViewModels/SettingsWindowViewModel.cs b/src/XmlFormatterOsIndependent/ViewModels/SettingsWindowViewModel.cs index 0db5a651..fa2a95ca 100644 --- a/src/XmlFormatterOsIndependent/ViewModels/SettingsWindowViewModel.cs +++ b/src/XmlFormatterOsIndependent/ViewModels/SettingsWindowViewModel.cs @@ -1,13 +1,7 @@ -using CommunityToolkit.Mvvm.Input; -using PluginFramework.DataContainer; -using PluginFramework.Interfaces.Manager; -using PluginFramework.Interfaces.PluginTypes; -using ReactiveUI; -using System.Collections.Generic; -using System.Linq; -using XmlFormatterModel.Setting; -using XmlFormatterOsIndependent.Commands; -using XmlFormatterOsIndependent.Enums; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using XmlFormatterOsIndependent.Model.Messages; using XmlFormatterOsIndependent.Services; namespace XmlFormatterOsIndependent.ViewModels @@ -15,85 +9,21 @@ namespace XmlFormatterOsIndependent.ViewModels /// /// View model class for the settings window /// - public partial class SettingsWindowViewModel : ViewModelBase + public partial class SettingsWindowViewModel : ObservableObject { + [ObservableProperty] + private ObservableObject? settingsBackupContent; - /// - /// A list with all the update strategies - /// - public List List { get; } - - /// - /// Ask before closing setting - /// - public bool AskBeforeClosing - { - get => askBeforeClosing; - set => this.RaiseAndSetIfChanged(ref askBeforeClosing, value); - } - /// - /// Private acces for ask before closing setting - /// - private bool askBeforeClosing; + [ObservableProperty] + private ObservableObject? applicationSettingsContent; - /// - /// The selected theme index - /// - public int ThemeMode - { - get => themeMode; - set => this.RaiseAndSetIfChanged(ref themeMode, value); - } - /// - /// Private selected theme index - /// - private int themeMode; - - /// - /// Check for updates on start - /// - public bool CheckUpdateOnStart - { - get => checkUpdateOnStart; - set => this.RaiseAndSetIfChanged(ref checkUpdateOnStart, value); - } - /// - /// Private check for updates on start - /// - private bool checkUpdateOnStart; - - /// - /// The current updater to use - /// - public PluginMetaData Updater - { - get => updater; - set => this.RaiseAndSetIfChanged(ref updater, value); - } - /// - /// Private updater to use - /// - private PluginMetaData updater; + [ObservableProperty] + private ObservableObject? loggingContent; - /// - /// Index of the selected updater - /// - public int UpdaterIndex - { - get => updaterIndex; - set => this.RaiseAndSetIfChanged(ref updaterIndex, value); - } - /// - /// Private index of the selected updater - /// - private int updaterIndex; + [ObservableProperty] + private ObservableObject? hotfolderContent; - /// - /// The setting scope of this application - /// - private readonly ISettingScope applicationScope; private readonly IWindowApplicationService applicationService; - private readonly IThemeService themeService; /// /// Create a new instance of this view @@ -101,71 +31,14 @@ public int UpdaterIndex /// The view for this model /// The settings manager to use /// The plugin manager to use - public SettingsWindowViewModel(ISettingsManager settingsManager, IPluginManager pluginManager, IWindowApplicationService applicationService, IThemeService themeService) - : base(settingsManager, pluginManager) + public SettingsWindowViewModel( + IWindowApplicationService applicationService, + IDependencyInjectionResolverService resolverService) { - - if (this.settingsManager == null || this.pluginManager == null) - { - return; - } - this.settingsManager.Load(settingsPath); - applicationScope = this.settingsManager.GetScope("Default"); - List = pluginManager.ListPlugins().ToList(); - - if (applicationScope == null) - { - applicationScope = new SettingScope("Default"); - this.settingsManager.AddScope(applicationScope); - } - LoadSettings(); this.applicationService = applicationService; - this.themeService = themeService; - } - /// - /// Load all the settings - /// - private void LoadSettings() - { - AskBeforeClosing = GetSettingsValue("AskBeforeClosing"); - CheckUpdateOnStart = GetSettingsValue("SearchUpdateOnStartup"); - IDataCommand getTheme = new GetThemeCommand(); - ExecuteCommand(getTheme, settingsManager); - ThemeMode = (int)getTheme.GetData(); - - string updater = GetSettingsValue("UpdateStrategy"); - int updaterToUse = -1; - if (List.Count > 0) - { - updaterToUse = 0; - } - - for (int i = 0; i < List.Count; i++) - { - if (List[i].Type.ToString() == updater) - { - updaterToUse = i; - break; - } - } - - if (updaterToUse >= 0) - { - UpdaterIndex = updaterToUse; - } - } - - /// - /// Get a specific settings value - /// - /// Type of the value to get - /// Name of the value to get - /// The value casted to the given type - private T GetSettingsValue(string name) - { - ISettingPair settingPair = applicationScope.GetSetting(name); - return settingPair == null ? default : settingPair.GetValue(); + settingsBackupContent = resolverService.GetService(); + applicationSettingsContent = resolverService.GetService(); } [RelayCommand] @@ -179,24 +52,7 @@ public void CloseWindow() /// public void SaveAndClose() { - ThemeEnum theme = ThemeMode == 0 ? ThemeEnum.Light : ThemeEnum.Dark; - - ISettingPair askClose = new SettingPair("AskBeforeClosing"); - ISettingPair searchUpdate = new SettingPair("SearchUpdateOnStartup"); - ISettingPair updater = new SettingPair("UpdateStrategy"); - ISettingPair themeMode = new SettingPair("Theme"); - askClose.SetValue(AskBeforeClosing); - searchUpdate.SetValue(CheckUpdateOnStart); - updater.SetValue(Updater.Type.ToString()); - themeMode.SetValue(theme.ToString()); - - themeService.ChangeTheme(theme); - - applicationScope.AddSetting(askClose); - applicationScope.AddSetting(searchUpdate); - applicationScope.AddSetting(updater); - applicationScope.AddSetting(themeMode); - settingsManager.Save(settingsPath); + WeakReferenceMessenger.Default.Send(new SaveSettingsWindowMessage(true)); CloseWindowCommand.Execute(null); } } diff --git a/src/XmlFormatterOsIndependent/Views/ApplicationSettingsBackupView.axaml b/src/XmlFormatterOsIndependent/Views/ApplicationSettingsBackupView.axaml new file mode 100644 index 00000000..925776fe --- /dev/null +++ b/src/XmlFormatterOsIndependent/Views/ApplicationSettingsBackupView.axaml @@ -0,0 +1,13 @@ + + + - - - + + + + + + + + + + + + + + + + + + +