Ejemplo n.º 1
0
        /// <summary>
        /// Resolves the assembly location.
        /// </summary>
        /// <param name="assemblyName">Name of the assembly.</param>
        /// <returns></returns>
        public static string ResolveAssemblyLocation(string assemblyName)
        {
            int pos = assemblyName.IndexOf(',');

            if (pos > 0)
            {
                assemblyName = assemblyName.Substring(0, pos).Trim();
            }
            string extension = assemblyName.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase) ? String.Empty : ".dll";

            assemblyName = String.Format("{0}{1}", assemblyName, extension);
            string location;

            // Recherche dans le cache
            if (s_assemblyLocationCache.TryGetValue(assemblyName, out location))
            {
                return(location);
            }

            location = RepositoryManager.ResolvePath(RepositoryCategory.Strategies, Path.Combine(assemblyName, assemblyName));
            if (!File.Exists(location))
            {
                List <String> fileNames = Utils.SearchFile(RepositoryManager.ResolvePath(RepositoryCategory.Strategies, String.Empty), assemblyName);
                if (fileNames.Count > 0)
                {
                    location = fileNames[0];
                }
            }
            s_assemblyLocationCache.Add(assemblyName, location);
            return(location);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Permet de calculer le chemin du fichier modèle
        /// </summary>
        /// <param name="id">Id du modèle</param>
        /// <param name="version">n° de version</param>
        /// <param name="modelFileName">Nom du fichier (sans le path) du modèle (extension facultative)</param>
        /// <param name="kind">Type de chemin souhaité</param>
        /// <returns>Path absolu ou relatif au repository</returns>
        public static string GetFileName(Guid id, VersionInfo version, string modelFileName, PathKind kind)
        {
            if (!System.IO.Path.HasExtension(modelFileName))
            {
                modelFileName += ModelConstants.FileNameExtension;
            }

            // Chemin relatif
            string relPath =
                System.IO.Path.Combine(System.IO.Path.Combine(id.ToString(), version.ToString(3)), modelFileName);

            if (kind == PathKind.Relative)
            {
                return(relPath);
            }
            // Chemin physique
            return(RepositoryManager.ResolvePath(RepositoryCategory.Models, relPath));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Création du fichier absolu à partir du chemin relatif
 /// </summary>
 /// <param name="relativePath">The relative path.</param>
 /// <returns></returns>
 private string CreateAbsoluteLocalPath(string relativePath)
 {
     return(RepositoryManager.ResolvePath(_category, relativePath));
 }