예제 #1
0
파일: Core.cs 프로젝트: tinmanjk/NetOffice
 /// <summary>
 /// Clears all Core caches
 /// </summary>
 /// <param name="forceClear">method want do nothing if cache option is KeepExistingCacheAlive. You can force clear caches anyway by giving true</param>
 public virtual void ClearCaches(bool forceClear)
 {
     if (forceClear || CacheOptions.ClearExistingCache == Settings.CacheOptions)
     {
         lock (_assembliesLock)
         {
             InternalCache.Clear();
             InternalFactories.Clear();
             _initalized = false;
         }
     }
 }
예제 #2
0
파일: Core.cs 프로젝트: tinmanjk/NetOffice
        public virtual void Initialize(CacheOptions cacheOptions)
        {
#if DEBUG
            new InternalDebugDiagnostics().ValidateCore(this);
#endif

            Settings.CacheOptions = cacheOptions;

            if (!_initalized)
            {
                _initalized = true;
                RaiseIsInitializedChanged();
            }

            try
            {
                DateTime startTime = DateTime.Now;

                lock (_assembliesLock)
                {
                    Console.WriteLine("NetOffice Core.Initialize() Core Version:{0}; Deep Loading:{1}; Load Assemblies Unsafe:{2}; AppDomain:{3}",
                                      ThisAssembly.GetName().Version, Settings.EnableDeepLoading,
                                      Settings.LoadAssembliesUnsafe, AppDomain.CurrentDomain.Id.ToString() + "-" + AppDomain.CurrentDomain.FriendlyName);

                    if (Settings.EnableMoreDebugOutput)
                    {
                        string localPath = Resolver.UriResolver.ResolveLocalPath(ThisAssembly.CodeBase);
                        Console.WriteLine("Local Bind Path:{0}", localPath);
                    }

                    CoreDomain.TryLoadAssemblies(this);

                    ClearCaches(false);
                    InternalFactories.LoadAPIFactories();
                    InternalFactories.LoadDependentAPIFactories();

                    InitializedTime = DateTime.Now - startTime;

                    if (Settings.EnableMoreDebugOutput)
                    {
                        Console.WriteLine("NetOffice Core contains {0} assemblies", InternalFactories.FactoryAssemblies.Count);
                        Console.WriteLine("NetOffice Core.Initialize() passed in {0} milliseconds", InitializedTime.TotalMilliseconds);
                    }
                }
            }
            catch (Exception exception)
            {
                DebugConsole.Default.WriteException(exception);
                throw new NetOfficeInitializeException(exception);
            }
        }
 public static IPresetVoiLutOperationFactory GetFactory(string factoryName)
 {
     return(InternalFactories.Find(delegate(IPresetVoiLutOperationFactory factory) { return factory.Name == factoryName; }));
 }