示例#1
0
        private void ReportStringResourceFailure(StringResourceReference resource, DisplayResourceManagerCache.LoadingResult result, DisplayResourceManagerCache.AssemblyBindingStatus bindingStatus)
        {
            string assemblyName;
            switch (bindingStatus)
            {
                case DisplayResourceManagerCache.AssemblyBindingStatus.FoundInGac:
                    assemblyName = StringUtil.Format(FormatAndOutXmlLoadingStrings.AssemblyInGAC, resource.assemblyName);
                    break;

                case DisplayResourceManagerCache.AssemblyBindingStatus.FoundInPath:
                    assemblyName = Path.Combine(resource.loadingInfo.fileDirectory, resource.assemblyName);
                    break;

                default:
                    assemblyName = resource.assemblyName;
                    break;
            }
            string message = null;
            switch (result)
            {
                case DisplayResourceManagerCache.LoadingResult.AssemblyNotFound:
                    message = StringUtil.Format(FormatAndOutXmlLoadingStrings.AssemblyNotFound, new object[] { base.ComputeCurrentXPath(), base.FilePath, assemblyName });
                    break;

                case DisplayResourceManagerCache.LoadingResult.ResourceNotFound:
                    message = StringUtil.Format(FormatAndOutXmlLoadingStrings.ResourceNotFound, new object[] { base.ComputeCurrentXPath(), base.FilePath, resource.baseName, assemblyName });
                    break;

                case DisplayResourceManagerCache.LoadingResult.StringNotFound:
                    message = StringUtil.Format(FormatAndOutXmlLoadingStrings.StringResourceNotFound, new object[] { base.ComputeCurrentXPath(), base.FilePath, resource.resourceId, resource.baseName, assemblyName });
                    break;
            }
            base.ReportError(message);
        }
示例#2
0
        private void ReportStringResourceFailure(StringResourceReference resource,
                                                    DisplayResourceManagerCache.LoadingResult result,
                                                    DisplayResourceManagerCache.AssemblyBindingStatus bindingStatus)
        {
            string assemblyDisplayName;
            switch (bindingStatus)
            {
                case DisplayResourceManagerCache.AssemblyBindingStatus.FoundInPath:
                    {
                        assemblyDisplayName =
                            System.IO.Path.Combine(resource.loadingInfo.fileDirectory, resource.assemblyName);
                    }
                    break;
                case DisplayResourceManagerCache.AssemblyBindingStatus.FoundInGac:
                    {
                        //"(Global Assembly Cache) {0}"
                        assemblyDisplayName = StringUtil.Format(FormatAndOutXmlLoadingStrings.AssemblyInGAC, resource.assemblyName);
                    }
                    break;
                default:
                    {
                        assemblyDisplayName = resource.assemblyName;
                    }
                    break;
            }

            string msg = null;
            switch (result)
            {
                case DisplayResourceManagerCache.LoadingResult.AssemblyNotFound:
                    {
                        //Error at XPath {0} in file {1}: Assembly {2} is not found.
                        msg = StringUtil.Format(FormatAndOutXmlLoadingStrings.AssemblyNotFound, ComputeCurrentXPath(), FilePath, assemblyDisplayName);
                    }
                    break;
                case DisplayResourceManagerCache.LoadingResult.ResourceNotFound:
                    {
                        //Error at XPath {0} in file {1}: Resource {2} in assembly {3} is not found.
                        msg = StringUtil.Format(FormatAndOutXmlLoadingStrings.ResourceNotFound, ComputeCurrentXPath(), FilePath, resource.baseName, assemblyDisplayName);
                    }
                    break;
                case DisplayResourceManagerCache.LoadingResult.StringNotFound:
                    {
                        //Error at XPath {0} in file {1}: String {2} from resource {3} in assembly {4} is not found.
                        msg = StringUtil.Format(FormatAndOutXmlLoadingStrings.StringResourceNotFound, ComputeCurrentXPath(), FilePath,
                            resource.resourceId, resource.baseName, assemblyDisplayName);
                    }
                    break;
            }
            this.ReportError(msg);
        }