GIF fps limit increased to 30, fixed gif cache integer overflow problem

This commit is contained in:
Jaex 2015-02-09 17:17:04 +02:00
parent 37417ccbf2
commit c903ec8639
16 changed files with 6845 additions and 3981 deletions

View file

@ -76,6 +76,33 @@ public static int CopyStreamTo(this Stream fromStream, Stream toStream, int offs
return totalBytesRead;
}
public static int CopyStreamTo64(this FileStream fromStream, Stream toStream, long offset, int length, int bufferSize = DefaultBufferSize)
{
fromStream.Position = offset;
byte[] buffer = new byte[bufferSize];
int bytesRead;
int totalBytesRead = 0;
int positionLimit = length - bufferSize;
int readLength = bufferSize;
do
{
if (totalBytesRead > positionLimit)
{
readLength = length - totalBytesRead;
}
bytesRead = fromStream.Read(buffer, 0, readLength);
toStream.Write(buffer, 0, bytesRead);
totalBytesRead += bytesRead;
}
while (bytesRead > 0 && totalBytesRead < length);
return totalBytesRead;
}
public static bool WriteToFile(this Stream stream, string filePath)
{
if (stream.Length > 0 && !string.IsNullOrEmpty(filePath))

View file

@ -124,17 +124,7 @@ internal class Resources {
return ResourceManager.GetString("FFmpegOptionsForm_UpdateUI_Quality_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cache file size cannot exceed {0} Bytes.
///Please use FFmpeg screen recording instead of GIF..
/// </summary>
internal static string HardDiskCache_GetImageEnumerator_Cache_file_size_cannot_exceed {
get {
return ResourceManager.GetString("HardDiskCache_GetImageEnumerator_Cache_file_size_cannot_exceed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ctrl: Drawing mode ░ Space: Fullscreen capture.
/// </summary>

View file

@ -1,4 +1,4 @@
<root>
<root>
<!--
Microsoft ResX Schema
@ -134,10 +134,6 @@
<data name="FFmpegOptionsForm_UpdateUI_Quality_" xml:space="preserve">
<value>Qualität:</value>
</data>
<data name="HardDiskCache_GetImageEnumerator_Cache_file_size_cannot_exceed" xml:space="preserve">
<value>Cache Dateigröße kann nicht {0} Bytes überschreiten
Bitte benutze FFmpeg Aufnahmen anstatt von GIF</value>
</data>
<data name="RectangleAnnotate_DrawTips_Drawing_mode_off" xml:space="preserve">
<value>Strg: Zeichenmodus ░ Leertaste: Vollbildschirmaufnahme</value>
</data>

View file

@ -1,4 +1,4 @@
<root>
<root>
<!--
Microsoft ResX Schema
@ -122,10 +122,6 @@
<data name="FFmpegOptionsForm_buttonFFmpegBrowse_Click_Browse_for_ffmpeg_exe" xml:space="preserve">
<value>Parcourir pour ffmpeg.exe</value>
</data>
<data name="HardDiskCache_GetImageEnumerator_Cache_file_size_cannot_exceed" xml:space="preserve">
<value>La taille du fichier cache ne peut pas dépasser {0} octets.
S'il vous plaît utiliser FFmpeg pour l'enregistrement d'écran au lieu de GIF.</value>
</data>
<data name="RectangleAnnotate_DrawTips_Drawing_mode_off" xml:space="preserve">
<value>Ctrl: le mode Dessin ░ Espace: la capture plein écran</value>
</data>

View file

@ -135,10 +135,6 @@
<data name="FFmpegOptionsForm_UpdateUI_Quality_" xml:space="preserve">
<value>Minőség:</value>
</data>
<data name="HardDiskCache_GetImageEnumerator_Cache_file_size_cannot_exceed" xml:space="preserve">
<value>A cache fájl mérete nem haladhatja meg a(z) {0} bájtot.
Kérlek használd az FFmpeg felvételi opciót a GIF helyett.</value>
</data>
<data name="RectangleAnnotate_DrawTips_Drawing_mode_off" xml:space="preserve">
<value>Ctrl: Rajzolási mód ░ Space: Teljesméretű felvétel</value>
</data>

View file

@ -124,10 +124,6 @@
<data name="FFmpegHelper_Record_FFmpeg_error" xml:space="preserve">
<value>FFmpeg error</value>
</data>
<data name="HardDiskCache_GetImageEnumerator_Cache_file_size_cannot_exceed" xml:space="preserve">
<value>Cache file size cannot exceed {0} Bytes.
Please use FFmpeg screen recording instead of GIF.</value>
</data>
<data name="Surface_InitializeComponent_Region_capture" xml:space="preserve">
<value>Region capture</value>
</data>

View file

@ -141,10 +141,6 @@
<data name="RectangleAnnotate_InitializeComponent_Rectangle_capture_annotate" xml:space="preserve">
<value>Dikdörtgen yakalama dipnot</value>
</data>
<data name="HardDiskCache_GetImageEnumerator_Cache_file_size_cannot_exceed" xml:space="preserve">
<value>Önbellek dosya boyutu {0} bytes dan fazla olamaz.
Lütfen GIF yerine FFmpeg ekran kaydetmeyi kullanın.</value>
</data>
<data name="RectangleAnnotate_DrawTips_Drawing_mode_off" xml:space="preserve">
<value>Ctrl: Çizme modu ░ Boşluk: Tam ekran yakalama</value>
</data>

View file

@ -1,4 +1,4 @@
<root>
<root>
<!--
Microsoft ResX Schema
@ -134,10 +134,6 @@
<data name="FFmpegOptionsForm_UpdateUI_Quality_" xml:space="preserve">
<value>质量:</value>
</data>
<data name="HardDiskCache_GetImageEnumerator_Cache_file_size_cannot_exceed" xml:space="preserve">
<value>缓存文件大小不能超过{0}字节.
请使用FFmpeg的屏幕录制,而不是GIF.</value>
</data>
<data name="RectangleAnnotate_DrawTips_Drawing_mode_off" xml:space="preserve">
<value>按Ctrl:开启画笔░区域:全屏</value>
</data>

View file

@ -24,12 +24,10 @@
#endregion License Information (GPL v3)
using ShareX.HelpersLib;
using ShareX.ScreenCaptureLib.Properties;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;
namespace ShareX.ScreenCaptureLib
{
@ -88,16 +86,9 @@ public IEnumerable<Image> GetImageEnumerator()
{
foreach (LocationInfo index in indexList)
{
if (index.Location > int.MaxValue || index.Length > int.MaxValue)
{
MessageBox.Show(string.Format(Resources.HardDiskCache_GetImageEnumerator_Cache_file_size_cannot_exceed, int.MaxValue),
"ShareX", MessageBoxButtons.OK, MessageBoxIcon.Warning);
yield break;
}
using (MemoryStream ms = new MemoryStream())
{
fsCache.CopyStreamTo(ms, (int)index.Location, (int)index.Length);
fsCache.CopyStreamTo64(ms, index.Location, (int)index.Length);
yield return Image.FromStream(ms);
}
}

View file

@ -138,7 +138,6 @@ private void InitializeComponent()
this.cbDropboxAutoCreateShareableLink = new System.Windows.Forms.CheckBox();
this.btnDropboxShowFiles = new System.Windows.Forms.Button();
this.pbDropboxLogo = new System.Windows.Forms.PictureBox();
this.btnDropboxRegister = new System.Windows.Forms.Button();
this.lblDropboxStatus = new System.Windows.Forms.Label();
this.lblDropboxPathTip = new System.Windows.Forms.Label();
this.lblDropboxPath = new System.Windows.Forms.Label();
@ -170,7 +169,6 @@ private void InitializeComponent()
this.pbCopyLogo = new System.Windows.Forms.PictureBox();
this.lblCopyURLType = new System.Windows.Forms.Label();
this.cbCopyURLType = new System.Windows.Forms.ComboBox();
this.btnCopyRegister = new System.Windows.Forms.Button();
this.lblCopyStatus = new System.Windows.Forms.Label();
this.lblCopyPath = new System.Windows.Forms.Label();
this.txtCopyPath = new System.Windows.Forms.TextBox();
@ -1276,7 +1274,6 @@ private void InitializeComponent()
this.tpDropbox.Controls.Add(this.cbDropboxAutoCreateShareableLink);
this.tpDropbox.Controls.Add(this.btnDropboxShowFiles);
this.tpDropbox.Controls.Add(this.pbDropboxLogo);
this.tpDropbox.Controls.Add(this.btnDropboxRegister);
this.tpDropbox.Controls.Add(this.lblDropboxStatus);
this.tpDropbox.Controls.Add(this.lblDropboxPathTip);
this.tpDropbox.Controls.Add(this.lblDropboxPath);
@ -1324,13 +1321,6 @@ private void InitializeComponent()
this.pbDropboxLogo.TabStop = false;
this.pbDropboxLogo.Click += new System.EventHandler(this.pbDropboxLogo_Click);
//
// btnDropboxRegister
//
resources.ApplyResources(this.btnDropboxRegister, "btnDropboxRegister");
this.btnDropboxRegister.Name = "btnDropboxRegister";
this.btnDropboxRegister.UseVisualStyleBackColor = true;
this.btnDropboxRegister.Click += new System.EventHandler(this.btnDropboxRegister_Click);
//
// lblDropboxStatus
//
resources.ApplyResources(this.lblDropboxStatus, "lblDropboxStatus");
@ -1533,7 +1523,6 @@ private void InitializeComponent()
this.tpCopy.Controls.Add(this.pbCopyLogo);
this.tpCopy.Controls.Add(this.lblCopyURLType);
this.tpCopy.Controls.Add(this.cbCopyURLType);
this.tpCopy.Controls.Add(this.btnCopyRegister);
this.tpCopy.Controls.Add(this.lblCopyStatus);
this.tpCopy.Controls.Add(this.lblCopyPath);
this.tpCopy.Controls.Add(this.txtCopyPath);
@ -1563,13 +1552,6 @@ private void InitializeComponent()
this.cbCopyURLType.Name = "cbCopyURLType";
this.cbCopyURLType.SelectedIndexChanged += new System.EventHandler(this.cbCopyURLType_SelectedIndexChanged);
//
// btnCopyRegister
//
resources.ApplyResources(this.btnCopyRegister, "btnCopyRegister");
this.btnCopyRegister.Name = "btnCopyRegister";
this.btnCopyRegister.UseVisualStyleBackColor = true;
this.btnCopyRegister.Click += new System.EventHandler(this.btnCopyRegister_Click);
//
// lblCopyStatus
//
resources.ApplyResources(this.lblCopyStatus, "lblCopyStatus");
@ -3646,7 +3628,6 @@ private void InitializeComponent()
private System.Windows.Forms.CheckBox cbDropboxAutoCreateShareableLink;
private System.Windows.Forms.Button btnDropboxShowFiles;
private System.Windows.Forms.PictureBox pbDropboxLogo;
private System.Windows.Forms.Button btnDropboxRegister;
private System.Windows.Forms.Label lblDropboxStatus;
private System.Windows.Forms.Label lblDropboxPathTip;
private System.Windows.Forms.Label lblDropboxPath;
@ -3657,7 +3638,6 @@ private void InitializeComponent()
private OAuthControl oAuthCopy;
private System.Windows.Forms.Button btnCopyShowFiles;
private System.Windows.Forms.PictureBox pbCopyLogo;
private System.Windows.Forms.Button btnCopyRegister;
private System.Windows.Forms.Label lblCopyStatus;
private System.Windows.Forms.Label lblCopyPath;
private System.Windows.Forms.TextBox txtCopyPath;

View file

@ -1056,11 +1056,6 @@ private void pbDropboxLogo_Click(object sender, EventArgs e)
URLHelpers.OpenURL("https://www.dropbox.com");
}
private void btnDropboxRegister_Click(object sender, EventArgs e)
{
URLHelpers.OpenURL("http://db.tt/CtPYXvu");
}
private void oauth2Dropbox_OpenButtonClicked()
{
DropboxAuthOpen();
@ -1107,11 +1102,6 @@ private void pbCopyLogo_Click(object sender, EventArgs e)
URLHelpers.OpenURL("https://copy.com");
}
private void btnCopyRegister_Click(object sender, EventArgs e)
{
URLHelpers.OpenURL("https://copy.com?r=BUN9jI");
}
private void txtCopyPath_TextChanged(object sender, EventArgs e)
{
Config.CopyUploadPath = txtCopyPath.Text;

File diff suppressed because it is too large Load diff

View file

@ -829,13 +829,13 @@
<value>286, 17</value>
</metadata>
<data name="tsmiShowErrors.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiShowErrors.Text" xml:space="preserve">
<value>Show errors</value>
</data>
<data name="tsmiStopUpload.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiStopUpload.Text" xml:space="preserve">
<value>Stop upload</value>
@ -886,7 +886,7 @@
<value>Thumbnail file</value>
</data>
<data name="tsmiOpen.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiOpen.Text" xml:space="preserve">
<value>Open</value>
@ -1024,94 +1024,94 @@
<value>False</value>
</data>
<data name="tsmiCopy.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiCopy.Text" xml:space="preserve">
<value>Copy</value>
</data>
<data name="tsmiUploadSelectedFile.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiUploadSelectedFile.Text" xml:space="preserve">
<value>Upload</value>
</data>
<data name="tsmiEditSelectedFile.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiEditSelectedFile.Text" xml:space="preserve">
<value>Edit image...</value>
</data>
<data name="tsmiDeleteSelectedFile.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiDeleteSelectedFile.Text" xml:space="preserve">
<value>Delete file locally</value>
<value>Delete file locally...</value>
</data>
<data name="tsmiShortenSelectedURL.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiShortenSelectedURL.Text" xml:space="preserve">
<value>Shorten URL</value>
</data>
<data name="tsmiShareSelectedURL.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiShareSelectedURL.Text" xml:space="preserve">
<value>Share URL</value>
</data>
<data name="tsmiShowQRCode.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiShowQRCode.Text" xml:space="preserve">
<value>Show QR code...</value>
</data>
<data name="tsmiShowResponse.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiShowResponse.Text" xml:space="preserve">
<value>Show response...</value>
</data>
<data name="tsmiClearList.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiClearList.Text" xml:space="preserve">
<value>Clear list</value>
</data>
<data name="tssUploadInfo1.Size" type="System.Drawing.Size, System.Drawing">
<value>160, 6</value>
<value>169, 6</value>
</data>
<data name="tsmiHideMenu.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiHideMenu.Text" xml:space="preserve">
<value>Hide menu</value>
</data>
<data name="tsmiImagePreviewShow.Size" type="System.Drawing.Size, System.Drawing">
<value>130, 22</value>
<value>152, 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>130, 22</value>
<value>152, 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>130, 22</value>
<value>152, 22</value>
</data>
<data name="tsmiImagePreviewAutomatic.Text" xml:space="preserve">
<value>Automatic</value>
</data>
<data name="tsmiImagePreview.Size" type="System.Drawing.Size, System.Drawing">
<value>163, 22</value>
<value>172, 22</value>
</data>
<data name="tsmiImagePreview.Text" xml:space="preserve">
<value>Image preview</value>
</data>
<data name="cmsTaskInfo.Size" type="System.Drawing.Size, System.Drawing">
<value>164, 318</value>
<value>173, 340</value>
</data>
<data name="&gt;&gt;cmsTaskInfo.Name" xml:space="preserve">
<value>cmsTaskInfo</value>
@ -1499,7 +1499,7 @@
</data>
<data name="niTray.Text" xml:space="preserve">
<value>ShareX</value>
<comment>@Invariant</comment></data>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1520,7 +1520,7 @@
</data>
<data name="$this.Text" xml:space="preserve">
<value>ShareX</value>
<comment>@Invariant</comment></data>
</data>
<data name="&gt;&gt;chFilename.Name" xml:space="preserve">
<value>chFilename</value>
</data>

View file

@ -116,6 +116,7 @@ private void InitializeComponent()
this.tpRegionCapture = new System.Windows.Forms.TabPage();
this.pgRegionCapture = new System.Windows.Forms.PropertyGrid();
this.tpScreenRecorder = new System.Windows.Forms.TabPage();
this.btnScreenRecorderFFmpegOptions = new System.Windows.Forms.Button();
this.lblScreenRecorderStartDelay = new System.Windows.Forms.Label();
this.chkScreenRecordAutoStart = new System.Windows.Forms.CheckBox();
this.cbScreenRecordAutoDisableAero = new System.Windows.Forms.CheckBox();
@ -177,7 +178,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.btnScreenRecorderFFmpegOptions = new System.Windows.Forms.Button();
this.tcTaskSettings.SuspendLayout();
this.tpTask.SuspendLayout();
this.cmsDestinations.SuspendLayout();
@ -912,6 +912,13 @@ private void InitializeComponent()
this.tpScreenRecorder.Name = "tpScreenRecorder";
this.tpScreenRecorder.UseVisualStyleBackColor = true;
//
// btnScreenRecorderFFmpegOptions
//
resources.ApplyResources(this.btnScreenRecorderFFmpegOptions, "btnScreenRecorderFFmpegOptions");
this.btnScreenRecorderFFmpegOptions.Name = "btnScreenRecorderFFmpegOptions";
this.btnScreenRecorderFFmpegOptions.UseVisualStyleBackColor = true;
this.btnScreenRecorderFFmpegOptions.Click += new System.EventHandler(this.btnScreenRecorderFFmpegOptions_Click);
//
// lblScreenRecorderStartDelay
//
resources.ApplyResources(this.lblScreenRecorderStartDelay, "lblScreenRecorderStartDelay");
@ -1044,7 +1051,7 @@ private void InitializeComponent()
//
resources.ApplyResources(this.nudGIFFPS, "nudGIFFPS");
this.nudGIFFPS.Maximum = new decimal(new int[] {
15,
30,
0,
0,
0});
@ -1413,13 +1420,6 @@ private void InitializeComponent()
this.tttvMain.TreeViewFont = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.tttvMain.TreeViewSize = 190;
//
// btnScreenRecorderFFmpegOptions
//
resources.ApplyResources(this.btnScreenRecorderFFmpegOptions, "btnScreenRecorderFFmpegOptions");
this.btnScreenRecorderFFmpegOptions.Name = "btnScreenRecorderFFmpegOptions";
this.btnScreenRecorderFFmpegOptions.UseVisualStyleBackColor = true;
this.btnScreenRecorderFFmpegOptions.Click += new System.EventHandler(this.btnScreenRecorderFFmpegOptions_Click);
//
// TaskSettingsForm
//
resources.ApplyResources(this, "$this");

File diff suppressed because it is too large Load diff

View file

@ -292,12 +292,6 @@ public class TaskSettingsCapture
#endregion Capture / Region capture
#region Capture / Rectangle annotate
public RectangleAnnotateOptions RectangleAnnotateOptions = new RectangleAnnotateOptions();
#endregion Capture / Rectangle annotate
#region Capture / Screen recorder
public FFmpegOptions FFmpegOptions = new FFmpegOptions();
@ -312,6 +306,12 @@ public class TaskSettingsCapture
public bool ScreenRecordAutoDisableAero = false;
#endregion Capture / Screen recorder
#region Capture / Rectangle annotate
public RectangleAnnotateOptions RectangleAnnotateOptions = new RectangleAnnotateOptions();
#endregion Capture / Rectangle annotate
}
public class TaskSettingsUpload