Skip to content

Commit

Permalink
Merge pull request #82 from XanatosX/develop
Browse files Browse the repository at this point in the history
Version 0.0.8
  • Loading branch information
XanatosX authored May 19, 2020
2 parents 56ac5ed + 06d585a commit 2591687
Show file tree
Hide file tree
Showing 78 changed files with 3,431 additions and 370 deletions.
9 changes: 7 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
**What is this Pull-Request about**

What did get fixed.
What was extended or implemented.
What did you change.

**What issue is this Pull-Request solving**

As example type `closes #` or `fixing #`.

** How hat this been tested? **

Which tests did you run to verify your changes?

* [x] Test A
* [ ] Test B

** Checklist **

* [ ] **IMPORTANT** I have checked that this pull request is targeting the develop branch
* [ ] I have reviewed my code
* [ ] I have added all the required summary tests
* [ ] I have reviewed my code
* [ ] I have added all the required summary blocks to my classes, methods and variables/fields

**Special information required for reviewing or testing**

Write down any special information the reviewer could need for his or her review or any information to test this Pull-Request.

Please write comments on the `changed files` tab to the code if you want to explain something more into detail to the reviewers.
Binary file added .github/Screenshots/ActivateHotfolder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/Screenshots/AddPathToFile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Screenshots/ConverterSelection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Screenshots/GeneralHotfolderSettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Screenshots/InstallationFolder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Screenshots/JsonExample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/Screenshots/ModeSelection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Screenshots/OpenPluginManager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Screenshots/OpenSettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Screenshots/PluginFolder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Screenshots/PluginSelected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/Screenshots/SelectButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions .github/workflows/CheckPullRequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check pull request

on: [pull_request]

jobs:
build:
name: Check pull request
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.0
- name: Build project
run: msbuild /t:Build /p:Configuration=Release
shell: powershell
75 changes: 75 additions & 0 deletions .github/workflows/CreateLiveBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Live build

on:
push:
tags:
- '*'

jobs:
build:
name: Create live versioned build artifact
runs-on: windows-latest
steps:
- name: Clone Repository
uses: actions/checkout@v2
with:
ref: master
- name: Get Current Tag
run: echo "::set-env name=tag::$(($env:GITHUB_REF -split '/')[-1] -replace ' ','')"
- name: Install NuGet
uses: nuget/setup-nuget@v1
- name: Install msbuild
uses: microsoft/setup-msbuild@v1.0.0
- name: Build Project
run: |
nuget restore
echo $env:tag > .\XmlFormatter\Version.txt
msbuild /t:Build /p:Configuration=Release
shell: powershell
- name: Create Artifacts
run: |
$xmlFormatter = -join($env:tag, "_XmlFormatter.zip")
$jsonPlugin = -join($env:tag, "_JsonPlugin.zip")
echo "::set-env name=xmlFormatter::$($xmlFormatter)"
echo "::set-env name=jsonPlugin::$($JsonPlugin)"
mkdir ..\Artifacts
mkdir ..\Artifacts\XmlFormatter\
mkdir ..\Artifacts\JsonPlugin\
mv .\XmlFormatter\bin\Release\** ..\Artifacts\XmlFormatter\
mv LICENSE ..\Artifacts\XmlFormatter\
cd ..\Artifacts\
mv .\XmlFormatter\Plugins\*Json*.dll .\JsonPlugin\
7z a $xmlFormatter .\XmlFormatter\**
7z a $jsonPlugin .\JsonPlugin\**
shell: powershell
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release - ${{ env.tag }}
body: Body goes here!
draft: true
prerelease: false
- name: Upload XmlFormatter Release Asset
id: upload-application-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ..\Artifacts\${{ env.xmlFormatter }}
asset_name: ${{ env.xmlFormatter }}
asset_content_type: application/zip
- name: Upload JsonPlugin Release Asset
id: upload-plugin-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ..\Artifacts\${{ env.jsonPlugin }}
asset_name: ${{ env.jsonPlugin }}
asset_content_type: application/zip
68 changes: 68 additions & 0 deletions .github/workflows/LatestBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Latest unstable build

on:
pull_request:
types: [closed]

jobs:
build:
if: github.event.pull_request.merged == true
name: Create latest build artifact
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
ref: develop
- name: Install nuget
uses: nuget/setup-nuget@v1
- name: Setup msbuild
uses: microsoft/setup-msbuild@v1.0.0
- name: Build project
run: |
nuget restore
msbuild /t:Build /p:Configuration=Release
shell: powershell
- name: Create artifacts
run: |
mkdir ..\Artifacts
mkdir ..\Artifacts\XmlFormatter\
mkdir ..\Artifacts\JsonPlugin\
mv .\XmlFormatter\bin\Release\** ..\Artifacts\XmlFormatter\
mv LICENSE ..\Artifacts\XmlFormatter\
cd ..\Artifacts\
mv .\XmlFormatter\Plugins\*Json*.dll .\JsonPlugin\
7z a LatestDevelopment_XmlFormatter.zip .\XmlFormatter\**
7z a LatestDevelopment_JsonPlugin.zip .\JsonPlugin\**
shell: powershell
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}-${{ GITHUB.RUN_NUMBER }}
release_name: Latest unstable
body: You cannot update this version from within the application!
draft: false
prerelease: true
- name: Upload XmlFormatter Release Asset
id: upload-application-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ..\Artifacts\LatestDevelopment_XmlFormatter.zip
asset_name: LatestDevelopment_XmlFormatter.zip
asset_content_type: application/zip
- name: Upload Json Plugin Release Asset
id: upload-plugin-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ..\Artifacts\LatestDevelopment_JsonPlugin.zip
asset_name: LatestDevelopment_JsonPlugin.zip
asset_content_type: application/zip
63 changes: 63 additions & 0 deletions CorePlugin/CorePlugin.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3E81CFB2-ADEE-4B81-BC13-F6CE8546F9C9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CorePlugin</RootNamespace>
<AssemblyName>CorePlugin</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Octokit, Version=0.47.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Octokit.0.47.0\lib\net46\Octokit.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="src\Formatter\XmlFormatterProvider.cs" />
<Compile Include="src\Updating\DownloadGitHubReleaseStrategy.cs" />
<Compile Include="src\Updating\OpenGitHubReleasesStrategy.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PluginFramework\PluginFramework.csproj">
<Project>{9808f069-6dc1-4c26-a434-16630fc697e8}</Project>
<Name>PluginFramework</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
35 changes: 35 additions & 0 deletions CorePlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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("CorePlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CorePlugin")]
[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("3e81cfb2-adee-4b81-bc13-f6ce8546f9c9")]

// 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")]
4 changes: 4 additions & 0 deletions CorePlugin/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Octokit" version="0.47.0" targetFramework="net472" />
</packages>
91 changes: 91 additions & 0 deletions CorePlugin/src/Formatter/XmlFormatterProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using PluginFramework.src.DataContainer;
using PluginFramework.src.Formatter;
using System;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace CorePlugin.src.Formatter
{
/// <summary>
/// A xml formatter class instance
/// </summary>
class XmlFormatterProvider : BaseFormatter
{
/// <summary>
/// Create a new instance of this class
/// </summary>
public XmlFormatterProvider() : base("xml", new PluginInformation("Xml Formatter", "Convert xml files", "XanatosX", new Version(1, 0)))
{
}

/// <inheritdoc/>
public override bool ConvertToFlat(string filePath, string outputName)
{
FormatFile(filePath, outputName, SaveOptions.DisableFormatting);
return true;
}

/// <inheritdoc/>
public override bool ConvertToFormatted(string filePath, string outputName)
{
FormatFile(filePath, outputName, SaveOptions.None);
return true;
}

/// <summary>
/// This method will convert the file
/// </summary>
/// <param name="inputFilePath">The input file to convert</param>
/// <param name="outputName">The output file to generate</param>
/// <param name="options">The save options to use</param>
private async void FormatFile(string inputFilePath, string outputName, SaveOptions options)
{
if (!IsFileReadableWriteable(inputFilePath, outputName))
{
FireEvent("Saving failed", "Files where locked!");
return;
}

FireEvent("Loading", "Loading ...");
XElement fileToConvert = await Task<XElement>.Run(() =>
{
XElement returnElement;
try
{
returnElement = XElement.Load(inputFilePath);
}
catch (Exception)
{
FireEvent("Input file not valid", "The input file was not valid!");
returnElement = null;
}
return returnElement;
});

if (fileToConvert == null)
{
return;
}

FireEvent("Saving", "Saving ...");
bool saveSuccess = await Task<bool>.Run(() =>
{
try
{
fileToConvert.Save(outputName, options);
return true;
}
catch (Exception)
{
FireEvent("Saving did fail", "Saving went wrong, maybe the file was used?");
return false;
}
});

if (saveSuccess)
{
FireEvent("Done", "Saving done!");
}
}
}
}
Loading

0 comments on commit 2591687

Please sign in to comment.