private static void SetWebsiteCustomProperty <T>(string name, T value, Project proj) { string cacheDir = VSUtilities.GetWebsiteCacheFolder(proj); if (cacheDir != null) { string filename = string.Concat(cacheDir, name, ".xml"); XmlSerializer serializer = new XmlSerializer(typeof(T)); using (FileStream fout = File.Create(filename)) { serializer.Serialize(fout, value); } } }
private static T GetWebsiteCustomProperty <T>(string name, Project proj) { string cacheDir = VSUtilities.GetWebsiteCacheFolder(proj); if (cacheDir != null) { string filename = string.Concat(cacheDir, name, ".xml"); if (File.Exists(filename)) { XmlSerializer serializer = new XmlSerializer(typeof(T)); using (FileStream fin = File.OpenRead(filename)) { return((T)serializer.Deserialize(fin)); } } } return(default(T)); }