Ejemplo n.º 1
0
        public IEnumerable <NamedDesktopPoint> GetIconPositions()
        {
            //using (var use_storage = IsolatedStorageFile.GetUserStoreForAssembly())
            {
                //if (use_storage.FileExists(m_sFileName) == false)
                //{ return new NamedDesktopPoint[0]; }

                using (var stream = UseStorage.OpenFile(_mSFileName, FileMode.Open, FileAccess.Read))
                {
                    using (var reader = XmlReader.Create(stream))
                    {
                        var xDoc = XDocument.Load(reader);

                        var icons = xDoc.Root?.Element("Icons");
                        if (icons != null)
                        {
                            return(icons.Elements("Icon")
                                   .Select(el => new NamedDesktopPoint(el.Value, int.Parse(el.Attribute("x").Value), int.Parse(el.Attribute("y").Value)))
                                   .ToArray());
                        }
                    }
                }
            }
            return(new NamedDesktopPoint[0]);
        }
Ejemplo n.º 2
0
        public IDictionary <string, string> GetRegistryValues()
        {
            //using (var use_storage = IsolatedStorageFile.GetUserStoreForAssembly())
            {
                //if (use_storage.FileExists(m_sFileName) == false)
                //{ return new Dictionary<string, string>(); }

                using (var stream = UseStorage.OpenFile(_mSFileName, FileMode.Open, FileAccess.Read))
                {
                    using (var reader = XmlReader.Create(stream))
                    {
                        var xDoc = XDocument.Load(reader);

                        var elRegistry = xDoc.Root?.Element("Registry");
                        if (elRegistry != null)
                        {
                            return(elRegistry.Elements("Value")
                                   .ToDictionary(el => el.Element("Name").Value, el => el.Element("Data").Value));
                        }
                    }
                }
            }
            return(new Dictionary <string, string>());
        }