Appending a date to the output file is now working.
This commit should resolve issue #1. Appending a date to the output file is now a selectable option in the app configuration.
This commit is contained in:
parent
8c5d3f9e06
commit
1e75972ae9
@ -3,7 +3,9 @@
|
|||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="PDF-Path" value=""/>
|
<add key="PDF-Path" value=""/>
|
||||||
<add key="PDF-Output" value=""/>
|
<add key="PDF-Output" value=""/>
|
||||||
<add key="PDF-Name" value="merged.pdf"/>
|
<add key="PDF-Name" value="merged"/>
|
||||||
|
<add key ="PDF-Extension" value=".pdf"/>
|
||||||
<add key="overwrite" value="true"/>
|
<add key="overwrite" value="true"/>
|
||||||
|
<add key="appendDate" value="false"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
25
ConfForm.Designer.cs
generated
25
ConfForm.Designer.cs
generated
@ -42,6 +42,8 @@ namespace PDF_Merge
|
|||||||
outPathBtn = new Button();
|
outPathBtn = new Button();
|
||||||
FileLable = new Label();
|
FileLable = new Label();
|
||||||
FileNameBox = new TextBox();
|
FileNameBox = new TextBox();
|
||||||
|
fileExtlabel = new Label();
|
||||||
|
appendDatecheckBox = new CheckBox();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// saveBtn
|
// saveBtn
|
||||||
@ -144,11 +146,32 @@ namespace PDF_Merge
|
|||||||
FileNameBox.Size = new Size(150, 31);
|
FileNameBox.Size = new Size(150, 31);
|
||||||
FileNameBox.TabIndex = 10;
|
FileNameBox.TabIndex = 10;
|
||||||
//
|
//
|
||||||
|
// fileExtlabel
|
||||||
|
//
|
||||||
|
fileExtlabel.AutoSize = true;
|
||||||
|
fileExtlabel.Location = new Point(327, 114);
|
||||||
|
fileExtlabel.Name = "fileExtlabel";
|
||||||
|
fileExtlabel.Size = new Size(44, 25);
|
||||||
|
fileExtlabel.TabIndex = 11;
|
||||||
|
fileExtlabel.Text = ".pdf";
|
||||||
|
//
|
||||||
|
// appendDatecheckBox
|
||||||
|
//
|
||||||
|
appendDatecheckBox.AutoSize = true;
|
||||||
|
appendDatecheckBox.Location = new Point(171, 187);
|
||||||
|
appendDatecheckBox.Name = "appendDatecheckBox";
|
||||||
|
appendDatecheckBox.Size = new Size(144, 29);
|
||||||
|
appendDatecheckBox.TabIndex = 12;
|
||||||
|
appendDatecheckBox.Text = "Append Date";
|
||||||
|
appendDatecheckBox.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// 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(500, 282);
|
||||||
|
Controls.Add(appendDatecheckBox);
|
||||||
|
Controls.Add(fileExtlabel);
|
||||||
Controls.Add(FileNameBox);
|
Controls.Add(FileNameBox);
|
||||||
Controls.Add(FileLable);
|
Controls.Add(FileLable);
|
||||||
Controls.Add(outPathBtn);
|
Controls.Add(outPathBtn);
|
||||||
@ -180,5 +203,7 @@ namespace PDF_Merge
|
|||||||
private Button outPathBtn;
|
private Button outPathBtn;
|
||||||
private Label FileLable;
|
private Label FileLable;
|
||||||
private TextBox FileNameBox;
|
private TextBox FileNameBox;
|
||||||
|
private Label fileExtlabel;
|
||||||
|
private CheckBox appendDatecheckBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
11
ConfForm.cs
11
ConfForm.cs
@ -20,10 +20,13 @@ namespace PDF_Merge
|
|||||||
string sourcePath = ConfigurationManager.AppSettings["PDF-Path"];
|
string sourcePath = ConfigurationManager.AppSettings["PDF-Path"];
|
||||||
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"];
|
||||||
|
|
||||||
sourceBox.Text = sourcePath;
|
sourceBox.Text = sourcePath;
|
||||||
outputBox.Text = outputPath;
|
outputBox.Text = outputPath;
|
||||||
FileNameBox.Text = outputName;
|
FileNameBox.Text = outputName;
|
||||||
|
fileExtlabel.Text = outputExt;
|
||||||
|
|
||||||
if (ConfigurationManager.AppSettings["overwrite"] == true.ToString())
|
if (ConfigurationManager.AppSettings["overwrite"] == true.ToString())
|
||||||
{
|
{
|
||||||
overrideCBox.Checked = true;
|
overrideCBox.Checked = true;
|
||||||
@ -32,6 +35,13 @@ namespace PDF_Merge
|
|||||||
{
|
{
|
||||||
overrideCBox.Checked = false;
|
overrideCBox.Checked = false;
|
||||||
}
|
}
|
||||||
|
if (ConfigurationManager.AppSettings["appendDate"] == true.ToString() )
|
||||||
|
{
|
||||||
|
appendDatecheckBox.Checked = true;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
appendDatecheckBox.Checked = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelBtn_Click(object sender, EventArgs e)
|
private void cancelBtn_Click(object sender, EventArgs e)
|
||||||
@ -68,6 +78,7 @@ namespace PDF_Merge
|
|||||||
MessageBox.Show("File must be named.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("File must be named.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
appSettings.Settings["overwrite"].Value = overrideCBox.Checked.ToString();
|
appSettings.Settings["overwrite"].Value = overrideCBox.Checked.ToString();
|
||||||
|
appSettings.Settings["appendDate"].Value = appendDatecheckBox.Checked.ToString();
|
||||||
appConfig.Save(ConfigurationSaveMode.Modified);
|
appConfig.Save(ConfigurationSaveMode.Modified);
|
||||||
ConfigurationManager.RefreshSection("appSettings");
|
ConfigurationManager.RefreshSection("appSettings");
|
||||||
this.Close();
|
this.Close();
|
||||||
|
10
MainForm.cs
10
MainForm.cs
@ -12,7 +12,15 @@ namespace PDF_Merge
|
|||||||
}
|
}
|
||||||
private static string getOutputPath()
|
private static string getOutputPath()
|
||||||
{
|
{
|
||||||
string pdfPath = ConfigurationManager.AppSettings["PDF-Output"] + Path.DirectorySeparatorChar + ConfigurationManager.AppSettings["PDF-Name"];
|
string pdfPath;
|
||||||
|
if (ConfigurationManager.AppSettings["appendDate"] == true.ToString())
|
||||||
|
{
|
||||||
|
pdfPath = ConfigurationManager.AppSettings["PDF-Output"] + Path.DirectorySeparatorChar + ConfigurationManager.AppSettings["PDF-Name"] + "_" + MergePDFs.GetDate() + ConfigurationManager.AppSettings["PDF-Extension"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pdfPath = ConfigurationManager.AppSettings["PDF-Output"] + Path.DirectorySeparatorChar + ConfigurationManager.AppSettings["PDF-Name"] + ConfigurationManager.AppSettings["PDF-Extension"];
|
||||||
|
}
|
||||||
return pdfPath;
|
return pdfPath;
|
||||||
}
|
}
|
||||||
public void SetPathLable()
|
public void SetPathLable()
|
||||||
|
@ -77,6 +77,12 @@
|
|||||||
}
|
}
|
||||||
return pdfFiles;
|
return pdfFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetDate()
|
||||||
|
{
|
||||||
|
DateTime date = DateTime.Now;
|
||||||
|
return date.ToString("yyyy-MM-dd");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user