diff --git a/ShareX.HelpersLib/Native/NativeMethods_Helpers.cs b/ShareX.HelpersLib/Native/NativeMethods_Helpers.cs index bc69ffb53..f48dcc198 100644 --- a/ShareX.HelpersLib/Native/NativeMethods_Helpers.cs +++ b/ShareX.HelpersLib/Native/NativeMethods_Helpers.cs @@ -235,11 +235,16 @@ public static bool UseImmersiveDarkMode(IntPtr handle, bool enabled) { if (Helpers.IsWindows10OrGreater(17763)) { - var attribute = DwmWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1; + DwmWindowAttribute attribute; + if (Helpers.IsWindows10OrGreater(18985)) { attribute = DwmWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE; } + else + { + attribute = DwmWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1; + } int useImmersiveDarkMode = enabled ? 1 : 0; return DwmSetWindowAttribute(handle, (int)attribute, ref useImmersiveDarkMode, sizeof(int)) == 0; diff --git a/ShareX.UploadersLib/TextUploaders/GitHubGist.cs b/ShareX.UploadersLib/TextUploaders/GitHubGist.cs index 9edcac3fb..ad1d857a1 100644 --- a/ShareX.UploadersLib/TextUploaders/GitHubGist.cs +++ b/ShareX.UploadersLib/TextUploaders/GitHubGist.cs @@ -117,15 +117,6 @@ public override UploadResult UploadText(string text, string fileName) if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(fileName)) { - var gistUploadObject = new - { - @public = PublicUpload, - files = new Dictionary - { - { fileName, new { content = text } } - } - }; - string url; if (!string.IsNullOrEmpty(CustomURLAPI)) @@ -139,7 +130,17 @@ public override UploadResult UploadText(string text, string fileName) url = URLHelpers.CombineURL(url, "gists"); - string json = JsonConvert.SerializeObject(gistUploadObject); + GistUpload gistUpload = new GistUpload() + { + description = "", + @public = PublicUpload, + files = new Dictionary() + { + { fileName, new GistUploadFileInfo() { content = text } } + } + }; + + string json = JsonConvert.SerializeObject(gistUpload); Dictionary args = new Dictionary(); args.Add("access_token", AuthInfo.Token.access_token); @@ -164,13 +165,25 @@ public override UploadResult UploadText(string text, string fileName) return ur; } + private class GistUpload + { + public string description { get; set; } + public bool @public { get; set; } + public Dictionary files { get; set; } + } + + private class GistUploadFileInfo + { + public string content { get; set; } + } + private class GistResponse { public string html_url { get; set; } - public Dictionary files { get; set; } + public Dictionary files { get; set; } } - private class GistFileInfo + private class GistResponseFileInfo { public string filename { get; set; } public string raw_url { get; set; } diff --git a/ShareX/ChromeManifest.cs b/ShareX/ChromeManifest.cs new file mode 100644 index 000000000..29c8a638b --- /dev/null +++ b/ShareX/ChromeManifest.cs @@ -0,0 +1,36 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (c) 2007-2019 ShareX Team + + 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 2 + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Optionally you can also view the license at . +*/ + +#endregion License Information (GPL v3) + +namespace ShareX +{ + public class ChromeManifest + { + public string name { get; set; } + public string description { get; set; } + public string path { get; set; } + public string type { get; set; } + public string[] allowed_origins { get; set; } + } +} \ No newline at end of file diff --git a/ShareX/FirefoxManifest.cs b/ShareX/FirefoxManifest.cs new file mode 100644 index 000000000..24b15787e --- /dev/null +++ b/ShareX/FirefoxManifest.cs @@ -0,0 +1,36 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (c) 2007-2019 ShareX Team + + 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 2 + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Optionally you can also view the license at . +*/ + +#endregion License Information (GPL v3) + +namespace ShareX +{ + public class FirefoxManifest + { + public string name { get; set; } + public string description { get; set; } + public string path { get; set; } + public string type { get; set; } + public string[] allowed_extensions { get; set; } + } +} \ No newline at end of file diff --git a/ShareX/IntegrationHelpers.cs b/ShareX/IntegrationHelpers.cs index e6e6ab49c..60e332596 100644 --- a/ShareX/IntegrationHelpers.cs +++ b/ShareX/IntegrationHelpers.cs @@ -253,7 +253,7 @@ private static void CreateChromeHostManifest(string filepath) { Helpers.CreateDirectoryFromFilePath(filepath); - var manifest = new + ChromeManifest manifest = new ChromeManifest() { name = "com.getsharex.sharex", description = "ShareX", @@ -323,7 +323,7 @@ private static void CreateFirefoxHostManifest(string filepath) { Helpers.CreateDirectoryFromFilePath(filepath); - var manifest = new + FirefoxManifest manifest = new FirefoxManifest() { name = "ShareX", description = "ShareX", diff --git a/ShareX/ShareX.csproj b/ShareX/ShareX.csproj index fce098feb..d8f8729f5 100644 --- a/ShareX/ShareX.csproj +++ b/ShareX/ShareX.csproj @@ -149,6 +149,7 @@ + UserControl @@ -178,6 +179,7 @@ + Form