예제 #1
0
        private void AddLoaderException(PluginErrorInfo loaderException)
        {
            EffectsCollection effectss = this;

            lock (effectss)
            {
                this.loaderExceptions.Add(loaderException);
            }
        }
예제 #2
0
        public PluginErrorInfo[] GetLoaderExceptions()
        {
            EffectsCollection effectss = this;

            lock (effectss)
            {
                return(this.loaderExceptions.ToArrayEx <PluginErrorInfo>());
            }
        }
예제 #3
0
        private static EffectsCollection GatherEffects()
        {
            List<Assembly> assemblies = new List<Assembly>();

            // this assembly
            assemblies.Add(Assembly.GetExecutingAssembly());

            // PaintDotNet.Effects.dll
            assemblies.Add(Assembly.GetAssembly(typeof(Effect)));

            // TARGETDIR\Effects\*.dll
            string homeDir = PdnInfo.GetApplicationDir();
            string effectsDir = Path.Combine(homeDir, InvariantStrings.EffectsSubDir);
            bool dirExists;

            try
            {
                dirExists = Directory.Exists(effectsDir);
            }

            catch
            {
                dirExists = false;
            }

            if (dirExists)
            {
                string fileSpec = "*" + InvariantStrings.DllExtension;
                string[] filePaths = Directory.GetFiles(effectsDir, fileSpec);

                foreach (string filePath in filePaths)
                {
                    Assembly pluginAssembly = null;

                    try
                    {
                        pluginAssembly = Assembly.LoadFrom(filePath);
                        assemblies.Add(pluginAssembly);
                    }

                    catch (Exception ex)
                    {
                        Tracing.Ping("Exception while loading " + filePath + ": " + ex.ToString());
                    }
                }
            }

            EffectsCollection ec = new EffectsCollection(assemblies);
            return ec;
        }