public ScriptFileViewModel(YukaScript script) { _script = script; script.EnsureCompiled(); _instructionCount = script.InstructionList.Count; Attributes.Add(new KeyValuePair <string, object>("Instructions", _instructionCount)); }
protected override void Execute() { if (arguments.Length == 0) { Fail("No source file specified"); } string sourceBasePath = Helpers.AbsolutePath(arguments[0]); string targetBasePath = arguments.Length > 1 ? Helpers.AbsolutePath(arguments[1]) : sourceBasePath; string[] files = null; if (Directory.Exists(sourceBasePath)) { files = Directory.GetFiles(sourceBasePath, "*." + Constants.ykd, SearchOption.AllDirectories); } else if (File.Exists(sourceBasePath)) { files = new string[] { sourceBasePath }; sourceBasePath = targetBasePath = ""; } else { Fail("The specified source file does not exist"); } for (int i = 0; i < files.Length; i++) { string sourcePath = files[i]; string localPath = Helpers.RelativePath(sourcePath, sourceBasePath); string targetPath = Path.ChangeExtension(Path.Combine(targetBasePath, localPath), Constants.yks); currentFile = localPath; if (flags.Has('v')) { Console.WriteLine(); Console.WriteLine("SourceBase: " + sourceBasePath); Console.WriteLine("TargetBase: " + targetBasePath); Console.WriteLine("Source: " + sourcePath); Console.WriteLine("Target: " + targetPath); Console.WriteLine("Local: " + localPath); } Directory.CreateDirectory(Path.GetDirectoryName(targetPath)); YukaScript script = ScriptFactory.Instance.FromSource(sourcePath); ScriptFactory.Instance.ToBinary(script, new FileStream(targetPath, FileMode.Create)); } currentFile = ""; if (flags.Has('w')) { Console.ReadLine(); } }
public StringInternalizer(YukaScript script) { Script = script; }
public Assembler(YukaScript script, Stream stream) { Script = script; Stream = stream; }