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); }
public static void Initialize() { if (!Load()) { Instance = new SiteID(); Instance.Value = Guid.NewGuid(); Instance.Save(); } }