예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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));
        }