mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Indexer custom CSS file path changes to not use it from program files
This commit is contained in:
parent
1b9e14c2a6
commit
1de5f7977a
9 changed files with 31 additions and 31 deletions
|
@ -55,7 +55,6 @@ Name: "CreateStartupIcon"; Description: "Launch {#AppName} automatically at Wind
|
||||||
Source: "{#AppParentDirectory}\ShareX.exe"; DestDir: {app}; Flags: ignoreversion
|
Source: "{#AppParentDirectory}\ShareX.exe"; DestDir: {app}; Flags: ignoreversion
|
||||||
Source: "{#AppParentDirectory}\ShareX.exe.config"; DestDir: {app}; Flags: ignoreversion
|
Source: "{#AppParentDirectory}\ShareX.exe.config"; DestDir: {app}; Flags: ignoreversion
|
||||||
Source: "{#AppParentDirectory}\*.dll"; DestDir: {app}; Flags: ignoreversion
|
Source: "{#AppParentDirectory}\*.dll"; DestDir: {app}; Flags: ignoreversion
|
||||||
Source: "{#AppParentDirectory}\IndexerDefault.css"; DestDir: {app}; Flags: ignoreversion
|
|
||||||
Source: "..\Licenses\*.txt"; DestDir: {app}\Licenses; Flags: ignoreversion
|
Source: "..\Licenses\*.txt"; DestDir: {app}\Licenses; Flags: ignoreversion
|
||||||
Source: "Output\Recorder-devices-setup.exe"; DestDir: {app}; Flags: ignoreversion
|
Source: "Output\Recorder-devices-setup.exe"; DestDir: {app}; Flags: ignoreversion
|
||||||
Source: "..\..\ShareX_Chrome\ShareX_Chrome\bin\Release\ShareX_Chrome.exe"; DestDir: {app}; Flags: ignoreversion
|
Source: "..\..\ShareX_Chrome\ShareX_Chrome\bin\Release\ShareX_Chrome.exe"; DestDir: {app}; Flags: ignoreversion
|
||||||
|
|
|
@ -32,22 +32,6 @@ namespace ShareX.IndexerLib
|
||||||
{
|
{
|
||||||
public static class HtmlHelper
|
public static class HtmlHelper
|
||||||
{
|
{
|
||||||
public static string GetCssStyle(string filePath)
|
|
||||||
{
|
|
||||||
string css;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath))
|
|
||||||
{
|
|
||||||
css = File.ReadAllText(filePath, Encoding.UTF8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
css = Resources.IndexerDefault;
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Format("<style type=\"text/css\">\r\n{0}\r\n</style>", css);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string StartTag(string tag, string style = "", string otherFields = "")
|
public static string StartTag(string tag, string style = "", string otherFields = "")
|
||||||
{
|
{
|
||||||
string css = string.Empty;
|
string css = string.Empty;
|
||||||
|
|
|
@ -44,7 +44,7 @@ public override string Index(string folderPath)
|
||||||
StringBuilder sbHtmlIndex = new StringBuilder();
|
StringBuilder sbHtmlIndex = new StringBuilder();
|
||||||
sbHtmlIndex.AppendLine(Resources.doctype_xhtml);
|
sbHtmlIndex.AppendLine(Resources.doctype_xhtml);
|
||||||
sbHtmlIndex.AppendLine(HtmlHelper.Tag("title", "Index for " + Path.GetFileName(folderPath)));
|
sbHtmlIndex.AppendLine(HtmlHelper.Tag("title", "Index for " + Path.GetFileName(folderPath)));
|
||||||
sbHtmlIndex.AppendLine(HtmlHelper.GetCssStyle(config.CssFilePath));
|
sbHtmlIndex.AppendLine(GetCssStyle());
|
||||||
sbHtmlIndex.AppendLine(HtmlHelper.EndTag("head"));
|
sbHtmlIndex.AppendLine(HtmlHelper.EndTag("head"));
|
||||||
sbHtmlIndex.AppendLine(HtmlHelper.StartTag("body"));
|
sbHtmlIndex.AppendLine(HtmlHelper.StartTag("body"));
|
||||||
string index = base.Index(folderPath).Trim();
|
string index = base.Index(folderPath).Trim();
|
||||||
|
@ -127,5 +127,21 @@ protected override string GetFooter()
|
||||||
return string.Format("Generated by {0} on {1}.", string.Format("<a href=\"{0}\">{1}</a>", Links.URL_WEBSITE, "ShareX " + Application.ProductVersion),
|
return string.Format("Generated by {0} on {1}.", string.Format("<a href=\"{0}\">{1}</a>", Links.URL_WEBSITE, "ShareX " + Application.ProductVersion),
|
||||||
DateTime.UtcNow.ToString("yyyy-MM-dd 'at' HH:mm:ss 'UTC'"));
|
DateTime.UtcNow.ToString("yyyy-MM-dd 'at' HH:mm:ss 'UTC'"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetCssStyle()
|
||||||
|
{
|
||||||
|
string css;
|
||||||
|
|
||||||
|
if (config.UseCustomCSSFile && !string.IsNullOrEmpty(config.CustomCSSFilePath) && File.Exists(config.CustomCSSFilePath))
|
||||||
|
{
|
||||||
|
css = File.ReadAllText(config.CustomCSSFilePath, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
css = Resources.IndexerDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"<style type=\"text/css\">\r\n{css}\r\n</style>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -53,9 +53,12 @@ public class IndexerSettings
|
||||||
[Category("Indexer / Text"), DefaultValue(false), Description("Adds empty line after folders.")]
|
[Category("Indexer / Text"), DefaultValue(false), Description("Adds empty line after folders.")]
|
||||||
public bool AddEmptyLineAfterFolders { get; set; }
|
public bool AddEmptyLineAfterFolders { get; set; }
|
||||||
|
|
||||||
[Category("Indexer / HTML"), DefaultValue("IndexerDefault.css"), Description("Cascading Style Sheet file path.")]
|
[Category("Indexer / HTML"), DefaultValue(false), Description("Use custom Cascading Style Sheet file.")]
|
||||||
|
public bool UseCustomCSSFile { get; set; }
|
||||||
|
|
||||||
|
[Category("Indexer / HTML"), DefaultValue(""), Description("Custom Cascading Style Sheet file path.")]
|
||||||
[Editor(typeof(CssFileNameEditor), typeof(UITypeEditor))]
|
[Editor(typeof(CssFileNameEditor), typeof(UITypeEditor))]
|
||||||
public string CssFilePath { get; set; }
|
public string CustomCSSFilePath { get; set; }
|
||||||
|
|
||||||
[Category("Indexer / HTML"), DefaultValue(false), Description("Add W3C validation icons. The W3C validation icons may be used on documents that successfully passed validation for a specific technology, using the W3C validation services.")]
|
[Category("Indexer / HTML"), DefaultValue(false), Description("Add W3C validation icons. The W3C validation icons may be used on documents that successfully passed validation for a specific technology, using the W3C validation services.")]
|
||||||
public bool AddValidationIcons { get; set; }
|
public bool AddValidationIcons { get; set; }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.34209
|
// Runtime Version:4.0.30319.42000
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
|
|
@ -112,12 +112,12 @@
|
||||||
<value>2.0</value>
|
<value>2.0</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="reader">
|
<resheader name="reader">
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
<data name="doctype_xhtml" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="doctype_xhtml" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\doctype_xhtml.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
<value>..\Resources\doctype_xhtml.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -125,6 +125,6 @@
|
||||||
<value>..\Resources\valid_xhtml.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
<value>..\Resources\valid_xhtml.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="IndexerDefault" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="IndexerDefault" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\IndexerDefault.css;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;windows-1254</value>
|
<value>..\resources\indexerdefault.css;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -92,9 +92,7 @@
|
||||||
<None Include="Resources\doctype_xhtml.txt" />
|
<None Include="Resources\doctype_xhtml.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="IndexerDefault.css">
|
<None Include="Resources\IndexerDefault.css" />
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||||
|
|
|
@ -55,6 +55,7 @@ private enum SetupType
|
||||||
private static readonly string steamOutputDir = Path.Combine(outputDir, "ShareX");
|
private static readonly string steamOutputDir = Path.Combine(outputDir, "ShareX");
|
||||||
private static readonly string steamLauncherDir = Path.Combine(parentDir, @"..\ShareX_Steam\ShareX_Steam\bin\Release");
|
private static readonly string steamLauncherDir = Path.Combine(parentDir, @"..\ShareX_Steam\ShareX_Steam\bin\Release");
|
||||||
private static readonly string steamUpdatesDir = Path.Combine(steamOutputDir, "Updates");
|
private static readonly string steamUpdatesDir = Path.Combine(steamOutputDir, "Updates");
|
||||||
|
private static readonly string chromeReleaseDir = Path.Combine(parentDir, @"..\ShareX_Chrome\ShareX_Chrome\bin\Release");
|
||||||
private static readonly string innoSetupPath = @"C:\Program Files (x86)\Inno Setup 5\ISCC.exe";
|
private static readonly string innoSetupPath = @"C:\Program Files (x86)\Inno Setup 5\ISCC.exe";
|
||||||
private static readonly string innoSetupScriptPath = Path.Combine(parentDir, "InnoSetup", "ShareX setup.iss");
|
private static readonly string innoSetupScriptPath = Path.Combine(parentDir, "InnoSetup", "ShareX setup.iss");
|
||||||
|
|
||||||
|
@ -138,10 +139,9 @@ private static void CreatePortable(string destination)
|
||||||
CopyFile(Path.Combine(ReleaseDirectory, "ShareX.exe"), destination);
|
CopyFile(Path.Combine(ReleaseDirectory, "ShareX.exe"), destination);
|
||||||
CopyFile(Path.Combine(ReleaseDirectory, "ShareX.exe.config"), destination);
|
CopyFile(Path.Combine(ReleaseDirectory, "ShareX.exe.config"), destination);
|
||||||
CopyFiles(ReleaseDirectory, "*.dll", destination);
|
CopyFiles(ReleaseDirectory, "*.dll", destination);
|
||||||
CopyFile(Path.Combine(ReleaseDirectory, "IndexerDefault.css"), destination);
|
|
||||||
CopyFiles(Path.Combine(parentDir, "Licenses"), "*.txt", Path.Combine(destination, "Licenses"));
|
CopyFiles(Path.Combine(parentDir, "Licenses"), "*.txt", Path.Combine(destination, "Licenses"));
|
||||||
CopyFile(Path.Combine(outputDir, "Recorder-devices-setup.exe"), destination);
|
CopyFile(Path.Combine(outputDir, "Recorder-devices-setup.exe"), destination);
|
||||||
CopyFile(Path.Combine(parentDir, @"..\ShareX_Chrome\ShareX_Chrome\bin\Release\ShareX_Chrome.exe"), destination);
|
CopyFile(Path.Combine(chromeReleaseDir, "ShareX_Chrome.exe"), destination);
|
||||||
|
|
||||||
string[] languages = new string[] { "de", "es", "fr", "hu", "ko-KR", "nl-NL", "pt-BR", "tr", "zh-CN" };
|
string[] languages = new string[] { "de", "es", "fr", "hu", "ko-KR", "nl-NL", "pt-BR", "tr", "zh-CN" };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue