Пример #1
0
        private static string GetLocalizedEffectErrorMessage(Assembly assembly, Type type, Exception exception)
        {
            IPluginSupportInfo pluginSupportInfo;
            string             fullName;

            if (type != null)
            {
                fullName          = type.FullName;
                pluginSupportInfo = PluginSupportInfo.GetPluginSupportInfo(type);
            }
            else if (exception is TypeLoadException)
            {
                TypeLoadException exception2 = exception as TypeLoadException;
                fullName          = exception2.TypeName;
                pluginSupportInfo = PluginSupportInfo.GetPluginSupportInfo(assembly);
            }
            else
            {
                pluginSupportInfo = PluginSupportInfo.GetPluginSupportInfo(assembly);
                fullName          = null;
            }
            return(GetLocalizedEffectErrorMessage(assembly, fullName, pluginSupportInfo, exception));
        }
Пример #2
0
        private static string GetLocalizedEffectErrorMessage(Assembly assembly, string typeName, Exception exception)
        {
            IPluginSupportInfo pluginSupportInfo = PluginSupportInfo.GetPluginSupportInfo(assembly);

            return(GetLocalizedEffectErrorMessage(assembly, typeName, pluginSupportInfo, exception));
        }
Пример #3
0
        private static string GetDetailTextForFilePath(IPluginErrorService pluginErrorService, IEnumerable <PluginErrorInfo> allPluginErrorInfos, string filePath)
        {
            string format = PdnResources.GetString("SettingsDialog.Plugins.AssemblyDetailText.Name.Format");
            string str2   = PdnResources.GetString("SettingsDialog.Plugins.SupportInfo.DisplayName.Format");
            string str3   = PdnResources.GetString("SettingsDialog.Plugins.SupportInfo.Version.Format");
            string str4   = PdnResources.GetString("SettingsDialog.Plugins.SupportInfo.Author.Format");
            string str5   = PdnResources.GetString("SettingsDialog.Plugins.SupportInfo.Copyright.Format");
            string str6   = PdnResources.GetString("SettingsDialog.Plugins.SupportInfo.Website.Format");
            string str7   = PdnResources.GetString("SettingsDialog.Plugins.SupportInfo.Type.Format");

            if (((allPluginErrorInfos == null) || !allPluginErrorInfos.Any <PluginErrorInfo>()) || (filePath == null))
            {
                return(string.Empty);
            }
            string             str8 = null;
            IPluginSupportInfo pluginSupportInfo = null;

            if (str8 == null)
            {
                Assembly assembly = (from pei in allPluginErrorInfos
                                     where pei.FilePath == filePath
                                     where pei.HasAssembly
                                     select pei.Assembly).FirstOrDefault <Assembly>();
                if (assembly != null)
                {
                    AssemblyName name = new AssemblyName(assembly.FullName);
                    pluginSupportInfo = PluginSupportInfo.GetPluginSupportInfo(assembly);
                    str8 = string.Format(format, assembly.Location, name.Version);
                }
            }
            if (str8 == null)
            {
                str8 = filePath;
                pluginSupportInfo = null;
            }
            StringBuilder builder = new StringBuilder();

            builder.Append(str8);
            builder.Append("\r\n");
            if (pluginSupportInfo != null)
            {
                if (!string.IsNullOrWhiteSpace(pluginSupportInfo.DisplayName))
                {
                    builder.AppendFormat(str2, pluginSupportInfo.DisplayName);
                    builder.Append("\r\n");
                }
                if ((pluginSupportInfo.Version != null) && (pluginSupportInfo.Version != new Version(0, 0, 0, 0)))
                {
                    builder.AppendFormat(str3, pluginSupportInfo.Version.ToString());
                    builder.Append("\r\n");
                }
                if (!string.IsNullOrWhiteSpace(pluginSupportInfo.Author))
                {
                    builder.AppendFormat(str4, pluginSupportInfo.Author);
                    builder.Append("\r\n");
                }
                if (!string.IsNullOrWhiteSpace(pluginSupportInfo.Copyright))
                {
                    builder.AppendFormat(str5, pluginSupportInfo.Copyright);
                    builder.Append("\r\n");
                }
                if (pluginSupportInfo.WebsiteUri != null)
                {
                    builder.AppendFormat(str6, pluginSupportInfo.WebsiteUri.ToString());
                    builder.Append("\r\n");
                }
            }
            builder.Append("\r\n");
            PluginErrorInfo[] infoArray = (from pei in allPluginErrorInfos
                                           where pei.FilePath == filePath
                                           orderby pei.TypeName
                                           select pei).ToArrayEx <PluginErrorInfo>();
            bool flag = true;

            foreach (PluginErrorInfo info2 in infoArray)
            {
                IPluginSupportInfo info3;
                string             pluginBlockReasonString;
                if (!flag)
                {
                    builder.Append("\r\n");
                }
                else
                {
                    flag = false;
                }
                if (info2.Type != null)
                {
                    info3 = PluginSupportInfo.GetPluginSupportInfo(info2.Type);
                }
                else
                {
                    info3 = null;
                }
                if ((info3 != null) && !string.IsNullOrWhiteSpace(info3.DisplayName))
                {
                    builder.AppendFormat(str2, info3.DisplayName);
                    builder.Append("\r\n");
                }
                if (info2.HasTypeName)
                {
                    builder.AppendFormat(str7, info2.TypeName);
                    builder.Append("\r\n");
                }
                if (info3 != null)
                {
                    if ((info3.Version != null) && (info3.Version != new Version(0, 0, 0, 0)))
                    {
                        builder.AppendFormat(str3, info3.Version.ToString());
                        builder.Append("\r\n");
                    }
                    if (!string.IsNullOrWhiteSpace(info3.Author))
                    {
                        builder.AppendFormat(str4, info3.Author);
                        builder.Append("\r\n");
                    }
                    if (!string.IsNullOrWhiteSpace(info3.Copyright))
                    {
                        builder.AppendFormat(str5, info3.Copyright);
                        builder.Append("\r\n");
                    }
                    if (info3.WebsiteUri != null)
                    {
                        builder.AppendFormat(str6, info3.WebsiteUri.ToString());
                        builder.Append("\r\n");
                    }
                }
                if (info2.Error is BlockedPluginException)
                {
                    pluginBlockReasonString = GetPluginBlockReasonString(((BlockedPluginException)info2.Error).Reason);
                }
                else
                {
                    pluginBlockReasonString = info2.ErrorString;
                }
                builder.Append(pluginBlockReasonString);
                builder.Append("\r\n");
            }
            return(builder.ToString());
        }