Ejemplo n.º 1
0
        private string BuildMessage(IResourceSupplier resourceSupplier, string baseName, string resourceId, params object[] args)
        {
            if (resourceSupplier == null)
            {
                throw PSTraceSource.NewArgumentNullException("resourceSupplier");
            }
            if (string.IsNullOrEmpty(baseName))
            {
                throw PSTraceSource.NewArgumentNullException("baseName");
            }
            if (string.IsNullOrEmpty(resourceId))
            {
                throw PSTraceSource.NewArgumentNullException("resourceId");
            }
            string template = "";

            try
            {
                template = resourceSupplier.GetResourceString(baseName, resourceId);
            }
            catch (MissingManifestResourceException exception)
            {
                this._textLookupError = exception;
                return("");
            }
            catch (ArgumentException exception2)
            {
                this._textLookupError = exception2;
                return("");
            }
            return(this.BuildMessage(template, baseName, resourceId, args));
        }
Ejemplo n.º 2
0
 private string BuildMessage(IResourceSupplier resourceSupplier, string baseName, string resourceId, params object[] args)
 {
     if (resourceSupplier == null)
     {
         throw PSTraceSource.NewArgumentNullException("resourceSupplier");
     }
     if (string.IsNullOrEmpty(baseName))
     {
         throw PSTraceSource.NewArgumentNullException("baseName");
     }
     if (string.IsNullOrEmpty(resourceId))
     {
         throw PSTraceSource.NewArgumentNullException("resourceId");
     }
     string template = "";
     try
     {
         template = resourceSupplier.GetResourceString(baseName, resourceId);
     }
     catch (MissingManifestResourceException exception)
     {
         this._textLookupError = exception;
         return "";
     }
     catch (ArgumentException exception2)
     {
         this._textLookupError = exception2;
         return "";
     }
     return this.BuildMessage(template, baseName, resourceId, args);
 }
Ejemplo n.º 3
0
        } // BuildMessage
        private string BuildMessage(
            IResourceSupplier resourceSupplier,
            string baseName,
            string resourceId,
            params object[] args)
        {
            if (null == resourceSupplier)
                throw PSTraceSource.NewArgumentNullException("resourceSupplier");

            if (String.IsNullOrEmpty(baseName))
                throw PSTraceSource.NewArgumentNullException("baseName");

            if (String.IsNullOrEmpty(resourceId))
                throw PSTraceSource.NewArgumentNullException("resourceId");

            string template = "";

            try
            {
                template = resourceSupplier.GetResourceString(baseName, resourceId);
            }
            catch (MissingManifestResourceException e)
            {
                _textLookupError = e;
                return ""; // fallback to Exception.Message
            }
            catch (ArgumentException e)
            {
                _textLookupError = e;
                return ""; // fallback to Exception.Message
            }
            return BuildMessage(template, baseName, resourceId, args);
        } // BuildMessage