Exemplo n.º 1
0
        private static SiteCollections OpenAndRead(string fileName)
        {
            SiteCollections sites = new SiteCollections();

            try
            {
                if (!string.IsNullOrEmpty(fileName) && System.IO.File.Exists(fileName))
                {
                    // Create the serializer
                    var serializer = new XmlSerializer(typeof(SiteCollections));

                    // Open config file
                    using (var stream = new System.IO.StreamReader(fileName))
                    {
                        // De-serialize the XML
                        sites = serializer.Deserialize(stream) as SiteCollections;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Can't read the configuration, 'Recent Sites' is empty.", ex);
            }

            return(sites);
        }
Exemplo n.º 2
0
        private static void Write(string fileName, SiteCollections sites)
        {
            if (!string.IsNullOrEmpty(fileName))
            {
                // Create the serializer
                var serializer = new XmlSerializer(typeof(SiteCollections));

                // Open config file
                using (var stream = new System.IO.StreamWriter(fileName))
                {
                    // Serialize the XML
                    serializer.Serialize(stream, sites);
                }
            }
        }
Exemplo n.º 3
0
 static Globals()
 {
     SiteCollections          = new SiteCollections();
     CustomFeatureDefinitions = new FeatureCollection();
 }