mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-05 20:54:31 +13:00
Creating manifest file dynamically
This commit is contained in:
parent
e15efd8855
commit
1080d899cf
8 changed files with 30 additions and 35 deletions
16
ShareX/Forms/ApplicationSettingsForm.Designer.cs
generated
16
ShareX/Forms/ApplicationSettingsForm.Designer.cs
generated
|
@ -33,6 +33,7 @@ private void InitializeComponent()
|
|||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ApplicationSettingsForm));
|
||||
this.tcSettings = new System.Windows.Forms.TabControl();
|
||||
this.tpGeneral = new System.Windows.Forms.TabPage();
|
||||
this.btnChromeSupport = new System.Windows.Forms.Button();
|
||||
this.btnLanguages = new ShareX.HelpersLib.MenuButton();
|
||||
this.cmsLanguages = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.llTranslators = new System.Windows.Forms.LinkLabel();
|
||||
|
@ -108,7 +109,6 @@ private void InitializeComponent()
|
|||
this.tpAdvanced = new System.Windows.Forms.TabPage();
|
||||
this.pgSettings = new System.Windows.Forms.PropertyGrid();
|
||||
this.tttvMain = new ShareX.HelpersLib.TabToTreeView();
|
||||
this.btnChromeSupport = new System.Windows.Forms.Button();
|
||||
this.tcSettings.SuspendLayout();
|
||||
this.tpGeneral.SuspendLayout();
|
||||
this.tpPaths.SuspendLayout();
|
||||
|
@ -161,6 +161,13 @@ private void InitializeComponent()
|
|||
this.tpGeneral.Name = "tpGeneral";
|
||||
this.tpGeneral.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnChromeSupport
|
||||
//
|
||||
resources.ApplyResources(this.btnChromeSupport, "btnChromeSupport");
|
||||
this.btnChromeSupport.Name = "btnChromeSupport";
|
||||
this.btnChromeSupport.UseVisualStyleBackColor = true;
|
||||
this.btnChromeSupport.Click += new System.EventHandler(this.btnChromeSupport_Click);
|
||||
//
|
||||
// btnLanguages
|
||||
//
|
||||
resources.ApplyResources(this.btnLanguages, "btnLanguages");
|
||||
|
@ -718,13 +725,6 @@ private void InitializeComponent()
|
|||
this.tttvMain.TreeViewFont = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
|
||||
this.tttvMain.TreeViewSize = 175;
|
||||
//
|
||||
// btnChromeSupport
|
||||
//
|
||||
resources.ApplyResources(this.btnChromeSupport, "btnChromeSupport");
|
||||
this.btnChromeSupport.Name = "btnChromeSupport";
|
||||
this.btnChromeSupport.UseVisualStyleBackColor = true;
|
||||
this.btnChromeSupport.Click += new System.EventHandler(this.btnChromeSupport_Click);
|
||||
//
|
||||
// ApplicationSettingsForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
|
|
|
@ -126,14 +126,14 @@
|
|||
<value>8, 272</value>
|
||||
</data>
|
||||
<data name="btnChromeSupport.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 24</value>
|
||||
<value>224, 24</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="btnChromeSupport.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name="btnChromeSupport.Text" xml:space="preserve">
|
||||
<value>Chrome support...</value>
|
||||
<value>Chrome extension support...</value>
|
||||
</data>
|
||||
<data name=">>btnChromeSupport.Name" xml:space="preserve">
|
||||
<value>btnChromeSupport</value>
|
||||
|
|
2
ShareX/Forms/ChromeForm.Designer.cs
generated
2
ShareX/Forms/ChromeForm.Designer.cs
generated
|
@ -121,7 +121,7 @@ private void InitializeComponent()
|
|||
this.MaximizeBox = false;
|
||||
this.Name = "ChromeForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "ShareX - Chrome support";
|
||||
this.Text = "ShareX - Chrome extension support";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using ShareX.HelpersLib;
|
||||
using ShareX.Properties;
|
||||
using System;
|
||||
|
@ -45,13 +46,27 @@ public ChromeForm()
|
|||
Icon = ShareXResources.Icon;
|
||||
}
|
||||
|
||||
private void CreateChromeHostManifest(string filepath)
|
||||
{
|
||||
var manifest = new
|
||||
{
|
||||
name = "com.test.test",
|
||||
description = "ShareX",
|
||||
path = Program.ChromeHostPath,
|
||||
type = "stdio",
|
||||
allowed_origins = new string[] { "" }
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(manifest, Formatting.Indented);
|
||||
|
||||
File.WriteAllText(filepath, json, Encoding.UTF8);
|
||||
}
|
||||
|
||||
private void btnRegister_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string manifest = Encoding.UTF8.GetString(Resources.Chrome_host_manifest);
|
||||
manifest = manifest.Replace("{path}", Program.ChromeHostPath);
|
||||
File.WriteAllText(Program.ChromeHostManifestPath, manifest, Encoding.UTF8);
|
||||
CreateChromeHostManifest(Program.ChromeHostManifestPath);
|
||||
|
||||
RegistryHelpers.RegisterChromeSupport(Program.ChromeHostManifestPath);
|
||||
}
|
||||
|
@ -80,6 +95,7 @@ private void btnUnregister_Click(object sender, EventArgs e)
|
|||
|
||||
private void btnInstallExtension_Click(object sender, EventArgs e)
|
||||
{
|
||||
URLHelpers.OpenURL("");
|
||||
}
|
||||
}
|
||||
}
|
10
ShareX/Properties/Resources.Designer.cs
generated
10
ShareX/Properties/Resources.Designer.cs
generated
|
@ -454,16 +454,6 @@ public static System.Drawing.Bitmap checkbox_uncheck {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
public static byte[] Chrome_host_manifest {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Chrome_host_manifest", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
|
|
@ -784,7 +784,4 @@ Would you like to restart ShareX?</value>
|
|||
<data name="arrow-270" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrow-270.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Chrome_host_manifest" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\chrome-host-manifest.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "com.test.test",
|
||||
"description": "ShareX",
|
||||
"path": "{path}",
|
||||
"type": "stdio",
|
||||
"allowed_origins": [ "" ]
|
||||
}
|
|
@ -866,7 +866,6 @@
|
|||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Resources\Chrome-host-manifest.json" />
|
||||
<None Include="Resources\RoundedRectangle.png" />
|
||||
<None Include="Resources\Rectangle.png" />
|
||||
<None Include="Resources\Polygon.png" />
|
||||
|
|
Loading…
Reference in a new issue