Exemplo n.º 1
0
 public StartupParams(IAuthProvider provider, IPathManager pathManager,
     ICustomNodeManager customNodeManager)
 {
     this.authProvider = provider;
     this.pathManager = pathManager;
     this.customNodeManager = customNodeManager;
 }
Exemplo n.º 2
0
        private static bool ResolveForAssembly(string assemblyLocation,
            IPathManager pathManager, ref string documentationPath)
        {
            string cashedAssemblyLocation = assemblyLocation;
            if (pathManager != null)
            {
                pathManager.ResolveLibraryPath(ref assemblyLocation);
            }

            // Some nodes don't have assembly, e.g. operators, but they do have xml file.
            if (String.IsNullOrEmpty(assemblyLocation))
            {
                assemblyLocation = cashedAssemblyLocation;
            }

            var assemblyPath = Path.GetFullPath(assemblyLocation);

            var baseDir = Path.GetDirectoryName(assemblyPath);
            var xmlFileName = Path.GetFileNameWithoutExtension(assemblyPath) + ".xml";

            var language = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString();
            var localizedResPath = Path.Combine(baseDir, language);
            documentationPath = Path.Combine(localizedResPath, xmlFileName);

            if (File.Exists(documentationPath))
                return true;

            localizedResPath = Path.Combine(baseDir, UI.Configurations.FallbackUiCulture);
            documentationPath = Path.Combine(localizedResPath, xmlFileName);
            if (File.Exists(documentationPath))
                return true;

            documentationPath = Path.Combine(baseDir, xmlFileName);
            return File.Exists(documentationPath);
        }
Exemplo n.º 3
0
        public AwsManager(IAmazonS3 amazonS3, IPathManager pathManager)
        {
            if (null == amazonS3)
                throw new ArgumentNullException(nameof(amazonS3));
            if (null == pathManager)
                throw new ArgumentNullException(nameof(pathManager));

            _pathManager = pathManager;
            _amazonS3 = amazonS3;

            var storageClass = S3StorageClass.Standard;
            var storageClassString = ConfigurationManager.AppSettings["AwsStorageClass"];

            if (!string.IsNullOrWhiteSpace(storageClassString))
                storageClass = S3StorageClass.FindValue(storageClassString);

            var blobStorageClass = storageClass;
            var blobStorageClassString = ConfigurationManager.AppSettings["AwsBlobStorageClass"];

            if (!string.IsNullOrWhiteSpace(blobStorageClassString))
                blobStorageClass = S3StorageClass.FindValue(blobStorageClassString);

            var linkStorageClass = storageClass;
            var linkStorageClassString = ConfigurationManager.AppSettings["AwsLinkStorageClass"];

            if (!string.IsNullOrWhiteSpace(linkStorageClassString))
                linkStorageClass = S3StorageClass.FindValue(linkStorageClassString);

            _s3Blobs = new S3Blobs(amazonS3, pathManager, blobStorageClass);
            _s3Links = new S3Links(amazonS3, pathManager, linkStorageClass);
        }
Exemplo n.º 4
0
        private static bool ResolveForAssembly(string assemblyLocation,
            IPathManager pathManager, ref string customizationPath)
        {
            try
            {
                if ((pathManager != null) && (!pathManager.ResolveLibraryPath(ref assemblyLocation)))
                {
                    return false;
                }

                var qualifiedPath = Path.GetFullPath(assemblyLocation);
                var fn = Path.GetFileNameWithoutExtension(qualifiedPath);
                var dir = Path.GetDirectoryName(qualifiedPath);

                fn = fn + "_DynamoCustomization.xml";

                customizationPath = Path.Combine(dir, fn);

                return File.Exists(customizationPath);
            }
            catch
            {
                // Just to be sure, that nothing will be crashed.
                customizationPath = "";
                return false;
            }
        }
Exemplo n.º 5
0
        private static bool ResolveResourceAssembly(
            string assemblyLocation,
            IPathManager pathManager,
            bool useAdditionalPaths,
            out string resourceAssemblyPath)
        {
            try
            {
                var fn = Path.GetFileNameWithoutExtension(assemblyLocation);
                // First try side-by-side search for customization dll.
                var dirName = Path.GetDirectoryName(assemblyLocation);
                resourceAssemblyPath = Path.Combine(dirName, fn + Configurations.IconResourcesDLL);

                if (File.Exists(resourceAssemblyPath))
                    return true;
                if (pathManager == null) // Can't resolve path without IPathManager.
                    return false;

                resourceAssemblyPath = fn + Configurations.IconResourcesDLL;

                if (!useAdditionalPaths) // Should only look up alongside the main assembly.
                    return false;

                // Side-by-side customization dll not found, try other resolution paths.
                return pathManager.ResolveLibraryPath(ref resourceAssemblyPath);
            }
            catch
            {
                // Just to be sure, that nothing will be crashed.
                resourceAssemblyPath = "";
                return false;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Constructs a new execution session.
 /// </summary>
 public ExecutionSession(Scheduler.UpdateGraphAsyncTask updateTask, DynamoModel model, string geometryFactoryPath)
 {
     CurrentWorkspacePath = updateTask.TargetedWorkspace.FileName;
     pathManager = model.PathManager;
     parameters[ParameterKeys.GeometryFactory] = geometryFactoryPath;
     parameters[ParameterKeys.MajorVersion] = pathManager.MajorFileVersion;
     parameters[ParameterKeys.MinorVersion] = pathManager.MinorFileVersion;
     parameters[ParameterKeys.NumberFormat] = model.PreferenceSettings.NumberFormat;
 }
 public SettingsStyleContentController(IAuthManager authManager, IPathManager pathManager, IDatabaseManager databaseManager, ISiteRepository siteRepository, IChannelRepository channelRepository, IContentRepository contentRepository, ITableStyleRepository tableStyleRepository)
 {
     _authManager          = authManager;
     _pathManager          = pathManager;
     _databaseManager      = databaseManager;
     _siteRepository       = siteRepository;
     _channelRepository    = channelRepository;
     _contentRepository    = contentRepository;
     _tableStyleRepository = tableStyleRepository;
 }
Exemplo n.º 8
0
 public UsersController(IAuthManager authManager, IPathManager pathManager, IConfigRepository configRepository, IAccessTokenRepository accessTokenRepository, IUserRepository userRepository, ILogRepository logRepository, IStatRepository statRepository)
 {
     _authManager           = authManager;
     _pathManager           = pathManager;
     _configRepository      = configRepository;
     _accessTokenRepository = accessTokenRepository;
     _userRepository        = userRepository;
     _logRepository         = logRepository;
     _statRepository        = statRepository;
 }
 public FolderContentSearchManager(
     IDirectoryManagerAsync directoryManager,
     IPathManager pathManager,
     IFileManagerAsync fileManager,
     IConfiguration configuration)
 {
     _pathManager    = pathManager;
     _configuration  = configuration;
     _folderProvider = new CacheSearchFolderProvider(directoryManager, pathManager, fileManager, configuration);
 }
Exemplo n.º 10
0
 private void LoadPackages(IPreferences preferences, IPathManager pathManager)
 {
     // Load Packages
     PackageLoader.DoCachedPackageUninstalls(preferences);
     PackageLoader.LoadAll(new LoadPackageParams
     {
         Preferences = preferences,
         PathManager = pathManager
     });
 }
Exemplo n.º 11
0
 public FolderContentManager(
     IPathManager pathManager,
     IConfiguration configuration,
     IFolderProvider <Folder> folderProvider) :
     base(pathManager, folderProvider)
 {
     CreateFolderAsync(configuration.BaseFolderName, configuration.BaseFolderPath).Wait();
     CreateFolderAsync(configuration.HomeFolderName, configuration.HomeFolderPath).Wait();
     CreateFolderAsync(configuration.TemporaryFileFolderName, configuration.HomeFolderPath).Wait();
 }
Exemplo n.º 12
0
 public ContentsLayerImportController(ICacheManager <CacheUtils.Process> cacheManager, IAuthManager authManager, IPathManager pathManager, ICreateManager createManager, IDatabaseManager databaseManager, ISiteRepository siteRepository, IChannelRepository channelRepository)
 {
     _cacheManager      = cacheManager;
     _authManager       = authManager;
     _pathManager       = pathManager;
     _createManager     = createManager;
     _databaseManager   = databaseManager;
     _siteRepository    = siteRepository;
     _channelRepository = channelRepository;
 }
Exemplo n.º 13
0
 public ContentsLayerWordController(IAuthManager authManager, IPathManager pathManager, ICreateManager createManager, ISiteRepository siteRepository, IChannelRepository channelRepository, IContentRepository contentRepository, ITableStyleRepository tableStyleRepository)
 {
     _authManager          = authManager;
     _pathManager          = pathManager;
     _createManager        = createManager;
     _siteRepository       = siteRepository;
     _channelRepository    = channelRepository;
     _contentRepository    = contentRepository;
     _tableStyleRepository = tableStyleRepository;
 }
Exemplo n.º 14
0
 public ContentsLayerExportController(ICacheManager cacheManager, IAuthManager authManager, IPathManager pathManager, IDatabaseManager databaseManager, ISiteRepository siteRepository, IChannelRepository channelRepository, IContentRepository contentRepository)
 {
     _cacheManager      = cacheManager;
     _authManager       = authManager;
     _pathManager       = pathManager;
     _databaseManager   = databaseManager;
     _siteRepository    = siteRepository;
     _channelRepository = channelRepository;
     _contentRepository = contentRepository;
 }
Exemplo n.º 15
0
        internal PackageLoader(IPathManager pathManager)
        {
            this.pathManager = pathManager;
            InitPackageLoader(pathManager.PackagesDirectories, PathManager.BuiltinPackagesDirectory);

            if (!string.IsNullOrEmpty(pathManager.CommonDataDirectory))
            {
                packagesDirectoriesToVerifyCertificates.Add(pathManager.CommonDataDirectory);
            }
        }
 public ImageCommandService(IProductRepository productRepository,
                            IImageRepository imageRepository,
                            IPathManager pathManager,
                            IFileManager fileManager)
 {
     this.productRepository = productRepository;
     this.imageRepository   = imageRepository;
     this.pathManager       = pathManager;
     this.fileManager       = fileManager;
 }
Exemplo n.º 17
0
 public GatherManager(IPathManager pathManager, ICacheManager cacheManager, ITaskManager taskManager, ISiteRepository siteRepository, IChannelRepository channelRepository, IContentRepository contentRepository, IRuleRepository ruleRepository)
 {
     _pathManager       = pathManager;
     _cacheManager      = cacheManager;
     _taskManager       = taskManager;
     _siteRepository    = siteRepository;
     _channelRepository = channelRepository;
     _contentRepository = contentRepository;
     _ruleRepository    = ruleRepository;
 }
Exemplo n.º 18
0
 public StartupParams(IAuthProvider provider, IPathManager pathManager,
     ILibraryLoader libraryLoader, ICustomNodeManager customNodeManager,
     Version dynamoVersion)
 {
     this.authProvider = provider;
     this.pathManager = pathManager;
     this.libraryLoader = libraryLoader;
     this.customNodeManager = customNodeManager;
     this.dynamoVersion = dynamoVersion;
 }
Exemplo n.º 19
0
 public void Load(IPreferences preferences, IPathManager pathManager)
 {
     // Load Packages
     PackageLoader.DoCachedPackageUninstalls(preferences);
     PackageLoader.LoadAll(new LoadPackageParams
     {
         Preferences = preferences,
         PathManager = pathManager
     });
 }
Exemplo n.º 20
0
 public ImageController(ISettingsManager settingsManager, IAuthManager authManager, IPathManager pathManager, IWxManager openManager, ISiteRepository siteRepository, IMaterialGroupRepository materialGroupRepository, IMaterialImageRepository materialImageRepository, IWxAccountRepository openAccountRepository)
 {
     _settingsManager         = settingsManager;
     _authManager             = authManager;
     _pathManager             = pathManager;
     _openManager             = openManager;
     _siteRepository          = siteRepository;
     _materialGroupRepository = materialGroupRepository;
     _materialImageRepository = materialImageRepository;
     _openAccountRepository   = openAccountRepository;
 }
Exemplo n.º 21
0
        public TestCountCheck(ICheckConfig checkConfig, Task <List <FeatureEvidence> > projectBuildTask)
        {
            this.projectBuildTask = projectBuildTask;
            workingDir            = Path.Combine(checkConfig.PathManager.ModifiedTestDirPath, "UnitConverterTests");
            pathManager           = checkConfig.PathManager;

            UnitTestEvidence.Feature       = Feature.TestCountCheck;
            UnitTestEvidence.HelperMessage = messages.TestCountCheck;
            processName = "dotnet";
            arguments   = "test --no-build";
        }
Exemplo n.º 22
0
 public ContentsLayerCopyController(IAuthManager authManager, IPathManager pathManager, ICreateManager createManager, IDatabaseManager databaseManager, IPluginManager pluginManager, ISiteRepository siteRepository, IChannelRepository channelRepository, IContentRepository contentRepository)
 {
     _authManager       = authManager;
     _pathManager       = pathManager;
     _createManager     = createManager;
     _databaseManager   = databaseManager;
     _pluginManager     = pluginManager;
     _siteRepository    = siteRepository;
     _channelRepository = channelRepository;
     _contentRepository = contentRepository;
 }
Exemplo n.º 23
0
 public AdministratorsController(ICacheManager <object> cacheManager, IAuthManager authManager, IPathManager pathManager, IDatabaseManager databaseManager, IAdministratorRepository administratorRepository, IRoleRepository roleRepository, ISiteRepository siteRepository, IAdministratorsInRolesRepository administratorsInRolesRepository)
 {
     _cacheManager                    = cacheManager;
     _authManager                     = authManager;
     _pathManager                     = pathManager;
     _databaseManager                 = databaseManager;
     _administratorRepository         = administratorRepository;
     _roleRepository                  = roleRepository;
     _siteRepository                  = siteRepository;
     _administratorsInRolesRepository = administratorsInRolesRepository;
 }
Exemplo n.º 24
0
 public StartupParams(IAuthProvider provider, IPathManager pathManager,
                      ILibraryLoader libraryLoader, ICustomNodeManager customNodeManager,
                      Version dynamoVersion, IPreferences preferences)
 {
     this.authProvider      = provider;
     this.pathManager       = pathManager;
     this.libraryLoader     = libraryLoader;
     this.customNodeManager = customNodeManager;
     this.dynamoVersion     = dynamoVersion;
     this.preferences       = preferences;
 }
Exemplo n.º 25
0
 public CreateManager(IPathManager pathManager, IParseManager parseManager, ITaskManager taskManager, IChannelRepository channelRepository, IContentRepository contentRepository, ISiteRepository siteRepository, ISpecialRepository specialRepository, ITemplateRepository templateRepository)
 {
     _pathManager        = pathManager;
     _parseManager       = parseManager;
     _taskManager        = taskManager;
     _channelRepository  = channelRepository;
     _contentRepository  = contentRepository;
     _siteRepository     = siteRepository;
     _specialRepository  = specialRepository;
     _templateRepository = templateRepository;
 }
Exemplo n.º 26
0
        public static string GetDescription(this TypedParameter member, IPathManager pathManager)
        {
            XDocument xml = null;

            if (member.Function != null && member.Function.Assembly != null)
            {
                xml = DocumentationServices.GetForAssembly(member.Function.Assembly, pathManager);
            }

            return(member.GetDescription(xml));
        }
Exemplo n.º 27
0
        public static string GetSummary(this FunctionDescriptor member, IPathManager pathManager)
        {
            XDocument xml = null;

            if (member.Assembly != null)
            {
                xml = DocumentationServices.GetForAssembly(member.Assembly, pathManager);
            }

            return(member.GetSummary(xml));
        }
Exemplo n.º 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LibraryServices"/> class.
        /// </summary>
        /// <param name="libraryManagementCore">Core which is used for parsing code and loading libraries</param>
        /// <param name="pathManager">Instance of IPathManager containing neccessary Dynamo paths</param>
        public LibraryServices(ProtoCore.Core libraryManagementCore, IPathManager pathManager)
        {
            LibraryManagementCore = libraryManagementCore;
            this.pathManager      = pathManager;

            PreloadLibraries(pathManager.PreloadedLibraries);
            PopulateBuiltIns();
            PopulateOperators();
            PopulatePreloadLibraries();
            LibraryLoadFailed += new EventHandler <LibraryLoadFailedEventArgs>(LibraryLoadFailureHandler);
        }
Exemplo n.º 29
0
 public ListController(IAuthManager authManager, IPathManager pathManager, IGatherManager gatherManager, IRuleRepository ruleRepository, ISiteRepository siteRepository, IChannelRepository channelRepository, IContentRepository contentRepository, ITableStyleRepository tableStyleRepository)
 {
     _authManager          = authManager;
     _pathManager          = pathManager;
     _gatherManager        = gatherManager;
     _ruleRepository       = ruleRepository;
     _siteRepository       = siteRepository;
     _channelRepository    = channelRepository;
     _contentRepository    = contentRepository;
     _tableStyleRepository = tableStyleRepository;
 }
Exemplo n.º 30
0
 public ActionsPageContentsController(ISettingsManager settingsManager, IAuthManager authManager, IPathManager pathManager, IParseManager parseManager, IConfigRepository configRepository, ISiteRepository siteRepository, IChannelRepository channelRepository, ITemplateRepository templateRepository)
 {
     _settingsManager    = settingsManager;
     _authManager        = authManager;
     _pathManager        = pathManager;
     _parseManager       = parseManager;
     _configRepository   = configRepository;
     _siteRepository     = siteRepository;
     _channelRepository  = channelRepository;
     _templateRepository = templateRepository;
 }
Exemplo n.º 31
0
 public ManageController(IAuthManager authManager, IPathManager pathManager, ISiteRepository sitetRepository, IUserRepository userRepository, IContentRepository contentRepository, ICommentManager formManager, ISettingsRepository formRepository, ICommentRepository dataRepository)
 {
     _authManager        = authManager;
     _pathManager        = pathManager;
     _sitetRepository    = sitetRepository;
     _userRepository     = userRepository;
     _contentRepository  = contentRepository;
     _commentManager     = formManager;
     _settingsRepository = formRepository;
     _commentRepository  = dataRepository;
 }
Exemplo n.º 32
0
 public ChatSendController(IAuthManager authManager, IWxManager wxManager, IPathManager pathManager, IWxChatRepository wxChatRepository, IMaterialImageRepository materialImageRepository, IMaterialAudioRepository materialAudioRepository, IMaterialVideoRepository materialVideoRepository, ISiteRepository siteRepository)
 {
     _authManager             = authManager;
     _wxManager               = wxManager;
     _pathManager             = pathManager;
     _wxChatRepository        = wxChatRepository;
     _materialImageRepository = materialImageRepository;
     _materialAudioRepository = materialAudioRepository;
     _materialVideoRepository = materialVideoRepository;
     _siteRepository          = siteRepository;
 }
Exemplo n.º 33
0
 public LoginController(ISettingsManager settingsManager, IAuthManager authManager, IPathManager pathManager, IConfigRepository configRepository, IAdministratorRepository administratorRepository, IDbCacheRepository dbCacheRepository, ILogRepository logRepository, IStatRepository statRepository)
 {
     _settingsManager         = settingsManager;
     _authManager             = authManager;
     _pathManager             = pathManager;
     _configRepository        = configRepository;
     _administratorRepository = administratorRepository;
     _dbCacheRepository       = dbCacheRepository;
     _logRepository           = logRepository;
     _statRepository          = statRepository;
 }
Exemplo n.º 34
0
 public TemplatesEditorController(IAuthManager authManager, IPathManager pathManager, ICreateManager createManager, IParseManager parseManager, ISiteRepository siteRepository, ITemplateRepository templateRepository, IChannelRepository channelRepository, IContentRepository contentRepository)
 {
     _authManager        = authManager;
     _pathManager        = pathManager;
     _createManager      = createManager;
     _parseManager       = parseManager;
     _siteRepository     = siteRepository;
     _templateRepository = templateRepository;
     _channelRepository  = channelRepository;
     _contentRepository  = contentRepository;
 }
Exemplo n.º 35
0
        public MediaManager(IPathManager pathManager, IVideoJoiner videoJoiner)
        {
            _appStoragePath       = pathManager.GetAppStoragePath();
            _appImagesStoragePath = pathManager.GetImagesStoragePath();
            _appVideosStoragePath = pathManager.GetVideosStoragePath();
            _appCachePath         = pathManager.GetAppCachePath();

            InitialiseDirectories();

            _videoJoiner = videoJoiner;
        }
Exemplo n.º 36
0
        /// <summary>
        /// Default constructor for the IconResourceProvider
        /// </summary>
        /// <param name="pathManager">Path manager instance to resolve the
        /// customization resource path</param>
        /// <param name="defaultIcon">Name of the default icon (including
        /// extension) to be used when it can't find the requested icon</param>
        public IconResourceProvider(IPathManager pathManager, string defaultIcon = "default-icon.svg") : base(true)
        {
            this.pathManager = pathManager;
            defaultIconName  = defaultIcon;
            var dynCore = typeof(DynamoModel).Assembly;

            //TODO replace with direct calls after Dynamo 2.6 is released.
            this.getForAssemblyMethodInfo = dynCore.GetType("Dynamo.Engine.LibraryCustomizationServices").GetMethod("GetForAssembly", BindingFlags.Static | BindingFlags.Public);
            this.LibraryCustomizationType = dynCore.GetType("Dynamo.Engine.LibraryCustomization");
            this.LibraryCustomizationResourceAssemblyProperty = LibraryCustomizationType.GetProperty("ResourceAssembly", BindingFlags.Instance | BindingFlags.Public);
        }
 public BufferedFolderProvider(
     IDirectoryManagerAsync directoryManager,
     IPathManager pathManager,
     IFileManagerAsync fileManager,
     IConfiguration configuration)
 {
     _directoryManager = directoryManager;
     _pathManager      = pathManager;
     _fileManager      = fileManager;
     _configuration    = configuration;
 }
Exemplo n.º 38
0
 public ContentsController(IAuthManager authManager, IPathManager pathManager, IDatabaseManager databaseManager, ISiteRepository siteRepository, IChannelRepository channelRepository, IContentRepository contentRepository, IContentGroupRepository contentGroupRepository, IContentTagRepository contentTagRepository)
 {
     _authManager            = authManager;
     _pathManager            = pathManager;
     _databaseManager        = databaseManager;
     _siteRepository         = siteRepository;
     _channelRepository      = channelRepository;
     _contentRepository      = contentRepository;
     _contentGroupRepository = contentGroupRepository;
     _contentTagRepository   = contentTagRepository;
 }
Exemplo n.º 39
0
        public S3Links(IAmazonS3 amazonS3, IPathManager pathManager, S3StorageClass s3StorageClass)
            : base(amazonS3)
        {
            if (null == pathManager)
                throw new ArgumentNullException(nameof(pathManager));
            if (null == s3StorageClass)
                throw new ArgumentNullException(nameof(s3StorageClass));

            _pathManager = pathManager;
            _s3StorageClass = s3StorageClass;
        }
Exemplo n.º 40
0
        public static XmlReader GetForAssembly(string assemblyPath, IPathManager pathManager)
        {
            if (_triedPaths.ContainsKey(assemblyPath))
            {
                return _triedPaths[assemblyPath] ? _cached[assemblyPath] : null;
            }

            var documentationPath = "";
            if (ResolveForAssembly(assemblyPath, pathManager, ref documentationPath))
            {
                var c = XmlReader.Create(documentationPath);
                _triedPaths.Add(assemblyPath, true);
                _cached.Add(assemblyPath, c);
                return c;
            }

            _triedPaths.Add(assemblyPath, false);
            return null;
        }
Exemplo n.º 41
0
        private static bool ResolveForAssembly(string assemblyLocation,
            IPathManager pathManager, ref string documentationPath)
        {
            var assemblyName = Path.GetFileNameWithoutExtension(assemblyLocation);
            if (pathManager != null)
            {
                pathManager.ResolveLibraryPath(ref assemblyLocation);
            }

            string baseDir = String.Empty;
            if (String.IsNullOrEmpty(assemblyLocation) || !File.Exists(assemblyLocation))
            {
                // Some nodes do not have a corresponding assembly, but their documentation 
                // xml file resides alongside DynamoCore.dll. If the assembly could not be 
                // located, fall back onto using DynamoCoreDirectory.
                baseDir = pathManager.DynamoCoreDirectory;
            }
            else
            {
                // Found the assembly location, search for documentation alongside it.
                baseDir = Path.GetDirectoryName(Path.GetFullPath(assemblyLocation));
            }

            var language = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString();
            //try with the system culture
            var localizedDocPath = Path.Combine(baseDir, language);

            //try with the fallback culture
            var localizedFallbackDockPath = Path.Combine(baseDir, Configurations.FallbackUiCulture);

            var searchPaths = new List<string>() { localizedDocPath, localizedFallbackDockPath, baseDir };
            var extension = ".xml";

            documentationPath = FindFileInPaths(assemblyName, extension, searchPaths.ToArray());
            if(documentationPath != string.Empty)
            {
                return true;
            }
            return false;
        }
Exemplo n.º 42
0
        private static bool ResolveForAssembly(string assemblyLocation,
            IPathManager pathManager, ref string documentationPath)
        {
            var assemblyName = Path.GetFileNameWithoutExtension(assemblyLocation);
            if (pathManager != null)
            {
                pathManager.ResolveLibraryPath(ref assemblyLocation);
            }

            string baseDir = String.Empty;
            if (String.IsNullOrEmpty(assemblyLocation) || !File.Exists(assemblyLocation))
            {
                // Some nodes do not have a corresponding assembly, but their documentation 
                // xml file resides alongside DynamoCore.dll. If the assembly could not be 
                // located, fall back onto using DynamoCoreDirectory.
                baseDir = pathManager.DynamoCoreDirectory;
            }
            else
            {
                // Found the assembly location, search for documentation alongside it.
                baseDir = Path.GetDirectoryName(Path.GetFullPath(assemblyLocation));
            }

            var xmlFileName = assemblyName + ".xml";

            var language = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString();
            var localizedResPath = Path.Combine(baseDir, language);
            documentationPath = Path.Combine(localizedResPath, xmlFileName);

            if (File.Exists(documentationPath))
                return true;

            localizedResPath = Path.Combine(baseDir, UI.Configurations.FallbackUiCulture);
            documentationPath = Path.Combine(localizedResPath, xmlFileName);
            if (File.Exists(documentationPath))
                return true;

            documentationPath = Path.Combine(baseDir, xmlFileName);
            return File.Exists(documentationPath);
        }
Exemplo n.º 43
0
        public static LibraryCustomization GetForAssembly(string assemblyPath, IPathManager pathManager, bool useAdditionalPaths = true)
        {
            if (triedPaths.ContainsKey(assemblyPath))
            {
                return triedPaths[assemblyPath] ? cache[assemblyPath] : null;
            }

            var customizationPath = "";
            var resourceAssemblyPath = "";

            XDocument xDocument = null;
            Assembly resAssembly = null;

            if (ResolveForAssembly(assemblyPath, pathManager, ref customizationPath))
            {
                xDocument = XDocument.Load(customizationPath);
            }

            if (ResolveResourceAssembly(assemblyPath, pathManager, useAdditionalPaths, out resourceAssemblyPath))
            {
                resAssembly = Assembly.LoadFrom(resourceAssemblyPath);
            }

            // We need 'LibraryCustomization' if either one is not 'null'
            if (xDocument != null || (resAssembly != null))
            {
                var c = new LibraryCustomization(resAssembly, xDocument);
                triedPaths.Add(assemblyPath, true);
                cache.Add(assemblyPath, c);
                return c;
            }

            triedPaths.Add(assemblyPath, false);
            return null;

        }
Exemplo n.º 44
0
        public FunctionDescriptor(FunctionDescriptorParams funcDescParams)
        {
            if (!String.IsNullOrEmpty(funcDescParams.Summary))
            {
                summary = funcDescParams.Summary;
            }

            pathManager = funcDescParams.PathManager;
            Assembly = funcDescParams.Assembly;
            ClassName = funcDescParams.ClassName;
            FunctionName = funcDescParams.FunctionName;

            Parameters = funcDescParams.Parameters.Select(
                x =>
                {
                    x.UpdateFunctionDescriptor(this);
                    return x;
                }).ToList();

            var type = funcDescParams.FunctionType;
            var inputParameters = new List<Tuple<string, string>>();
            //Add instance parameter as one of the inputs for instance method as well as properties.
            if(type == FunctionType.InstanceMethod || type == FunctionType.InstanceProperty)
                inputParameters.Add(Tuple.Create(UnqualifedClassName.ToLower(), UnqualifedClassName));

            if (Parameters.Any())
            {
                inputParameters.AddRange(Parameters.Select(
                    par => Tuple.Create(par.Name, par.DisplayTypeName)));
            }

            InputParameters = inputParameters;
            ReturnType =  funcDescParams.ReturnType;
            Type = type;
            ReturnKeys = funcDescParams.ReturnKeys;
            IsVarArg = funcDescParams.IsVarArg;
            IsVisibleInLibrary = funcDescParams.IsVisibleInLibrary;
            ObsoleteMessage = funcDescParams.ObsoleteMsg;
            CanUpdatePeriodically = funcDescParams.CanUpdatePeriodically;
            IsBuiltIn = funcDescParams.IsBuiltIn;
            IsPackageMember = funcDescParams.IsPackageMember;
        }
Exemplo n.º 45
0
 internal IconServices(IPathManager pathManager)
 {
     this.pathManager = pathManager;
 }
 public ReflectionBasedTypeSystem(ISurrogateProvider surrogateProvider, IPathManager pathManager)
 {
     SurrogateProvider = surrogateProvider;
     PathManager = pathManager;
 }
Exemplo n.º 47
0
 public LibraryCustomizationServices(IPathManager assemblyPathManager)
 {
     this.pathManager = assemblyPathManager;
 }