Ejemplo n.º 1
0
 public fileSource_wim(wimImage image)
 {
     wimImageName        = image.name;
     wimImageIndex       = image.index;
     wimImageSize        = (long)image.sizeBytes;
     wimImageDescription = image.description;
 }
Ejemplo n.º 2
0
        public wimImage[] getImages(string absoluteFilename)
        {
            string stdout = wsusUpdate.runAndGetStdout("dism", "/get-wiminfo /wimfile:" + absoluteFilename);

            string[] lines = stdout.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);

            List <wimImage> images  = new List <wimImage>();
            wimImage        current = null;

            foreach (string line in lines)
            {
                string lineTrimmed = line.Trim();

                if (lineTrimmed.StartsWith("Index : "))
                {
                    if (current != null)
                    {
                        images.Add(current);
                    }

                    current       = new wimImage();
                    current.index = Int32.Parse(line.Substring(7));
                }
                else if (lineTrimmed.StartsWith("Name : "))
                {
                    current.name = lineTrimmed.Substring(7);
                }
                else if (lineTrimmed.StartsWith("Description : "))
                {
                    current.description = lineTrimmed.Substring(14);
                }
                else if (lineTrimmed.StartsWith("Size : "))
                {
                    // The string will be in the form "123,456,768 bytes".
                    lineTrimmed       = lineTrimmed.Substring(6).Replace(",", "");
                    lineTrimmed       = lineTrimmed.Trim().Split(' ')[0];
                    current.sizeBytes = UInt64.Parse(lineTrimmed);
                }
            }
            if (current != null)
            {
                images.Add(current);
            }

            return(images.ToArray());
            //return new wimImage[]  { images.ToArray()[0] };
        }