Beispiel #1
0
 protected static T GetCurrentModel <T>(string resourceName)
 {
     using (Stream stream = ResourcesUtils.GetEmbeddedResource(resourceName)) {
         XmlSerializer serializer = new XmlSerializer(typeof(T));
         return((T)serializer.Deserialize(stream));
     }
 }
Beispiel #2
0
 public static string GetCurrentResource(string resourceName)
 {
     using (Stream stream = ResourcesUtils.GetEmbeddedResource(resourceName)) {
         stream.Position = 0;
         using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) {
             return(reader.ReadToEnd());
         }
     }
 }
Beispiel #3
0
        static Stream GetDemosModelContentStream(bool isMvc)
        {
            var demosModelFilePath = HttpContext.Current.Server.MapPath("~/App_Data/Demos.xml");

            if (File.Exists(demosModelFilePath))
            {
                return(File.OpenRead(demosModelFilePath));
            }
            return(ResourcesUtils.GetEmbeddedResource(isMvc ? DemosModelMvcPath : DemosModelPath));
        }