&& (writeList.Count == 0) && (pathList.Count == 0));
}
- private FileIOPermission Cast (IPermission target)
+ private static FileIOPermission Cast (IPermission target)
{
if (target == null)
return null;
return fiop;
}
- internal void ThrowInvalidFlag (FileIOPermissionAccess access, bool context)
+ internal static void ThrowInvalidFlag (FileIOPermissionAccess access, bool context)
{
string msg = null;
if (context)
throw new ArgumentException (String.Format (msg, access), "access");
}
- internal void ThrowIfInvalidPath (string path)
+ internal static void ThrowIfInvalidPath (string path)
{
#if NET_2_0
string dir = Path.GetDirectoryName (path);
}
}
\r
- internal void ThrowIfInvalidPath (string[] paths)
+ internal static void ThrowIfInvalidPath (string[] paths)
{
foreach (string path in paths)
ThrowIfInvalidPath (path);
}\r
// note: all path in IList are already "full paths"
- internal bool KeyIsSubsetOf (IList local, IList target)
+ internal static bool KeyIsSubsetOf (IList local, IList target)
{
bool result = false;
foreach (string l in local) {
foreach (string t in target) {
- if (l.StartsWith (t)) {
+ if (Path.IsPathSubsetOf (t, l)) {
result = true;
break;
}
return true;
}
- internal void UnionKeys (IList list, string[] paths)
+ internal static void UnionKeys (IList list, string[] paths)
{
foreach (string path in paths) {
int len = list.Count;
list.Add (path);
}
else {
- for (int i=0; i < len; i++) {
+ int i;
+ for (i=0; i < len; i++) {
string s = (string) list [i];
- if (s.StartsWith (path)) {
+ if (Path.IsPathSubsetOf (path, s)) {
// replace (with reduced version)
list [i] = path;
break;
}
- else if (path.StartsWith (s)) {
+ else if (Path.IsPathSubsetOf (s, path)) {
// no need to add
break;
}
- else {
- list.Add (path);
- break;
- }
+ }
+ if (i == len) {
+ list.Add (path);
}
}
}
}
- internal void IntersectKeys (IList local, IList target, IList result)
+ internal static void IntersectKeys (IList local, IList target, IList result)
{
foreach (string l in local) {
foreach (string t in target) {
if (t.Length > l.Length) {
- if (t.StartsWith (l))
+ if (Path.IsPathSubsetOf (l ,t))
result.Add (t);
}
else {
- if (l.StartsWith (t))
+ if (Path.IsPathSubsetOf (t, l))
result.Add (l);
}
}