using System;
using System.IO;
using System.Runtime.InteropServices;
namespace System.Security.Policy
{
/// Provides the application directory as evidence for policy evaluation. This class cannot be inherited.
// Token: 0x0200057A RID: 1402
[ComVisible(true)]
[Serializable]
public sealed class ApplicationDirectory : IBuiltInEvidence
{
/// Initializes a new instance of the class.
/// The path of the application directory.
/// The parameter is null.
// Token: 0x0600333C RID: 13116 RVA: 0x000B03E0 File Offset: 0x000AE5E0
public ApplicationDirectory(string name)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (name.Length < 1)
{
throw new FormatException(Locale.GetText("Empty"));
}
this.directory = name;
}
// Token: 0x0600333D RID: 13117 RVA: 0x000B0428 File Offset: 0x000AE628
int IBuiltInEvidence.GetRequiredSize(bool verbose)
{
return ((!verbose) ? 1 : 3) + this.directory.Length;
}
// Token: 0x0600333E RID: 13118 RVA: 0x000B0444 File Offset: 0x000AE644
[MonoTODO("IBuiltInEvidence")]
int IBuiltInEvidence.InitFromBuffer(char[] buffer, int position)
{
return 0;
}
// Token: 0x0600333F RID: 13119 RVA: 0x000B0448 File Offset: 0x000AE648
[MonoTODO("IBuiltInEvidence")]
int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
{
return 0;
}
/// Gets the path of the application directory.
/// The path of the application directory.
// Token: 0x17000A0E RID: 2574
// (get) Token: 0x06003340 RID: 13120 RVA: 0x000B044C File Offset: 0x000AE64C
public string Directory
{
get
{
return this.directory;
}
}
/// Creates a new copy of the .
/// A new, identical copy of the .
// Token: 0x06003341 RID: 13121 RVA: 0x000B0454 File Offset: 0x000AE654
public object Copy()
{
return new ApplicationDirectory(this.Directory);
}
/// Determines whether instances of the same type of an evidence object are equivalent.
/// true if the two instances are equivalent; otherwise, false.
/// An object of same type as the current evidence object.
// Token: 0x06003342 RID: 13122 RVA: 0x000B0464 File Offset: 0x000AE664
public override bool Equals(object o)
{
ApplicationDirectory applicationDirectory = o as ApplicationDirectory;
if (applicationDirectory != null)
{
this.ThrowOnInvalid(applicationDirectory.directory);
return this.directory == applicationDirectory.directory;
}
return false;
}
/// Gets the hash code of the current application directory.
/// The hash code of the current application directory.
// Token: 0x06003343 RID: 13123 RVA: 0x000B04A0 File Offset: 0x000AE6A0
public override int GetHashCode()
{
return this.Directory.GetHashCode();
}
/// Gets a string representation of the state of the evidence object.
/// A representation of the state of the evidence object.
// Token: 0x06003344 RID: 13124 RVA: 0x000B04B0 File Offset: 0x000AE6B0
public override string ToString()
{
this.ThrowOnInvalid(this.Directory);
SecurityElement securityElement = new SecurityElement("System.Security.Policy.ApplicationDirectory");
securityElement.AddAttribute("version", "1");
securityElement.AddChild(new SecurityElement("Directory", this.directory));
return securityElement.ToString();
}
// Token: 0x06003345 RID: 13125 RVA: 0x000B0500 File Offset: 0x000AE700
private void ThrowOnInvalid(string appdir)
{
if (appdir.IndexOfAny(Path.InvalidPathChars) != -1)
{
string text = Locale.GetText("Invalid character(s) in directory {0}");
throw new ArgumentException(string.Format(text, appdir), "other");
}
}
// Token: 0x04001502 RID: 5378
private string directory;
}
}