From ef4b1344e58478c552384bfb42782f0e9176e77e Mon Sep 17 00:00:00 2001 From: JKlingen Date: Sun, 16 Sep 2012 22:09:26 +0000 Subject: [PATCH] extracted imgur credentials to another class git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2047 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- .../GreenshotImgurPlugin.csproj | 17 ++++++++++++++--- GreenshotImgurPlugin/ImgurCredentials.cs | 12 ++++++++++++ GreenshotImgurPlugin/ImgurUtils.cs | 4 ++-- 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 GreenshotImgurPlugin/ImgurCredentials.cs diff --git a/GreenshotImgurPlugin/GreenshotImgurPlugin.csproj b/GreenshotImgurPlugin/GreenshotImgurPlugin.csproj index 6512763b7..2ad8ad5a7 100644 --- a/GreenshotImgurPlugin/GreenshotImgurPlugin.csproj +++ b/GreenshotImgurPlugin/GreenshotImgurPlugin.csproj @@ -14,7 +14,7 @@ False 4 false - OnBuildSuccess + Always @@ -68,6 +68,7 @@ SettingsForm.cs + @@ -100,8 +101,18 @@ - "$(SolutionDir)\tools\TortoiseSVN\SubWCRev.exe" "$(ProjectDir)\" "$(ProjectDir)\Properties\AssemblyInfo.cs.template" "$(ProjectDir)\Properties\AssemblyInfo.cs" - mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)" + "$(SolutionDir)\tools\TortoiseSVN\SubWCRev.exe" "$(ProjectDir)\" "$(ProjectDir)\Properties\AssemblyInfo.cs.template" "$(ProjectDir)\Properties\AssemblyInfo.cs" + +if exist "$(ProjectDir)ImgurCredentials.private.cs" ( + rename "$(ProjectDir)ImgurCredentials.cs" "ImgurCredentials.orig.cs" + rename "$(ProjectDir)ImgurCredentials.private.cs" "ImgurCredentials.cs" +) else exit /b -1 + if exist "$(ProjectDir)ImgurCredentials.orig.cs" ( + rename "$(ProjectDir)ImgurCredentials.cs" "ImgurCredentials.private.cs" + rename "$(ProjectDir)ImgurCredentials.orig.cs" "ImgurCredentials.cs" +) else exit /b -1 + +mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)" copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp" mkdir "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)" copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" diff --git a/GreenshotImgurPlugin/ImgurCredentials.cs b/GreenshotImgurPlugin/ImgurCredentials.cs new file mode 100644 index 000000000..e767bcd2a --- /dev/null +++ b/GreenshotImgurPlugin/ImgurCredentials.cs @@ -0,0 +1,12 @@ +using System; + +namespace GreenshotImgurPlugin { + /// + /// This class is merely a placeholder for the file keeping the API key and secret for imgur integration. + /// Copy this file to ImgurCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the Imgur plugin then.) + /// + public static class ImgurCredentials { + public static string CONSUMER_KEY = empty; + public static string CONSUMER_SECRET = empty; + } +} diff --git a/GreenshotImgurPlugin/ImgurUtils.cs b/GreenshotImgurPlugin/ImgurUtils.cs index a30224b36..afe8a240c 100644 --- a/GreenshotImgurPlugin/ImgurUtils.cs +++ b/GreenshotImgurPlugin/ImgurUtils.cs @@ -150,8 +150,8 @@ namespace GreenshotImgurPlugin { oAuth.AccessTokenUrl = "http://api.imgur.com/oauth/access_token"; oAuth.AuthorizeUrl = "http://api.imgur.com/oauth/authorize"; oAuth.RequestTokenUrl = "http://api.imgur.com/oauth/request_token"; - oAuth.ConsumerKey = fill in; - oAuth.ConsumerSecret = fill in; + oAuth.ConsumerKey = ImgurCredentials.CONSUMER_KEY; + oAuth.ConsumerSecret = ImgurCredentials.CONSUMER_SECRET; oAuth.UserAgent = "Greenshot"; if (string.IsNullOrEmpty(config.ImgurToken)) { LOG.Debug("Creating Imgur Token");