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(); }
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); }
static public void Parse(GErr gerr, out DefsGV.TypeGV typeGV, out int[] indsGlyph) { typeGV = DefsGV.TypeGV.Invalid; indsGlyph = null; string strSign = gerr.SignCreator; if (strSign == null) { throw new ExceptionGlyph("GErrSign", "Parse", null); } string[] strs = strSign.Split('_'); if (strs.Length < 1) { throw new ExceptionGlyph("GErrSign", "Parse", null); } typeGV = (DefsGV.TypeGV)Enum.Parse(typeof(DefsGV.TypeGV), strs[0]); if ((strs.Length) > 1) { indsGlyph = new int[strs.Length - 1]; } for (int iInd = 1; iInd < strs.Length; iInd++) { indsGlyph[iInd] = Int32.Parse(strs[iInd]); } }
/* * 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); } } }
/* * METHODS */ public bool Add(GErr gerrToAdd) { if (gerrToAdd == null) { throw new ExceptionGlyph("GErrList", "Add", "Null argument"); } int numErrBefore = this.gerrs.Count; this.gerrs.Add(gerrToAdd); int numErrAfter = this.gerrs.Count; return(numErrAfter > numErrBefore); }
// 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 DefsGV.TypeGV GetTypeErrCreator(GErr gerr) { string strSign = gerr.SignCreator; foreach (string strTypeGV in Enum.GetNames(typeof(DefsGV.TypeGV))) { if (strSign.StartsWith(strTypeGV)) { return((DefsGV.TypeGV)(Enum.Parse(typeof(DefsGV.TypeGV), strTypeGV))); } } throw new ExceptionGlyph("GErrSign", "GetTypeErrCreator", null); //return DefsGV.TypeGV.Invalid; }
static public void Sign(GErr gerr, DefsGV.TypeGV typeGV, params int[] indsGlyph) { if (gerr == null) { throw new ExceptionGlyph("GErrSign", "Sign", "NullArgument"); } StringBuilder sb = new StringBuilder(""); sb.Append(Enum.GetName(typeof(DefsGV.TypeGV), typeGV)); sb.Append("_"); foreach (int indGlyph in indsGlyph) { sb.Append(indGlyph + "_"); } gerr.SignCreator = sb.ToString(); }
static public bool GetIndGlyph(GErr gerr, out int indGlyph) { indGlyph = GConsts.IND_UNINITIALIZED; string sign = gerr.SignCreator; if (sign == null) { return(false); } string[] strAux = sign.Split('_'); if (strAux.Length < 2) { return(false); } indGlyph = Int32.Parse(strAux[1]); return(true); }
/* * METHODS: clear */ internal void ClearByGV(int indGlyph, DefsGV.TypeGV typeGV) { GErrList gerrlist = this.gerrlists[indGlyph] as GErrList; if (gerrlist == null) { return; } for (int poz = gerrlist.Length - 1; poz >= 0; poz--) { GErr gerr = gerrlist[poz]; if (GErrSign.DICFunc_IsSignedBy(gerr, typeGV) && GErrSign.DICFunc_IsSignedBy(gerr, indGlyph)) { this.DIAFunc_DeleteFromPool(gerr); } } }
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)); }
public bool Delete(GErr gerrToDelete) { int numErrBefore = this.gerrs.Count; int poz; for (poz = 0; poz < numErrBefore; poz++) { if ((object)this.gerrs[poz] == (object)gerrToDelete) { break; } } if (poz == numErrBefore) { return(false); } this.gerrs.RemoveAt(poz); int numErrAfter = this.gerrs.Count; return(numErrAfter < numErrBefore); }