Exemple #1
0
        public static DumpCommand FromText(string text)
        {
            var dump = new DumpCommand();

            var substring = text.Substring(4);
            var parts     = substring.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);


            dump.From   = SearchConstraints.ResolveTarget(parts[0]);
            dump.Target = Target.ResolveTarget(parts[1]);

            return(dump);
        }
Exemple #2
0
        public static CpuCommand Build(string line)
        {
            var commandParts = line.Split(new [] { " " }, StringSplitOptions.None);
            var commandName  = commandParts[0];
            var isPut        = string.Equals(commandName, "put", StringComparison.OrdinalIgnoreCase);

            if (isPut)
            {
                return(ReadCpuCommand.FromText(line));
            }

            var isQuery = string.Equals(commandName, "query", StringComparison.OrdinalIgnoreCase);

            if (isQuery)
            {
                return(QueryCpuCommand.FromText(line));
            }

            var isAssert = string.Equals(commandName, "test", StringComparison.OrdinalIgnoreCase);

            if (isAssert)
            {
                return(AssertCpuCommand.FromText(line));
            }

            var isSeek = string.Equals(commandName, "seek", StringComparison.OrdinalIgnoreCase);

            if (isSeek)
            {
                return(SeekCpuCommand.FromText(line));
            }

            var isExec = string.Equals(commandName, "exec", StringComparison.OrdinalIgnoreCase);

            if (isExec)
            {
                return(ExecCpuCommand.FromText(line));
            }

            var isDump = string.Equals(commandName, "dump", StringComparison.OrdinalIgnoreCase);

            if (isDump)
            {
                return(DumpCommand.FromText(line));
            }


            throw new ArgumentException($"Unknown cpu command '{commandName}'");
        }