Add options to set file created/modified timestamps (#638)

This commit is contained in:
MBucari 2023-06-25 14:07:39 -06:00
parent a5d98364fa
commit ac87d70613
14 changed files with 227 additions and 122 deletions

View file

@ -28,15 +28,9 @@ namespace LibationWinForms.Dialogs
});
maxSampleRateCb.Items.AddRange(
new object[]
{
new SampleRateSelection(AAXClean.SampleRate.Hz_44100),
new SampleRateSelection(AAXClean.SampleRate.Hz_32000),
new SampleRateSelection(AAXClean.SampleRate.Hz_24000),
new SampleRateSelection(AAXClean.SampleRate.Hz_22050),
new SampleRateSelection(AAXClean.SampleRate.Hz_16000),
new SampleRateSelection(AAXClean.SampleRate.Hz_12000)
});
Enum.GetValues<AAXClean.SampleRate>()
.Select(v => new EnumDiaplay<AAXClean.SampleRate>(v, $"{(int)v} Hz"))
.ToArray());
encoderQualityCb.Items.AddRange(
new object[]
@ -62,7 +56,13 @@ namespace LibationWinForms.Dialogs
lameTargetBitrateRb.Checked = config.LameTargetBitrate;
lameTargetQualityRb.Checked = !config.LameTargetBitrate;
maxSampleRateCb.SelectedItem = maxSampleRateCb.Items.Cast<SampleRateSelection>().Single(s => s.SampleRate == config.MaxSampleRate);
maxSampleRateCb.SelectedItem
= maxSampleRateCb.Items
.Cast<EnumDiaplay<AAXClean.SampleRate>>()
.SingleOrDefault(v => v.Value == config.MaxSampleRate)
?? maxSampleRateCb.Items[0];
encoderQualityCb.SelectedItem = config.LameEncoderQuality;
lameDownsampleMonoCbox.Checked = config.LameDownsampleMono;
lameBitrateTb.Value = config.LameBitrate;
@ -95,9 +95,8 @@ namespace LibationWinForms.Dialogs
config.StripAudibleBrandAudio = stripAudibleBrandingCbox.Checked;
config.DecryptToLossy = convertLossyRb.Checked;
config.MoveMoovToBeginning = moveMoovAtomCbox.Checked;
config.LameTargetBitrate = lameTargetBitrateRb.Checked;
config.MaxSampleRate = ((SampleRateSelection)maxSampleRateCb.SelectedItem).SampleRate;
config.MaxSampleRate = ((EnumDiaplay<AAXClean.SampleRate>)maxSampleRateCb.SelectedItem).Value;
config.LameEncoderQuality = (NAudio.Lame.EncoderQuality)encoderQualityCb.SelectedItem;
encoderQualityCb.SelectedItem = config.LameEncoderQuality;
config.LameDownsampleMono = lameDownsampleMonoCbox.Checked;

View file

@ -53,6 +53,11 @@
tab1ImportantSettings = new System.Windows.Forms.TabPage();
betaOptInCbox = new System.Windows.Forms.CheckBox();
booksGb = new System.Windows.Forms.GroupBox();
lastWriteTimeCb = new System.Windows.Forms.ComboBox();
creationTimeCb = new System.Windows.Forms.ComboBox();
lastWriteTimeLbl = new System.Windows.Forms.Label();
creationTimeLbl = new System.Windows.Forms.Label();
overwriteExistingCbox = new System.Windows.Forms.CheckBox();
saveEpisodesToSeriesFolderCbox = new System.Windows.Forms.CheckBox();
tab2ImportLibrary = new System.Windows.Forms.TabPage();
autoDownloadEpisodesCb = new System.Windows.Forms.CheckBox();
@ -119,7 +124,6 @@
retainAaxFileCbox = new System.Windows.Forms.CheckBox();
downloadCoverArtCbox = new System.Windows.Forms.CheckBox();
createCueSheetCbox = new System.Windows.Forms.CheckBox();
overwriteExistingCbox = new System.Windows.Forms.CheckBox();
badBookGb.SuspendLayout();
tabControl.SuspendLayout();
tab1ImportantSettings.SuspendLayout();
@ -331,7 +335,7 @@
//
// logsBtn
//
logsBtn.Location = new System.Drawing.Point(256, 220);
logsBtn.Location = new System.Drawing.Point(256, 261);
logsBtn.Name = "logsBtn";
logsBtn.Size = new System.Drawing.Size(132, 23);
logsBtn.TabIndex = 5;
@ -351,7 +355,7 @@
// loggingLevelLbl
//
loggingLevelLbl.AutoSize = true;
loggingLevelLbl.Location = new System.Drawing.Point(6, 223);
loggingLevelLbl.Location = new System.Drawing.Point(6, 264);
loggingLevelLbl.Name = "loggingLevelLbl";
loggingLevelLbl.Size = new System.Drawing.Size(78, 15);
loggingLevelLbl.TabIndex = 3;
@ -361,7 +365,7 @@
//
loggingLevelCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
loggingLevelCb.FormattingEnabled = true;
loggingLevelCb.Location = new System.Drawing.Point(90, 220);
loggingLevelCb.Location = new System.Drawing.Point(90, 261);
loggingLevelCb.Name = "loggingLevelCb";
loggingLevelCb.Size = new System.Drawing.Size(129, 23);
loggingLevelCb.TabIndex = 4;
@ -409,17 +413,69 @@
// booksGb
//
booksGb.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
booksGb.Controls.Add(lastWriteTimeCb);
booksGb.Controls.Add(creationTimeCb);
booksGb.Controls.Add(lastWriteTimeLbl);
booksGb.Controls.Add(creationTimeLbl);
booksGb.Controls.Add(overwriteExistingCbox);
booksGb.Controls.Add(saveEpisodesToSeriesFolderCbox);
booksGb.Controls.Add(booksSelectControl);
booksGb.Controls.Add(booksLocationDescLbl);
booksGb.Location = new System.Drawing.Point(6, 6);
booksGb.Name = "booksGb";
booksGb.Size = new System.Drawing.Size(842, 182);
booksGb.Size = new System.Drawing.Size(842, 249);
booksGb.TabIndex = 0;
booksGb.TabStop = false;
booksGb.Text = "Books location";
//
// lastWriteTimeCb
//
lastWriteTimeCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
lastWriteTimeCb.FormattingEnabled = true;
lastWriteTimeCb.Location = new System.Drawing.Point(188, 214);
lastWriteTimeCb.Name = "lastWriteTimeCb";
lastWriteTimeCb.Size = new System.Drawing.Size(266, 23);
lastWriteTimeCb.TabIndex = 5;
//
// creationTimeCb
//
creationTimeCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
creationTimeCb.FormattingEnabled = true;
creationTimeCb.Location = new System.Drawing.Point(188, 185);
creationTimeCb.Name = "creationTimeCb";
creationTimeCb.Size = new System.Drawing.Size(266, 23);
creationTimeCb.TabIndex = 5;
//
// lastWriteTimeLbl
//
lastWriteTimeLbl.AutoSize = true;
lastWriteTimeLbl.Location = new System.Drawing.Point(7, 217);
lastWriteTimeLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lastWriteTimeLbl.Name = "lastWriteTimeLbl";
lastWriteTimeLbl.Size = new System.Drawing.Size(116, 15);
lastWriteTimeLbl.TabIndex = 4;
lastWriteTimeLbl.Text = "[last write time desc]";
//
// creationTimeLbl
//
creationTimeLbl.AutoSize = true;
creationTimeLbl.Location = new System.Drawing.Point(7, 188);
creationTimeLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
creationTimeLbl.Name = "creationTimeLbl";
creationTimeLbl.Size = new System.Drawing.Size(112, 15);
creationTimeLbl.TabIndex = 4;
creationTimeLbl.Text = "[creation time desc]";
//
// overwriteExistingCbox
//
overwriteExistingCbox.AutoSize = true;
overwriteExistingCbox.Location = new System.Drawing.Point(7, 156);
overwriteExistingCbox.Name = "overwriteExistingCbox";
overwriteExistingCbox.Size = new System.Drawing.Size(129, 19);
overwriteExistingCbox.TabIndex = 3;
overwriteExistingCbox.Text = "[Overwrite Existing]";
overwriteExistingCbox.UseVisualStyleBackColor = true;
//
// saveEpisodesToSeriesFolderCbox
//
saveEpisodesToSeriesFolderCbox.AutoSize = true;
@ -1145,16 +1201,6 @@
createCueSheetCbox.UseVisualStyleBackColor = true;
createCueSheetCbox.CheckedChanged += allowLibationFixupCbox_CheckedChanged;
//
// overwriteExistingCbox
//
overwriteExistingCbox.AutoSize = true;
overwriteExistingCbox.Location = new System.Drawing.Point(7, 156);
overwriteExistingCbox.Name = "overwriteExistingCbox";
overwriteExistingCbox.Size = new System.Drawing.Size(129, 19);
overwriteExistingCbox.TabIndex = 3;
overwriteExistingCbox.Text = "[Overwrite Existing]";
overwriteExistingCbox.UseVisualStyleBackColor = true;
//
// SettingsDialog
//
AcceptButton = saveBtn;
@ -1300,5 +1346,9 @@
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.CheckBox overwriteExistingCbox;
private System.Windows.Forms.Label creationTimeLbl;
private System.Windows.Forms.ComboBox lastWriteTimeCb;
private System.Windows.Forms.ComboBox creationTimeCb;
private System.Windows.Forms.Label lastWriteTimeLbl;
}
}

View file

@ -1,4 +1,5 @@
using LibationFileManager;
using LibationUiBase;
using System;
using System.Linq;
@ -13,6 +14,15 @@ namespace LibationWinForms.Dialogs
this.importEpisodesCb.Text = desc(nameof(config.ImportEpisodes));
this.downloadEpisodesCb.Text = desc(nameof(config.DownloadEpisodes));
this.autoDownloadEpisodesCb.Text = desc(nameof(config.AutoDownloadEpisodes));
creationTimeLbl.Text = desc(nameof(config.CreationTime));
lastWriteTimeLbl.Text = desc(nameof(config.LastWriteTime));
var dateTimeSources = Enum.GetValues<Configuration.DateTimeSource>().Select(v => new EnumDiaplay<Configuration.DateTimeSource>(v)).ToArray();
creationTimeCb.Items.AddRange(dateTimeSources);
lastWriteTimeCb.Items.AddRange(dateTimeSources);
creationTimeCb.SelectedItem = dateTimeSources.SingleOrDefault(v => v.Value == config.CreationTime) ?? dateTimeSources[0];
lastWriteTimeCb.SelectedItem = dateTimeSources.SingleOrDefault(v => v.Value == config.LastWriteTime) ?? dateTimeSources[0];
autoScanCb.Checked = config.AutoScan;
showImportedStatsCb.Checked = config.ShowImportedStats;
@ -22,6 +32,9 @@ namespace LibationWinForms.Dialogs
}
private void Save_ImportLibrary(Configuration config)
{
config.CreationTime = ((EnumDiaplay<Configuration.DateTimeSource>)creationTimeCb.SelectedItem).Value;
config.LastWriteTime = ((EnumDiaplay<Configuration.DateTimeSource>)lastWriteTimeCb.SelectedItem).Value;
config.AutoScan = autoScanCb.Checked;
config.ShowImportedStats = showImportedStatsCb.Checked;
config.ImportEpisodes = importEpisodesCb.Checked;

View file

@ -1,64 +1,4 @@
<?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.
-->
<root>
<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">