Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wholetthedogsoutside committed Nov 4, 2017
0 parents commit 9cf1514
Show file tree
Hide file tree
Showing 62 changed files with 2,275 additions and 0 deletions.
Binary file added .vs/iTired/v14/.suo
Binary file not shown.
674 changes: 674 additions & 0 deletions License-GPL3.txt

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions iTired.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iTired", "iTired\iTired.csproj", "{7E1D127A-4553-4E47-A1A7-8097C8386AE5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E1D127A-4553-4E47-A1A7-8097C8386AE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E1D127A-4553-4E47-A1A7-8097C8386AE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E1D127A-4553-4E47-A1A7-8097C8386AE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E1D127A-4553-4E47-A1A7-8097C8386AE5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions iTired/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
8 changes: 8 additions & 0 deletions iTired/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace iTired
{
public static class Constants
{
public const int RD_ENTRY_LENGTH = 0x20;
public const string INVALID = "N/A";
}
}
564 changes: 564 additions & 0 deletions iTired/Form_main.Designer.cs

Large diffs are not rendered by default.

141 changes: 141 additions & 0 deletions iTired/Form_main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Windows.Forms;

namespace iTired
{
public partial class Form_main : Form
{
private RootDirectory root;

private readonly string size_error = "RD entry's size must be exactly " + Constants.RD_ENTRY_LENGTH + " bytes.";

private const string
name = "iTired",
seper = " - ",
changed = " (changed)";

public Form_main()
{
InitializeComponent();
}


public /*static*/ string RemoveWhitespace(/*this*/ string input)
{
return new string(input.ToCharArray()
.Where(c => !Char.IsWhiteSpace(c))
.ToArray());
}

static IEnumerable<string> Split(string str, int chunkSize)
{
return Enumerable.Range(0, str.Length / chunkSize)
.Select(i => str.Substring(i * chunkSize, chunkSize));
}

private void button_go_Click(object sender = null, EventArgs e = null)
{
//43 4F 4D 4D 41 4E 44 53 54 58 54 20 18 53 DD 98 8C 49 5F 4B 00 00 93 A0 3B 4B 24 01 27 54 00 00
try
{
string text = RemoveWhitespace(richTextBox_data.Text);
byte[] data = (Split(text, 2)).Select(s => Convert.ToByte(s, 16)).ToArray();

if (data.Length == Constants.RD_ENTRY_LENGTH)
{
root = new RootDirectory(data);

textBox_fileBody.Text = root.FileName;
textBox_file_ext.Text = root.FileExtension;

checkBox_readonly.Checked = root.isReadonly;
checkBox_hidden.Checked = root.isHidden;
checkBox_system.Checked = root.isSystemFile;
checkBox_volume_label.Checked = root.isVolumeLabel;
checkBox_folder.Checked = root.isFolder;
checkBox_archive.Checked = root.isArchive;
textBox_start_cluster_num.Text = root.start_cluster.ToString();
textBox_file_byte_size.Text = root.byteSize.ToString();
textBox_created_date.Text = root.createdDate;
textBox_modified_date.Text = root.modifyDate;
textBox_access_date.Text = root.accessDate;

textBox_created_time.Text = root.createdTime;
textBox_modified_time.Text = root.modifyTime;

if (!groupBox_info.Enabled)
groupBox_info.Enabled = true;
}
else
{
clear();
MessageBox.Show(size_error);
}

}
catch
{
clear();
}
}

private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
{
MessageBox.Show(
"Created by Nick Bruno.\n" +
"This utility reads root directory entries from the FAT file system.\n" +
"GitHub: https://github.com/wholetthedogsoutside/");
}

private void clear()
{
groupBox_info.Enabled = false;
checkBox_readonly.Checked =
checkBox_hidden.Checked =
checkBox_system.Checked =
checkBox_volume_label.Checked =
checkBox_folder.Checked =
checkBox_archive.Checked = false;

textBox_fileBody.Text =
textBox_file_ext.Text =
textBox_start_cluster_num.Text =
textBox_file_byte_size.Text =
textBox_created_date.Text =
textBox_modified_date.Text =
textBox_access_date.Text =
textBox_created_time.Text =
textBox_modified_time.Text = "";
}


private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog FD = new OpenFileDialog();

if (FD.ShowDialog() == DialogResult.OK)
{
if (File.Exists(FD.FileName))
{
byte[] data = File.ReadAllBytes(FD.FileName);

if (data.Length == Constants.RD_ENTRY_LENGTH)
{
string s = "";
foreach (byte b in data)
s += b.ToString("X2") + " ";
s = s.Substring(0, s.Length - 1);
richTextBox_data.Text = s;
Text = name + seper + FD.FileName;
button_go_Click();
}
else MessageBox.Show(size_error);
}
}
}
}
}
144 changes: 144 additions & 0 deletions iTired/Form_main.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>172, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAQAAEABADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAABAAAA/v//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAIiIiIiIiAAAAACIiIiIiIiIiIiIiIgAAAAAiIiIiIiIiIiIiAAARERERAAAiIiIiIiIiIgAA
EREREQAAIiIiIiIiIgAREREREREREQAiIiIiIiIAEREREREREREAIiIiIiIAEREREREREREREQAiIiIi
ABEREREREREREREAIiIiABEREREREREREREREQAiIgAREREREREREREREREAIiIAERERERERERERERER
ACIiABEREREREREREREREQAiABERERERAAAAERERERERAAAREREREQAAABEREREREQAAEREREQAREREA
EREREREAABEREREAERERABERERERAAAREREAEREREREAEREREQAAERERABERERERABEREREAABERERER
ERERERERERERAAAREREREREREREREREREQAiABEREREAEQAREREREQAiIgARERERABEAEREREREAIiIA
EREREQARABERERERACIiABEREREAEQAREREREQAiIiIAEREREREREREREQAiIiIiABEREREREREREREA
IiIiIiIAEREREREREREAIiIiIiIiABERERERERERACIiIiIiIiIAABEREREAACIiIiIiIiIiAAARERER
AAAiIiIiIiIiIiIiAAAAACIiIiIiIiIiIiIiIgAAAAAiIiIiIiL/8A////AP//8AAP//AAD//AAAP/wA
AD/wAAAP8AAAD8AAAAPAAAADwAAAA8AAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAA
AAPAAAADwAAAA8AAAAPwAAAP8AAAD/wAAD/8AAA//wAA//8AAP//8A////AP/w==
</value>
</data>
</root>
22 changes: 22 additions & 0 deletions iTired/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace iTired
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form_main());
}
}
}
36 changes: 36 additions & 0 deletions iTired/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("imTired")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("imTired")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7e1d127a-4553-4e47-a1a7-8097c8386ae5")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading

0 comments on commit 9cf1514

Please sign in to comment.