Updated csproj files, so we don't have to migrate every time. Added a fix for BUG-1863: Cannot get access to deleted object, and added some small code quality chances. [skip ci]

This commit is contained in:
Robin 2015-11-06 09:31:22 +01:00
parent 63e360e254
commit 4f9d6eb865
21 changed files with 112 additions and 54 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}</ProjectGuid> <ProjectGuid>{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}</ProjectGuid>
@ -18,7 +18,8 @@
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation /> <UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net"> <Reference Include="log4net">

View file

@ -213,7 +213,7 @@ namespace Greenshot.Helpers {
/// </summary> /// </summary>
/// <param name="pluginFiles"></param> /// <param name="pluginFiles"></param>
/// <param name="path"></param> /// <param name="path"></param>
private void findPluginsOnPath(List<string> pluginFiles, String path) { private void findPluginsOnPath(List<string> pluginFiles, string path) {
if (Directory.Exists(path)) { if (Directory.Exists(path)) {
try { try {
foreach (string pluginFile in Directory.GetFiles(path, "*.gsp", SearchOption.AllDirectories)) { foreach (string pluginFile in Directory.GetFiles(path, "*.gsp", SearchOption.AllDirectories)) {

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{697CF066-9077-4F22-99D9-D989CCE7282B}</ProjectGuid> <ProjectGuid>{697CF066-9077-4F22-99D9-D989CCE7282B}</ProjectGuid>
@ -14,6 +14,11 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>Always</RunPostBuildEvent> <RunPostBuildEvent>Always</RunPostBuildEvent>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<NoWarn>1685</NoWarn> <NoWarn>1685</NoWarn>
<ProjectGuid>{C3052651-598A-44E2-AAB3-2E41311D50F9}</ProjectGuid> <ProjectGuid>{C3052651-598A-44E2-AAB3-2E41311D50F9}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>GreenshotConfluencePlugin</RootNamespace> <RootNamespace>GreenshotConfluencePlugin</RootNamespace>
@ -15,6 +15,11 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<TargetFrameworkProfile>Client</TargetFrameworkProfile> <TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}</ProjectGuid> <ProjectGuid>{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}</ProjectGuid>
@ -14,6 +14,11 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>Always</RunPostBuildEvent> <RunPostBuildEvent>Always</RunPostBuildEvent>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{47F23C86-604E-4CC3-8767-B3D4088F30BB}</ProjectGuid> <ProjectGuid>{47F23C86-604E-4CC3-8767-B3D4088F30BB}</ProjectGuid>
@ -14,6 +14,11 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -125,7 +125,7 @@ namespace GreenshotFlickrPlugin
_config.ShowConfigDialog(); _config.ShowConfigDialog();
} }
public bool Upload(ICaptureDetails captureDetails, ISurface surface, out String uploadUrl) { public bool Upload(ICaptureDetails captureDetails, ISurface surface, out string uploadUrl) {
SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(_config.UploadFormat, _config.UploadJpegQuality, false); SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(_config.UploadFormat, _config.UploadJpegQuality, false);
uploadUrl = null; uploadUrl = null;
try { try {

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}</ProjectGuid> <ProjectGuid>{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}</ProjectGuid>
@ -15,6 +15,10 @@
<RunPostBuildEvent>Always</RunPostBuildEvent> <RunPostBuildEvent>Always</RunPostBuildEvent>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}</ProjectGuid> <ProjectGuid>{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}</ProjectGuid>
@ -17,7 +17,8 @@
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation /> <UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{19FEEF09-313F-43C7-819D-F1BCA782B08B}</ProjectGuid> <ProjectGuid>{19FEEF09-313F-43C7-819D-F1BCA782B08B}</ProjectGuid>
@ -17,7 +17,8 @@
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation /> <UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>
@ -37,7 +38,9 @@
<Compile Include="Forms\JiraForm.Designer.cs"> <Compile Include="Forms\JiraForm.Designer.cs">
<DependentUpon>JiraForm.cs</DependentUpon> <DependentUpon>JiraForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Forms\JiraFormBase.cs" /> <Compile Include="Forms\JiraFormBase.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\SettingsForm.cs"> <Compile Include="Forms\SettingsForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@ -20,6 +20,11 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress> <BaseAddress>4194304</BaseAddress>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugType>full</DebugType> <DebugType>full</DebugType>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{C6988EE8-2FEE-4349-9F09-F9628A0D8965}</ProjectGuid> <ProjectGuid>{C6988EE8-2FEE-4349-9F09-F9628A0D8965}</ProjectGuid>
@ -17,7 +17,8 @@
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation /> <UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}</ProjectGuid> <ProjectGuid>{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -15,6 +15,11 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' "> <PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{9C0ECC4C-7807-4111-916A-4F57BB29788A}</ProjectGuid> <ProjectGuid>{9C0ECC4C-7807-4111-916A-4F57BB29788A}</ProjectGuid>
@ -14,6 +14,11 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{1893A2E4-A78A-4713-A8E7-E70058DABEE0}</ProjectGuid> <ProjectGuid>{1893A2E4-A78A-4713-A8E7-E70058DABEE0}</ProjectGuid>
@ -13,9 +13,12 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>Always</RunPostBuildEvent> <RunPostBuildEvent>Always</RunPostBuildEvent>
<FileUpgradeFlags /> <FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -471,14 +471,20 @@ namespace GreenshotPlugin.Core {
isHttpError = (int)response.StatusCode >= 300; isHttpError = (int)response.StatusCode >= 300;
if (isHttpError) if (isHttpError)
{ {
LOG.ErrorFormat("HTTP error {0} with content: {1}", response.StatusCode, responseData); LOG.ErrorFormat("HTTP error {0}", response.StatusCode);
} }
DebugHeaders(response); DebugHeaders(response);
responseData = GetResponseAsString(response); responseData = GetResponseAsString(response);
} catch (WebException e) { if (isHttpError)
{
LOG.ErrorFormat("HTTP response {0}", responseData);
}
}
catch (WebException e) {
response = (HttpWebResponse) e.Response; response = (HttpWebResponse) e.Response;
HttpStatusCode statusCode = response.StatusCode;
if (response != null) { if (response != null) {
LOG.ErrorFormat("HTTP error {0}", response.StatusCode); LOG.ErrorFormat("HTTP error {0}", statusCode);
string errorContent = GetResponseAsString(response); string errorContent = GetResponseAsString(response);
if (alsoReturnContentOnError) if (alsoReturnContentOnError)
{ {
@ -487,6 +493,10 @@ namespace GreenshotPlugin.Core {
LOG.ErrorFormat("Content: {0}", errorContent); LOG.ErrorFormat("Content: {0}", errorContent);
} }
LOG.Error("WebException: ", e); LOG.Error("WebException: ", e);
if (statusCode == HttpStatusCode.Unauthorized)
{
throw new UnauthorizedAccessException(e.Message);
}
throw; throw;
} }
finally finally

View file

@ -499,7 +499,7 @@ namespace GreenshotPlugin.Core {
/// Authorize the token by showing the dialog /// Authorize the token by showing the dialog
/// </summary> /// </summary>
/// <returns>The request token.</returns> /// <returns>The request token.</returns>
private String GetAuthorizeToken() { private string GetAuthorizeToken() {
if (string.IsNullOrEmpty(Token)) { if (string.IsNullOrEmpty(Token)) {
Exception e = new Exception("The request token is not set"); Exception e = new Exception("The request token is not set");
throw e; throw e;
@ -532,7 +532,7 @@ namespace GreenshotPlugin.Core {
/// Get the access token /// Get the access token
/// </summary> /// </summary>
/// <returns>The access token.</returns> /// <returns>The access token.</returns>
private String GetAccessToken() { private string GetAccessToken() {
if (string.IsNullOrEmpty(Token) || (CheckVerifier && string.IsNullOrEmpty(Verifier))) { if (string.IsNullOrEmpty(Token) || (CheckVerifier && string.IsNullOrEmpty(Verifier))) {
Exception e = new Exception("The request token and verifier were not set"); Exception e = new Exception("The request token and verifier were not set");
throw e; throw e;
@ -663,39 +663,36 @@ namespace GreenshotPlugin.Core {
} }
try { try {
Sign(method, signUrl, parametersToSign); Sign(method, signUrl, parametersToSign);
// Join all parameters // Join all parameters
IDictionary<string, object> newParameters = new Dictionary<string, object>(); IDictionary<string, object> newParameters = new Dictionary<string, object>();
foreach(var parameter in parametersToSign) { foreach (var parameter in parametersToSign) {
newParameters.Add(parameter); newParameters.Add(parameter);
} }
if (additionalParameters != null) { if (additionalParameters != null) {
foreach(var parameter in additionalParameters) { foreach (var parameter in additionalParameters) {
newParameters.Add(parameter); newParameters.Add(parameter);
} }
} }
return MakeRequest(method, requestURL, headers, newParameters, postData); return MakeRequest(method, requestURL, headers, newParameters, postData);
} catch (WebException wEx) { } catch (UnauthorizedAccessException uaEx) {
lastException = wEx; lastException = uaEx;
if (wEx.Response != null) { Token = null;
HttpWebResponse response = wEx.Response as HttpWebResponse; TokenSecret = null;
if (response != null && response.StatusCode == HttpStatusCode.Unauthorized) { // Remove oauth keys, so they aren't added double
Token = null; List<string> keysToDelete = new List<string>();
TokenSecret = null; foreach (string parameterKey in parametersToSign.Keys)
// Remove oauth keys, so they aren't added double {
List<string> keysToDelete = new List<string>(); if (parameterKey.StartsWith(OAUTH_PARAMETER_PREFIX))
foreach (string parameterKey in parametersToSign.Keys) { {
if (parameterKey.StartsWith(OAUTH_PARAMETER_PREFIX)) { keysToDelete.Add(parameterKey);
keysToDelete.Add(parameterKey);
}
}
foreach(string keyToDelete in keysToDelete) {
parametersToSign.Remove(keyToDelete);
}
continue;
} }
} }
throw; foreach (string keyToDelete in keysToDelete)
{
parametersToSign.Remove(keyToDelete);
}
continue;
} }
} }
if (lastException != null) { if (lastException != null) {

View file

@ -97,7 +97,7 @@ namespace GreenshotPlugin.Core {
/// </summary> /// </summary>
public class SourceForgeHelper { public class SourceForgeHelper {
private static ILog LOG = LogManager.GetLogger(typeof(SourceForgeHelper)); private static ILog LOG = LogManager.GetLogger(typeof(SourceForgeHelper));
private const String RSSFEED = "http://getgreenshot.org/project-feed/"; private const string RSSFEED = "http://getgreenshot.org/project-feed/";
/// <summary> /// <summary>
/// This is using the HTTP HEAD Method to check if the RSS Feed is modified after the supplied date /// This is using the HTTP HEAD Method to check if the RSS Feed is modified after the supplied date

View file

@ -1490,7 +1490,7 @@ namespace GreenshotPlugin.Core {
/// </summary> /// </summary>
/// <param name="hWnd">IntPtr with the windows handle</param> /// <param name="hWnd">IntPtr with the windows handle</param>
/// <returns>String with ClassName</returns> /// <returns>String with ClassName</returns>
public static String GetClassName(IntPtr hWnd) { public static string GetClassName(IntPtr hWnd) {
StringBuilder classNameBuilder = new StringBuilder(260, 260); StringBuilder classNameBuilder = new StringBuilder(260, 260);
User32.GetClassName(hWnd, classNameBuilder, classNameBuilder.Capacity); User32.GetClassName(hWnd, classNameBuilder, classNameBuilder.Capacity);
return classNameBuilder.ToString(); return classNameBuilder.ToString();

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\CommonProject.properties" /> <Import Project="..\CommonProject.properties" />
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{5B924697-4DCD-4F98-85F1-105CB84B7341}</ProjectGuid> <ProjectGuid>{5B924697-4DCD-4F98-85F1-105CB84B7341}</ProjectGuid>
@ -14,6 +14,11 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>

View file

@ -142,8 +142,6 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern bool ShowScrollBar(IntPtr hwnd, ScrollBarDirection scrollBar, bool show); public static extern bool ShowScrollBar(IntPtr hwnd, ScrollBarDirection scrollBar, bool show);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern int SetScrollPos(IntPtr hWnd, Orientation nBar, int nPos, bool bRedraw); public static extern int SetScrollPos(IntPtr hWnd, Orientation nBar, int nPos, bool bRedraw);
[DllImport("user32", SetLastError=true)]
public static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]
public static extern RegionResult GetWindowRgn(IntPtr hWnd, SafeHandle hRgn); public static extern RegionResult GetWindowRgn(IntPtr hWnd, SafeHandle hRgn);
[DllImport("user32", SetLastError = true)] [DllImport("user32", SetLastError = true)]