Making the initial stuff working, getting an installer, when running from VS.

This commit is contained in:
Krom, Robertus 2020-02-04 15:29:10 +01:00
commit 57e2044839
1023 changed files with 20896 additions and 19456 deletions

View file

@ -139,20 +139,15 @@ namespace ExternalCommand {
/// </summary>
/// <param name="property">The property to return a default for</param>
/// <returns>object with the default value for the supplied property</returns>
public override object GetDefault(string property) {
switch(property) {
case nameof(DeletedBuildInCommands):
return new List<string>();
case nameof(Commands):
return new List<string>();
case nameof(Commandline):
return new Dictionary<string, string>();
case nameof(Argument):
return new Dictionary<string, string>();
case nameof(RunInbackground):
return new Dictionary<string, bool>();
}
return null;
}
}
public override object GetDefault(string property) =>
property switch
{
nameof(DeletedBuildInCommands) => (object) new List<string>(),
nameof(Commands) => new List<string>(),
nameof(Commandline) => new Dictionary<string, string>(),
nameof(Argument) => new Dictionary<string, string>(),
nameof(RunInbackground) => new Dictionary<string, bool>(),
_ => null
};
}
}

View file

@ -171,47 +171,46 @@ namespace ExternalCommand {
string arguments = config.Argument[commando];
output = null;
error = null;
if (!string.IsNullOrEmpty(commandline)) {
using (Process process = new Process())
{
// Fix variables
commandline = FilenameHelper.FillVariables(commandline, true);
commandline = FilenameHelper.FillCmdVariables(commandline, true);
if (!string.IsNullOrEmpty(commandline))
{
using Process process = new Process();
// Fix variables
commandline = FilenameHelper.FillVariables(commandline, true);
commandline = FilenameHelper.FillCmdVariables(commandline, true);
arguments = FilenameHelper.FillVariables(arguments, false);
arguments = FilenameHelper.FillCmdVariables(arguments, false);
arguments = FilenameHelper.FillVariables(arguments, false);
arguments = FilenameHelper.FillCmdVariables(arguments, false);
process.StartInfo.FileName = FilenameHelper.FillCmdVariables(commandline, true);
process.StartInfo.Arguments = FormatArguments(arguments, fullPath);
process.StartInfo.UseShellExecute = false;
if (config.RedirectStandardOutput) {
process.StartInfo.RedirectStandardOutput = true;
}
if (config.RedirectStandardError) {
process.StartInfo.RedirectStandardError = true;
}
if (verb != null) {
process.StartInfo.Verb = verb;
}
LOG.InfoFormat("Starting : {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
process.Start();
process.WaitForExit();
if (config.RedirectStandardOutput) {
output = process.StandardOutput.ReadToEnd();
if (config.ShowStandardOutputInLog && output.Trim().Length > 0) {
LOG.InfoFormat("Output:\n{0}", output);
}
}
if (config.RedirectStandardError) {
error = process.StandardError.ReadToEnd();
if (error.Trim().Length > 0) {
LOG.WarnFormat("Error:\n{0}", error);
}
}
LOG.InfoFormat("Finished : {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
return process.ExitCode;
}
}
process.StartInfo.FileName = FilenameHelper.FillCmdVariables(commandline, true);
process.StartInfo.Arguments = FormatArguments(arguments, fullPath);
process.StartInfo.UseShellExecute = false;
if (config.RedirectStandardOutput) {
process.StartInfo.RedirectStandardOutput = true;
}
if (config.RedirectStandardError) {
process.StartInfo.RedirectStandardError = true;
}
if (verb != null) {
process.StartInfo.Verb = verb;
}
LOG.InfoFormat("Starting : {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
process.Start();
process.WaitForExit();
if (config.RedirectStandardOutput) {
output = process.StandardOutput.ReadToEnd();
if (config.ShowStandardOutputInLog && output.Trim().Length > 0) {
LOG.InfoFormat("Output:\n{0}", output);
}
}
if (config.RedirectStandardError) {
error = process.StandardError.ReadToEnd();
if (error.Trim().Length > 0) {
LOG.WarnFormat("Error:\n{0}", error);
}
}
LOG.InfoFormat("Finished : {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
return process.ExitCode;
}
return -1;
}

View file

@ -1,114 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" />
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<ProjectGuid>{47F23C86-604E-4CC3-8767-B3D4088F30BB}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>GreenshotExternalCommandPlugin</RootNamespace>
<AssemblyName>GreenshotExternalCommandPlugin</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<None Include="Languages\language*.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="ExternalCommandDestination.cs" />
<Compile Include="ExternalCommandForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ExternalCommandPlugin.cs" />
<Compile Include="IconCache.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ExternalCommandConfiguration.cs" />
<Compile Include="SettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SettingsForm.Designer.cs">
<DependentUpon>SettingsForm.cs</DependentUpon>
</Compile>
<Compile Include="SettingsFormDetail.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SettingsFormDetail.Designer.cs">
<DependentUpon>SettingsFormDetail.cs</DependentUpon>
</Compile>
<None Include="Languages\language_externalcommandplugin-en-US.xml" />
<ProjectReference Include="..\GreenshotPlugin\GreenshotPlugin.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GreenshotPlugin\GreenshotPlugin.csproj">
<Project>{5b924697-4dcd-4f98-85f1-105cb84b7341}</Project>
<Name>GreenshotPlugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="log4net">
<Version>2.0.8</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"
mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>x86</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DebugType>Full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>TRACE</DefineConstants>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DebugType>None</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
</Project>
</Project>

View file

@ -26,22 +26,9 @@ 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("GreenshotExternalCommandPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("External command Plugin")]
[assembly: AssemblyCopyright("Copyright (C) 2007-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The PluginAttribute describes the "entryType" and if the plugin is configurable
[assembly: PluginAttribute("ExternalCommand.ExternalCommandPlugin", true)]
[assembly: Plugin("ExternalCommand.ExternalCommandPlugin", true)]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version, replaced by build scripts
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]