Exemplo n.º 1
0
        internal static string InternalCombine(string path1, string path2)
        {
            if ((path1 == null) || (path2 == null))
            {
                throw new ArgumentNullException((path1 == null) ? "path1" : "path2");
            }
            CheckInvalidPathChars(path1);
            CheckInvalidPathChars(path2);
            if (path2.Length == 0)
            {
                throw new ArgumentException(JsImplEnvironment.GetResourceString("Argument_PathEmpty"), "path2");
            }
            if (IsPathRooted(path2))
            {
                throw new ArgumentException(JsImplEnvironment.GetResourceString("Arg_Path2IsRooted"), "path2");
            }
            int length = path1.Length;

            if (length == 0)
            {
                return(path2);
            }
            char ch = path1[length - 1];

            if (((ch != DirectorySeparatorChar) && (ch != AltDirectorySeparatorChar)) && (ch != VolumeSeparatorChar))
            {
                return(path1 + DirectorySeparatorChar + path2);
            }
            return(path1 + path2);
        }
Exemplo n.º 2
0
 internal static void CheckInvalidPathChars(string path)
 {
     for (int i = 0; i < path.Length; i++)
     {
         int num2 = path.As <JsString>().charCodeAt(i);
         if (((num2 == 0x22) || (num2 == 60)) || (((num2 == 0x3e) || (num2 == 0x7c)) || (num2 < 0x20)))
         {
             throw new ArgumentException(JsImplEnvironment.GetResourceString("Argument_InvalidPathChars"));
         }
     }
 }
Exemplo n.º 3
0
        internal static void CheckSearchPattern(string searchPattern)
        {
            int num;

            //if (((Environment.OSInfo & Environment.OSName.Win9x) != Environment.OSName.Invalid) && CanPathCircumventSecurityNative(searchPattern))
            //{
            //  throw new ArgumentException(Environment.GetResourceString("Arg_InvalidSearchPattern"));
            //}
            while ((num = searchPattern.IndexOf("..", StringComparison.Ordinal)) != -1)
            {
                if ((num + 2) == searchPattern.Length)
                {
                    throw new ArgumentException(JsImplEnvironment.GetResourceString("Arg_InvalidSearchPattern"));
                }
                if ((searchPattern[num + 2] == DirectorySeparatorChar) || (searchPattern[num + 2] == AltDirectorySeparatorChar))
                {
                    throw new ArgumentException(JsImplEnvironment.GetResourceString("Arg_InvalidSearchPattern"));
                }
                searchPattern = searchPattern.Substring(num + 2);
            }
        }
Exemplo n.º 4
0
 // Methods
 public JsImplArgumentException()
     : base(JsImplEnvironment.GetResourceString("Arg_ArgumentException"))
 {
     base.SetErrorCode(-2147024809);
 }
Exemplo n.º 5
0
 // Methods
 public JsImplSystemException()
     : base(JsImplEnvironment.GetResourceString("Arg_SystemException"))
 {
     base.SetErrorCode(-2146233087);
 }