Resolve issue #1 #5
+1
-1
@@ -37,7 +37,7 @@ namespace PDF_Merge
|
|||||||
return titleAttribute.Title;
|
return titleAttribute.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
|
return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,5 +7,7 @@
|
|||||||
<add key ="PDF-Extension" value=".pdf"/>
|
<add key ="PDF-Extension" value=".pdf"/>
|
||||||
<add key="overwrite" value="true"/>
|
<add key="overwrite" value="true"/>
|
||||||
<add key="appendDate" value="false"/>
|
<add key="appendDate" value="false"/>
|
||||||
|
<add key ="dateFormat" value="yyyy-MM-dd"/>
|
||||||
|
<add key="dateIndex" value="0"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
Generated
+38
-25
@@ -30,8 +30,8 @@ namespace PDF_Merge
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
saveBtn = new Button();
|
SaveBtn = new Button();
|
||||||
cancelBtn = new Button();
|
CancelBtn = new Button();
|
||||||
sourceBox = new TextBox();
|
sourceBox = new TextBox();
|
||||||
outputBox = new TextBox();
|
outputBox = new TextBox();
|
||||||
folderBrowserDialog1 = new FolderBrowserDialog();
|
folderBrowserDialog1 = new FolderBrowserDialog();
|
||||||
@@ -44,27 +44,28 @@ namespace PDF_Merge
|
|||||||
FileNameBox = new TextBox();
|
FileNameBox = new TextBox();
|
||||||
fileExtlabel = new Label();
|
fileExtlabel = new Label();
|
||||||
appendDatecheckBox = new CheckBox();
|
appendDatecheckBox = new CheckBox();
|
||||||
|
dateFormatOpts = new ComboBox();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// saveBtn
|
// SaveBtn
|
||||||
//
|
//
|
||||||
saveBtn.Location = new Point(327, 227);
|
SaveBtn.Location = new Point(327, 227);
|
||||||
saveBtn.Name = "saveBtn";
|
SaveBtn.Name = "SaveBtn";
|
||||||
saveBtn.Size = new Size(112, 34);
|
SaveBtn.Size = new Size(112, 34);
|
||||||
saveBtn.TabIndex = 0;
|
SaveBtn.TabIndex = 0;
|
||||||
saveBtn.Text = "Save";
|
SaveBtn.Text = "Save";
|
||||||
saveBtn.UseVisualStyleBackColor = true;
|
SaveBtn.UseVisualStyleBackColor = true;
|
||||||
saveBtn.Click += saveBtn_Click;
|
SaveBtn.Click += SaveBtn_Click;
|
||||||
//
|
//
|
||||||
// cancelBtn
|
// CancelBtn
|
||||||
//
|
//
|
||||||
cancelBtn.Location = new Point(193, 227);
|
CancelBtn.Location = new Point(193, 227);
|
||||||
cancelBtn.Name = "cancelBtn";
|
CancelBtn.Name = "CancelBtn";
|
||||||
cancelBtn.Size = new Size(112, 34);
|
CancelBtn.Size = new Size(112, 34);
|
||||||
cancelBtn.TabIndex = 1;
|
CancelBtn.TabIndex = 1;
|
||||||
cancelBtn.Text = "Cancel";
|
CancelBtn.Text = "Cancel";
|
||||||
cancelBtn.UseVisualStyleBackColor = true;
|
CancelBtn.UseVisualStyleBackColor = true;
|
||||||
cancelBtn.Click += cancelBtn_Click;
|
CancelBtn.Click += CancelBtn_Click;
|
||||||
//
|
//
|
||||||
// sourceBox
|
// sourceBox
|
||||||
//
|
//
|
||||||
@@ -118,7 +119,7 @@ namespace PDF_Merge
|
|||||||
sourceDirBtn.TabIndex = 7;
|
sourceDirBtn.TabIndex = 7;
|
||||||
sourceDirBtn.Text = "...";
|
sourceDirBtn.Text = "...";
|
||||||
sourceDirBtn.UseVisualStyleBackColor = true;
|
sourceDirBtn.UseVisualStyleBackColor = true;
|
||||||
sourceDirBtn.Click += sourceDirBtn_Click;
|
sourceDirBtn.Click += SourceDirBtn_Click;
|
||||||
//
|
//
|
||||||
// outPathBtn
|
// outPathBtn
|
||||||
//
|
//
|
||||||
@@ -128,7 +129,7 @@ namespace PDF_Merge
|
|||||||
outPathBtn.TabIndex = 8;
|
outPathBtn.TabIndex = 8;
|
||||||
outPathBtn.Text = "...";
|
outPathBtn.Text = "...";
|
||||||
outPathBtn.UseVisualStyleBackColor = true;
|
outPathBtn.UseVisualStyleBackColor = true;
|
||||||
outPathBtn.Click += outPathBtn_Click;
|
outPathBtn.Click += OutPathBtn_Click;
|
||||||
//
|
//
|
||||||
// FileLable
|
// FileLable
|
||||||
//
|
//
|
||||||
@@ -164,12 +165,23 @@ namespace PDF_Merge
|
|||||||
appendDatecheckBox.TabIndex = 12;
|
appendDatecheckBox.TabIndex = 12;
|
||||||
appendDatecheckBox.Text = "Append Date";
|
appendDatecheckBox.Text = "Append Date";
|
||||||
appendDatecheckBox.UseVisualStyleBackColor = true;
|
appendDatecheckBox.UseVisualStyleBackColor = true;
|
||||||
|
appendDatecheckBox.CheckedChanged += AppendDatecheckBox_CheckedChanged;
|
||||||
|
//
|
||||||
|
// dateFormatOpts
|
||||||
|
//
|
||||||
|
dateFormatOpts.FormattingEnabled = true;
|
||||||
|
dateFormatOpts.Items.AddRange(new object[] { "yyyy-MM-dd", "MM-dd-yyyy" });
|
||||||
|
dateFormatOpts.Location = new Point(321, 188);
|
||||||
|
dateFormatOpts.Name = "dateFormatOpts";
|
||||||
|
dateFormatOpts.Size = new Size(182, 33);
|
||||||
|
dateFormatOpts.TabIndex = 13;
|
||||||
//
|
//
|
||||||
// ConfForm
|
// ConfForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(500, 282);
|
ClientSize = new Size(546, 282);
|
||||||
|
Controls.Add(dateFormatOpts);
|
||||||
Controls.Add(appendDatecheckBox);
|
Controls.Add(appendDatecheckBox);
|
||||||
Controls.Add(fileExtlabel);
|
Controls.Add(fileExtlabel);
|
||||||
Controls.Add(FileNameBox);
|
Controls.Add(FileNameBox);
|
||||||
@@ -181,8 +193,8 @@ namespace PDF_Merge
|
|||||||
Controls.Add(sourceLabel);
|
Controls.Add(sourceLabel);
|
||||||
Controls.Add(outputBox);
|
Controls.Add(outputBox);
|
||||||
Controls.Add(sourceBox);
|
Controls.Add(sourceBox);
|
||||||
Controls.Add(cancelBtn);
|
Controls.Add(CancelBtn);
|
||||||
Controls.Add(saveBtn);
|
Controls.Add(SaveBtn);
|
||||||
Name = "ConfForm";
|
Name = "ConfForm";
|
||||||
Text = "Configure";
|
Text = "Configure";
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
@@ -191,8 +203,8 @@ namespace PDF_Merge
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private Button saveBtn;
|
private Button SaveBtn;
|
||||||
private Button cancelBtn;
|
private Button CancelBtn;
|
||||||
private TextBox sourceBox;
|
private TextBox sourceBox;
|
||||||
private TextBox outputBox;
|
private TextBox outputBox;
|
||||||
private FolderBrowserDialog folderBrowserDialog1;
|
private FolderBrowserDialog folderBrowserDialog1;
|
||||||
@@ -205,5 +217,6 @@ namespace PDF_Merge
|
|||||||
private TextBox FileNameBox;
|
private TextBox FileNameBox;
|
||||||
private Label fileExtlabel;
|
private Label fileExtlabel;
|
||||||
private CheckBox appendDatecheckBox;
|
private CheckBox appendDatecheckBox;
|
||||||
|
private ComboBox dateFormatOpts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+39
-7
@@ -21,12 +21,24 @@ namespace PDF_Merge
|
|||||||
string outputPath = ConfigurationManager.AppSettings["PDF-Output"];
|
string outputPath = ConfigurationManager.AppSettings["PDF-Output"];
|
||||||
string outputName = ConfigurationManager.AppSettings["PDF-Name"];
|
string outputName = ConfigurationManager.AppSettings["PDF-Name"];
|
||||||
string outputExt = ConfigurationManager.AppSettings["PDF-Extension"];
|
string outputExt = ConfigurationManager.AppSettings["PDF-Extension"];
|
||||||
|
string dateIndex = ConfigurationManager.AppSettings["dateIndex"];
|
||||||
|
|
||||||
|
int dateIndexValue;
|
||||||
|
|
||||||
|
bool indexSet = int.TryParse(dateIndex, out dateIndexValue);
|
||||||
|
if (indexSet)
|
||||||
|
{
|
||||||
|
dateFormatOpts.SelectedIndex = dateIndexValue;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
dateFormatOpts.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
sourceBox.Text = sourcePath;
|
sourceBox.Text = sourcePath;
|
||||||
outputBox.Text = outputPath;
|
outputBox.Text = outputPath;
|
||||||
FileNameBox.Text = outputName;
|
FileNameBox.Text = outputName;
|
||||||
fileExtlabel.Text = outputExt;
|
fileExtlabel.Text = outputExt;
|
||||||
|
|
||||||
if (ConfigurationManager.AppSettings["overwrite"] == true.ToString())
|
if (ConfigurationManager.AppSettings["overwrite"] == true.ToString())
|
||||||
{
|
{
|
||||||
overrideCBox.Checked = true;
|
overrideCBox.Checked = true;
|
||||||
@@ -35,21 +47,23 @@ namespace PDF_Merge
|
|||||||
{
|
{
|
||||||
overrideCBox.Checked = false;
|
overrideCBox.Checked = false;
|
||||||
}
|
}
|
||||||
if (ConfigurationManager.AppSettings["appendDate"] == true.ToString() )
|
if (ConfigurationManager.AppSettings["appendDate"] == true.ToString())
|
||||||
{
|
{
|
||||||
appendDatecheckBox.Checked = true;
|
appendDatecheckBox.Checked = true;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
appendDatecheckBox.Checked = false;
|
appendDatecheckBox.Checked = false;
|
||||||
}
|
}
|
||||||
|
CheckAppend();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelBtn_Click(object sender, EventArgs e)
|
private void CancelBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveBtn_Click(object sender, EventArgs e)
|
private void SaveBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Configuration appConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
Configuration appConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||||
AppSettingsSection appSettings = appConfig.AppSettings;
|
AppSettingsSection appSettings = appConfig.AppSettings;
|
||||||
@@ -79,12 +93,14 @@ namespace PDF_Merge
|
|||||||
}
|
}
|
||||||
appSettings.Settings["overwrite"].Value = overrideCBox.Checked.ToString();
|
appSettings.Settings["overwrite"].Value = overrideCBox.Checked.ToString();
|
||||||
appSettings.Settings["appendDate"].Value = appendDatecheckBox.Checked.ToString();
|
appSettings.Settings["appendDate"].Value = appendDatecheckBox.Checked.ToString();
|
||||||
|
appSettings.Settings["dateFormat"].Value = dateFormatOpts.SelectedItem.ToString();
|
||||||
|
appSettings.Settings["dateIndex"].Value = dateFormatOpts.SelectedIndex.ToString();
|
||||||
appConfig.Save(ConfigurationSaveMode.Modified);
|
appConfig.Save(ConfigurationSaveMode.Modified);
|
||||||
ConfigurationManager.RefreshSection("appSettings");
|
ConfigurationManager.RefreshSection("appSettings");
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sourceDirBtn_Click(object sender, EventArgs e)
|
private void SourceDirBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using (var SourceDirPicker = new FolderBrowserDialog())
|
using (var SourceDirPicker = new FolderBrowserDialog())
|
||||||
{
|
{
|
||||||
@@ -105,7 +121,7 @@ namespace PDF_Merge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void outPathBtn_Click(object sender, EventArgs e)
|
private void OutPathBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using (var OutPathPicker = new FolderBrowserDialog())
|
using (var OutPathPicker = new FolderBrowserDialog())
|
||||||
{
|
{
|
||||||
@@ -117,5 +133,21 @@ namespace PDF_Merge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AppendDatecheckBox_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
CheckAppend();
|
||||||
|
}
|
||||||
|
private void CheckAppend()
|
||||||
|
{
|
||||||
|
if (appendDatecheckBox.Checked)
|
||||||
|
{
|
||||||
|
dateFormatOpts.Visible = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dateFormatOpts.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -81,7 +81,8 @@
|
|||||||
public static string GetDate()
|
public static string GetDate()
|
||||||
{
|
{
|
||||||
DateTime date = DateTime.Now;
|
DateTime date = DateTime.Now;
|
||||||
return date.ToString("yyyy-MM-dd");
|
string dateFormat = ConfigurationManager.AppSettings["dateFormat"];
|
||||||
|
return date.ToString(dateFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="PDFsharp" Version="6.1.1" />
|
<PackageReference Include="PDFsharp" Version="6.1.1" />
|
||||||
<PackageReference Include="QuestPDF" Version="2024.7.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user