Beispiel #1
0
        public static OsDisk MatchResultToOsDisk(byte[] resultBytes, Encoding encode)
        {
            string result  = GetResultFromInterval(resultBytes, encode);
            string pattern = @"^(?<ShellDir>.*?)\t(?<AvailableDisk>.*?)$";
            Regex  regex   = new Regex(pattern, RegexOptions.Singleline);
            Match  m       = regex.Match(result);

            if (!m.Success)
            {
                throw new ResponseCustomException(ExceptionTitle.MatchResultFailed.ToString(), "match result failed", result);
            }
            else
            {
                OsDisk disk = new OsDisk();
                disk.ShellDir      = m.Groups["ShellDir"].Value;
                disk.AvailableDisk = m.Groups["AvailableDisk"].Value;
                return(disk);
            }
        }
Beispiel #2
0
 public static OsDisk MatchResultToOsDisk(byte[] resultBytes, Encoding encode)
 {
     string result = GetResultFromInterval(resultBytes, encode);
     string pattern = @"^(?<ShellDir>.*?)\t(?<AvailableDisk>.*?)$";
     Regex regex = new Regex(pattern, RegexOptions.Singleline);
     Match m = regex.Match(result);
     if (!m.Success)
     {
         throw new ResponseCustomException(ExceptionTitle.MatchResultFailed.ToString(), "match result failed", result);
     }
     else
     {
         OsDisk disk = new OsDisk();
         disk.ShellDir = m.Groups["ShellDir"].Value;
         disk.AvailableDisk = m.Groups["AvailableDisk"].Value;
         return disk;
     }
 }