Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohne authored Nov 28, 2018
1 parent 0784454 commit 41da6c0
Show file tree
Hide file tree
Showing 12 changed files with 1,633 additions and 0 deletions.
31 changes: 31 additions & 0 deletions FileDateTime Manipulator.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.106
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDateTime Manipulator", "FileDateTime Manipulator\FileDateTime Manipulator.csproj", "{240D0064-BE56-4DBB-80C9-580C3D24ECDD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{240D0064-BE56-4DBB-80C9-580C3D24ECDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{240D0064-BE56-4DBB-80C9-580C3D24ECDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{240D0064-BE56-4DBB-80C9-580C3D24ECDD}.Debug|x64.ActiveCfg = Debug|x64
{240D0064-BE56-4DBB-80C9-580C3D24ECDD}.Debug|x64.Build.0 = Debug|x64
{240D0064-BE56-4DBB-80C9-580C3D24ECDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{240D0064-BE56-4DBB-80C9-580C3D24ECDD}.Release|Any CPU.Build.0 = Release|Any CPU
{240D0064-BE56-4DBB-80C9-580C3D24ECDD}.Release|x64.ActiveCfg = Release|x64
{240D0064-BE56-4DBB-80C9-580C3D24ECDD}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F40BA7E7-1544-40E2-9AD2-C25C9E5A7AAB}
EndGlobalSection
EndGlobal
859 changes: 859 additions & 0 deletions FileDateTime Manipulator/FdtmForm.Designer.cs

Large diffs are not rendered by default.

204 changes: 204 additions & 0 deletions FileDateTime Manipulator/FdtmForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
using System;
using System.IO;
using System.Reflection;
using System.Windows.Forms;

namespace FileDateTime_Manipulator
{
public partial class FdtmForm : Form
{
private FileInfo fileInfo;

#region Assemblyattributaccessoren

/// <summary>
///
/// </summary>
/// <returns></returns>
public string GetAssemblyTitle()
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyTitleAttribute), inherit: false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(path: Assembly.GetExecutingAssembly().CodeBase);
}

/// <summary>
///
/// </summary>
/// <returns></returns>
public string GetAssemblyVersion() => Assembly.GetExecutingAssembly().GetName().Version.ToString();

/// <summary>
///
/// </summary>
/// <returns></returns>
public string GetAssemblyDescription()
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyDescriptionAttribute), inherit: false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}

/// <summary>
///
/// </summary>
/// <returns></returns>
public string GetAssemblyProduct()
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyProductAttribute), inherit: false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}

/// <summary>
///
/// </summary>
/// <returns></returns>
public string GetAssemblyCopyright()
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyCopyrightAttribute), inherit: false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}

/// <summary>
///
/// </summary>
/// <returns></returns>
public string GetAssemblyCompany()
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyCompanyAttribute), inherit: false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
#endregion

public FdtmForm()
{
InitializeComponent();
}

private void FdtmForm_Load(object sender, EventArgs e)
{
}

private void ButtonSelectFile_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
fileInfo = new FileInfo(fileName: openFileDialog.FileName);
textBoxPath.Text = fileInfo.FullName;
textBoxCreationDate.Text = fileInfo.CreationTime.ToString();
textBoxLastAccessDate.Text = fileInfo.LastAccessTime.ToString();
textBoxLastWriteDate.Text = fileInfo.LastWriteTime.ToString();

numericUpDownCreationDateYear.Enabled = true;
numericUpDownAccessDateYear.Enabled = true;
numericUpDownWriteDateYear.Enabled = true;
numericUpDownCreationDateMonth.Enabled = true;
numericUpDownAccessDateMonth.Enabled = true;
numericUpDownWriteDateMonth.Enabled = true;
numericUpDownCreationDateDay.Enabled = true;
numericUpDownAccessDateDay.Enabled = true;
numericUpDownWriteDateDay.Enabled = true;
numericUpDownCreationDateHour.Enabled = true;
numericUpDownAccessDateHour.Enabled = true;
numericUpDownWriteDateHour.Enabled = true;
numericUpDownCreationDateMinute.Enabled = true;
numericUpDownAccessDateMinute.Enabled = true;
numericUpDownWriteDateMinute.Enabled = true;
numericUpDownCreationDateSecond.Enabled = true;
numericUpDownAccessDateSecond.Enabled = true;
numericUpDownWriteDateSecond.Enabled = true;
buttonApply.Enabled = true;

numericUpDownCreationDateYear.Value = fileInfo.CreationTime.Year;
numericUpDownAccessDateYear.Value = fileInfo.LastAccessTime.Year;
numericUpDownWriteDateYear.Value = fileInfo.LastWriteTime.Year;
numericUpDownCreationDateMonth.Value = fileInfo.CreationTime.Month;
numericUpDownAccessDateMonth.Value = fileInfo.LastAccessTime.Month;
numericUpDownWriteDateMonth.Value = fileInfo.LastWriteTime.Month;
numericUpDownCreationDateDay.Value = fileInfo.CreationTime.Day;
numericUpDownAccessDateDay.Value = fileInfo.LastAccessTime.Day;
numericUpDownWriteDateDay.Value = fileInfo.LastWriteTime.Day;
numericUpDownCreationDateHour.Value = fileInfo.CreationTime.Hour;
numericUpDownAccessDateHour.Value = fileInfo.LastAccessTime.Hour;
numericUpDownWriteDateHour.Value = fileInfo.LastWriteTime.Hour;
numericUpDownCreationDateMinute.Value = fileInfo.CreationTime.Minute;
numericUpDownAccessDateMinute.Value = fileInfo.LastAccessTime.Minute;
numericUpDownWriteDateMinute.Value = fileInfo.LastWriteTime.Minute;
numericUpDownCreationDateSecond.Value = fileInfo.CreationTime.Second;
numericUpDownAccessDateSecond.Value = fileInfo.LastAccessTime.Second;
numericUpDownWriteDateSecond.Value = fileInfo.LastWriteTime.Second;
}
}

private void ButtonApply_Click(object sender, EventArgs e)
{
DateTime creationTime = new DateTime(
year: (int)numericUpDownCreationDateYear.Value,
month: (int)numericUpDownCreationDateMonth.Value,
day: (int)numericUpDownCreationDateDay.Value,
hour: (int)numericUpDownCreationDateHour.Value,
minute: (int)numericUpDownCreationDateMinute.Value,
second: (int)numericUpDownCreationDateSecond.Value);

DateTime lastAccessTime = new DateTime(
year: (int)numericUpDownAccessDateYear.Value,
month: (int)numericUpDownAccessDateMonth.Value,
day: (int)numericUpDownAccessDateDay.Value,
hour: (int)numericUpDownAccessDateHour.Value,
minute: (int)numericUpDownAccessDateMinute.Value,
second: (int)numericUpDownAccessDateSecond.Value);

DateTime lastWriteTime = new DateTime(
year: (int)numericUpDownWriteDateYear.Value,
month: (int)numericUpDownWriteDateMonth.Value,
day: (int)numericUpDownWriteDateDay.Value,
hour: (int)numericUpDownWriteDateHour.Value,
minute: (int)numericUpDownWriteDateMinute.Value,
second: (int)numericUpDownWriteDateSecond.Value);

File.SetCreationTime(path: fileInfo.FullName, creationTime: creationTime);
File.SetLastAccessTime(path: fileInfo.FullName, lastAccessTime: lastAccessTime);
File.SetLastWriteTime(path: fileInfo.FullName, lastWriteTime: lastWriteTime);

fileInfo = new FileInfo(fileName: textBoxPath.Text);
textBoxCreationDate.Text = fileInfo.CreationTime.ToString();
textBoxLastAccessDate.Text = fileInfo.LastAccessTime.ToString();
textBoxLastWriteDate.Text = fileInfo.LastWriteTime.ToString();

MessageBox.Show(text: "All dates has been changed!", caption: "Information", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Information);
}

private void ButtonInfo_Click(object sender, EventArgs e)
{
string message = GetAssemblyTitle() + " " + GetAssemblyVersion() + "\r\r\r" + GetAssemblyDescription() + "\r\r" + GetAssemblyCopyright();
MessageBox.Show(text: message, caption: "Information", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Information);
}

private void ButtonClose_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
123 changes: 123 additions & 0 deletions FileDateTime Manipulator/FdtmForm.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?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>
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
Loading

0 comments on commit 41da6c0

Please sign in to comment.