-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from AtomCrafty/feature-auto
Feature: auto
- Loading branch information
Showing
18 changed files
with
318 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/> | ||
</startup> | ||
</configuration> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
namespace Yuka.Data { | ||
[Flags] | ||
enum DataType { | ||
None = 0, | ||
Archive = 1, | ||
Graphics = 2, | ||
Script = 4, | ||
Raw = 8 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using Yuka.Data; | ||
using Yuka.Data.Factory; | ||
using Yuka.Script; | ||
|
||
namespace Yuka.Tasks { | ||
class AutoTask : Task { | ||
public override Task NewTask() { | ||
return new AutoTask(); | ||
} | ||
|
||
public override void DefaultFlags(FlagCollection flags) { | ||
flags.Add('v', "verbose", "Outputs additional information", false); | ||
flags.Add('w', "wait", "Waits for enter before closing the console", false); | ||
} | ||
|
||
protected override void Execute() { | ||
if(arguments.Length == 0) { | ||
Task task = new HelpTask(); | ||
task.arguments = new string[0]; | ||
task.flags = flags; | ||
task.Run(); | ||
} | ||
else if(arguments[0].EndsWith(".patch.ykc")) { | ||
// patch mode | ||
Task task = null; | ||
for(int i = 1; i <= 5; i++) { | ||
if(Path.GetFileName(arguments[0]).Contains(".data0" + i + '.')) { | ||
if(File.Exists(Path.Combine(Path.GetDirectoryName(arguments[0]), "data0" + i + ".ykc"))) { | ||
flags.Set('v'); | ||
task = new PatchTask(new[] { arguments[0], Path.Combine(Path.GetDirectoryName(arguments[0]), "data0" + i + ".ykc") }, flags); | ||
} | ||
else if(File.Exists(Helpers.AbsolutePath("data0" + i + ".ykc"))) { | ||
flags.Set('v'); | ||
task = new PatchTask(new[] { arguments[0], Path.Combine(Directory.GetCurrentDirectory(), "data0" + i + ".ykc") }, flags); | ||
} | ||
break; | ||
} | ||
} | ||
if(task == null) { | ||
Fail("Unable to determine patch target"); | ||
} | ||
else { | ||
task.Run(); | ||
} | ||
Console.ReadLine(); | ||
} | ||
else if(Path.GetExtension(arguments[0]) == ".ykg") { | ||
string path = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetFileName(arguments[0]), "png")); | ||
using(FileStream fs = new FileStream(Helpers.AbsolutePath(arguments[0]), FileMode.Open)) { | ||
YukaGraphics g = GraphicsFactory.Instance.FromBinary(fs); | ||
g.bitmap.Save(path); | ||
System.Diagnostics.Process.Start(path); | ||
} | ||
} | ||
else if(Directory.Exists(arguments[0])) { | ||
string patchLogPath = Path.Combine(Helpers.AbsolutePath(arguments[0]), "patch.ypl"); | ||
if(File.Exists(patchLogPath)) { | ||
} | ||
} | ||
else if(Path.GetExtension(arguments[0]) == ".ypl") { | ||
flags.Set('v'); | ||
flags.Set('w'); | ||
new PatchTask(arguments, flags).Run(); | ||
} | ||
else { | ||
Fail("Unable to auto determine processing method"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.