Exemplo n.º 1
0
 public static string ToCASPath(this string path, ManagedDict <string, string> extraPath = null)
 {
     if (string.IsNullOrEmpty(path))
     {
         path = "@working";
     }
     path = path.ToCASString(extraPath);
     if (path.StartsWith("\\\\") || path.Contains(":"))
     {
         return(path);
     }
     return(Path.GetFullPath(path));
 }
Exemplo n.º 2
0
        public static string ToCASString(this string path, ManagedDict <string, string> extraPath = null)
        {
            if (extraPath != null)
            {
                foreach (var k in extraPath)
                {
                    path = Regex.Replace(path, "{@" + k.Key + "}", k.Value.ToString(), RegexOptions.Compiled | RegexOptions.IgnoreCase);
                    path = Regex.Replace(path, $"@{k.Key}", k.Value.ToString(), RegexOptions.Compiled | RegexOptions.IgnoreCase);
                }
            }

            foreach (var k in ENV_PATH)
            {
                path = Regex.Replace(path, "{@" + k.Key + "}", k.Value.ToString(), RegexOptions.Compiled | RegexOptions.IgnoreCase);
                path = Regex.Replace(path, $"@{k.Key}", k.Value.ToString(), RegexOptions.Compiled | RegexOptions.IgnoreCase);
            }

            string workingDir = Directory.GetCurrentDirectory();

            path = Regex.Replace(path, "{@working}", workingDir, RegexOptions.Compiled | RegexOptions.IgnoreCase);
            path = Regex.Replace(path, "@working", workingDir, RegexOptions.Compiled | RegexOptions.IgnoreCase);

            return(path);
        }