public void DIAFunc(ValInfoBasic info) { if (this.dic(info)) { this.dia(info); } }
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)); } }
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; }
// 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(); } }
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); }
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); }
// 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; }
/* * METHODS: IsSame */ override public bool IsSame(object obj) { ValInfoBasic info=new ValInfoBasic(this); return info.IsSame(obj); }
/* * 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); }
public GErr DIWFunc(ValInfoBasic info) { return new GErrSource(info,this.indGlyphOwner,this.typeGlyph,this.scope); }
/* 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); }
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"); }
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(); }
/// <summary>Copy constructor</summary> public ValidationInfo(ValInfoBasic viBasic): base(viBasic) { }
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); }
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(); }
// wrapper - reports errors public void SendInfo(ValInfoBasic info) { if (this.dia!=null) { dia(info); } }
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; }
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); }
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); }
/* * 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); } } }