main
 1namespace Gorilla.Commons.Infrastructure.FileSystem
 2{
 3    public class ApplicationFile : File
 4    {
 5        public ApplicationFile(string path)
 6        {
 7            this.path = path;
 8        }
 9
10        public virtual string path { get; private set; }
11
12        public virtual bool does_the_file_exist()
13        {
14            return !string.IsNullOrEmpty(path) && System.IO.File.Exists(path);
15        }
16
17        public void copy_to(string other_path)
18        {
19            System.IO.File.Copy(path, other_path, true);
20        }
21
22        public void delete()
23        {
24            System.IO.File.Delete(path);
25        }
26
27        public static implicit operator ApplicationFile(string file_path)
28        {
29            return new ApplicationFile(file_path);
30        }
31
32        public static implicit operator string(ApplicationFile file)
33        {
34            return file.path;
35        }
36
37        public bool Equals(ApplicationFile other)
38        {
39            if (ReferenceEquals(null, other)) return false;
40            if (ReferenceEquals(this, other)) return true;
41            return Equals(other.path, path);
42        }
43
44        public override bool Equals(object obj)
45        {
46            if (ReferenceEquals(null, obj)) return false;
47            if (ReferenceEquals(this, obj)) return true;
48            if (obj.GetType() != typeof (ApplicationFile)) return false;
49            return Equals((ApplicationFile) obj);
50        }
51
52        public override int GetHashCode()
53        {
54            return (path != null ? path.GetHashCode() : 0);
55        }
56
57        public override string ToString()
58        {
59            return path;
60        }
61    }
62}