示例#1
0
        public static bool Load()
        {
            bool result = false;

            Stream stream = null;

            try
            {
                XmlSerializer xml = new XmlSerializer(typeof(SiteID));

                stream = Storage4.OpenRead(MyFilename, StorageSource.UserSpace);

                Instance = (SiteID)xml.Deserialize(stream);

                result = true;
            }
            catch { }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                }
            }

            return(result);
        }
示例#2
0
 public static void Initialize()
 {
     if (!Load())
     {
         Instance       = new SiteID();
         Instance.Value = Guid.NewGuid();
         Instance.Save();
     }
 }