static void Main(string[] args) { InputHandler argumentHandler = new InputHandler(ProgramType.Compiler); argumentHandler.HandleArgs(args); Compiler mainC = new Compiler(new ConsoleInterface()); mainC.SetProperties(ref argumentHandler); }
public static void SelectArguments(ProgramType programType, InputHandler sourceHandler) { for (int i = 0; i < sharedArguments.Count; i++) { sourceHandler.LoadArgument(sharedArguments[i]); } switch (programType) { case ProgramType.Compiler: for (int i = 0; i < compilerArguments.Count; i++) { sourceHandler.LoadArgument(compilerArguments[i]); } break; case ProgramType.Computer: for (int i = 0; i <computerArguments.Count; i++) { sourceHandler.LoadArgument(computerArguments[i]); } break; default: throw new NotImplementedException("Unknown Program Type"); } }
public void SetProperties(ref InputHandler handler) { SteppedMode = handler.StepThrough; RunAfterCompile = handler.RunAfterCompile; OutputPath = handler.outputName; string text; int endingLocation; using (StreamReader reader = new StreamReader(handler.InputMethod.GetInput(handler.InputTypePayload))) { text = reader.ReadToEnd(); } endingLocation = text.IndexOf(MonoCompat.UnixLineEnding); if (endingLocation > text.Length - 2) { throw new InvalidDataException("Source was too short"); //log and error } if (endingLocation == -1) { //log expected line ending found none SetSource(new string[]{text}); } else if (text.Substring((endingLocation + 2), 2).CompareTo(MonoCompat.WindowsExtraEnding) == 1) { SetSource(text.Split(new string[] { MonoCompat.UnixLineEnding + MonoCompat.WindowsExtraEnding }, StringSplitOptions.RemoveEmptyEntries)); } else { SetSource(text.Split(new string[] { MonoCompat.UnixLineEnding }, StringSplitOptions.RemoveEmptyEntries)); } }
public void HandleArgument(ref String[] arguments, InputHandler handler) { handler.StepThrough = true; }
public void HandleArgument(ref string[] arguments, InputHandler handler) { EnumUtil.TryParse(arguments[1], out mInputType, true); switch (mInputType) { case InputType.Text: handler.InputMethod = new InputFromText(); break; case InputType.File: handler.InputMethod = new InputFromFile(); break; case InputType.Net: throw new NotImplementedException(); default: throw new ArgumentException(string.Format("Invalid Input type: {0}", mInputType)); } handler.InputTypePayload = arguments[2]; }
public void HandleArgument(ref String[] arguments, InputHandler handler) { handler.outputName = Path.Combine(Paths.CompiledPath, arguments[1]); }
public void HandleArgument(ref String[] arguments, InputHandler handler) { handler.RunAfterCompile = true; }
public void HandleArgument(ref string[] arguments, InputHandler handler) { handler.InputMethod = new InputFromDrag(); handler.InputTypePayload = arguments[0]; }
public void SetProperties(ref InputHandler handler) { OutputPath = handler.outputName; Stream stream = handler.InputMethod.GetInput(handler.InputTypePayload); InitialiseMemory((short)(stream.Length / 2)); for (int i = 0; i < _memory.Length; i++) { _memory[i] = (ushort)(stream.ReadByte() << 8); _memory[i] += (ushort)stream.ReadByte(); } _stockMemory = _memory.Get(); _memorySet = true; SteppedMode = handler.StepThrough; }
static void Main(string[] args) { InputHandler test = new InputHandler(ProgramType.Computer); test.HandleArgs(args); }