Ejemplo n.º 1
0
 public static Resource getResouce()
 {
     if (null == resource)
     {
         lock (syncRoot)
         {
             if (null == resource)
                 resource = new Resource();
         }
     }
     return resource;
 }
        public override long GetLastModified(Resource resource)
        {
            String path = (String) templatePaths[resource.Name];
            FileInfo file = new FileInfo(path + Path.AltDirectorySeparatorChar + resource.Name);

            if (file.Exists)
            {
                return file.LastWriteTime.Ticks;
            }
            else
            {
                return 0;
            }
        }
Ejemplo n.º 3
0
 public MyForm()
 {
     resource = Util.Resource.getResouce();
 }
		/// <summary> Get the last modified time of the InputStream source
		/// that was used to create the template. We need the template
		/// here because we have to extract the name of the template
		/// in order to locate the InputStream source.
		/// </summary>
		public override long GetLastModified(Resource resource)
		{
			return resource.LastModified;
		}
		/// <summary> Given a template, check to see if the source of InputStream
		/// has been modified.
		/// </summary>
		public override bool IsSourceModified(Resource resource)
		{
			return false;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// How to keep track of all the modified times
		/// across the paths.
		/// </summary>
		public override bool IsSourceModified(Resource resource)
		{
			String path = (String) templatePaths[resource.Name];
			FileInfo file = new FileInfo(path + Path.AltDirectorySeparatorChar + resource.Name);

			if (file.Exists)
			{
				if (file.LastWriteTime.Ticks != resource.LastModified)
				{
					return true;
				}
				else
				{
					return false;
				}
			}

			// If the file is now unreadable, or it has
			// just plain disappeared then we'll just say
			// that it's modified :-) When the loader attempts
			// to load the stream it will fail and the error
			// will be reported then.
			return true;
		}