Making it possible to compile the first projects [skip ci]

This commit is contained in:
Robin 2018-11-04 23:32:15 +01:00
commit c4b686e96c
34 changed files with 244 additions and 441 deletions

View file

@ -9,10 +9,12 @@
<PackageLicenseUrl>https://www.gnu.org/licenses/gpl.html</PackageLicenseUrl>
<LangVersion>latest</LangVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<DisableImplicitFrameworkReferences Condition="'$(TargetFramework)' == 'net461'">true</DisableImplicitFrameworkReferences>
<!-- <DisableImplicitFrameworkReferences Condition="'$(TargetFramework)' == 'net471'">true</DisableImplicitFrameworkReferences> -->
<CopyLocalLockFileAssemblies Condition="'$(TargetFramework)' != 'net471'">true</CopyLocalLockFileAssemblies>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
<AssemblySearchPaths Condition="'$(TargetFramework)' == 'net471'">{HintPathFromItem};{TargetFrameworkDirectory};{RawFileName};</AssemblySearchPaths>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' != 'Debug' And !$(MSBuildProjectName.Contains('Test')) And !$(MSBuildProjectName.Contains('Demo'))">
@ -41,7 +43,7 @@
<DebugSymbols>True</DebugSymbols>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<ItemGroup Condition="'$(TargetFramework)' == 'net471'">
<!--ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View file

@ -21,7 +21,6 @@
#endregion
#if !NETCOREAPP30
#region Usings
using System;
@ -360,4 +359,3 @@ namespace Greenshot.Addon.InternetExplorer
#endregion
}
}
#endif

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
@ -9,7 +9,7 @@
<FrameworkReference Include="Microsoft.DesktopUI" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net471' ">
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
@ -34,10 +34,10 @@
<ItemGroup>
<PackageReference Include="Dapplo.Windows">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
<PackageReference Include="Dapplo.Windows.Com">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
<PackageReference Include="Unofficial.Microsoft.mshtml" Version="7.0.3300" />
</ItemGroup>

View file

@ -108,14 +108,18 @@ namespace Greenshot.Addon.InternetExplorer {
{
continue;
}
#if !NETCOREAPP30
#if !NETCOREAPP3_0
var ieAccessible = new Accessible(directUiWd.Handle);
foreach (var url in ieAccessible.IETabUrls)
{
yield return url;
}
#endif
}
}
#if NETCOREAPP3_0
return Enumerable.Empty<string>();
#endif
}
}
}

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
@ -9,7 +9,7 @@
<FrameworkReference Include="Microsoft.DesktopUI" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net471' ">
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
@ -51,19 +51,19 @@
<Version>2.0.4</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Configuration">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Translations">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.HttpExtensions">
<Version>0.9.6</Version>
</PackageReference>
<PackageReference Include="Dapplo.Windows.Clipboard">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
<PackageReference Include="Dapplo.Windows.Icons">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
</ItemGroup>
</Project>

View file

@ -41,7 +41,7 @@ namespace Greenshot.Addons.Controls
/// </summary>
public class AnimatingForm : GreenshotForm
{
private readonly ICoreConfiguration _coreConfiguration;
protected readonly ICoreConfiguration _coreConfiguration;
private const int DefaultVerticalRefresh = 60;
private static readonly LogSource Log = new LogSource();
private Timer _timer;

View file

@ -25,6 +25,7 @@
using System.Drawing;
using System.Windows.Forms;
using Dapplo.Windows.Common.Structs;
using Greenshot.Addons.Config.Impl;
using Greenshot.Addons.Core;
using Greenshot.Gfx;
@ -45,7 +46,7 @@ namespace Greenshot.Addons.Controls
private bool _newImage;
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
if (_scaledCheckbox == null || _scaledCheckbox.Size != CoreConfig.IconSize)
if (_scaledCheckbox == null || (NativeSize)_scaledCheckbox.Size != CoreConfig.IconSize)
{
if (_newImage)
{

View file

@ -192,11 +192,11 @@ EndSelection:<<<<<<<4
var clipboardOwner = GetClipboardOwner();
if (clipboardOwner != null)
{
messageText = Language.GetFormattedString("clipboard_inuse", clipboardOwner);
messageText = "in use"; // Language.GetFormattedString("clipboard_inuse", clipboardOwner);
}
else
{
messageText = Language.GetString("Core","clipboard_error");
messageText = "error"; // Language.GetString("Core","clipboard_error");
}
Log.Error().WriteLine(clipboardSetException, messageText);
}
@ -223,13 +223,14 @@ EndSelection:<<<<<<<4
{
string messageText;
var clipboardOwner = GetClipboardOwner();
// TODO: Translations
if (clipboardOwner != null)
{
messageText = Language.GetFormattedString("clipboard_inuse", clipboardOwner);
messageText = "In use"; // Language.GetFormattedString("clipboard_inuse", clipboardOwner);
}
else
{
messageText = Language.GetString("Core", "clipboard_error");
messageText = "Error"; // Language.GetString("Core", "clipboard_error");
}
Log.Error().WriteLine(ee, messageText);
}

View file

@ -149,7 +149,9 @@ namespace Greenshot.Addons.Core
}
catch (ExternalException)
{
MessageBox.Show(Language.GetFormattedString("error_nowriteaccess", saveImageFileDialog.FileName).Replace(@"\\", @"\"), Language.GetString("error"));
MessageBox.Show("Can't write to " + saveImageFileDialog.FileName.Replace(@"\\", @"\"), "Error");
// TODO: Fix
//MessageBox.Show(Language.GetFormattedString("error_nowriteaccess", saveImageFileDialog.FileName).Replace(@"\\", @"\"), Language.GetString("error"));
}
}
}

View file

@ -1,231 +0,0 @@
#region Greenshot GNU General Public License
// Greenshot - a free and open source screenshot tool
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
//
// For more information see: http://getgreenshot.org/
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#endregion
#region Usings
using System;
using System.Collections.Generic;
using System.Linq;
using Dapplo.Language;
#endregion
namespace Greenshot.Addons.Core
{
public delegate void LanguageChangedHandler(object sender, EventArgs e);
/// <summary>
/// This class supplies the GUI with translations, based upon keys.
/// The language resources are loaded from the language files found on fixed or supplied paths
/// </summary>
public class Language
{
private static LanguageLoader languageLoader = LanguageLoader.Current;
/// <summary>
/// Get or set the current language
/// </summary>
public static string CurrentLanguage
{
get => languageLoader.CurrentLanguage;
set { languageLoader.ChangeLanguageAsync(value); }
}
/// <summary>
/// Return a list of all the supported languages
/// </summary>
public static IDictionary<string, string> SupportedLanguages => languageLoader.AvailableLanguages;
/// <summary>
/// Check if a resource with prefix.key exists
/// </summary>
/// <param name="prefix"></param>
/// <param name="key"></param>
/// <returns>true if available</returns>
public static bool HasKey(string prefix, string key)
{
return languageLoader[prefix].Keys().Contains(key);
}
/// <summary>
/// Check if a resource with prefix.key exists
/// </summary>
/// <param name="prefix"></param>
/// <param name="key"></param>
/// <returns>true if available</returns>
public static bool HasKey(string prefix, Enum key)
{
return languageLoader[prefix].Keys().Contains(key.ToString());
}
public static string Translate(object key)
{
var typename = key.GetType().Name;
var enumKey = typename + "." + key;
if (HasKey("Core", enumKey))
{
return GetString("Core", enumKey);
}
return key.ToString();
}
/// <summary>
/// TryGet method which combines HasKey & GetString
/// </summary>
/// <param name="prefix">string with prefix</param>
/// <param name="key">string with key</param>
/// <param name="languageString">out string</param>
/// <returns>bool</returns>
public static bool TryGetString(string prefix, string key, out string languageString)
{
if (languageLoader.Any(l => l.PrefixName() == prefix) && languageLoader[prefix].Keys().Contains(key))
{
languageString = languageLoader[prefix][key];
return true;
}
languageString = null;
return false;
}
/// <summary>
/// TryGet method which combines HasKey & GetString
/// </summary>
/// <param name="key">string with key</param>
/// <param name="languageString">out string</param>
/// <returns>bool</returns>
public static bool TryGetString(string key, out string languageString)
{
return TryGetString("Core", key, out languageString);
}
/// <summary>
/// Get the resource for prefix.key
/// </summary>
/// <param name="prefix"></param>
/// <param name="key"></param>
/// <returns>resource or a "string ###prefix.key### not found"</returns>
public static string GetString(string prefix, string key)
{
if (key == null)
{
return null;
}
return languageLoader[prefix][key];
}
/// <summary>
/// Get the resource for key
/// </summary>
/// <param name="key"></param>
/// <returns>resource or a "string ###prefix.key### not found"</returns>
public static string GetString(string key)
{
if (key == null)
{
return null;
}
return languageLoader["Core"][key];
}
/// <summary>
/// Get the resource for key
/// </summary>
/// <param name="key">Enum</param>
/// <returns>resource or a "string ###prefix.key### not found"</returns>
public static string GetString(Enum key)
{
if (key == null)
{
return null;
}
return languageLoader["Core"][key.ToString()];
}
/// <summary>
/// Get the resource for prefix.key
/// </summary>
/// <param name="prefix"></param>
/// <param name="key"></param>
/// <returns>resource or a "string ###prefix.key### not found"</returns>
public static string GetString(string prefix, Enum key)
{
if (key == null)
{
return null;
}
return GetString(prefix, key.ToString());
}
/// <summary>
/// Get the resource for key, format with with string.format an supply the parameters
/// </summary>
/// <param name="key"></param>
/// <param name="param"></param>
/// <returns>formatted resource or a "string ###key### not found"</returns>
public static string GetFormattedString(Enum key, object param)
{
return GetFormattedString(key.ToString(), param);
}
/// <summary>
/// Get the resource for prefix.key, format with with string.format an supply the parameters
/// </summary>
/// <param name="prefix"></param>
/// <param name="key"></param>
/// <param name="param"></param>
/// <returns>formatted resource or a "string ###prefix.key### not found"</returns>
public static string GetFormattedString(string prefix, Enum key, object param)
{
return GetFormattedString(prefix, key.ToString(), param);
}
/// <summary>
/// Get the resource for prefix.key, format with with string.format an supply the parameters
/// </summary>
/// <param name="prefix"></param>
/// <param name="key"></param>
/// <param name="param"></param>
/// <returns>formatted resource or a "string ###prefix.key### not found"</returns>
public static string GetFormattedString(string prefix, string key, object param)
{
if (TryGetString(prefix, key, out var value))
{
return string.Format(value, param);
}
return $"string ###{prefix}.{key}### not found";
}
/// <summary>
/// Get the resource for key, format with with string.format an supply the parameters
/// </summary>
/// <param name="key"></param>
/// <param name="param"></param>
/// <returns>formatted resource or a "string ###key### not found"</returns>
public static string GetFormattedString(string key, object param)
{
return GetFormattedString("Core", key, param);
}
}
}

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Wpf">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
@ -10,7 +10,7 @@
<PackageReference Include="System.ComponentModel.Composition" Version="4.5.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net471' ">
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
@ -32,22 +32,18 @@
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Interfaces\IGreenshotContract.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommonServiceLocator">
<Version>2.0.4</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Configuration">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Toasts">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Translations">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.HttpExtensions">
<Version>0.9.6</Version>
@ -59,10 +55,10 @@
<Version>0.9.6</Version>
</PackageReference>
<PackageReference Include="Dapplo.Windows.Clipboard">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
<PackageReference Include="Dapplo.Windows.Icons">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
<PackageReference Include="MahApps.Metro.IconPacks">
<Version>3.0.0-alpha0082</Version>

View file

@ -21,6 +21,8 @@
#endregion
#if !NETCOREAPP3_0
using System.ServiceModel;
namespace Greenshot.Addons.Interfaces
@ -58,3 +60,5 @@ namespace Greenshot.Addons.Interfaces
void OpenFile(string filename);
}
}
#endif

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
@ -9,7 +9,7 @@
<FrameworkReference Include="Microsoft.DesktopUI" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net471' ">
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
@ -33,7 +33,7 @@
<ItemGroup>
<PackageReference Include="Dapplo.Windows.Icons">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
</ItemGroup>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Wpf">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
@ -9,7 +9,7 @@
<FrameworkReference Include="Microsoft.DesktopUI" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net471' ">
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
@ -9,7 +9,7 @@
<FrameworkReference Include="Microsoft.DesktopUI" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net471' ">
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
@ -36,7 +36,7 @@
<Version>2.0.4</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Translations">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Svg">
<Version>2.3.0</Version>

View file

@ -3,6 +3,7 @@ using System.Drawing.Imaging;
using Dapplo.Log;
using Dapplo.Log.XUnit;
using Greenshot.Gfx;
using Greenshot.Tests.Implementation;
using Xunit;
using Xunit.Abstractions;

View file

@ -1,91 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net461</TargetFrameworks>
<TargetFrameworks>net471</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0' ">
<FrameworkReference Include="Microsoft.DesktopUI" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<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" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<None Include="IniTests.cs" />
<None Include="TestFiles\scroll0.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\scroll105.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\scroll124.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\scroll35.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\scroll70.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\project-feed.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet">
<Version>0.11.1</Version>
</PackageReference>
<PackageReference Include="CommandLineParser">
<Version>2.3.0</Version>
</PackageReference>
<PackageReference Include="CommonServiceLocator">
<Version>2.0.4</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Translations">
<Version>1.1.1-gd01f910204</Version>
</PackageReference>
<PackageReference Include="Dapplo.HttpExtensions.OAuth">
<Version>0.9.6</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<Version>2.6.2</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp">
<Version>2.9.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions">
<Version>2.1.0</Version>
</PackageReference>
<PackageReference Include="System.Console">
<Version>4.3.1</Version>
</PackageReference>
@ -113,6 +34,91 @@
<PackageReference Include="System.Xml.ReaderWriter">
<Version>4.3.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net471' ">
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<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" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Remove="IniTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="IniTests.cs" />
<None Include="TestFiles\scroll0.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\scroll105.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\scroll124.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\scroll35.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\scroll70.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="TestFiles\project-feed.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet">
<Version>0.11.2</Version>
</PackageReference>
<PackageReference Include="CommandLineParser">
<Version>2.3.0</Version>
</PackageReference>
<PackageReference Include="CommonServiceLocator">
<Version>2.0.4</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Translations">
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.HttpExtensions.OAuth">
<Version>0.9.6</Version>
</PackageReference>
<PackageReference Include="Dapplo.Log.XUnit" Version="1.3.11" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<Version>2.6.2</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp">
<Version>2.9.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions">
<Version>2.1.0</Version>
</PackageReference>
<PackageReference Include="xunit">
<Version>2.4.1</Version>
</PackageReference>
@ -131,12 +137,11 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Xunit.StaFact">
<Version>0.3.2</Version>
<Version>0.3.5</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Greenshot.Addon.Dropbox\Greenshot.Addon.Dropbox.csproj" />
<ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj" />
<ProjectReference Include="..\Greenshot.Core\Greenshot.Core.csproj" />
<ProjectReference Include="..\Greenshot.Gfx.Experimental\Greenshot.Gfx.Experimental.csproj" />

View file

@ -21,6 +21,8 @@
#endregion
#if !NETCOREAPP3_0
using System.Collections.Generic;
using System.ServiceModel;
using Greenshot.Addons.Interfaces;
@ -78,3 +80,4 @@ namespace Greenshot.Components
}
}
}
#endif

View file

@ -21,6 +21,8 @@
#endregion
#if !NETCOREAPP3_0
#region Usings
using System;
@ -32,7 +34,6 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Dapplo.Addons;
using Dapplo.Ini;
using Dapplo.Log;
using Greenshot.Addons.Components;
using Greenshot.Addons.Core;
@ -116,7 +117,8 @@ namespace Greenshot.Components
Log.Info().WriteLine("Reload requested");
try
{
IniConfig.Current?.ReloadAsync().Wait();
// TODO: Fix
//IniConfig.Current?.ReloadAsync().Wait();
_mainForm.Invoke((MethodInvoker)(() =>
{
// Even update language when needed, this should be done automatically :)
@ -181,3 +183,4 @@ namespace Greenshot.Components
#endregion
}
}
#endif

View file

@ -51,7 +51,7 @@ namespace Greenshot.Components
/// <param name="propertyName">string with the property of the ICoreConfiguration to use</param>
public HotKeyHandler(ICoreConfiguration coreConfiguration, string propertyName)
{
string RetrieveFunc() => coreConfiguration[propertyName].Value as string;
string RetrieveFunc() => coreConfiguration.GetIniValue(propertyName).Value as string;
_propertyChangeSubscription = coreConfiguration
.OnPropertyChanged(propertyName)
.Subscribe(pc => UpdateKeyCombination(RetrieveFunc));

View file

@ -32,6 +32,7 @@ using Dapplo.Addons;
using Dapplo.CaliburnMicro;
using Dapplo.Log;
using Dapplo.Windows.Multimedia;
using Dapplo.Windows.Multimedia.Enums;
using Greenshot.Addons.Core;
#endregion

View file

@ -21,6 +21,8 @@
#endregion
#if !NETCOREAPP3_0
#region Usings
using System;
@ -243,3 +245,4 @@ namespace Greenshot.Components
}
}
}
#endif

View file

@ -386,20 +386,21 @@ namespace Greenshot.Forms
}
*/
break;
case Keys.I:
try
{
using (Process.Start("\"" + IniConfig.Current.IniLocation + "\""))
{
// Ignore
}
}
catch (Exception)
{
MessageBox.Show("Couldn't open the greenshot.ini, it's located here: " + IniConfig.Current.IniLocation, "Error opening greeenshot.ini", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
}
break;
// TODO: Open configuration location
// case Keys.I:
//try
//{
// using (Process.Start("\"" + IniConfig.Current.IniLocation + "\""))
// {
// // Ignore
// }
//}
//catch (Exception)
//{
// MessageBox.Show("Couldn't open the greenshot.ini, it's located here: " + IniConfig.Current.IniLocation, "Error opening greeenshot.ini", MessageBoxButtons.OK,
// MessageBoxIcon.Asterisk);
//}
//break;
default:
return base.ProcessCmdKey(ref msg, keyData);
}

View file

@ -27,7 +27,6 @@ using System;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using Dapplo.Language;
using Dapplo.Log;
using Greenshot.Addons.Core;
@ -72,9 +71,10 @@ namespace Greenshot.Forms
// Set datasource last to prevent problems
// See: http://www.codeproject.com/KB/database/scomlistcontrolbinding.aspx?fid=111644
comboBoxLanguage.DataSource = LanguageLoader.Current.AvailableLanguages.ToList();
// TODO: Get languages
//comboBoxLanguage.DataSource = LanguageLoader.Current.AvailableLanguages.ToList();
var currentLanguage = LanguageLoader.Current.CurrentLanguage;
var currentLanguage = "en-US"; // LanguageLoader.Current.CurrentLanguage;
if (currentLanguage != null)
{
@ -88,14 +88,14 @@ namespace Greenshot.Forms
// Close again when there is only one language, this shows the form briefly!
// But the use-case is not so interesting, only happens once, to invest a lot of time here.
if (LanguageLoader.Current.AvailableLanguages.Count != 1)
if (false) //LanguageLoader.Current.AvailableLanguages.Count != 1)
{
return;
}
comboBoxLanguage.SelectedValue = LanguageLoader.Current.AvailableLanguages.Keys.FirstOrDefault();
// TODO: Check
var ignoreTask = LanguageLoader.Current.ChangeLanguageAsync(SelectedLanguage);
comboBoxLanguage.SelectedValue = "en-US"; // LanguageLoader.Current.AvailableLanguages.Keys.FirstOrDefault();
// TODO: Change language
//var ignoreTask = LanguageLoader.Current.ChangeLanguageAsync(SelectedLanguage);
_properOkPressed = true;
Close();
}
@ -104,7 +104,8 @@ namespace Greenshot.Forms
{
_properOkPressed = true;
// Fix for Bug #3431100
Language.CurrentLanguage = SelectedLanguage;
// TODO: Change language
//Language.CurrentLanguage = SelectedLanguage;
Close();
}
}

View file

@ -34,7 +34,6 @@ using System.Reflection;
using System.Windows.Forms;
using Autofac.Features.OwnedInstances;
using Caliburn.Micro;
using Dapplo.Ini;
using Dapplo.Windows.Desktop;
using Greenshot.Destinations;
using Greenshot.Help;
@ -60,6 +59,7 @@ using Greenshot.Gfx;
using Greenshot.Ui.Configuration.ViewModels;
using Message = System.Windows.Forms.Message;
using Screen = System.Windows.Forms.Screen;
using Dapplo.Config.Ini;
#endregion
@ -933,7 +933,7 @@ namespace Greenshot.Forms
var enumTypeName = typeof(WindowCaptureModes).Name;
foreach (WindowCaptureModes captureMode in Enum.GetValues(typeof(WindowCaptureModes)))
{
selectList.AddItem(Language.GetString(enumTypeName + "." + captureMode), captureMode, _coreConfiguration.WindowCaptureMode == captureMode);
selectList.AddItem(_greenshotLanguage[enumTypeName + "." + captureMode], captureMode, _coreConfiguration.WindowCaptureMode == captureMode);
}
selectList.CheckedChanged += QuickSettingCaptureModeChanged;
contextmenu_quicksettings.DropDownItems.Add(selectList);
@ -947,7 +947,7 @@ namespace Greenshot.Forms
foreach (var outputPrintIniValue in _coreConfiguration.GetIniValues().Values.Where(value => value.PropertyName.StartsWith("OutputPrint") && value.ValueType == typeof(bool) && !_coreConfiguration.IsWriteProtected(value.PropertyName)))
{
selectList.AddItem(Language.GetString(outputPrintIniValue.PropertyName), outputPrintIniValue, (bool) outputPrintIniValue.Value);
selectList.AddItem(_greenshotLanguage[outputPrintIniValue.PropertyName], outputPrintIniValue, (bool) outputPrintIniValue.Value);
}
if (selectList.DropDownItems.Count > 0)
{
@ -965,18 +965,18 @@ namespace Greenshot.Forms
Text = _greenshotLanguage.SettingsVisualization
};
var iniValue = _coreConfiguration["PlayCameraSound"];
var iniValue = _coreConfiguration.GetIniValue("PlayCameraSound");
var languageKey = _coreConfiguration.GetTagValue(iniValue.PropertyName, ConfigTags.LanguageKey) as string;
if (!_coreConfiguration.IsWriteProtected(iniValue.PropertyName))
{
selectList.AddItem(Language.GetString(languageKey), iniValue, (bool) iniValue.Value);
selectList.AddItem(_greenshotLanguage[languageKey], iniValue, (bool) iniValue.Value);
}
iniValue = _coreConfiguration["ShowTrayNotification"];
iniValue = _coreConfiguration.GetIniValue("ShowTrayNotification");
languageKey = _coreConfiguration.GetTagValue(iniValue.PropertyName, ConfigTags.LanguageKey) as string;
if (!_coreConfiguration.IsWriteProtected(iniValue.PropertyName))
{
selectList.AddItem(Language.GetString(languageKey), iniValue, (bool) iniValue.Value);
selectList.AddItem(_greenshotLanguage[languageKey], iniValue, (bool) iniValue.Value);
}
if (selectList.DropDownItems.Count > 0)
{

View file

@ -29,8 +29,8 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using Greenshot.Gfx;
using Dapplo.Ini;
using Greenshot.Addons.Core;
using Greenshot.Addons.Config.Impl;
#endregion
@ -41,7 +41,8 @@ namespace Greenshot.Forms
/// </summary>
public sealed class ToolStripMenuSelectList : ToolStripMenuItem
{
private static readonly ICoreConfiguration CoreConfig = IniConfig.Current.Get<ICoreConfiguration>();
// TODO: Solve, was static reference!
private static readonly ICoreConfiguration CoreConfig = new CoreConfigurationImpl();
private static Image _defaultImage;
private readonly bool _multiCheckAllowed;
private bool _updateInProgress;

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0;net471</TargetFrameworks>
<LangVersion>latest</LangVersion>
<ApplicationIcon>icons\applicationIcon\icon.ico</ApplicationIcon>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
@ -52,7 +52,7 @@
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net471' ">
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System.ComponentModel.Composition" />
@ -72,6 +72,7 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
@ -84,17 +85,20 @@
<PackageReference Include="CommonServiceLocator">
<Version>2.0.4</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Dapp">
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Configuration">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Metro">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Toasts">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.CaliburnMicro.Translations">
<Version>1.1.1-gd01f910204</Version>
<Version>1.1.10-ge2d1078449</Version>
</PackageReference>
<PackageReference Include="Dapplo.HttpExtensions.JsonNet">
<Version>0.9.6</Version>
@ -109,13 +113,13 @@
<Version>1.3.11</Version>
</PackageReference>
<PackageReference Include="Dapplo.Windows.Clipboard">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
<PackageReference Include="Dapplo.Windows.Icons">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
<PackageReference Include="Dapplo.Windows.Multimedia">
<Version>0.7.16</Version>
<Version>0.7.19</Version>
</PackageReference>
<PackageReference Include="gong-wpf-dragdrop">
<Version>1.1.0</Version>
@ -129,16 +133,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Greenshot.Addon.InternetExplorer\Greenshot.Addon.InternetExplorer.csproj" />
<ProjectReference Include="..\Greenshot.Addon.LegacyEditor\Greenshot.Addon.LegacyEditor.csproj" />
<ProjectReference Include="..\Greenshot.Core\Greenshot.Core.csproj" />
<ProjectReference Include="..\Greenshot.Gfx\Greenshot.Gfx.csproj" />
<ProjectReference Include="..\Greenshot.Addons\Greenshot.Addons.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Components\GreenshotClient.cs" />
<Compile Remove="Components\GreenshotServer.cs" />
<Compile Remove="Components\UpdateService.cs" />
</ItemGroup>
</Project>

View file

@ -44,7 +44,7 @@ namespace Greenshot.Help
public static void LoadHelp()
{
var uri = FindOnlineHelpUrl(Language.CurrentLanguage);// ?? Language.HelpFilePath;
var uri = FindOnlineHelpUrl("en-US");// Language.CurrentLanguage);// ?? Language.HelpFilePath;
Process.Start(uri);
}

View file

@ -31,7 +31,6 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using Dapplo.Ini;
using Dapplo.Windows.App;
using Dapplo.Windows.Desktop;
using Greenshot.Destinations;
@ -51,6 +50,7 @@ using Greenshot.Components;
using Greenshot.Core.Enums;
using Greenshot.Gfx;
using LangKey = Greenshot.Configuration.LangKey;
using Greenshot.Addons.Config.Impl;
#endregion
@ -62,7 +62,8 @@ namespace Greenshot.Helpers
public class CaptureHelper : IDisposable
{
private static readonly LogSource Log = new LogSource();
private static readonly ICoreConfiguration CoreConfig = IniConfig.Current.Get<ICoreConfiguration>();
// TODO: Solve, was static reference!
private static readonly ICoreConfiguration CoreConfig = new CoreConfigurationImpl();
private readonly bool _captureMouseCursor;
private ICapture _capture;
private CaptureMode _captureMode;
@ -425,7 +426,8 @@ namespace Greenshot.Helpers
}
else
{
MessageBox.Show(Language.GetString("clipboard_noimage"));
// TODO: Translation
//MessageBox.Show(Language.GetString("clipboard_noimage"));
}
break;
case CaptureMode.File:
@ -449,7 +451,8 @@ namespace Greenshot.Helpers
catch (Exception e)
{
Log.Error().WriteLine(e, e.Message);
MessageBox.Show(Language.GetFormattedString(LangKey.error_openfile, filename));
// TODO: Translation
//MessageBox.Show(Language.GetFormattedString(LangKey.error_openfile, filename));
}
try
{
@ -458,7 +461,8 @@ namespace Greenshot.Helpers
catch (Exception e)
{
Log.Error().WriteLine(e, e.Message);
MessageBox.Show(Language.GetFormattedString(LangKey.error_openfile, filename));
// TODO: Translation
//MessageBox.Show(Language.GetFormattedString(LangKey.error_openfile, filename));
}
}
if (fileImage != null)

View file

@ -31,8 +31,8 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Dapplo.Ini;
using Dapplo.Log;
using Greenshot.Addons.Config.Impl;
using Greenshot.Addons.Core;
using Greenshot.Addons.Interfaces;
using Greenshot.Addons.Interfaces.Plugin;
@ -77,7 +77,8 @@ namespace Greenshot.Helpers
#endregion Enums
private static readonly LogSource Log = new LogSource();
private static readonly ICoreConfiguration CoreConfig = IniConfig.Current.Get<ICoreConfiguration>();
// TODO: Solve, was static reference!
private static readonly ICoreConfiguration CoreConfig = new CoreConfigurationImpl();
#region Member Variables

View file

@ -131,7 +131,8 @@ namespace Greenshot.Helpers
catch (Exception e)
{
Log.Error().WriteLine(e, "An error ocurred while trying to print");
MessageBox.Show(Language.GetString(LangKey.print_error), Language.GetString(LangKey.error));
// TODO: Translation
//MessageBox.Show(Language.GetString(LangKey.print_error), Language.GetString(LangKey.error));
}
return returnPrinterSettings;
}
@ -164,7 +165,8 @@ namespace Greenshot.Helpers
catch (Exception e)
{
Log.Error().WriteLine(e, "An error ocurred while trying to print");
MessageBox.Show(Language.GetString(LangKey.print_error), Language.GetString(LangKey.error));
// TODO: Translation
//MessageBox.Show(Language.GetString(LangKey.print_error), Language.GetString(LangKey.error));
}
return returnPrinterSettings;
}

View file

@ -25,8 +25,8 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Dapplo.Ini;
using Dapplo.Log;
using Greenshot.Addons.Config.Impl;
using Greenshot.Addons.Core;
using Greenshot.Addons.Interfaces;
@ -40,7 +40,8 @@ namespace Greenshot.Processors
public class TitleFixProcessor : AbstractProcessor
{
private static readonly LogSource Log = new LogSource();
private static readonly ICoreConfiguration config = IniConfig.Current.Get<ICoreConfiguration>();
// TODO: Solve, was static reference!
private static readonly ICoreConfiguration config = new CoreConfigurationImpl();
public TitleFixProcessor()
{

View file

@ -32,8 +32,8 @@ using Autofac.Features.OwnedInstances;
using Caliburn.Micro;
using Dapplo.Addons.Bootstrapper;
using Dapplo.CaliburnMicro.Dapp;
using Dapplo.Ini.Converters;
using Dapplo.Language;
using Dapplo.Config.Ini.Converters;
using Dapplo.Config.Language;
using Dapplo.Log;
using Dapplo.Log.Loggers;
using Dapplo.Utils;
@ -71,7 +71,6 @@ namespace Greenshot
.Create()
.WithApplicationName("Greenshot")
.WithMutex("F48E86D3-E34C-4DB7-8F8F-9A0EA55F0D08")
.WithConfigSupport()
.WithCaliburnMicro()
.WithoutCopyOfEmbeddedAssemblies()
.WithAssemblyPatterns("Greenshot.Addon*")

View file

@ -30,7 +30,6 @@ using Caliburn.Micro;
using Dapplo.CaliburnMicro.Configuration;
using Dapplo.CaliburnMicro.Extensions;
using Dapplo.CaliburnMicro.Metro;
using Dapplo.Language;
using Dapplo.Utils.Extensions;
using Greenshot.Addons;
using Greenshot.Addons.Core;
@ -60,13 +59,15 @@ namespace Greenshot.Ui.Configuration.ViewModels
/// Used from the View
/// </summary>
// ReSharper disable once UnusedMember.Global
public IDictionary<string, string> AvailableLanguages => LanguageLoader.Current.AvailableLanguages;
// TODO: Fix
public IDictionary<string, string> AvailableLanguages => new Dictionary<string, string>();//LanguageLoader.Current.AvailableLanguages;
/// <summary>
/// Can the login button be pressed?
/// </summary>
// TODO: Fix
public bool CanChangeLanguage
=> !string.IsNullOrWhiteSpace(CoreConfiguration.Language) && CoreConfiguration.Language != LanguageLoader.Current.CurrentLanguage;
=> !string.IsNullOrWhiteSpace(CoreConfiguration.Language); // && CoreConfiguration.Language != LanguageLoader.Current.CurrentLanguage;
public IMetroConfiguration MetroConfiguration { get; }
@ -102,7 +103,8 @@ namespace Greenshot.Ui.Configuration.ViewModels
MetroWindowManager.ChangeThemeAccent(MetroConfiguration.ThemeAccent);
CoreConfiguration.CommitTransaction();
Execute.OnUIThread(async () => { await LanguageLoader.Current.ChangeLanguageAsync(CoreConfiguration.Language).ConfigureAwait(false); });
// TODO: Fix
//Execute.OnUIThread(async () => { await LanguageLoader.Current.ChangeLanguageAsync(CoreConfiguration.Language).ConfigureAwait(false); });
}