コード例 #1
0
ファイル: LoadPathQPlay.cs プロジェクト: IllidanS4/pcsconv
        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));
        }
コード例 #2
0
ファイル: LoadSaveDP.cs プロジェクト: andrich48/pcsconv
        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));
        }
コード例 #3
0
        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));
        }