Пример #1
0
        static ServerDisk disklist_old()
        {
            var res = Command_P("lsblk", "  -n ", "old");
            // string s = "";
            ServerDisk disk = new ServerDisk();

            disk.Blockdevices = new List <Blockdevice>();
            foreach (var item in res.Res_RAW_List)
            {
                var s = item.Split(" ", StringSplitOptions.RemoveEmptyEntries);
                disk.Blockdevices.Add(new Blockdevice()
                {
                    Name = s[0],
                    Size = s[3],
                    Type = s[5]
                });

                //    Console.WriteLine (s[0] + "  " + s[3] + " " + s[5]);
            }
            // foreach (var re in disk.Blockdevices) {
            //     Console.WriteLine (re.Type);
            // }
            //res.Res_RAW_List.Add()

            return(disk);
        }
Пример #2
0
        static ServerDisk disklist()
        {
            var    res = Command_P("lsblk");
            string s   = "";

            foreach (var item in res.Res_RAW_List)
            {
                s = s + item;
            }
            ServerDisk serverDisk = Newtonsoft.Json.JsonConvert.DeserializeObject <ServerDisk>(s);

            return(serverDisk);
        }