コード例 #1
0
 public void DIAFunc(ValInfoBasic info)
 {
     if (this.dic(info))
     {
         this.dia(info);
     }
 }
コード例 #2
0
 private bool DICFunc(ValInfoBasic info)
 {
     this.pars[0]=info;
     if (this.obj!=null)
     {
         return (bool)(this.infoMethod.Invoke(this.obj,this.pars));
     }
     else
     {
         return (bool)(this.infoMethod.Invoke(this.typeObj,this.pars));
     }
 }
コード例 #3
0
 public ValInfoBasic(ValInfoBasic viBasic) 
 {
     Debug.Assert(viBasic!=null);
     this.m_Type=viBasic.TypeBasic;
     this.m_StringName=viBasic.Name;
     this.m_StringValueName=null;
     this.m_StringValueUser=viBasic.ValueUser;
     this.m_NameFileErrs=viBasic.NameFileErrs;
     this.m_NameAsmFileErrs=viBasic.NameAsmFileErrs;
     this.m_OTTagPrincipal=viBasic.TagPrincipal;
     this.m_StringTestName=viBasic.m_StringTestName;
     //this.m_OTTagRelated=viBasic.TagRelated;
 }
コード例 #4
0
ファイル: GErrFile.cs プロジェクト: bitforks/Font-Validator
        // methods
        public void DIAFunc_WriteToFile(ValInfoBasic info)
        {
            GErr gerr = info as GErr;
            // TODO: wrap

            if (gerr!=null)
            {
                string str=gerr.Write();
                StreamWriter writer=this.infoFile.AppendText();
                writer.WriteLine(str);
                writer.Close();
            }
        }
コード例 #5
0
ファイル: GErrSign.cs プロジェクト: bitforks/Font-Validator
 static public bool DICFunc_IsSignedBy(ValInfoBasic info, int indGlyph)
 {
     GErr gerr=info as GErr;
     if (gerr==null)
     {
         throw new ExceptionGlyph("GErrSign","DICFunc_IsSignedBy",null);
     }
     string strSign=gerr.SignCreator;
     if (strSign==null)
     {
         throw new ExceptionGlyph("GErrSign","DICFunc_IsSignedBy",null);
     }
     string strGlyph="_"+indGlyph+"_";
     return (strSign.IndexOf(strGlyph)!=GConsts.POZ_INVALID);
 }
コード例 #6
0
ファイル: GErrSign.cs プロジェクト: bitforks/Font-Validator
 static public bool DICFunc_IsSignedBy(ValInfoBasic info, DefsGV.TypeGV typeGV)
 {
     GErr gerr=info as GErr;
     if (gerr==null)
     {
         throw new ExceptionGlyph("GErrSign","DICFunc_IsSignedBy",null);
     }
     string strSign=gerr.SignCreator;
     if (strSign==null)
     {
         throw new ExceptionGlyph("GErrSign","DICFunc_IsSignedBy",null);
     }
     string strTypeGV=Enum.GetName(typeof(DefsGV.TypeGV),typeGV);
     return strSign.StartsWith(strTypeGV);
 }
コード例 #7
0
 // methods
 public virtual bool IsSame(object obj)
 {
     ValInfoBasic info = obj as ValInfoBasic;
     if (info == null)
         return false;
     if (this.m_Type != info.TypeBasic)
         return false;
     if (this.m_OTTagPrincipal != info.TagPrincipal)
         return false;
     /*
     if (this.m_OTTagRelated!=info.TagRelated)
         return false;
         */
     if (String.Compare(this.m_StringName, info.Name) != 0)
         return false;
     if (String.Compare(this.m_NameFileErrs, info.NameFileErrs) != 0)
         return false;
     if (String.Compare(this.m_NameAsmFileErrs, info.NameAsmFileErrs) != 0)
         return false;
     return true;
 }
コード例 #8
0
ファイル: GErr.cs プロジェクト: bitforks/Font-Validator
 /*
  *        METHODS:    IsSame
  */
 override public bool IsSame(object obj)                        
 {
     ValInfoBasic info=new ValInfoBasic(this);
     return info.IsSame(obj);
 }
コード例 #9
0
ファイル: GErr.cs プロジェクト: bitforks/Font-Validator
        /*
         *        CONSTRUCTOR
         */
        public GErrSource(ValInfoBasic info,
            int indGlyphOwner, GConsts.TypeGlyph typeGlyph,
            GScope.TypeGScope scope)
        {
            // ValInfoBasic
            base.TypeBasic = info.TypeBasic;
            base.Name = info.Name;
            base.ValueUser = info.ValueUser;
            base.NameFileErrs = info.NameFileErrs;
            base.NameAsmFileErrs = info.NameAsmFileErrs;
            base.TagPrincipal = info.TagPrincipal;


            // GErr
            base.indexGlyphOwner=indGlyphOwner;
            base.typeGlyph=typeGlyph;
            if (info.TypeBasic==ValInfoBasic.ValInfoType.Error)
            {
                base.severity=GErr.TypeGErrSeverity.Fatal;
            }
            else if (info.TypeBasic==ValInfoBasic.ValInfoType.Warning)
            {
                base.severity=GErr.TypeGErrSeverity.Low;
            }
            else
            {
                base.severity=GErr.TypeGErrSeverity.Undef;
            }
            base.SetScope(scope);
        }        
コード例 #10
0
ファイル: GErr.cs プロジェクト: bitforks/Font-Validator
 public GErr DIWFunc(ValInfoBasic info)
 {
     return new GErrSource(info,this.indGlyphOwner,this.typeGlyph,this.scope);
 }
コード例 #11
0
ファイル: GErr.cs プロジェクト: bitforks/Font-Validator
 /*
         static public bool DICFunc_HasTypeExact(ValInfoBasic info, Type typeGErr)
         {
             GErr gerr=info as GErr;
             if (gerr==null)
                 return false;
             return (gerr is typeGErr);
         }
 */
 static public bool DICFunc_HasSeverity(ValInfoBasic info, GErr.TypeGErrSeverity severity)
 {
     GErr gerr=info as GErr;
     if (gerr==null)
         return false;   // has NO ANY severity
     return (gerr.severity==severity);
 }
コード例 #12
0
        public void ValidatorCallback(ValInfoBasic viBasic)
        {
            ValidationInfo vi=new ValidationInfo(viBasic);

            string sCode    = (vi.GetErrorID()!=null)? vi.GetErrorID() : "?????";
            string sType    = ValInfoTypeToString( vi.GetValInfoType() );
            string sTable   = (vi.GetOTTag()!=null)? "'"+vi.GetOTTag()+"'" : "";
            string sMsg     = vi.GetString();
            string sDetails = vi.GetDetails();

            m_xmlWriter.WriteStartElement("Report");
            // I do not know why this try-catch is here.
            try {
                m_xmlWriter.WriteAttributeString("ErrorType", sType);
                m_xmlWriter.WriteAttributeString("ErrorCode", sCode);
                m_xmlWriter.WriteAttributeString("Message", sMsg);
                if (sDetails != null) {
                    m_xmlWriter.WriteAttributeString("Details", sDetails);
                }
                if (viBasic.TestName != null) {
                    m_xmlWriter.WriteAttributeString("TestName", 
                                                     viBasic.TestName);
                }
            }
            catch(Exception) {
                Debug.Assert(false);
            }
            m_xmlWriter.WriteEndElement();
            m_xmlWriter.WriteWhitespace("\r\n");
        }
コード例 #13
0
ファイル: GErrPool.cs プロジェクト: bitforks/Font-Validator
 internal void DIAFunc_DeleteFromPool(ValInfoBasic info)
 {
     if (info==null)
         return;
     GErr gerr=info as GErr;
     if (gerr==null)
     {
         throw new ExceptionGlyph("GErrPool","DIAFunc_DeleteFromPool",null);
     }
     if (this.gerrlists[gerr.IndexGlyphOwner]==null)
         return;
     bool isDeleted=((GErrList)(this.gerrlists[gerr.IndexGlyphOwner])).Delete(gerr);
     if (!isDeleted)
     {
         throw new ExceptionGlyph("GErrPool","DIAFunc_DeleteFromPool",null);
     }
     if (this.dia_OnErrorDelete.DIA!=null)
     {
         this.dia_OnErrorDelete.DIA(gerr);
     }
     gerr.ClearDestroy();
 }
コード例 #14
0
 /// <summary>Copy constructor</summary>
 public ValidationInfo(ValInfoBasic viBasic):
     base(viBasic)
 {
 }
コード例 #15
0
 private void DIAFunc_Filter(ValInfoBasic info)
 {
     if ((string)(info.TagPrincipal)=="loca")
         return;
     for (int iCnt=0; iCnt<this.m_cnts.Length; iCnt++)
     {
         if (info.Name==this.m_namesInfoCnt[iCnt])
         {
             this.m_cnts[iCnt]++;
             return;
         }
     }
     
     this.m_diaValidate(info);
 }
コード例 #16
0
 public void SendInfoOneByOne(ValInfoBasic info, out string strErrMessage)
 {
     strErrMessage=null;
     StringBuilder sb=null;
     if (this.dia==null)
         return;
     Delegate[] delegs=this.dia.GetInvocationList();            
     foreach (Delegate deleg in delegs)
     {
         try
         {
             DIAction dia=(DIAction)deleg;
             dia(info);
         }
         catch
         {
             if (sb==null)
             {
                 sb=new StringBuilder();
             }
             sb.Append(deleg.Target.GetType());
             sb.Append("\r\n");
         }
     }
     strErrMessage=sb.ToString();
 }
コード例 #17
0
 // wrapper - reports errors
 public void SendInfo(ValInfoBasic info)
 {
     if (this.dia!=null)
     {
         dia(info);
     }
 }    
コード例 #18
0
        public bool Validate(Validator validator, OTFontVal fontOwner)
        {
            bool bRet = true;
            if (!validator.PerformTest(T.glyf_ValidateAll))
            {
                return true;
            }

            this.m_diaValidate=validator.DIA;
            this.m_cnts=new int[this.m_namesInfoCnt.Length];
            for (int iCnt=0; iCnt<this.m_cnts.Length; iCnt++)
            {
                this.m_cnts[iCnt]=0;
            }

            I_IOGlyphsFile i_IOGlyphs=new I_IOGlyphsFile();
            if (!i_IOGlyphs.Initialize(fontOwner,validator))
            {
                return false; // the error is already reported
            }

            DIAction diaFilter=
                DIActionBuilder.DIA(this,"DIAFunc_Filter");
            FManager fm=new FManager(i_IOGlyphs, null, null);
            int numGlyph=fm.FNumGlyph;
            int indGlyph;
            for (indGlyph=0; indGlyph<numGlyph; indGlyph++)
            {
                try
                {
                    validator.OnTableProgress("Validating glyph with index "+indGlyph+" (out of "+numGlyph+" glyphs)");
                    Glyph glyph=fm.GGet(indGlyph);
                    glyph.GValidate();
                    bRet &= fm.GErrGetInformed(indGlyph,diaFilter);
                    fm.ClearManagementStructs();
                }
                catch
                {
                    validator.Error(T.T_NULL, E.glyf_E_ExceptionUnhandeled, (OTTag)"glyf",
                        "Glyph index "+indGlyph);
                }
                if (validator.CancelFlag)
                    break;
            }
            i_IOGlyphs.Clear();
            fm.ClearDestroy();    
            fm=null;
                    
/*            
            I_ProgressUpdater i_ProgressUpdater=new ValidationCancel(validator);

            FManager fm=new FManager(i_IOGlyphs, null, null);
            DIAction diaFilter=
                DIActionBuilder.DIA(this,"DIAFunc_Filter");

            fm.GErrActionAdd(diaFilter,
                FManager.TypeActionOnErr.onAdd);
            
            
            fm.FValidate(GConsts.IND_UNINITIALIZED,
                GConsts.IND_UNINITIALIZED);

            i_IOGlyphs.Clear();
            i_ProgressUpdater.Clear();
            fm.ClearDestroy();    
            fm=null;
*/
            for (int iCnt=0; iCnt<this.m_cnts.Length; iCnt++)
            {
                if (this.m_cnts[iCnt]>0)
                {
                    bool isGErr=this.m_namesInfoCnt[iCnt].StartsWith("GERR_");
                    string nameFileErr=isGErr? GErrConsts.FILE_RES_GERR_STRINGS: GErrConsts.FILE_RES_OTFFERR_STRINGS;
                    string nameAsmFileErr=isGErr? GErrConsts.ASM_RES_GERR_STRINGS: GErrConsts.ASM_RES_OTFFERR_STRINGS;
                    string strDetails="Number of glyphs with the warning = "+this.m_cnts[iCnt];
                    if (validator.CancelFlag)
                        strDetails+=" (Validation cancelled)";
                    ValInfoBasic info=new ValInfoBasic(
                        ValInfoBasic.ValInfoType.Warning,
                        this.m_namesInfoCnt[iCnt],
                        strDetails,
                        nameFileErr,
                        nameAsmFileErr,
                        "glyf",
                        null);
                    validator.DIA(info);
                }
            }

            this.m_cnts=null;
            return bRet;
        }
コード例 #19
0
ファイル: GErrList.cs プロジェクト: bitforks/Font-Validator
 public void DIAFunc_AddToListUnique(ValInfoBasic infoNew)
 {
     if (infoNew==null)
         return;
     GErr gerrNew=infoNew as GErr;
     if (gerrNew==null)
     {
         if (this.diw!=null)
         {
             gerrNew=diw(infoNew);
         }
         else
             return;
     }            
     foreach (GErr gerr in this.gerrs)
     {
         if (gerrNew.IsSame(gerr))
             return;
     }
     this.Add(gerrNew);
 }
コード例 #20
0
ファイル: GErrList.cs プロジェクト: bitforks/Font-Validator
 public void DIAFunc_AddToList(ValInfoBasic info)
 {
     if (info==null)
         return;
     GErr gerr;
     gerr=info as GErr;
     if ((gerr==null)&&(this.diw!=null))
     {
         gerr=diw(info);
     }
     this.Add(gerr);
 }
コード例 #21
0
ファイル: GErrPool.cs プロジェクト: bitforks/Font-Validator
        /*
         *        METHODS & DIAS: act on single GERR
         */


        internal void DIAFunc_AddToPool(ValInfoBasic info)
        {
            GErr gerr=info as GErr;
            if (gerr==null)
            {
                throw new ExceptionGlyph("GErrPool","DIAFunc_AddToPool",null);
            }
            int indexGlyph=gerr.IndexGlyphOwner;

            if (this.gerrlists[indexGlyph]==null)
            {
                this.gerrlists[indexGlyph]=new GErrList();
            }
            GErrList gerrlist=this.gerrlists[indexGlyph] as GErrList;
            int numGErrBefore=gerrlist.Length;
            ((GErrList)this.gerrlists[indexGlyph]).DIAFunc_AddToListUnique(gerr);
            int numGErrAfter=gerrlist.Length;
            bool isAdded=(numGErrAfter!=numGErrBefore);
            if (isAdded)
            {
                if (this.dia_OnErrorAdd.DIA!=null)
                {
                    this.dia_OnErrorAdd.DIA(gerr);            
                }
            }
        }