Compare commits
No commits in common. "a67f5bbef84ab4b16c1808f18306cd1890927bf7" and "524df8cbd7fda2ece4b81ecda4cbb7ad0f72a8c6" have entirely different histories.
a67f5bbef8
...
524df8cbd7
7 changed files with 15 additions and 72 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,6 +1,3 @@
|
||||||
# Custom Items
|
|
||||||
latest-commit-hash.txt
|
|
||||||
|
|
||||||
# ---> C Sharp
|
# ---> C Sharp
|
||||||
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
|
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
|
|
|
@ -6,7 +6,6 @@ EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5C9D36DD-3962-45BF-938E-BE1E258053EC}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5C9D36DD-3962-45BF-938E-BE1E258053EC}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
.gitignore = .gitignore
|
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
SpritePacker v{version}, by Starbeamrainbowlabs
|
SpritePacker, by Starbeamrainbowlabs
|
||||||
Built at {build-time} from git commit {commit-hash}
|
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
mono ./SpritePacker.exe [flags] [filenames]
|
mono ./SpritePacker.exe [flags] [filenames]
|
||||||
|
|
|
@ -10,24 +10,24 @@ namespace SpritePacker
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Utilities.GetProgramBuildDate();
|
|
||||||
List<string> values = new List<string>();
|
List<string> values = new List<string>();
|
||||||
for(int i = 0; i < args.Length; i++)
|
for(int i = 0; i < args.Length; i++)
|
||||||
{
|
{
|
||||||
switch(args[i])
|
switch(args[i])
|
||||||
{
|
{
|
||||||
case "--help":
|
case "--help":
|
||||||
string helpText = Utilities.GetEmbeddedResourceContent("SpritePacker.Help.txt");
|
/*
|
||||||
string commitHash = Utilities.GetEmbeddedResourceContent("SpritePacker.latest-commit-hash.txt").Trim();
|
string[] resFiles = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||||
Dictionary<string, string> templateValues = new Dictionary<string, string>() {
|
foreach (string str in resFiles)
|
||||||
{ "version", Utilities.GetProgramVersion().ToString() },
|
Console.WriteLine("[{0}]", str);
|
||||||
{ "build-time", Utilities.GetProgramBuildDate().ToString("dd/MM/yyyy h:mmtt") },
|
*/
|
||||||
{ "commit-hash", commitHash.Substring(commitHash.Length - 7) }
|
|
||||||
};
|
|
||||||
foreach (KeyValuePair<string, string> replacePair in templateValues)
|
|
||||||
helpText = helpText.Replace(string.Format("{{{0}}}", replacePair.Key), replacePair.Value);
|
|
||||||
|
|
||||||
Console.WriteLine(helpText);
|
Assembly asm = Assembly.GetExecutingAssembly();
|
||||||
|
Stream stream = asm.GetManifestResourceStream("SpritePacker.Help.txt");
|
||||||
|
StreamReader source = new StreamReader(stream);
|
||||||
|
Console.Write(source.ReadToEnd());
|
||||||
|
source.Dispose();
|
||||||
|
stream.Dispose();
|
||||||
return;
|
return;
|
||||||
case "--version":
|
case "--version":
|
||||||
Console.WriteLine("Version text coming soon!");
|
Console.WriteLine("Version text coming soon!");
|
||||||
|
|
|
@ -17,7 +17,7 @@ using System.Runtime.CompilerServices;
|
||||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.1.*")]
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
// The following attributes are used to specify the signing key for the assembly,
|
// The following attributes are used to specify the signing key for the assembly,
|
||||||
// if desired. See the Mono documentation for more information about signing.
|
// if desired. See the Mono documentation for more information about signing.
|
||||||
|
|
|
@ -29,9 +29,6 @@
|
||||||
<Externalconsole>true</Externalconsole>
|
<Externalconsole>true</Externalconsole>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
|
||||||
<PreBuildEvent>git rev-parse HEAD >../../latest-commit-hash.txt</PreBuildEvent>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
@ -41,11 +38,9 @@
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Packer.cs" />
|
<Compile Include="Packer.cs" />
|
||||||
<Compile Include="Sprite.cs" />
|
<Compile Include="Sprite.cs" />
|
||||||
<Compile Include="Utilities.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Help.txt" />
|
<EmbeddedResource Include="Help.txt" />
|
||||||
<EmbeddedResource Include="latest-commit-hash.txt" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,47 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Dynamic;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace SpritePacker
|
|
||||||
{
|
|
||||||
public class Utilities
|
|
||||||
{
|
|
||||||
public static string[] GetEmbeddedResourceList()
|
|
||||||
{
|
|
||||||
return System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void PrintEnbeddedResourceList()
|
|
||||||
{
|
|
||||||
string[] resFiles = GetEmbeddedResourceList();
|
|
||||||
foreach (string str in resFiles)
|
|
||||||
Console.WriteLine("[{0}]", str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetEmbeddedResourceContent(string resourceName)
|
|
||||||
{
|
|
||||||
Assembly asm = Assembly.GetExecutingAssembly();
|
|
||||||
Stream stream = asm.GetManifestResourceStream(resourceName);
|
|
||||||
StreamReader source = new StreamReader(stream);
|
|
||||||
string fileContent = source.ReadToEnd();
|
|
||||||
source.Dispose();
|
|
||||||
stream.Dispose();
|
|
||||||
return fileContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DateTime GetProgramBuildDate()
|
|
||||||
{
|
|
||||||
Version asmVersion = GetProgramVersion();
|
|
||||||
return new DateTime(2000, 1, 1).Add(new TimeSpan(
|
|
||||||
TimeSpan.TicksPerDay * asmVersion.Build +
|
|
||||||
TimeSpan.TicksPerSecond * asmVersion.Revision * 2
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Version GetProgramVersion()
|
|
||||||
{
|
|
||||||
return Assembly.GetEntryAssembly().GetName().Version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue