public override IList <OutputFile> ProcessFile(string file, ConvertOptions options) { List <RPCCommand> rpc = new List <RPCCommand>(); rpc.AddRange(QPlay.GetCommands(file)); return(LoadPCS.ProcessRPC(rpc, options)); }
public virtual IList <OutputFile> ProcessStream(Stream input, ConvertOptions options) { List <RPCCommand> rpc = new List <RPCCommand>(); using (BinaryReader reader = new BinaryReader(input)) { reader.ReadInt16(); int length = reader.ReadInt16(); byte lastb = 0; int delay = 0; for (int i = 0; i < length; i++) { byte b = reader.ReadByte(); if (b != lastb) { rpc.Add(RPCCommand.Delay(delay * 1000 / 140)); delay = 0; } if (b == 0) { rpc.Add(RPCCommand.ClearCountdown()); } else { double freq = b * 15; //frequencies[b]; rpc.Add(RPCCommand.SetCountdown(LoadMDT.FrequencyToCountdown(freq))); } delay += 1; lastb = b; } rpc.Add(RPCCommand.Delay(delay * 1000 / 140)); } return(LoadPCS.ProcessRPC(rpc, options)); }
public override IList <OutputFile> ProcessStream(Stream input, ConvertOptions options) { List <RPCCommand> rpc = new List <RPCCommand>(); StreamReader reader = new StreamReader(input); string line; while ((line = reader.ReadLine()) != null) { string[] split = line.Split(new[] { ": " }, 0); RPCCommandType cmd = (RPCCommandType)Enum.Parse(typeof(RPCCommandType), split[0]); int value = Int32.Parse(split[1]); rpc.Add(new RPCCommand(cmd, value)); } return(LoadPCS.ProcessRPC(rpc, options)); }