2004-04-12 David Sheldon <dave-mono@earth.li>
[mono.git] / mcs / class / corlib / System.Security.Policy / ApplicationDirectory.cs
1 // System.Security.Policy.ApplicationDirectory
2 //
3 // Author:
4 //  Jackson Harper (Jackson@LatitudeGeo.com)
5 //
6 // (C) 2002 Jackson Harper, All rights reserved.
7
8 using System;
9
10 namespace System.Security.Policy {
11
12         [MonoTODO("This class should use a URLString like class instead of just a string")]
13         [Serializable]
14         public sealed class ApplicationDirectory : IBuiltInEvidence {
15                 
16                 private string directory;
17
18                 //
19                 // Public Constructors
20                 //
21                 
22                 public ApplicationDirectory (string name)
23                 {
24                         if (null == name)
25                                 throw new ArgumentNullException ("name");               
26                         directory = name;
27                 }
28
29                 //
30                 // Public Properties
31                 //
32                 
33                 public string Directory {
34                         get { return directory; }
35                 }
36                 
37                 //
38                 // Public Methods
39                 //
40                 
41                 public object Copy ()
42                 {       
43                         return new ApplicationDirectory (Directory);
44                 }
45                 
46                 [MonoTODO("This needs to check for security subsets")]
47                 public override bool Equals (object other)
48                 {
49                         if (null != other && (other is ApplicationDirectory)) {
50                                 ApplicationDirectory compare = (ApplicationDirectory) other;
51                                 return compare.directory.Equals (directory);
52                         }
53                         return false;
54                 }
55                 
56                 /// <summary>
57                 ///   This does not return the exact same results as the MS version
58                 /// </summary>
59                 public override int GetHashCode ()
60                 {
61                         return directory.GetHashCode ();
62                 }
63                 
64                 public override string ToString ()
65                 {
66                         return ToXml ().ToString ();
67                 }
68
69                 private SecurityElement ToXml ()
70                 {
71                         SecurityElement element = new SecurityElement (GetType().FullName);
72                         element.AddAttribute ("version", "1");
73                         element.AddAttribute ("Directory", Directory);
74                         return element;
75                 }
76
77                 // interface IBuiltInEvidence
78
79                 [MonoTODO]
80                 int IBuiltInEvidence.GetRequiredSize (bool verbose) 
81                 {
82                         return 0;
83                 }
84
85                 [MonoTODO]
86                 int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position) 
87                 {
88                         return 0;
89                 }
90
91                 [MonoTODO]
92                 int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose) 
93                 {
94                         return 0;
95                 }
96         }
97 }