示例#1
0
        static List <Command_obj> ReadFromJson()
        {
            List <Command_obj> cmd_List = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Command_obj> >(File.ReadAllText(@"./cmd.json"));

            foreach (var item in cmd_List.Where(z => z.Cmd_type == "info"))
            {
                //    Console.WriteLine (item.Cmd_EXEFile + " " + item.Cmd_Args);

                item.Res_RAW_List = cmd_Excution(item).Res_RAW_List;

                // foreach (var str in item.Res_RAW_List) {
                //     Console.WriteLine (str);
                // }
                //
            }


            var disk = disklist_old();

            foreach (var item in disk.Blockdevices.Where(z => z.Type == "disk"))
            {
                var cmd = cmd_List.Where(z => z.Cmd_type == "sub").FirstOrDefault();

                ////  cmd.Cmd_name="";
                //  cmd.Cmd_Args=cmd.Cmd_Args.Trim()+item.Name;
                // cmd.Cmd_type="hdd";
                //    cmd.Res_RAW_List=cmd_Excution(cmd).Res_RAW_List;
                //   System.Console.WriteLine( cmd.Cmd_Args);
                var cc = new Command_obj
                {
                    Cmd_Args        = cmd.Cmd_Args.Trim() + item.Name,
                    Cmd_Description = cmd.Cmd_Description,
                    Cmd_EXEFile     = cmd.Cmd_EXEFile,
                    Cmd_name        = cmd.Cmd_name,
                    Cmd_type        = "hdd"
                };
                cc.Res_RAW_List = cmd_Excution(cc).Res_RAW_List;
                System.Console.WriteLine(cc.Cmd_Args);
                foreach (var m in cc.Res_RAW_List)
                {
                    System.Console.WriteLine(m);
                }
                cmd_List.Add(cc);
            }

            //   Console.WriteLine (cmd_List.ToJson ());
            return(cmd_List);
        }
示例#2
0
        static Command_obj cmd_Excution(Command_obj command_)
        {
            command_.Res_RAW_List = Cmd_Excutor.common_cmd(command_.Cmd_Args, command_.Cmd_EXEFile);

            return(command_);
        }