Ejemplo n.º 1
0
        /// <summary>In the special case that <c>m_NameAsmFileErrs</c> is
        /// <c>OTFontFileVal</c>, which I believe it always is, then
        /// read the string corresponding to <c>m_StringName</c> of the form
        /// <c>W1404: The LineGap value is less than the recommended value</c>
        /// from the hardcoded resource file <c>OTFontFileVal.ValStrings</c>
        /// and return a string consisting of the first 5 characters.
        ///
        /// If the resource is not present return <c>null</c>.
        /// If <c>m_NameAsmFileErrs != "OTFontFileVal</c>, then
        /// just return the value of the <c>ErrorID</c> property of the
        /// base class.
        /// <p/>
        /// This routine may be redundant since the <c>ErrorID</c>
        /// property already does a resource lookup on the resource.
        /// </summary>
        public string GetErrorID()
        {
            string s = null;

            if ((object)this.m_StringName != null)
            {
                if (this.m_NameAsmFileErrs == "OTFontFileVal")
                {
                    //var rm = DevMain2.OTFontFileVal_ValStrings.ResourceManager;
                    //System.Reflection.Assembly a = System.Reflection.Assembly.GetAssembly(this.GetType());
                    //System.Resources.ResourceManager rm = new System.Resources.ResourceManager("OTFontFileVal.ValStrings", a);
                    string sErrorAndMessage = ResMan.GetString(m_StringName);
                    if (sErrorAndMessage.Length > 6 && sErrorAndMessage[5] == ':' && sErrorAndMessage[6] == ' ')
                    {
                        s = sErrorAndMessage.Substring(0, 5);
                    }
                    else
                    {
                        s = null;
                    }
                }
                else
                {
                    s = ErrorID;
                }
            }

            return(s);
        }
Ejemplo n.º 2
0
        /// <summary>In the special case that <c>m_NameAsmFileErrs</c> is
        /// <c>OTFontFileVal</c>, which I believe it always is, then
        /// read the string corresponding to <c>m_StringName</c> of the form
        /// <c>W1404: The LineGap value is less than the recommended value</c>
        /// from the hardcoded resource file <c>OTFontFileVal.ValStrings</c>
        /// and return a string consisting of substring starting at character
        /// 7, that is, after discarding the initial "W1404: ".
        ///
        /// If the resource is not present return <c>null</c>.
        /// If <c>m_NameAsmFileErrs != "OTFontFileVal</c>, then
        /// just return the value of the <c>ErrorID</c> property of the
        /// base class.
        /// <p/>
        /// This routine may be redundant since the <c>ErrorID</c>
        /// property already does a resource lookup on the resource.
        /// </summary>
        public string GetString()
        {
            string s = null;

            if ((object)this.m_StringName != null)
            {
                // if string starts with "DEBUG" then just output the string
                if (this.m_StringName.Substring(0, 5) == "DEBUG")
                {
                    s = this.m_StringName;
                }
                else // else look it up in the resources
                {
                    if (this.m_NameAsmFileErrs == "OTFontFileVal")
                    {
                        //System.Reflection.Assembly a = System.Reflection.Assembly.GetAssembly(this.GetType());
                        //System.Resources.ResourceManager rm = new System.Resources.ResourceManager("OTFontFileVal.ValStrings", a);
                        //var rm = DevMain2.OTFontFileVal_ValStrings.ResourceManager;// OTFontFileVal.OTFontFileVal_ValStrings.ResourceManager;

                        string sErrorAndMessage = ResMan.GetString(m_StringName);
                        if (sErrorAndMessage.Length > 6 && sErrorAndMessage[5] == ':' && sErrorAndMessage[6] == ' ')
                        {
                            s = sErrorAndMessage.Substring(7);
                        }
                        else
                        {
                            s = null;
                        }
                    }
                    else if (this.m_NameAsmFileErrs == "Glyph")
                    {
                        var    rm = OTFontFileVal.GlyphX.NS_Glyph_GErrStrings.ResourceManager;
                        string sErrorAndMessage = rm.GetString(m_StringName);
                        if (sErrorAndMessage.Length > 6 && sErrorAndMessage[5] == ':' && sErrorAndMessage[6] == ' ')
                        {
                            s = sErrorAndMessage.Substring(7);
                        }
                        else
                        {
                            s = null;
                        }
                    }
                    else
                    {
                        s = this.ValueName;
                    }
                    Debug.Assert(s != null, "Resource string not found", m_StringName);
                }
            }

            return(s);
        }