mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Added "Restore auto backup" to file menu
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1226 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
7a354e7889
commit
198e2b94f2
10
src/Forms/Main.Designer.cs
generated
10
src/Forms/Main.Designer.cs
generated
@ -68,6 +68,7 @@
|
||||
this.reopenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItemRestoreAutoBackup = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItemSubStationAlpha = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator20 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.openOriginalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -773,6 +774,7 @@
|
||||
this.reopenToolStripMenuItem,
|
||||
this.saveToolStripMenuItem,
|
||||
this.saveAsToolStripMenuItem,
|
||||
this.toolStripMenuItemRestoreAutoBackup,
|
||||
this.toolStripMenuItemSubStationAlpha,
|
||||
this.toolStripSeparator20,
|
||||
this.openOriginalToolStripMenuItem,
|
||||
@ -836,6 +838,13 @@
|
||||
this.saveAsToolStripMenuItem.Text = "Save as...";
|
||||
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.SaveAsToolStripMenuItemClick);
|
||||
//
|
||||
// toolStripMenuItemRestoreAutoBackup
|
||||
//
|
||||
this.toolStripMenuItemRestoreAutoBackup.Name = "toolStripMenuItemRestoreAutoBackup";
|
||||
this.toolStripMenuItemRestoreAutoBackup.Size = new System.Drawing.Size(334, 22);
|
||||
this.toolStripMenuItemRestoreAutoBackup.Text = "Restore auto-backup...";
|
||||
this.toolStripMenuItemRestoreAutoBackup.Click += new System.EventHandler(this.toolStripMenuItemRestoreAutoBackup_Click);
|
||||
//
|
||||
// toolStripMenuItemSubStationAlpha
|
||||
//
|
||||
this.toolStripMenuItemSubStationAlpha.Name = "toolStripMenuItemSubStationAlpha";
|
||||
@ -4184,6 +4193,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemAssStyles;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSubStationAlpha;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemAlignment;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemRestoreAutoBackup;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1130,6 +1130,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
reopenToolStripMenuItem.Text = _language.Menu.File.Reopen;
|
||||
saveToolStripMenuItem.Text = _language.Menu.File.Save;
|
||||
saveAsToolStripMenuItem.Text = _language.Menu.File.SaveAs;
|
||||
toolStripMenuItemRestoreAutoBackup.Text = _language.Menu.File.RestoreAutoBackup;
|
||||
openOriginalToolStripMenuItem.Text = _language.Menu.File.OpenOriginal;
|
||||
saveOriginalToolStripMenuItem.Text = _language.Menu.File.SaveOriginal;
|
||||
saveOriginalAstoolStripMenuItem.Text = _language.SaveOriginalSubtitleAs;
|
||||
@ -4875,6 +4876,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void InsertBefore()
|
||||
{
|
||||
bool useExtraForStyle = _oldSubtitleFormat.GetType() == typeof(AdvancedSubStationAlpha) || _oldSubtitleFormat.GetType() == typeof(SubStationAlpha);
|
||||
List<string> styles = AdvancedSubStationAlpha.GetStylesFromHeader(_subtitle.Header);
|
||||
string style = "Default";
|
||||
if (styles.Count > 0)
|
||||
style = styles[0];
|
||||
|
||||
MakeHistoryForUndo(_language.BeforeInsertLine);
|
||||
|
||||
int startNumber = 1;
|
||||
@ -4889,6 +4896,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
addMilliseconds = 1;
|
||||
|
||||
var newParagraph = new Paragraph();
|
||||
if (useExtraForStyle)
|
||||
newParagraph.Extra = style;
|
||||
|
||||
Paragraph prev = _subtitle.GetParagraphOrDefault(firstSelectedIndex - 1);
|
||||
Paragraph next = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
|
||||
if (prev != null && next != null)
|
||||
@ -4959,6 +4969,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void InsertAfter()
|
||||
{
|
||||
bool useExtraForStyle = _oldSubtitleFormat.GetType() == typeof(AdvancedSubStationAlpha) || _oldSubtitleFormat.GetType() == typeof(SubStationAlpha);
|
||||
List<string> styles = AdvancedSubStationAlpha.GetStylesFromHeader(_subtitle.Header);
|
||||
string style = "Default";
|
||||
if (styles.Count > 0)
|
||||
style = styles[0];
|
||||
|
||||
MakeHistoryForUndo(_language.BeforeInsertLine);
|
||||
|
||||
int startNumber = 1;
|
||||
@ -4970,6 +4986,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
firstSelectedIndex = SubtitleListview1.SelectedItems[0].Index + 1;
|
||||
|
||||
var newParagraph = new Paragraph();
|
||||
if (useExtraForStyle)
|
||||
newParagraph.Extra = style;
|
||||
Paragraph prev = _subtitle.GetParagraphOrDefault(firstSelectedIndex - 1);
|
||||
Paragraph next = _subtitle.GetParagraphOrDefault(firstSelectedIndex);
|
||||
if (prev != null)
|
||||
@ -14151,5 +14169,20 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripMenuItemRestoreAutoBackup_Click(object sender, EventArgs e)
|
||||
{
|
||||
var restoreAutoBackup = new RestoreAutoBackup();
|
||||
_formPositionsAndSizes.SetPositionAndSize(restoreAutoBackup);
|
||||
if (restoreAutoBackup.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(restoreAutoBackup.AutoBackupFileName))
|
||||
{
|
||||
if (ContinueNewOrExit())
|
||||
{
|
||||
OpenSubtitle(restoreAutoBackup.AutoBackupFileName, null);
|
||||
_converted = true;
|
||||
}
|
||||
}
|
||||
_formPositionsAndSizes.SavePositionAndSize(restoreAutoBackup);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -681,7 +681,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAUABFAFAARQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAVgBFAFYARQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
171
src/Forms/RestoreAutoBackup.Designer.cs
generated
Normal file
171
src/Forms/RestoreAutoBackup.Designer.cs
generated
Normal file
@ -0,0 +1,171 @@
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
partial class RestoreAutoBackup
|
||||
{
|
||||
/// <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.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonOK = new System.Windows.Forms.Button();
|
||||
this.listViewBackups = new System.Windows.Forms.ListView();
|
||||
this.columnHeaderDateTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderFileName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeaderExtension = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.labelInfo = new System.Windows.Forms.Label();
|
||||
this.labelStatus = new System.Windows.Forms.Label();
|
||||
this.buttonOpenContainingFolder = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonCancel.Location = new System.Drawing.Point(466, 383);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 21);
|
||||
this.buttonCancel.TabIndex = 7;
|
||||
this.buttonCancel.Text = "C&ancel";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonOK
|
||||
//
|
||||
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonOK.Location = new System.Drawing.Point(385, 383);
|
||||
this.buttonOK.Name = "buttonOK";
|
||||
this.buttonOK.Size = new System.Drawing.Size(75, 21);
|
||||
this.buttonOK.TabIndex = 6;
|
||||
this.buttonOK.Text = "&OK";
|
||||
this.buttonOK.UseVisualStyleBackColor = true;
|
||||
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
|
||||
//
|
||||
// listViewBackups
|
||||
//
|
||||
this.listViewBackups.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.listViewBackups.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeaderDateTime,
|
||||
this.columnHeaderFileName,
|
||||
this.columnHeaderExtension});
|
||||
this.listViewBackups.FullRowSelect = true;
|
||||
this.listViewBackups.HideSelection = false;
|
||||
this.listViewBackups.Location = new System.Drawing.Point(12, 37);
|
||||
this.listViewBackups.MultiSelect = false;
|
||||
this.listViewBackups.Name = "listViewBackups";
|
||||
this.listViewBackups.Size = new System.Drawing.Size(529, 333);
|
||||
this.listViewBackups.TabIndex = 0;
|
||||
this.listViewBackups.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewBackups.View = System.Windows.Forms.View.Details;
|
||||
this.listViewBackups.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listViewBackups_MouseDoubleClick);
|
||||
//
|
||||
// columnHeaderDateTime
|
||||
//
|
||||
this.columnHeaderDateTime.Text = "Date and time";
|
||||
this.columnHeaderDateTime.Width = 130;
|
||||
//
|
||||
// columnHeaderFileName
|
||||
//
|
||||
this.columnHeaderFileName.Text = "File name";
|
||||
this.columnHeaderFileName.Width = 300;
|
||||
//
|
||||
// columnHeaderExtension
|
||||
//
|
||||
this.columnHeaderExtension.Text = "Extension";
|
||||
this.columnHeaderExtension.Width = 80;
|
||||
//
|
||||
// labelInfo
|
||||
//
|
||||
this.labelInfo.AutoSize = true;
|
||||
this.labelInfo.Location = new System.Drawing.Point(13, 13);
|
||||
this.labelInfo.Name = "labelInfo";
|
||||
this.labelInfo.Size = new System.Drawing.Size(122, 13);
|
||||
this.labelInfo.TabIndex = 8;
|
||||
this.labelInfo.Text = "Open auto save backup";
|
||||
//
|
||||
// labelStatus
|
||||
//
|
||||
this.labelStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.labelStatus.AutoSize = true;
|
||||
this.labelStatus.Location = new System.Drawing.Point(12, 388);
|
||||
this.labelStatus.Name = "labelStatus";
|
||||
this.labelStatus.Size = new System.Drawing.Size(59, 13);
|
||||
this.labelStatus.TabIndex = 9;
|
||||
this.labelStatus.Text = "labelStatus";
|
||||
//
|
||||
// buttonOpenContainingFolder
|
||||
//
|
||||
this.buttonOpenContainingFolder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonOpenContainingFolder.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonOpenContainingFolder.Location = new System.Drawing.Point(324, 9);
|
||||
this.buttonOpenContainingFolder.Name = "buttonOpenContainingFolder";
|
||||
this.buttonOpenContainingFolder.Size = new System.Drawing.Size(217, 21);
|
||||
this.buttonOpenContainingFolder.TabIndex = 10;
|
||||
this.buttonOpenContainingFolder.Text = "Open containing folder...";
|
||||
this.buttonOpenContainingFolder.UseVisualStyleBackColor = true;
|
||||
this.buttonOpenContainingFolder.Click += new System.EventHandler(this.buttonOpenContainingFolder_Click);
|
||||
//
|
||||
// RestoreAutoBackup
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(553, 414);
|
||||
this.Controls.Add(this.buttonOpenContainingFolder);
|
||||
this.Controls.Add(this.labelStatus);
|
||||
this.Controls.Add(this.labelInfo);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.Controls.Add(this.listViewBackups);
|
||||
this.KeyPreview = true;
|
||||
this.MinimumSize = new System.Drawing.Size(500, 400);
|
||||
this.Name = "RestoreAutoBackup";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Restore auto-backup";
|
||||
this.Shown += new System.EventHandler(this.RestoreAutoBackup_Shown);
|
||||
this.ResizeEnd += new System.EventHandler(this.RestoreAutoBackup_ResizeEnd);
|
||||
this.SizeChanged += new System.EventHandler(this.RestoreAutoBackup_SizeChanged);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.RestoreAutoBackup_KeyDown);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button buttonCancel;
|
||||
private System.Windows.Forms.Button buttonOK;
|
||||
private System.Windows.Forms.ListView listViewBackups;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderDateTime;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderFileName;
|
||||
private System.Windows.Forms.ColumnHeader columnHeaderExtension;
|
||||
private System.Windows.Forms.Label labelInfo;
|
||||
private System.Windows.Forms.Label labelStatus;
|
||||
private System.Windows.Forms.Button buttonOpenContainingFolder;
|
||||
}
|
||||
}
|
147
src/Forms/RestoreAutoBackup.cs
Normal file
147
src/Forms/RestoreAutoBackup.cs
Normal file
@ -0,0 +1,147 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
public partial class RestoreAutoBackup : Form
|
||||
{
|
||||
|
||||
private string[] _files;
|
||||
public string AutoBackupFileName { get; set; }
|
||||
|
||||
public RestoreAutoBackup()
|
||||
{
|
||||
InitializeComponent();
|
||||
labelStatus.Text = string.Empty;
|
||||
|
||||
var l = Configuration.Settings.Language.RestoreAutoBackup;
|
||||
Text = l.Title;
|
||||
buttonOpenContainingFolder.Text = Configuration.Settings.Language.Main.Menu.File.OpenContainingFolder;
|
||||
listViewBackups.Columns[0].Text = l.DateAndTime;
|
||||
listViewBackups.Columns[1].Text = l.FileName;
|
||||
listViewBackups.Columns[2].Text = l.Extension;
|
||||
|
||||
buttonOK.Text = Configuration.Settings.Language.General.OK;
|
||||
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
||||
|
||||
FixLargeFonts();
|
||||
}
|
||||
|
||||
private void FixLargeFonts()
|
||||
{
|
||||
Graphics graphics = CreateGraphics();
|
||||
SizeF textSize = graphics.MeasureString(buttonCancel.Text, Font);
|
||||
if (textSize.Height > buttonCancel.Height - 4)
|
||||
{
|
||||
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
|
||||
Utilities.SetButtonHeight(this, newButtonHeight, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void RestoreAutoBackup_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
private void RestoreAutoBackup_Shown(object sender, EventArgs e)
|
||||
{
|
||||
//2011-12-13_20-19-18_title
|
||||
var fileNamePattern = new Regex(@"^\d\d\d\d-\d\d-\d\d_\d\d-\d\d-\d\d_", RegexOptions.Compiled);
|
||||
|
||||
if (Directory.Exists(Configuration.AutoBackupFolder))
|
||||
{
|
||||
labelStatus.Text = Configuration.Settings.Language.General.PleaseWait;
|
||||
Application.DoEvents();
|
||||
Refresh();
|
||||
Application.DoEvents();
|
||||
|
||||
_files = Directory.GetFiles(Configuration.AutoBackupFolder, "*.*");
|
||||
foreach (string fileName in _files)
|
||||
{
|
||||
if (fileNamePattern.IsMatch(Path.GetFileName(fileName)))
|
||||
AddBackupToListView(fileName);
|
||||
}
|
||||
listViewBackups.Sorting = SortOrder.Descending;
|
||||
listViewBackups.Sort();
|
||||
labelStatus.Text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonOpenContainingFolder.Visible = false;
|
||||
labelStatus.Text = Configuration.Settings.Language.RestoreAutoBackup.NoBackedUpFilesFound;
|
||||
}
|
||||
listViewBackups.Columns[2].Width = -2;
|
||||
}
|
||||
|
||||
private void AddBackupToListView(string fileName)
|
||||
{
|
||||
string displayDate = Path.GetFileName(fileName).Substring(0, 19).Replace('_', ' ');
|
||||
string displayName = Path.GetFileName(fileName).Remove(0, 20);
|
||||
|
||||
var item = new ListViewItem(Path.GetFileName(displayDate));
|
||||
item.UseItemStyleForSubItems = false;
|
||||
item.Tag = fileName;
|
||||
|
||||
var subItem = new ListViewItem.ListViewSubItem(item, Path.GetFileNameWithoutExtension(displayName));
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
subItem = new ListViewItem.ListViewSubItem(item, Path.GetExtension(fileName));
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
listViewBackups.Items.Add(item);
|
||||
}
|
||||
|
||||
private void buttonOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewBackups.SelectedItems.Count == 1)
|
||||
AutoBackupFileName = listViewBackups.SelectedItems[0].Tag.ToString();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void listViewBackups_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (listViewBackups.SelectedItems.Count == 1)
|
||||
{
|
||||
AutoBackupFileName = listViewBackups.SelectedItems[0].Tag.ToString();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
|
||||
private void RestoreAutoBackup_ResizeEnd(object sender, EventArgs e)
|
||||
{
|
||||
listViewBackups.Columns[2].Width = -2;
|
||||
}
|
||||
|
||||
private void RestoreAutoBackup_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
listViewBackups.Columns[2].Width = -2;
|
||||
}
|
||||
|
||||
private void buttonOpenContainingFolder_Click(object sender, EventArgs e)
|
||||
{
|
||||
string folderName = Configuration.AutoBackupFolder;
|
||||
if (Utilities.IsRunningOnMono())
|
||||
{
|
||||
System.Diagnostics.Process.Start(folderName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (listViewBackups.SelectedItems.Count == 1)
|
||||
{
|
||||
string argument = @"/select, " + listViewBackups.SelectedItems[0].Tag.ToString();
|
||||
System.Diagnostics.Process.Start("explorer.exe", argument);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Process.Start(folderName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
src/Forms/RestoreAutoBackup.resx
Normal file
120
src/Forms/RestoreAutoBackup.resx
Normal 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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -49,6 +49,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public LanguageStructure.NetworkStart NetworkStart;
|
||||
public LanguageStructure.RemoveTextFromHearImpaired RemoveTextFromHearImpaired;
|
||||
public LanguageStructure.ReplaceDialog ReplaceDialog;
|
||||
public LanguageStructure.RestoreAutoBackup RestoreAutoBackup;
|
||||
public LanguageStructure.SetMinimumDisplayTimeBetweenParagraphs SetMinimumDisplayTimeBetweenParagraphs;
|
||||
public LanguageStructure.SetSyncPoint SetSyncPoint;
|
||||
public LanguageStructure.Settings Settings;
|
||||
@ -783,6 +784,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
Reopen = "&Reopen",
|
||||
Save = "&Save",
|
||||
SaveAs = "Save &as...",
|
||||
RestoreAutoBackup = "Restore auto-backup...",
|
||||
AdvancedSubStationAlphaProperties = "Advanced Sub Station Alpha properties...",
|
||||
SubStationAlphaProperties = "Sub Station Alpha properties...",
|
||||
OpenOriginal = "Open original subtitle (translator mode)...",
|
||||
@ -1138,12 +1140,22 @@ can edit in same subtitle file (collaboration)",
|
||||
Normal = "Normal",
|
||||
CaseSensitive = "Case sensitive",
|
||||
RegularExpression = "Regular expression",
|
||||
ReplaceWith = "Replace with",
|
||||
Find = "&Find",
|
||||
Replace = "&Replace",
|
||||
ReplaceWith = "Replace with",
|
||||
Find = "&Find",
|
||||
Replace = "&Replace",
|
||||
ReplaceAll = "Replace &all",
|
||||
};
|
||||
|
||||
RestoreAutoBackup = new LanguageStructure.RestoreAutoBackup
|
||||
{
|
||||
Title = "Restore auto backup",
|
||||
Information = "Open auto saved backup",
|
||||
DateAndTime = "Date and time",
|
||||
FileName = "File name",
|
||||
Extension = "Extension",
|
||||
NoBackedUpFilesFound = "No backed up files found!",
|
||||
};
|
||||
|
||||
SetMinimumDisplayTimeBetweenParagraphs = new LanguageStructure.SetMinimumDisplayTimeBetweenParagraphs
|
||||
{
|
||||
Title = "Set minimum display time between paragraphs",
|
||||
|
@ -725,6 +725,7 @@
|
||||
public string Reopen { get; set; }
|
||||
public string Save { get; set; }
|
||||
public string SaveAs { get; set; }
|
||||
public string RestoreAutoBackup { get; set; }
|
||||
public string AdvancedSubStationAlphaProperties { get; set; }
|
||||
public string SubStationAlphaProperties { get; set; }
|
||||
public string OpenOriginal { get; set; }
|
||||
@ -1093,6 +1094,16 @@
|
||||
public string ReplaceAll { get; set; }
|
||||
}
|
||||
|
||||
public class RestoreAutoBackup
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Information { get; set; }
|
||||
public string DateAndTime { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string Extension { get; set; }
|
||||
public string NoBackedUpFilesFound { get; set; }
|
||||
}
|
||||
|
||||
public class SetMinimumDisplayTimeBetweenParagraphs
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
@ -314,6 +314,12 @@
|
||||
<Compile Include="Forms\PacEncoding.Designer.cs">
|
||||
<DependentUpon>PacEncoding.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\RestoreAutoBackup.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\RestoreAutoBackup.Designer.cs">
|
||||
<DependentUpon>RestoreAutoBackup.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\SetSyncPoint.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -911,6 +917,9 @@
|
||||
<EmbeddedResource Include="Forms\PacEncoding.resx">
|
||||
<DependentUpon>PacEncoding.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\RestoreAutoBackup.resx">
|
||||
<DependentUpon>RestoreAutoBackup.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\SetSyncPoint.resx">
|
||||
<DependentUpon>SetSyncPoint.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
Loading…
Reference in New Issue
Block a user