Esempio n. 1
0
        public TsiFile(Stream source)
        {
            string data = XDocument
                          .Load(source)
                          .XPathSelectElement(XPATH_TO_DATA)
                          .Attribute("Value")
                          .Value;

            byte[] decoded = Convert.FromBase64String(data);

            _devicesContainer = new DeviceMappingsContainer(new MemoryStream(decoded));
            Devices = _devicesContainer.Devices.List.AsReadOnly();
            _source = source;
        }
Esempio n. 2
0
        public TsiFile(string filePath)
        {
            this.filePath = filePath;
            fileContents = File.ReadAllText(filePath);

            XDocument xml;
            using (TextReader textReader = new StringReader(fileContents))
            {
                xml = XDocument.Load(textReader);
            }

            string data = xml.XPathSelectElement(XPATH_TO_DATA).Attribute("Value").Value;

            byte[] decoded = Convert.FromBase64String(data);

            _devicesContainer = new DeviceMappingsContainer(new MemoryStream(decoded));
            Devices = _devicesContainer.Devices.List.AsReadOnly();
        }