Merge remote-tracking branch 'refs/remotes/ShareX/master'

This commit is contained in:
Jevan Pipitone 2016-02-04 17:42:09 +11:00
commit 46c26303f3
30 changed files with 2319 additions and 3129 deletions

View file

@ -209,10 +209,18 @@ public static string GetAllCharacters()
return Encoding.UTF8.GetString(Enumerable.Range(1, 255).Select(i => (byte)i).ToArray());
}
public static string GetValidFileName(string fileName)
public static string GetValidFileName(string fileName, string separator = "")
{
char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
return new string(fileName.Where(c => !invalidFileNameChars.Contains(c)).ToArray());
if (string.IsNullOrEmpty(separator))
{
return new string(fileName.Where(c => !invalidFileNameChars.Contains(c)).ToArray());
}
else
{
invalidFileNameChars.ForEach(x => fileName = fileName.Replace(x.ToString(), separator));
return fileName.Trim().Replace(separator + separator, separator);
}
}
public static string GetValidFolderPath(string folderPath)
@ -608,7 +616,7 @@ public static bool BrowseFile(string title, TextBox tb, string initialDirectory
return false;
}
public static bool BrowseFolder(string title, TextBox tb, string initialDirectory = "", bool detectSpecialFolders = true)
public static bool BrowseFolder(string title, TextBox tb, string initialDirectory = "", bool detectSpecialFolders = false)
{
using (FolderSelectDialog fsd = new FolderSelectDialog())
{

View file

@ -34,6 +34,9 @@ namespace ShareX.HelpersLib
{
public abstract class SettingsBase<T> where T : SettingsBase<T>, new()
{
public delegate void SettingsSavedEventHandler(T settings, string filePath, bool result);
public event SettingsSavedEventHandler SettingsSaved;
[Browsable(false)]
public string FilePath { get; private set; }
@ -58,12 +61,24 @@ public bool IsUpgrade
}
}
protected virtual void OnSettingsSaved(string filePath, bool result)
{
if (SettingsSaved != null)
{
SettingsSaved((T)this, filePath, result);
}
}
public bool Save(string filePath)
{
FilePath = filePath;
ApplicationVersion = Application.ProductVersion;
return SaveInternal(this, FilePath, true);
bool result = SaveInternal(this, FilePath, true);
OnSettingsSaved(FilePath, result);
return result;
}
public bool Save()

View file

@ -34,6 +34,8 @@ public enum IndexerOutput
[Description("HTML")]
Html,
[Description("XML")]
Xml
Xml,
[Description("JSON")]
Json
}
}

View file

@ -65,6 +65,7 @@ public FolderInfo(string folderPath)
public void Update()
{
Folders.ForEach(x => x.Update());
Folders.Sort((x, y) => x.FolderName.CompareTo(y.FolderName));
Size = Folders.Sum(x => x.Size) + Files.Sum(x => x.Length);
TotalFileCount = Files.Count + Folders.Sum(x => x.TotalFileCount);
TotalFolderCount = Folders.Count + Folders.Sum(x => x.TotalFolderCount);

View file

@ -0,0 +1,186 @@
namespace ShareX.IndexerLib
{
partial class DirectoryIndexerForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.wbPreview = new System.Windows.Forms.WebBrowser();
this.txtFolderPath = new System.Windows.Forms.TextBox();
this.btnBrowseFolder = new System.Windows.Forms.Button();
this.btnIndexFolder = new System.Windows.Forms.Button();
this.btnUpload = new System.Windows.Forms.Button();
this.tcMain = new System.Windows.Forms.TabControl();
this.tpPreview = new System.Windows.Forms.TabPage();
this.txtPreview = new System.Windows.Forms.TextBox();
this.tpSettings = new System.Windows.Forms.TabPage();
this.pgSettings = new System.Windows.Forms.PropertyGrid();
this.tcMain.SuspendLayout();
this.tpPreview.SuspendLayout();
this.tpSettings.SuspendLayout();
this.SuspendLayout();
//
// wbPreview
//
this.wbPreview.Dock = System.Windows.Forms.DockStyle.Fill;
this.wbPreview.Location = new System.Drawing.Point(0, 0);
this.wbPreview.MinimumSize = new System.Drawing.Size(20, 20);
this.wbPreview.Name = "wbPreview";
this.wbPreview.Size = new System.Drawing.Size(860, 564);
this.wbPreview.TabIndex = 0;
//
// txtFolderPath
//
this.txtFolderPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtFolderPath.Location = new System.Drawing.Point(192, 8);
this.txtFolderPath.Name = "txtFolderPath";
this.txtFolderPath.Size = new System.Drawing.Size(682, 20);
this.txtFolderPath.TabIndex = 2;
this.txtFolderPath.TextChanged += new System.EventHandler(this.txtFolderPath_TextChanged);
//
// btnBrowseFolder
//
this.btnBrowseFolder.Location = new System.Drawing.Point(8, 7);
this.btnBrowseFolder.Name = "btnBrowseFolder";
this.btnBrowseFolder.Size = new System.Drawing.Size(176, 23);
this.btnBrowseFolder.TabIndex = 1;
this.btnBrowseFolder.Text = "Browse folder...";
this.btnBrowseFolder.UseVisualStyleBackColor = true;
this.btnBrowseFolder.Click += new System.EventHandler(this.btnBrowseFolder_Click);
//
// btnIndexFolder
//
this.btnIndexFolder.Enabled = false;
this.btnIndexFolder.Location = new System.Drawing.Point(8, 32);
this.btnIndexFolder.Name = "btnIndexFolder";
this.btnIndexFolder.Size = new System.Drawing.Size(344, 23);
this.btnIndexFolder.TabIndex = 3;
this.btnIndexFolder.Text = "Index selected folder";
this.btnIndexFolder.UseVisualStyleBackColor = true;
this.btnIndexFolder.Click += new System.EventHandler(this.btnIndexFolder_Click);
//
// btnUpload
//
this.btnUpload.Enabled = false;
this.btnUpload.Location = new System.Drawing.Point(360, 32);
this.btnUpload.Name = "btnUpload";
this.btnUpload.Size = new System.Drawing.Size(344, 23);
this.btnUpload.TabIndex = 0;
this.btnUpload.Text = "Upload and close this window";
this.btnUpload.UseVisualStyleBackColor = true;
this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click);
//
// tcMain
//
this.tcMain.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tcMain.Controls.Add(this.tpPreview);
this.tcMain.Controls.Add(this.tpSettings);
this.tcMain.Location = new System.Drawing.Point(8, 64);
this.tcMain.Name = "tcMain";
this.tcMain.SelectedIndex = 0;
this.tcMain.Size = new System.Drawing.Size(868, 590);
this.tcMain.TabIndex = 4;
//
// tpPreview
//
this.tpPreview.Controls.Add(this.txtPreview);
this.tpPreview.Controls.Add(this.wbPreview);
this.tpPreview.Location = new System.Drawing.Point(4, 22);
this.tpPreview.Name = "tpPreview";
this.tpPreview.Size = new System.Drawing.Size(860, 564);
this.tpPreview.TabIndex = 1;
this.tpPreview.Text = "Preview";
this.tpPreview.UseVisualStyleBackColor = true;
//
// txtPreview
//
this.txtPreview.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtPreview.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtPreview.Location = new System.Drawing.Point(0, 0);
this.txtPreview.Multiline = true;
this.txtPreview.Name = "txtPreview";
this.txtPreview.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtPreview.Size = new System.Drawing.Size(860, 564);
this.txtPreview.TabIndex = 0;
//
// tpSettings
//
this.tpSettings.Controls.Add(this.pgSettings);
this.tpSettings.Location = new System.Drawing.Point(4, 22);
this.tpSettings.Name = "tpSettings";
this.tpSettings.Size = new System.Drawing.Size(860, 564);
this.tpSettings.TabIndex = 0;
this.tpSettings.Text = "Settings";
this.tpSettings.UseVisualStyleBackColor = true;
//
// pgSettings
//
this.pgSettings.Dock = System.Windows.Forms.DockStyle.Fill;
this.pgSettings.Location = new System.Drawing.Point(0, 0);
this.pgSettings.Name = "pgSettings";
this.pgSettings.Size = new System.Drawing.Size(860, 564);
this.pgSettings.TabIndex = 0;
this.pgSettings.ToolbarVisible = false;
//
// DirectoryIndexerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(884, 661);
this.Controls.Add(this.tcMain);
this.Controls.Add(this.btnUpload);
this.Controls.Add(this.btnIndexFolder);
this.Controls.Add(this.btnBrowseFolder);
this.Controls.Add(this.txtFolderPath);
this.Name = "DirectoryIndexerForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "ShareX - Directory indexer";
this.tcMain.ResumeLayout(false);
this.tpPreview.ResumeLayout(false);
this.tpPreview.PerformLayout();
this.tpSettings.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.WebBrowser wbPreview;
private System.Windows.Forms.TextBox txtFolderPath;
private System.Windows.Forms.Button btnBrowseFolder;
private System.Windows.Forms.Button btnIndexFolder;
private System.Windows.Forms.Button btnUpload;
private System.Windows.Forms.TabControl tcMain;
private System.Windows.Forms.TabPage tpSettings;
private System.Windows.Forms.PropertyGrid pgSettings;
private System.Windows.Forms.TabPage tpPreview;
private System.Windows.Forms.TextBox txtPreview;
}
}

View file

@ -0,0 +1,127 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2016 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 <http://www.gnu.org/licenses/>.
*/
#endregion License Information (GPL v3)
using ShareX.HelpersLib;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ShareX.IndexerLib
{
public partial class DirectoryIndexerForm : BaseForm
{
public delegate void UploadRequestedEventHandler(string source);
public event UploadRequestedEventHandler UploadRequested;
public IndexerSettings Settings { get; set; }
public string Source { get; private set; }
public DirectoryIndexerForm(IndexerSettings settings)
{
InitializeComponent();
Settings = settings;
pgSettings.SelectedObject = Settings;
BrowseFolder();
}
private void btnBrowseFolder_Click(object sender, EventArgs e)
{
BrowseFolder();
}
private void BrowseFolder()
{
// Translate
if (Helpers.BrowseFolder("ShareX - Choose folder path", txtFolderPath))
{
IndexFolder();
}
}
private void txtFolderPath_TextChanged(object sender, EventArgs e)
{
btnIndexFolder.Enabled = txtFolderPath.TextLength > 0;
}
private void btnIndexFolder_Click(object sender, EventArgs e)
{
IndexFolder();
}
private void IndexFolder()
{
string folderPath = txtFolderPath.Text;
if (!string.IsNullOrEmpty(folderPath) && Directory.Exists(folderPath))
{
btnUpload.Enabled = false;
Source = Indexer.Index(folderPath, Settings);
if (!string.IsNullOrEmpty(Source))
{
tcMain.SelectedTab = tpPreview;
if (Settings.Output == IndexerOutput.Html)
{
txtPreview.Visible = false;
wbPreview.Visible = true;
wbPreview.DocumentText = Source;
}
else
{
wbPreview.Visible = false;
txtPreview.Visible = true;
txtPreview.Text = Source;
}
btnUpload.Enabled = true;
}
}
}
private void btnUpload_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Source))
{
OnUploadRequested(Source);
Close();
}
}
protected void OnUploadRequested(string source)
{
if (UploadRequested != null)
{
UploadRequested(source);
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -33,57 +33,53 @@ namespace ShareX.IndexerLib
{
public abstract class Indexer
{
protected IndexerSettings config = null;
protected StringBuilder sbContent = new StringBuilder();
protected IndexerSettings settings = null;
protected Indexer(IndexerSettings indexerSettings)
{
config = indexerSettings;
settings = indexerSettings;
}
public static string Index(string folderPath, IndexerSettings config)
public static string Index(string folderPath, IndexerSettings settings)
{
Indexer indexer = null;
switch (config.Output)
switch (settings.Output)
{
case IndexerOutput.Html:
indexer = new IndexerHtml(config);
indexer = new IndexerHtml(settings);
break;
case IndexerOutput.Txt:
indexer = new IndexerText(config);
indexer = new IndexerText(settings);
break;
case IndexerOutput.Xml:
indexer = new IndexerXml(config);
indexer = new IndexerXml(settings);
break;
case IndexerOutput.Json:
indexer = new IndexerJson(settings);
break;
}
return indexer.Index(folderPath);
}
public virtual string Index(string folderPath)
{
FolderInfo folderInfo = GetFolderInfo(folderPath);
folderInfo.Update();
public abstract string Index(string folderPath);
IndexFolder(folderInfo);
return sbContent.ToString();
}
protected abstract void IndexFolder(FolderInfo dir, int level = 0);
protected FolderInfo GetFolderInfo(string folderPath, int level = 0)
{
FolderInfo folderInfo = new FolderInfo(folderPath);
if (config.MaxDepthLevel == 0 || level < config.MaxDepthLevel)
if (settings.MaxDepthLevel == 0 || level < settings.MaxDepthLevel)
{
try
{
DirectoryInfo currentDirectoryInfo = new DirectoryInfo(folderPath);
foreach (DirectoryInfo directoryInfo in currentDirectoryInfo.GetDirectories())
foreach (DirectoryInfo directoryInfo in currentDirectoryInfo.EnumerateDirectories())
{
if (config.SkipHiddenFolders && directoryInfo.Attributes.HasFlag(FileAttributes.Hidden))
if (settings.SkipHiddenFolders && directoryInfo.Attributes.HasFlag(FileAttributes.Hidden))
{
continue;
}
@ -93,9 +89,9 @@ protected FolderInfo GetFolderInfo(string folderPath, int level = 0)
subFolderInfo.Parent = folderInfo;
}
foreach (FileInfo fileInfo in currentDirectoryInfo.GetFiles())
foreach (FileInfo fileInfo in currentDirectoryInfo.EnumerateFiles())
{
if (config.SkipHiddenFiles && fileInfo.Attributes.HasFlag(FileAttributes.Hidden))
if (settings.SkipHiddenFiles && fileInfo.Attributes.HasFlag(FileAttributes.Hidden))
{
continue;
}
@ -112,30 +108,5 @@ protected FolderInfo GetFolderInfo(string folderPath, int level = 0)
return folderInfo;
}
protected abstract void IndexFolder(FolderInfo dir, int level = 0);
protected virtual string GetFolderNameRow(FolderInfo dir, int level = 0)
{
string text = string.Format("{0}{1}", config.IndentationText.Repeat(level), dir.FolderName);
if (dir.Size > 0)
{
text += string.Format(" [{0}]", dir.Size.ToSizeString(config.BinaryUnits));
}
return text;
}
protected virtual string GetFileNameRow(FileInfo fi, int level = 0)
{
return string.Format("{0}{1} [{2}]", config.IndentationText.Repeat(level), fi.Name, fi.Length.ToSizeString(config.BinaryUnits));
}
protected virtual string GetFooter()
{
return string.Format("Generated by ShareX {0} on {1}. Latest version can be downloaded from: {2}", Application.ProductVersion,
DateTime.UtcNow.ToString("yyyy-MM-dd 'at' HH:mm:ss 'UTC'"), Links.URL_WEBSITE);
}
}
}

View file

@ -34,29 +34,39 @@ namespace ShareX.IndexerLib
{
public class IndexerHtml : Indexer
{
public IndexerHtml(IndexerSettings indexerSettings)
: base(indexerSettings)
protected StringBuilder sbContent = new StringBuilder();
public IndexerHtml(IndexerSettings indexerSettings) : base(indexerSettings)
{
}
public override string Index(string folderPath)
{
StringBuilder sbHtmlIndex = new StringBuilder();
sbHtmlIndex.AppendLine(Resources.doctype_xhtml);
sbHtmlIndex.AppendLine("<!DOCTYPE html>");
sbHtmlIndex.AppendLine(HtmlHelper.StartTag("html"));
sbHtmlIndex.AppendLine(HtmlHelper.StartTag("head"));
sbHtmlIndex.AppendLine("<meta charset=\"UTF-8\">");
sbHtmlIndex.AppendLine("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">");
sbHtmlIndex.AppendLine(HtmlHelper.Tag("title", "Index for " + Path.GetFileName(folderPath)));
sbHtmlIndex.AppendLine(GetCssStyle());
sbHtmlIndex.AppendLine(HtmlHelper.EndTag("head"));
sbHtmlIndex.AppendLine(HtmlHelper.StartTag("body"));
string index = base.Index(folderPath).Trim();
FolderInfo folderInfo = GetFolderInfo(folderPath);
folderInfo.Update();
IndexFolder(folderInfo);
string index = sbContent.ToString().Trim();
sbHtmlIndex.AppendLine(index);
if (config.AddFooter) sbHtmlIndex.AppendLine(HtmlHelper.StartTag("div") + GetFooter() + HtmlHelper.EndTag("div"));
if (config.AddValidationIcons) sbHtmlIndex.AppendLine(Resources.valid_xhtml);
if (settings.AddFooter) sbHtmlIndex.AppendLine(HtmlHelper.StartTag("div") + GetFooter() + HtmlHelper.EndTag("div"));
sbHtmlIndex.AppendLine(HtmlHelper.EndTag("body"));
sbHtmlIndex.AppendLine(HtmlHelper.EndTag("html"));
return sbHtmlIndex.ToString().Trim();
}
protected override void IndexFolder(FolderInfo dir, int level)
protected override void IndexFolder(FolderInfo dir, int level = 0)
{
sbContent.AppendLine(GetFolderNameRow(dir, level));
@ -83,58 +93,69 @@ protected override void IndexFolder(FolderInfo dir, int level)
sbContent.AppendLine(HtmlHelper.EndTag("div"));
}
protected override string GetFolderNameRow(FolderInfo dir, int level)
private string GetFolderNameRow(FolderInfo dir, int level)
{
int heading = (level + 1).Between(1, 6);
string folderInfoText = string.Empty;
string folderNameRow = "";
if (!dir.IsEmpty)
{
folderInfoText = dir.Size.ToSizeString(config.BinaryUnits) + " (";
if (settings.ShowSizeInfo)
{
folderNameRow += dir.Size.ToSizeString(settings.BinaryUnits) + " ";
}
folderNameRow += "(";
if (dir.TotalFileCount > 0)
{
folderInfoText += dir.TotalFileCount + " file" + (dir.TotalFileCount > 1 ? "s" : "");
folderNameRow += dir.TotalFileCount + " file" + (dir.TotalFileCount > 1 ? "s" : "");
}
if (dir.TotalFolderCount > 0)
{
if (dir.TotalFileCount > 0)
{
folderInfoText += ", ";
folderNameRow += ", ";
}
folderInfoText += dir.TotalFolderCount + " folder" + (dir.TotalFolderCount > 1 ? "s" : "");
folderNameRow += dir.TotalFolderCount + " folder" + (dir.TotalFolderCount > 1 ? "s" : "");
}
folderInfoText += ")";
folderInfoText = " " + HtmlHelper.Tag("span", folderInfoText, "", "class=\"folderinfo\"");
folderNameRow += ")";
folderNameRow = " " + HtmlHelper.Tag("span", folderNameRow, "", "class=\"FolderInfo\"");
}
return HtmlHelper.StartTag("h" + heading) + URLHelpers.HtmlEncode(dir.FolderName) + folderInfoText + HtmlHelper.EndTag("h" + heading);
int heading = (level + 1).Between(1, 6);
return HtmlHelper.StartTag("h" + heading) + URLHelpers.HtmlEncode(dir.FolderName) + folderNameRow + HtmlHelper.EndTag("h" + heading);
}
protected override string GetFileNameRow(FileInfo fi, int level)
private string GetFileNameRow(FileInfo fi, int level)
{
string size = " " + HtmlHelper.Tag("span", fi.Length.ToSizeString(config.BinaryUnits), "", "class=\"filesize\"");
string fileNameRow = HtmlHelper.StartTag("li") + URLHelpers.HtmlEncode(fi.Name);
return HtmlHelper.StartTag("li") + URLHelpers.HtmlEncode(fi.Name) + size + HtmlHelper.EndTag("li");
if (settings.ShowSizeInfo)
{
fileNameRow += " " + HtmlHelper.Tag("span", fi.Length.ToSizeString(settings.BinaryUnits), "", "class=\"FileSize\"");
}
fileNameRow += HtmlHelper.EndTag("li");
return fileNameRow;
}
protected override string GetFooter()
private string GetFooter()
{
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'"));
return $"Generated by <a href=\"{Links.URL_WEBSITE}\">ShareX Directory Indexer</a> on {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))
if (settings.UseCustomCSSFile && !string.IsNullOrEmpty(settings.CustomCSSFilePath) && File.Exists(settings.CustomCSSFilePath))
{
css = File.ReadAllText(config.CustomCSSFilePath, Encoding.UTF8);
css = File.ReadAllText(settings.CustomCSSFilePath, Encoding.UTF8);
}
else
{

View file

@ -0,0 +1,147 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2016 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 <http://www.gnu.org/licenses/>.
*/
#endregion License Information (GPL v3)
using Newtonsoft.Json;
using ShareX.HelpersLib;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ShareX.IndexerLib
{
public class IndexerJson : Indexer
{
private JsonWriter jsonWriter;
public IndexerJson(IndexerSettings indexerSettings) : base(indexerSettings)
{
}
public override string Index(string folderPath)
{
FolderInfo folderInfo = GetFolderInfo(folderPath);
folderInfo.Update();
StringBuilder sbContent = new StringBuilder();
using (StringWriter sw = new StringWriter(sbContent))
using (jsonWriter = new JsonTextWriter(sw))
{
jsonWriter.Formatting = Formatting.Indented;
jsonWriter.WriteStartObject();
IndexFolder(folderInfo);
jsonWriter.WriteEndObject();
}
return sbContent.ToString();
}
protected override void IndexFolder(FolderInfo dir, int level = 0)
{
if (settings.CreateParseableJson)
{
IndexFolderParseable(dir, level);
}
else
{
IndexFolderSimple(dir, level);
}
}
private void IndexFolderSimple(FolderInfo dir, int level)
{
jsonWriter.WritePropertyName(dir.FolderName);
jsonWriter.WriteStartArray();
foreach (FolderInfo subdir in dir.Folders)
{
jsonWriter.WriteStartObject();
IndexFolder(subdir);
jsonWriter.WriteEndObject();
}
foreach (FileInfo fi in dir.Files)
{
jsonWriter.WriteValue(fi.Name);
}
jsonWriter.WriteEnd();
}
private void IndexFolderParseable(FolderInfo dir, int level)
{
jsonWriter.WritePropertyName("Name");
jsonWriter.WriteValue(dir.FolderName);
if (settings.ShowSizeInfo)
{
jsonWriter.WritePropertyName("Size");
jsonWriter.WriteValue(dir.Size.ToSizeString(settings.BinaryUnits));
}
if (dir.Folders.Count > 0)
{
jsonWriter.WritePropertyName("Folders");
jsonWriter.WriteStartArray();
foreach (FolderInfo subdir in dir.Folders)
{
jsonWriter.WriteStartObject();
IndexFolder(subdir);
jsonWriter.WriteEndObject();
}
jsonWriter.WriteEnd();
}
if (dir.Files.Count > 0)
{
jsonWriter.WritePropertyName("Files");
jsonWriter.WriteStartArray();
foreach (FileInfo fi in dir.Files)
{
jsonWriter.WriteStartObject();
jsonWriter.WritePropertyName("Name");
jsonWriter.WriteValue(fi.Name);
if (settings.ShowSizeInfo)
{
jsonWriter.WritePropertyName("Size");
jsonWriter.WriteValue(fi.Length.ToSizeString(settings.BinaryUnits));
}
jsonWriter.WriteEndObject();
}
jsonWriter.WriteEnd();
}
}
}
}

View file

@ -32,7 +32,7 @@ namespace ShareX.IndexerLib
{
public class IndexerSettings
{
[Category("Indexer"), DefaultValue(IndexerOutput.Html), Description("Indexer output type.")]
[Category("Indexer"), DefaultValue(IndexerOutput.Html), Description("Indexer output type."), TypeConverter(typeof(EnumDescriptionConverter))]
public IndexerOutput Output { get; set; }
[Category("Indexer"), DefaultValue(true), Description("Don't index hidden folders.")]
@ -44,6 +44,9 @@ public class IndexerSettings
[Category("Indexer"), DefaultValue(0), Description("Maximum folder depth level for indexing. 0 means unlimited.")]
public int MaxDepthLevel { get; set; }
[Category("Indexer"), DefaultValue(true), Description("Write folder and file size.")]
public bool ShowSizeInfo { get; set; }
[Category("Indexer"), DefaultValue(true), Description("Add footer information to show application and generated time.")]
public bool AddFooter { get; set; }
@ -56,16 +59,15 @@ public class IndexerSettings
[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))]
[Category("Indexer / HTML"), DefaultValue(""), Description("Custom Cascading Style Sheet file path."), Editor(typeof(CssFileNameEditor), typeof(UITypeEditor))]
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.")]
public bool AddValidationIcons { get; set; }
[Category("Indexer / XML"), DefaultValue(true), Description("Folder/File information (name, size etc.) will be written as attribute.")]
public bool UseAttribute { get; set; }
[Category("Indexer / JSON"), DefaultValue(true), Description("Creates parseable but longer json output.")]
public bool CreateParseableJson { get; set; }
[JsonIgnore]
public bool BinaryUnits;

View file

@ -24,24 +24,33 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using ShareX.HelpersLib;
using System;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace ShareX.IndexerLib
{
public class IndexerText : Indexer
{
public IndexerText(IndexerSettings indexerSettings)
: base(indexerSettings)
protected StringBuilder sbContent = new StringBuilder();
public IndexerText(IndexerSettings indexerSettings) : base(indexerSettings)
{
}
public override string Index(string folderPath)
{
StringBuilder sbTxtIndex = new StringBuilder();
string index = base.Index(folderPath).Trim();
FolderInfo folderInfo = GetFolderInfo(folderPath);
folderInfo.Update();
IndexFolder(folderInfo);
string index = sbContent.ToString().Trim();
sbTxtIndex.AppendLine(index);
if (config.AddFooter)
if (settings.AddFooter)
{
string footer = GetFooter();
sbTxtIndex.AppendLine("_".Repeat(footer.Length));
@ -50,13 +59,13 @@ public override string Index(string folderPath)
return sbTxtIndex.ToString().Trim();
}
protected override void IndexFolder(FolderInfo dir, int level)
protected override void IndexFolder(FolderInfo dir, int level = 0)
{
sbContent.AppendLine(GetFolderNameRow(dir, level));
foreach (FolderInfo subdir in dir.Folders)
{
if (config.AddEmptyLineAfterFolders)
if (settings.AddEmptyLineAfterFolders)
{
sbContent.AppendLine();
}
@ -66,7 +75,7 @@ protected override void IndexFolder(FolderInfo dir, int level)
if (dir.Files.Count > 0)
{
if (config.AddEmptyLineAfterFolders)
if (settings.AddEmptyLineAfterFolders)
{
sbContent.AppendLine();
}
@ -77,5 +86,34 @@ protected override void IndexFolder(FolderInfo dir, int level)
}
}
}
private string GetFolderNameRow(FolderInfo dir, int level)
{
string folderNameRow = string.Format("{0}{1}", settings.IndentationText.Repeat(level), dir.FolderName);
if (settings.ShowSizeInfo && dir.Size > 0)
{
folderNameRow += string.Format(" [{0}]", dir.Size.ToSizeString(settings.BinaryUnits));
}
return folderNameRow;
}
private string GetFileNameRow(FileInfo fi, int level)
{
string fileNameRow = settings.IndentationText.Repeat(level) + fi.Name;
if (settings.ShowSizeInfo)
{
fileNameRow += string.Format(" [{0}]", fi.Length.ToSizeString(settings.BinaryUnits));
}
return fileNameRow;
}
private string GetFooter()
{
return $"Generated by ShareX Directory Indexer on {DateTime.UtcNow.ToString("yyyy-MM-dd 'at' HH:mm:ss 'UTC'")}. Latest version can be downloaded from: {Links.URL_WEBSITE}";
}
}
}

View file

@ -32,10 +32,9 @@ namespace ShareX.IndexerLib
{
public class IndexerXml : Indexer
{
private XmlWriter xmlWriter;
protected XmlWriter xmlWriter;
public IndexerXml(IndexerSettings indexerSettings)
: base(indexerSettings)
public IndexerXml(IndexerSettings indexerSettings) : base(indexerSettings)
{
}
@ -67,15 +66,23 @@ protected override void IndexFolder(FolderInfo dir, int level = 0)
{
xmlWriter.WriteStartElement("Folder");
if (config.UseAttribute)
if (settings.UseAttribute)
{
xmlWriter.WriteAttributeString("Name", dir.FolderName);
if (!dir.IsEmpty) xmlWriter.WriteAttributeString("Size", dir.Size.ToSizeString(config.BinaryUnits));
if (settings.ShowSizeInfo && !dir.IsEmpty)
{
xmlWriter.WriteAttributeString("Size", dir.Size.ToSizeString(settings.BinaryUnits));
}
}
else
{
xmlWriter.WriteElementString("Name", dir.FolderName);
if (!dir.IsEmpty) xmlWriter.WriteElementString("Size", dir.Size.ToSizeString(config.BinaryUnits));
if (settings.ShowSizeInfo && !dir.IsEmpty)
{
xmlWriter.WriteElementString("Size", dir.Size.ToSizeString(settings.BinaryUnits));
}
}
if (dir.Files.Count > 0)
@ -86,15 +93,23 @@ protected override void IndexFolder(FolderInfo dir, int level = 0)
{
xmlWriter.WriteStartElement("File");
if (config.UseAttribute)
if (settings.UseAttribute)
{
xmlWriter.WriteAttributeString("Name", fi.Name);
xmlWriter.WriteAttributeString("Size", fi.Length.ToSizeString(config.BinaryUnits));
if (settings.ShowSizeInfo)
{
xmlWriter.WriteAttributeString("Size", fi.Length.ToSizeString(settings.BinaryUnits));
}
}
else
{
xmlWriter.WriteElementString("Name", fi.Name);
xmlWriter.WriteElementString("Size", fi.Length.ToSizeString(config.BinaryUnits));
if (settings.ShowSizeInfo)
{
xmlWriter.WriteElementString("Size", fi.Length.ToSizeString(settings.BinaryUnits));
}
}
xmlWriter.WriteEndElement();

View file

@ -5,7 +5,7 @@
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ShareX Team")]
[assembly: AssemblyProduct("ShareX")]
[assembly: AssemblyProduct("ShareX Directory Indexer")]
[assembly: AssemblyCopyright("Copyright (c) 2007-2016 ShareX Team")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -60,18 +60,6 @@ internal Resources() {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot; &quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&gt;
///&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
///&lt;head&gt;
///&lt;meta http-equiv=&quot;content-type&quot; content=&quot;application/xhtml+xml; charset=utf-8&quot; /&gt;.
/// </summary>
internal static string doctype_xhtml {
get {
return ResourceManager.GetString("doctype_xhtml", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to body {
/// font-family: Arial, Helvetica, sans-serif;
@ -87,8 +75,13 @@ internal static string doctype_xhtml {
///}
///
///ul {
/// margin: 0px 0px 10px 0px;
/// padding-left: 30px;
/// margin: 0px 0px 8px 0px;
/// list-style-type: none;
/// padding-left: 10px;
///}
///
///li {
/// margin-bottom: 2px;
///}
///
///h1, h2, h3, h4, h5, h6 {
@ -97,26 +90,12 @@ internal static string doctype_xhtml {
/// border-top-right-radius: 5px;
/// padding: 4px 0px 4px 10px;
/// margin: 0px 10px -10px 10px;
/// color: #FFFFFF;
/// font-family: Arial, Helvetica, sans-serif;
/// fo [rest of string was truncated]&quot;;.
/// color: # [rest of string was truncated]&quot;;.
/// </summary>
internal static string IndexerDefault {
get {
return ResourceManager.GetString("IndexerDefault", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;p&gt;
///&lt;a href=&quot;http://validator.w3.org/check?uri=referer&quot;&gt;&lt;img src=&quot;http://www.w3.org/Icons/valid-xhtml11-blue&quot; alt=&quot;Valid XHTML 1.1&quot; width=&quot;88&quot; height=&quot;31&quot; /&gt;&lt;/a&gt;
///&lt;a href=&quot;http://jigsaw.w3.org/css-validator/check/referer&quot;&gt;&lt;img src=&quot;http://jigsaw.w3.org/css-validator/images/vcss-blue&quot; alt=&quot;Valid CSS&quot; width=&quot;88&quot; height=&quot;31&quot; /&gt;&lt;/a&gt;
///&lt;/p&gt;.
/// </summary>
internal static string valid_xhtml {
get {
return ResourceManager.GetString("valid_xhtml", resourceCulture);
}
}
}
}

View file

@ -118,12 +118,6 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<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">
<value>..\Resources\doctype_xhtml.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="valid_xhtml" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\valid_xhtml.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="IndexerDefault" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\indexerdefault.css;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>

View file

@ -12,8 +12,13 @@ a:link, a:visited {
}
ul {
margin: 0px 0px 10px 0px;
padding-left: 30px;
margin: 0px 0px 8px 0px;
list-style-type: none;
padding-left: 10px;
}
li {
margin-bottom: 2px;
}
h1, h2, h3, h4, h5, h6 {
@ -31,9 +36,7 @@ h1, h2, h3, h4, h5, h6 {
h1 {
background-color: #336699;
padding: 4px 0px 4px 0px;
margin: 0px 0px -10px 0px;
text-align: center;
font-size: x-large;
}
@ -57,7 +60,7 @@ h6 {
background-color: #66CCFF;
}
div.MainFolderBorder, div.FolderBorder {
.MainFolderBorder, .FolderBorder {
border-style: solid;
border-width: 0px 1px 1px 1px;
border-bottom-left-radius: 5px;
@ -65,20 +68,21 @@ div.MainFolderBorder, div.FolderBorder {
padding: 20px 0px 0px 0px;
}
div.MainFolderBorder {
.MainFolderBorder {
margin: 0px 0px 10px 0px;
}
div.FolderBorder {
.FolderBorder {
margin: 0px 10px 10px 10px;
}
.folderinfo {
.FolderInfo {
color: #FFFFFF;
float: right;
margin-right: 10px;
display: block;
}
.filesize {
.FileSize {
color: #3D7AAD;
}

View file

@ -1,4 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />

View file

@ -1,4 +0,0 @@
<p>
<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11-blue" alt="Valid XHTML 1.1" width="88" height="31" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS" width="88" height="31" /></a>
</p>

View file

@ -50,16 +50,24 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Forms\DirectoryIndexerForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\DirectoryIndexerForm.Designer.cs">
<DependentUpon>DirectoryIndexerForm.cs</DependentUpon>
</Compile>
<Compile Include="Enums.cs" />
<Compile Include="HtmlHelper.cs" />
<Compile Include="Indexer.cs" />
<Compile Include="IndexerHtml.cs" />
<Compile Include="IndexerJson.cs" />
<Compile Include="IndexerSettings.cs" />
<Compile Include="IndexerText.cs" />
<Compile Include="FolderInfo.cs" />
@ -78,6 +86,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Forms\DirectoryIndexerForm.resx">
<DependentUpon>DirectoryIndexerForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -86,10 +97,6 @@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Resources\valid_xhtml.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\doctype_xhtml.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\IndexerDefault.css" />

View file

@ -192,13 +192,13 @@ public string GetFFmpegArgs(bool isCustom = false)
switch (FFmpeg.AudioCodec)
{
case FFmpegAudioCodec.libvoaacenc: // http://trac.ffmpeg.org/wiki/Encode/AAC
args.AppendFormat("-c:a libvo_aacenc -ac 2 -b:a {0}k ", FFmpeg.AAC_bitrate); // -ac 2 required otherwise failing with 7.1
args.AppendFormat("-c:a aac -strict -2 -ac 2 -b:a {0}k ", FFmpeg.AAC_bitrate); // -ac 2 required otherwise failing with 7.1
break;
case FFmpegAudioCodec.libvorbis: // http://trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide
args.AppendFormat("-c:a {0} -qscale:a {1} ", FFmpegAudioCodec.libvorbis, FFmpeg.Vorbis_qscale);
args.AppendFormat("-c:a libvorbis -qscale:a {0} ", FFmpeg.Vorbis_qscale);
break;
case FFmpegAudioCodec.libmp3lame: // http://trac.ffmpeg.org/wiki/Encode/MP3
args.AppendFormat("-c:a {0} -qscale:a {1} ", FFmpegAudioCodec.libmp3lame, FFmpeg.MP3_qscale);
args.AppendFormat("-c:a libmp3lame -qscale:a {0} ", FFmpeg.MP3_qscale);
break;
}
}

View file

@ -361,7 +361,7 @@ private void txtPersonalFolderPath_TextChanged(object sender, EventArgs e)
private void btnBrowsePersonalFolderPath_Click(object sender, EventArgs e)
{
Helpers.BrowseFolder(Resources.ApplicationSettingsForm_btnBrowsePersonalFolderPath_Click_Choose_ShareX_personal_folder_path, txtPersonalFolderPath, Program.PersonalFolder);
Helpers.BrowseFolder(Resources.ApplicationSettingsForm_btnBrowsePersonalFolderPath_Click_Choose_ShareX_personal_folder_path, txtPersonalFolderPath, Program.PersonalFolder, true);
}
private void btnOpenPersonalFolder_Click(object sender, EventArgs e)
@ -383,7 +383,7 @@ private void txtCustomScreenshotsPath_TextChanged(object sender, EventArgs e)
private void btnBrowseCustomScreenshotsPath_Click(object sender, EventArgs e)
{
Helpers.BrowseFolder(Resources.ApplicationSettingsForm_btnBrowseCustomScreenshotsPath_Click_Choose_screenshots_folder_path, txtCustomScreenshotsPath, Program.PersonalFolder);
Helpers.BrowseFolder(Resources.ApplicationSettingsForm_btnBrowseCustomScreenshotsPath_Click_Choose_screenshots_folder_path, txtCustomScreenshotsPath, Program.PersonalFolder, true);
}
private void txtSaveImageSubFolderPattern_TextChanged(object sender, EventArgs e)

View file

@ -1051,7 +1051,7 @@ private void tsmiAutomate_Click(object sender, EventArgs e)
private void tsmiIndexFolder_Click(object sender, EventArgs e)
{
TaskHelpers.OpenIndexFolder();
TaskHelpers.OpenDirectoryIndexer();
}
private void tsmiImageCombiner_Click(object sender, EventArgs e)
@ -1768,7 +1768,7 @@ private void ExecuteJob(TaskSettings taskSettings, HotkeyType job)
TaskHelpers.StartAutomate();
break;
case HotkeyType.IndexFolder:
TaskHelpers.OpenIndexFolder();
UploadManager.IndexFolder();
break;
case HotkeyType.ImageCombiner:
TaskHelpers.OpenImageCombiner(safeTaskSettings);

View file

@ -538,7 +538,7 @@
<value>183, 22</value>
</data>
<data name="tsmiIndexFolder.Text" xml:space="preserve">
<value>Index folder...</value>
<value>Directory indexer...</value>
</data>
<data name="tsmiImageCombiner.Size" type="System.Drawing.Size, System.Drawing">
<value>183, 22</value>
@ -1099,19 +1099,19 @@
<value>Hide columns</value>
</data>
<data name="tsmiImagePreviewShow.Size" type="System.Drawing.Size, System.Drawing">
<value>152, 22</value>
<value>130, 22</value>
</data>
<data name="tsmiImagePreviewShow.Text" xml:space="preserve">
<value>Show</value>
</data>
<data name="tsmiImagePreviewHide.Size" type="System.Drawing.Size, System.Drawing">
<value>152, 22</value>
<value>130, 22</value>
</data>
<data name="tsmiImagePreviewHide.Text" xml:space="preserve">
<value>Hide</value>
</data>
<data name="tsmiImagePreviewAutomatic.Size" type="System.Drawing.Size, System.Drawing">
<value>152, 22</value>
<value>130, 22</value>
</data>
<data name="tsmiImagePreviewAutomatic.Text" xml:space="preserve">
<value>Automatic</value>
@ -1333,7 +1333,7 @@
<value>183, 22</value>
</data>
<data name="tsmiTrayIndexFolder.Text" xml:space="preserve">
<value>Index folder...</value>
<value>Directory indexer...</value>
</data>
<data name="tsmiTrayImageCombiner.Size" type="System.Drawing.Size, System.Drawing">
<value>183, 22</value>

View file

@ -145,6 +145,28 @@ private void InitializeComponent()
this.pgScrollingCapture = new System.Windows.Forms.PropertyGrid();
this.tpRectangleAnnotate = new System.Windows.Forms.TabPage();
this.pgRectangleAnnotate = new System.Windows.Forms.PropertyGrid();
this.tpUpload = new System.Windows.Forms.TabPage();
this.tcUpload = new System.Windows.Forms.TabControl();
this.tpUploadMain = new System.Windows.Forms.TabPage();
this.chkUseDefaultUploadSettings = new System.Windows.Forms.CheckBox();
this.tpFileNaming = new System.Windows.Forms.TabPage();
this.lblAutoIncrementNumber = new System.Windows.Forms.Label();
this.cbRegionCaptureUseWindowPattern = new System.Windows.Forms.CheckBox();
this.cbNameFormatCustomTimeZone = new System.Windows.Forms.CheckBox();
this.lblNameFormatPatternPreview = new System.Windows.Forms.Label();
this.lblNameFormatPatternActiveWindow = new System.Windows.Forms.Label();
this.lblNameFormatPatternPreviewActiveWindow = new System.Windows.Forms.Label();
this.cbNameFormatTimeZone = new System.Windows.Forms.ComboBox();
this.txtNameFormatPatternActiveWindow = new System.Windows.Forms.TextBox();
this.btnResetAutoIncrementNumber = new System.Windows.Forms.Button();
this.cbFileUploadUseNamePattern = new System.Windows.Forms.CheckBox();
this.lblNameFormatPattern = new System.Windows.Forms.Label();
this.txtNameFormatPattern = new System.Windows.Forms.TextBox();
this.tpUploadClipboard = new System.Windows.Forms.TabPage();
this.cbClipboardUploadShareURL = new System.Windows.Forms.CheckBox();
this.chkClipboardUploadURLContents = new System.Windows.Forms.CheckBox();
this.cbClipboardUploadAutoIndexFolder = new System.Windows.Forms.CheckBox();
this.cbClipboardUploadShortenURL = new System.Windows.Forms.CheckBox();
this.tpActions = new System.Windows.Forms.TabPage();
this.pActions = new System.Windows.Forms.Panel();
this.btnActionsDuplicate = new System.Windows.Forms.Button();
@ -165,26 +187,6 @@ private void InitializeComponent()
this.chWatchFolderIncludeSubdirectories = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnWatchFolderRemove = new System.Windows.Forms.Button();
this.btnWatchFolderAdd = new System.Windows.Forms.Button();
this.tpUpload = new System.Windows.Forms.TabPage();
this.tcUpload = new System.Windows.Forms.TabControl();
this.tpUploadMain = new System.Windows.Forms.TabPage();
this.cbRegionCaptureUseWindowPattern = new System.Windows.Forms.CheckBox();
this.cbNameFormatCustomTimeZone = new System.Windows.Forms.CheckBox();
this.cbNameFormatTimeZone = new System.Windows.Forms.ComboBox();
this.lblNameFormatPattern = new System.Windows.Forms.Label();
this.cbFileUploadUseNamePattern = new System.Windows.Forms.CheckBox();
this.lblNameFormatPatternPreviewActiveWindow = new System.Windows.Forms.Label();
this.lblNameFormatPatternPreview = new System.Windows.Forms.Label();
this.txtNameFormatPatternActiveWindow = new System.Windows.Forms.TextBox();
this.txtNameFormatPattern = new System.Windows.Forms.TextBox();
this.btnResetAutoIncrementNumber = new System.Windows.Forms.Button();
this.lblNameFormatPatternActiveWindow = new System.Windows.Forms.Label();
this.chkUseDefaultUploadSettings = new System.Windows.Forms.CheckBox();
this.tpUploadClipboard = new System.Windows.Forms.TabPage();
this.cbClipboardUploadShareURL = new System.Windows.Forms.CheckBox();
this.chkClipboardUploadURLContents = new System.Windows.Forms.CheckBox();
this.cbClipboardUploadAutoIndexFolder = new System.Windows.Forms.CheckBox();
this.cbClipboardUploadShortenURL = new System.Windows.Forms.CheckBox();
this.tpTools = new System.Windows.Forms.TabPage();
this.tcTools = new System.Windows.Forms.TabControl();
this.tpToolsMain = new System.Windows.Forms.TabPage();
@ -197,8 +199,6 @@ private void InitializeComponent()
this.pgTaskSettings = new System.Windows.Forms.PropertyGrid();
this.chkUseDefaultAdvancedSettings = new System.Windows.Forms.CheckBox();
this.tttvMain = new ShareX.HelpersLib.TabToTreeView();
this.tpFileNaming = new System.Windows.Forms.TabPage();
this.lblAutoIncrementNumber = new System.Windows.Forms.Label();
this.tcTaskSettings.SuspendLayout();
this.tpTask.SuspendLayout();
this.cmsDestinations.SuspendLayout();
@ -232,20 +232,20 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.nudGIFFPS)).BeginInit();
this.tpScrollingCapture.SuspendLayout();
this.tpRectangleAnnotate.SuspendLayout();
this.tpActions.SuspendLayout();
this.pActions.SuspendLayout();
this.tpWatchFolders.SuspendLayout();
this.tpUpload.SuspendLayout();
this.tcUpload.SuspendLayout();
this.tpUploadMain.SuspendLayout();
this.tpFileNaming.SuspendLayout();
this.tpUploadClipboard.SuspendLayout();
this.tpActions.SuspendLayout();
this.pActions.SuspendLayout();
this.tpWatchFolders.SuspendLayout();
this.tpTools.SuspendLayout();
this.tcTools.SuspendLayout();
this.tpToolsMain.SuspendLayout();
this.tpIndexer.SuspendLayout();
this.tpVideoThumbnailer.SuspendLayout();
this.tpAdvanced.SuspendLayout();
this.tpFileNaming.SuspendLayout();
this.SuspendLayout();
//
// cmsAfterCapture
@ -563,13 +563,13 @@ private void InitializeComponent()
//
resources.ApplyResources(this.nudUseImageFormat2After, "nudUseImageFormat2After");
this.nudUseImageFormat2After.Maximum = new decimal(new int[] {
5000,
2048,
0,
0,
0});
this.nudUseImageFormat2After.Name = "nudUseImageFormat2After";
this.nudUseImageFormat2After.Value = new decimal(new int[] {
1024,
2048,
0,
0,
0});
@ -1240,6 +1240,167 @@ private void InitializeComponent()
this.pgRectangleAnnotate.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.pgRectangleAnnotate.ToolbarVisible = false;
//
// tpUpload
//
this.tpUpload.Controls.Add(this.tcUpload);
resources.ApplyResources(this.tpUpload, "tpUpload");
this.tpUpload.Name = "tpUpload";
this.tpUpload.UseVisualStyleBackColor = true;
//
// tcUpload
//
this.tcUpload.Controls.Add(this.tpUploadMain);
this.tcUpload.Controls.Add(this.tpFileNaming);
this.tcUpload.Controls.Add(this.tpUploadClipboard);
resources.ApplyResources(this.tcUpload, "tcUpload");
this.tcUpload.Name = "tcUpload";
this.tcUpload.SelectedIndex = 0;
//
// tpUploadMain
//
this.tpUploadMain.Controls.Add(this.chkUseDefaultUploadSettings);
resources.ApplyResources(this.tpUploadMain, "tpUploadMain");
this.tpUploadMain.Name = "tpUploadMain";
this.tpUploadMain.UseVisualStyleBackColor = true;
//
// chkUseDefaultUploadSettings
//
resources.ApplyResources(this.chkUseDefaultUploadSettings, "chkUseDefaultUploadSettings");
this.chkUseDefaultUploadSettings.Checked = true;
this.chkUseDefaultUploadSettings.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkUseDefaultUploadSettings.Name = "chkUseDefaultUploadSettings";
this.chkUseDefaultUploadSettings.UseVisualStyleBackColor = true;
this.chkUseDefaultUploadSettings.CheckedChanged += new System.EventHandler(this.chkUseDefaultUploadSettings_CheckedChanged);
//
// tpFileNaming
//
this.tpFileNaming.Controls.Add(this.lblAutoIncrementNumber);
this.tpFileNaming.Controls.Add(this.cbRegionCaptureUseWindowPattern);
this.tpFileNaming.Controls.Add(this.cbNameFormatCustomTimeZone);
this.tpFileNaming.Controls.Add(this.lblNameFormatPatternPreview);
this.tpFileNaming.Controls.Add(this.lblNameFormatPatternActiveWindow);
this.tpFileNaming.Controls.Add(this.lblNameFormatPatternPreviewActiveWindow);
this.tpFileNaming.Controls.Add(this.cbNameFormatTimeZone);
this.tpFileNaming.Controls.Add(this.txtNameFormatPatternActiveWindow);
this.tpFileNaming.Controls.Add(this.btnResetAutoIncrementNumber);
this.tpFileNaming.Controls.Add(this.cbFileUploadUseNamePattern);
this.tpFileNaming.Controls.Add(this.lblNameFormatPattern);
this.tpFileNaming.Controls.Add(this.txtNameFormatPattern);
resources.ApplyResources(this.tpFileNaming, "tpFileNaming");
this.tpFileNaming.Name = "tpFileNaming";
this.tpFileNaming.UseVisualStyleBackColor = true;
//
// lblAutoIncrementNumber
//
resources.ApplyResources(this.lblAutoIncrementNumber, "lblAutoIncrementNumber");
this.lblAutoIncrementNumber.Name = "lblAutoIncrementNumber";
//
// cbRegionCaptureUseWindowPattern
//
resources.ApplyResources(this.cbRegionCaptureUseWindowPattern, "cbRegionCaptureUseWindowPattern");
this.cbRegionCaptureUseWindowPattern.Name = "cbRegionCaptureUseWindowPattern";
this.cbRegionCaptureUseWindowPattern.UseVisualStyleBackColor = true;
this.cbRegionCaptureUseWindowPattern.CheckedChanged += new System.EventHandler(this.cbRegionCaptureUseWindowPattern_CheckedChanged);
//
// cbNameFormatCustomTimeZone
//
resources.ApplyResources(this.cbNameFormatCustomTimeZone, "cbNameFormatCustomTimeZone");
this.cbNameFormatCustomTimeZone.Name = "cbNameFormatCustomTimeZone";
this.cbNameFormatCustomTimeZone.UseVisualStyleBackColor = true;
this.cbNameFormatCustomTimeZone.CheckedChanged += new System.EventHandler(this.cbNameFormatCustomTimeZone_CheckedChanged);
//
// lblNameFormatPatternPreview
//
resources.ApplyResources(this.lblNameFormatPatternPreview, "lblNameFormatPatternPreview");
this.lblNameFormatPatternPreview.Name = "lblNameFormatPatternPreview";
//
// lblNameFormatPatternActiveWindow
//
resources.ApplyResources(this.lblNameFormatPatternActiveWindow, "lblNameFormatPatternActiveWindow");
this.lblNameFormatPatternActiveWindow.Name = "lblNameFormatPatternActiveWindow";
//
// lblNameFormatPatternPreviewActiveWindow
//
resources.ApplyResources(this.lblNameFormatPatternPreviewActiveWindow, "lblNameFormatPatternPreviewActiveWindow");
this.lblNameFormatPatternPreviewActiveWindow.Name = "lblNameFormatPatternPreviewActiveWindow";
//
// cbNameFormatTimeZone
//
this.cbNameFormatTimeZone.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbNameFormatTimeZone.FormattingEnabled = true;
resources.ApplyResources(this.cbNameFormatTimeZone, "cbNameFormatTimeZone");
this.cbNameFormatTimeZone.Name = "cbNameFormatTimeZone";
this.cbNameFormatTimeZone.SelectedIndexChanged += new System.EventHandler(this.cbNameFormatTimeZone_SelectedIndexChanged);
//
// txtNameFormatPatternActiveWindow
//
resources.ApplyResources(this.txtNameFormatPatternActiveWindow, "txtNameFormatPatternActiveWindow");
this.txtNameFormatPatternActiveWindow.Name = "txtNameFormatPatternActiveWindow";
this.txtNameFormatPatternActiveWindow.TextChanged += new System.EventHandler(this.txtNameFormatPatternActiveWindow_TextChanged);
//
// btnResetAutoIncrementNumber
//
resources.ApplyResources(this.btnResetAutoIncrementNumber, "btnResetAutoIncrementNumber");
this.btnResetAutoIncrementNumber.Name = "btnResetAutoIncrementNumber";
this.btnResetAutoIncrementNumber.UseVisualStyleBackColor = true;
this.btnResetAutoIncrementNumber.Click += new System.EventHandler(this.btnResetAutoIncrementNumber_Click);
//
// cbFileUploadUseNamePattern
//
resources.ApplyResources(this.cbFileUploadUseNamePattern, "cbFileUploadUseNamePattern");
this.cbFileUploadUseNamePattern.Name = "cbFileUploadUseNamePattern";
this.cbFileUploadUseNamePattern.UseVisualStyleBackColor = true;
this.cbFileUploadUseNamePattern.CheckedChanged += new System.EventHandler(this.cbFileUploadUseNamePattern_CheckedChanged);
//
// lblNameFormatPattern
//
resources.ApplyResources(this.lblNameFormatPattern, "lblNameFormatPattern");
this.lblNameFormatPattern.Name = "lblNameFormatPattern";
//
// txtNameFormatPattern
//
resources.ApplyResources(this.txtNameFormatPattern, "txtNameFormatPattern");
this.txtNameFormatPattern.Name = "txtNameFormatPattern";
this.txtNameFormatPattern.TextChanged += new System.EventHandler(this.txtNameFormatPattern_TextChanged);
//
// tpUploadClipboard
//
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadShareURL);
this.tpUploadClipboard.Controls.Add(this.chkClipboardUploadURLContents);
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadAutoIndexFolder);
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadShortenURL);
resources.ApplyResources(this.tpUploadClipboard, "tpUploadClipboard");
this.tpUploadClipboard.Name = "tpUploadClipboard";
this.tpUploadClipboard.UseVisualStyleBackColor = true;
//
// cbClipboardUploadShareURL
//
resources.ApplyResources(this.cbClipboardUploadShareURL, "cbClipboardUploadShareURL");
this.cbClipboardUploadShareURL.Name = "cbClipboardUploadShareURL";
this.cbClipboardUploadShareURL.UseVisualStyleBackColor = true;
this.cbClipboardUploadShareURL.CheckedChanged += new System.EventHandler(this.cbClipboardUploadShareURL_CheckedChanged);
//
// chkClipboardUploadURLContents
//
resources.ApplyResources(this.chkClipboardUploadURLContents, "chkClipboardUploadURLContents");
this.chkClipboardUploadURLContents.Name = "chkClipboardUploadURLContents";
this.chkClipboardUploadURLContents.UseVisualStyleBackColor = true;
this.chkClipboardUploadURLContents.CheckedChanged += new System.EventHandler(this.chkClipboardUploadContents_CheckedChanged);
//
// cbClipboardUploadAutoIndexFolder
//
resources.ApplyResources(this.cbClipboardUploadAutoIndexFolder, "cbClipboardUploadAutoIndexFolder");
this.cbClipboardUploadAutoIndexFolder.Name = "cbClipboardUploadAutoIndexFolder";
this.cbClipboardUploadAutoIndexFolder.UseVisualStyleBackColor = true;
this.cbClipboardUploadAutoIndexFolder.CheckedChanged += new System.EventHandler(this.cbClipboardUploadAutoIndexFolder_CheckedChanged);
//
// cbClipboardUploadShortenURL
//
resources.ApplyResources(this.cbClipboardUploadShortenURL, "cbClipboardUploadShortenURL");
this.cbClipboardUploadShortenURL.Name = "cbClipboardUploadShortenURL";
this.cbClipboardUploadShortenURL.UseVisualStyleBackColor = true;
this.cbClipboardUploadShortenURL.CheckedChanged += new System.EventHandler(this.cbClipboardUploadAutoDetectURL_CheckedChanged);
//
// tpActions
//
this.tpActions.Controls.Add(this.pActions);
@ -1387,144 +1548,6 @@ private void InitializeComponent()
this.btnWatchFolderAdd.UseVisualStyleBackColor = true;
this.btnWatchFolderAdd.Click += new System.EventHandler(this.btnWatchFolderAdd_Click);
//
// tpUpload
//
this.tpUpload.Controls.Add(this.tcUpload);
resources.ApplyResources(this.tpUpload, "tpUpload");
this.tpUpload.Name = "tpUpload";
this.tpUpload.UseVisualStyleBackColor = true;
//
// tcUpload
//
this.tcUpload.Controls.Add(this.tpUploadMain);
this.tcUpload.Controls.Add(this.tpFileNaming);
this.tcUpload.Controls.Add(this.tpUploadClipboard);
resources.ApplyResources(this.tcUpload, "tcUpload");
this.tcUpload.Name = "tcUpload";
this.tcUpload.SelectedIndex = 0;
//
// tpUploadMain
//
this.tpUploadMain.Controls.Add(this.chkUseDefaultUploadSettings);
resources.ApplyResources(this.tpUploadMain, "tpUploadMain");
this.tpUploadMain.Name = "tpUploadMain";
this.tpUploadMain.UseVisualStyleBackColor = true;
//
// cbRegionCaptureUseWindowPattern
//
resources.ApplyResources(this.cbRegionCaptureUseWindowPattern, "cbRegionCaptureUseWindowPattern");
this.cbRegionCaptureUseWindowPattern.Name = "cbRegionCaptureUseWindowPattern";
this.cbRegionCaptureUseWindowPattern.UseVisualStyleBackColor = true;
this.cbRegionCaptureUseWindowPattern.CheckedChanged += new System.EventHandler(this.cbRegionCaptureUseWindowPattern_CheckedChanged);
//
// cbNameFormatCustomTimeZone
//
resources.ApplyResources(this.cbNameFormatCustomTimeZone, "cbNameFormatCustomTimeZone");
this.cbNameFormatCustomTimeZone.Name = "cbNameFormatCustomTimeZone";
this.cbNameFormatCustomTimeZone.UseVisualStyleBackColor = true;
this.cbNameFormatCustomTimeZone.CheckedChanged += new System.EventHandler(this.cbNameFormatCustomTimeZone_CheckedChanged);
//
// cbNameFormatTimeZone
//
this.cbNameFormatTimeZone.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbNameFormatTimeZone.FormattingEnabled = true;
resources.ApplyResources(this.cbNameFormatTimeZone, "cbNameFormatTimeZone");
this.cbNameFormatTimeZone.Name = "cbNameFormatTimeZone";
this.cbNameFormatTimeZone.SelectedIndexChanged += new System.EventHandler(this.cbNameFormatTimeZone_SelectedIndexChanged);
//
// lblNameFormatPattern
//
resources.ApplyResources(this.lblNameFormatPattern, "lblNameFormatPattern");
this.lblNameFormatPattern.Name = "lblNameFormatPattern";
//
// cbFileUploadUseNamePattern
//
resources.ApplyResources(this.cbFileUploadUseNamePattern, "cbFileUploadUseNamePattern");
this.cbFileUploadUseNamePattern.Name = "cbFileUploadUseNamePattern";
this.cbFileUploadUseNamePattern.UseVisualStyleBackColor = true;
this.cbFileUploadUseNamePattern.CheckedChanged += new System.EventHandler(this.cbFileUploadUseNamePattern_CheckedChanged);
//
// lblNameFormatPatternPreviewActiveWindow
//
resources.ApplyResources(this.lblNameFormatPatternPreviewActiveWindow, "lblNameFormatPatternPreviewActiveWindow");
this.lblNameFormatPatternPreviewActiveWindow.Name = "lblNameFormatPatternPreviewActiveWindow";
//
// lblNameFormatPatternPreview
//
resources.ApplyResources(this.lblNameFormatPatternPreview, "lblNameFormatPatternPreview");
this.lblNameFormatPatternPreview.Name = "lblNameFormatPatternPreview";
//
// txtNameFormatPatternActiveWindow
//
resources.ApplyResources(this.txtNameFormatPatternActiveWindow, "txtNameFormatPatternActiveWindow");
this.txtNameFormatPatternActiveWindow.Name = "txtNameFormatPatternActiveWindow";
this.txtNameFormatPatternActiveWindow.TextChanged += new System.EventHandler(this.txtNameFormatPatternActiveWindow_TextChanged);
//
// txtNameFormatPattern
//
resources.ApplyResources(this.txtNameFormatPattern, "txtNameFormatPattern");
this.txtNameFormatPattern.Name = "txtNameFormatPattern";
this.txtNameFormatPattern.TextChanged += new System.EventHandler(this.txtNameFormatPattern_TextChanged);
//
// btnResetAutoIncrementNumber
//
resources.ApplyResources(this.btnResetAutoIncrementNumber, "btnResetAutoIncrementNumber");
this.btnResetAutoIncrementNumber.Name = "btnResetAutoIncrementNumber";
this.btnResetAutoIncrementNumber.UseVisualStyleBackColor = true;
this.btnResetAutoIncrementNumber.Click += new System.EventHandler(this.btnResetAutoIncrementNumber_Click);
//
// lblNameFormatPatternActiveWindow
//
resources.ApplyResources(this.lblNameFormatPatternActiveWindow, "lblNameFormatPatternActiveWindow");
this.lblNameFormatPatternActiveWindow.Name = "lblNameFormatPatternActiveWindow";
//
// chkUseDefaultUploadSettings
//
resources.ApplyResources(this.chkUseDefaultUploadSettings, "chkUseDefaultUploadSettings");
this.chkUseDefaultUploadSettings.Checked = true;
this.chkUseDefaultUploadSettings.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkUseDefaultUploadSettings.Name = "chkUseDefaultUploadSettings";
this.chkUseDefaultUploadSettings.UseVisualStyleBackColor = true;
this.chkUseDefaultUploadSettings.CheckedChanged += new System.EventHandler(this.chkUseDefaultUploadSettings_CheckedChanged);
//
// tpUploadClipboard
//
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadShareURL);
this.tpUploadClipboard.Controls.Add(this.chkClipboardUploadURLContents);
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadAutoIndexFolder);
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadShortenURL);
resources.ApplyResources(this.tpUploadClipboard, "tpUploadClipboard");
this.tpUploadClipboard.Name = "tpUploadClipboard";
this.tpUploadClipboard.UseVisualStyleBackColor = true;
//
// cbClipboardUploadShareURL
//
resources.ApplyResources(this.cbClipboardUploadShareURL, "cbClipboardUploadShareURL");
this.cbClipboardUploadShareURL.Name = "cbClipboardUploadShareURL";
this.cbClipboardUploadShareURL.UseVisualStyleBackColor = true;
this.cbClipboardUploadShareURL.CheckedChanged += new System.EventHandler(this.cbClipboardUploadShareURL_CheckedChanged);
//
// chkClipboardUploadURLContents
//
resources.ApplyResources(this.chkClipboardUploadURLContents, "chkClipboardUploadURLContents");
this.chkClipboardUploadURLContents.Name = "chkClipboardUploadURLContents";
this.chkClipboardUploadURLContents.UseVisualStyleBackColor = true;
this.chkClipboardUploadURLContents.CheckedChanged += new System.EventHandler(this.chkClipboardUploadContents_CheckedChanged);
//
// cbClipboardUploadAutoIndexFolder
//
resources.ApplyResources(this.cbClipboardUploadAutoIndexFolder, "cbClipboardUploadAutoIndexFolder");
this.cbClipboardUploadAutoIndexFolder.Name = "cbClipboardUploadAutoIndexFolder";
this.cbClipboardUploadAutoIndexFolder.UseVisualStyleBackColor = true;
this.cbClipboardUploadAutoIndexFolder.CheckedChanged += new System.EventHandler(this.cbClipboardUploadAutoIndexFolder_CheckedChanged);
//
// cbClipboardUploadShortenURL
//
resources.ApplyResources(this.cbClipboardUploadShortenURL, "cbClipboardUploadShortenURL");
this.cbClipboardUploadShortenURL.Name = "cbClipboardUploadShortenURL";
this.cbClipboardUploadShortenURL.UseVisualStyleBackColor = true;
this.cbClipboardUploadShortenURL.CheckedChanged += new System.EventHandler(this.cbClipboardUploadAutoDetectURL_CheckedChanged);
//
// tpTools
//
this.tpTools.Controls.Add(this.tcTools);
@ -1622,29 +1645,6 @@ private void InitializeComponent()
this.tttvMain.TreeViewSize = 190;
this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged);
//
// tpFileNaming
//
this.tpFileNaming.Controls.Add(this.lblAutoIncrementNumber);
this.tpFileNaming.Controls.Add(this.cbRegionCaptureUseWindowPattern);
this.tpFileNaming.Controls.Add(this.cbNameFormatCustomTimeZone);
this.tpFileNaming.Controls.Add(this.lblNameFormatPatternPreview);
this.tpFileNaming.Controls.Add(this.lblNameFormatPatternActiveWindow);
this.tpFileNaming.Controls.Add(this.lblNameFormatPatternPreviewActiveWindow);
this.tpFileNaming.Controls.Add(this.cbNameFormatTimeZone);
this.tpFileNaming.Controls.Add(this.txtNameFormatPatternActiveWindow);
this.tpFileNaming.Controls.Add(this.btnResetAutoIncrementNumber);
this.tpFileNaming.Controls.Add(this.cbFileUploadUseNamePattern);
this.tpFileNaming.Controls.Add(this.lblNameFormatPattern);
this.tpFileNaming.Controls.Add(this.txtNameFormatPattern);
resources.ApplyResources(this.tpFileNaming, "tpFileNaming");
this.tpFileNaming.Name = "tpFileNaming";
this.tpFileNaming.UseVisualStyleBackColor = true;
//
// lblAutoIncrementNumber
//
resources.ApplyResources(this.lblAutoIncrementNumber, "lblAutoIncrementNumber");
this.lblAutoIncrementNumber.Name = "lblAutoIncrementNumber";
//
// TaskSettingsForm
//
resources.ApplyResources(this, "$this");
@ -1697,17 +1697,19 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.nudGIFFPS)).EndInit();
this.tpScrollingCapture.ResumeLayout(false);
this.tpRectangleAnnotate.ResumeLayout(false);
this.tpUpload.ResumeLayout(false);
this.tcUpload.ResumeLayout(false);
this.tpUploadMain.ResumeLayout(false);
this.tpUploadMain.PerformLayout();
this.tpFileNaming.ResumeLayout(false);
this.tpFileNaming.PerformLayout();
this.tpUploadClipboard.ResumeLayout(false);
this.tpUploadClipboard.PerformLayout();
this.tpActions.ResumeLayout(false);
this.tpActions.PerformLayout();
this.pActions.ResumeLayout(false);
this.tpWatchFolders.ResumeLayout(false);
this.tpWatchFolders.PerformLayout();
this.tpUpload.ResumeLayout(false);
this.tcUpload.ResumeLayout(false);
this.tpUploadMain.ResumeLayout(false);
this.tpUploadMain.PerformLayout();
this.tpUploadClipboard.ResumeLayout(false);
this.tpUploadClipboard.PerformLayout();
this.tpTools.ResumeLayout(false);
this.tcTools.ResumeLayout(false);
this.tpToolsMain.ResumeLayout(false);
@ -1716,8 +1718,6 @@ private void InitializeComponent()
this.tpVideoThumbnailer.ResumeLayout(false);
this.tpAdvanced.ResumeLayout(false);
this.tpAdvanced.PerformLayout();
this.tpFileNaming.ResumeLayout(false);
this.tpFileNaming.PerformLayout();
this.ResumeLayout(false);
}

View file

@ -689,6 +689,7 @@ private void nudImageJPEGQuality_ValueChanged(object sender, EventArgs e)
private void nudUseImageFormat2After_ValueChanged(object sender, EventArgs e)
{
TaskSettings.ImageSettings.ImageSizeLimit = (int)nudUseImageFormat2After.Value;
cbImageFormat2.Enabled = TaskSettings.ImageSettings.ImageSizeLimit > 0;
}
private void cbImageFileExist_SelectedIndexChanged(object sender, EventArgs e)

File diff suppressed because it is too large Load diff

View file

@ -50,7 +50,7 @@ public WatchFolderForm(WatchFolderSettings watchFolder)
private void btnPathBrowse_Click(object sender, EventArgs e)
{
Helpers.BrowseFolder("ShareX - " + Resources.WatchFolderForm_btnPathBrowse_Click_Choose_folder_path, txtFolderPath);
Helpers.BrowseFolder("ShareX - " + Resources.WatchFolderForm_btnPathBrowse_Click_Choose_folder_path, txtFolderPath, "", true);
}
private void btnOK_Click(object sender, EventArgs e)

View file

@ -25,6 +25,7 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib;
using ShareX.ImageEffectsLib;
using ShareX.IndexerLib;
using ShareX.MediaLib;
using ShareX.Properties;
using ShareX.ScreenCaptureLib;
@ -561,9 +562,20 @@ public static void OpenHashCheck()
new HashCheckForm().Show();
}
public static void OpenIndexFolder()
public static void OpenDirectoryIndexer(TaskSettings taskSettings = null)
{
UploadManager.IndexFolder();
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
IndexerSettings indexerSettings = taskSettings.ToolsSettingsReference.IndexerSettings;
indexerSettings.BinaryUnits = Program.Settings.BinaryUnits;
DirectoryIndexerForm form = new DirectoryIndexerForm(indexerSettings);
form.UploadRequested += source =>
{
WorkerTask task = WorkerTask.CreateTextUploaderTask(source, taskSettings);
task.Info.FileName = Path.ChangeExtension(task.Info.FileName, indexerSettings.Output.ToString().ToLowerInvariant());
TaskManager.Start(task);
};
form.Show();
}
public static void OpenImageCombiner(TaskSettings taskSettings = null)

View file

@ -142,31 +142,6 @@ public static void UploadFolder(TaskSettings taskSettings = null)
}
}
public static void IndexFolder(TaskSettings taskSettings = null)
{
using (FolderSelectDialog dlg = new FolderSelectDialog())
{
if (dlg.ShowDialog())
{
IndexFolder(dlg.FileName, taskSettings);
}
}
}
public static void IndexFolder(string folderPath, TaskSettings taskSettings = null)
{
if (!string.IsNullOrEmpty(folderPath) && Directory.Exists(folderPath))
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
taskSettings.ToolsSettings.IndexerSettings.BinaryUnits = Program.Settings.BinaryUnits;
string text = Indexer.Index(folderPath, taskSettings.ToolsSettings.IndexerSettings);
WorkerTask task = WorkerTask.CreateTextUploaderTask(text, taskSettings);
task.Info.FileName = Path.ChangeExtension(task.Info.FileName, taskSettings.ToolsSettings.IndexerSettings.Output.ToString().ToLower());
TaskManager.Start(task);
}
}
public static void ClipboardUpload(TaskSettings taskSettings = null)
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
@ -450,5 +425,30 @@ public static void DownloadAndUploadFile(string url, TaskSettings taskSettings =
}
}
}
public static void IndexFolder(TaskSettings taskSettings = null)
{
using (FolderSelectDialog dlg = new FolderSelectDialog())
{
if (dlg.ShowDialog())
{
IndexFolder(dlg.FileName, taskSettings);
}
}
}
public static void IndexFolder(string folderPath, TaskSettings taskSettings = null)
{
if (!string.IsNullOrEmpty(folderPath) && Directory.Exists(folderPath))
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
taskSettings.ToolsSettings.IndexerSettings.BinaryUnits = Program.Settings.BinaryUnits;
string source = Indexer.Index(folderPath, taskSettings.ToolsSettings.IndexerSettings);
WorkerTask task = WorkerTask.CreateTextUploaderTask(source, taskSettings);
task.Info.FileName = Path.ChangeExtension(task.Info.FileName, taskSettings.ToolsSettings.IndexerSettings.Output.ToString().ToLower());
TaskManager.Start(task);
}
}
}
}