void card_objectChanged(ICard card, ICardObject obj, ChangeType change) { if (InvokeRequired) { BeginInvoke(new Action <Card, ICardObject, ChangeType>((a, b, c) => { card_objectChanged(a, b, c); }), card, obj, change); return; } if (change == ChangeType.Deleted) { delNode(treeView1.Nodes, obj); } if (change == ChangeType.Created) { TreeNodeCollection parentNode = null; if (obj.Parent == null) { parentNode = treeView1.Nodes; } else { parentNode = objNodes[obj.Parent].Nodes; } TreeNode node = parentNode.Add(obj.ID.ToString("X04") + " " + obj.Description); node.ImageIndex = getImageIndex(obj); node.SelectedImageIndex = node.ImageIndex; node.Tag = obj; objNodes[obj] = node; if (obj is IObjectWithDataRecords) { AddRecords(obj, node); } return; } else if (change == ChangeType.Selected) { objNodes[obj].NodeFont = selectedFont; return; } else if (change == ChangeType.Unselected) { objNodes[obj].NodeFont = DefaultFont; return; } else if (change == ChangeType.Modified) { if (obj is IObjectWithDataRecords) { objNodes[obj].Nodes.Clear(); AddRecords(obj, objNodes[obj]); } } }
public void RemoveChild(ICardObject obj) { int i = childs.IndexOf(obj); if (i >= 0) { childs.RemoveAt(i); owner.ObjectChanged(obj, ChangeType.Deleted); } }
public bool IsVerifiedAC(ICardObject obj, byte ac) { if (!(obj is IObjectWithAC)) { throw new ISO7816Exception(Error.InternalError); } IObjectWithAC acObj = obj as IObjectWithAC; byte condition = acObj.AC[ac]; if (condition == AC.Never) { return(false); } if (condition == AC.Always) { return(true); } BSO refrencedObject = obj is DF ? (obj as DF).GetChildBSO(condition, true) : obj.Parent.GetChildBSO(condition, true); if (context.securityStatus.ContainsKey(condition)) { BSO bso = context.securityStatus[condition]; if (refrencedObject == bso) { if (bso.CurValidityCounter == 0) { context.securityStatus.Remove((byte)bso.ID); return(false); } else if (bso.CurValidityCounter != 0xff) { bso.CurValidityCounter--; } return(true); } return(false); } else { // potrebbe essereun logical if (refrencedObject == null) { return(false); } if (refrencedObject.Algo == BSOAlgo.Logic) { int exprLen; return(TestLogic(refrencedObject, refrencedObject.Data.Length - 1, out exprLen)); } else { return(false); } } }
private static ICardCollection SetupFaceUpPileMock() { var faceUpPile = Substitute.For <ICardCollection>(); faceUpPile.Count.Returns(1); ICardObject card = SetupHearts3CardMock(); faceUpPile.PopNextCard().Returns(card); return(faceUpPile); }
int getImageIndex(ICardObject obj) { if (obj is DF) return 1; else if (obj is EF) return 2; else if (obj is BSO) return 0; else if (obj is SecurityEnvironmenet) return 3; else return 0; }
void setOwner(ICardObject obj, IISO7816Card owner) { obj.Owner = owner; if (obj is DF) { DF df = obj as DF; foreach (var c in df.Childs) { setOwner(c, owner); } } }
private void Elimina(object sender, EventArgs e) { if (treeView1.SelectedNode == null) { return; } ICardObject obj = treeView1.SelectedNode.Tag as ICardObject; if (obj.Parent != null) { obj.Parent.RemoveChild(obj); } }
public bool Equals(ICardObject x, ICardObject y) { if (x == null || y == null) { return(false); } if (x.Type == null || y.Type == null) { return(false); } return(x.Type.Value == y.Type.Value); }
bool delNode(TreeNodeCollection coll, ICardObject obj) { foreach (TreeNode c in coll) { if (c.Tag == obj) { c.Remove(); return true; } if (c.Nodes.Count > 0) if (delNode(c.Nodes, obj)) return true; } return false; }
private void creaEFTLVToolStripMenuItem_Click(object sender, EventArgs e) { if (treeView1.SelectedNode == null) { return; } ICardObject obj = treeView1.SelectedNode.Tag as ICardObject; if (!(obj is DF)) { return; } DF df = obj as DF; card.CreateEFLinearTLV(1, df, 10); }
private void CreaSE(object sender, EventArgs e) { if (treeView1.SelectedNode == null) { return; } ICardObject obj = treeView1.SelectedNode.Tag as ICardObject; if (!(obj is DF)) { return; } DF df = obj as DF; card.CreateSE(1, df); }
private static void AddRecords(ICardObject obj, TreeNode node) { var recs = obj as IObjectWithDataRecords; int numRec = 0; if (recs.Data == null) { return; } foreach (var v in recs.Data) { var recNode = node.Nodes.Add("Record " + numRec.ToString()); recNode.Tag = new RecObj(recs, numRec); recNode.ImageIndex = recNode.SelectedImageIndex = 4; numRec++; } }
bool delNode(TreeNodeCollection coll, ICardObject obj) { foreach (TreeNode c in coll) { if (c.Tag == obj) { c.Remove(); return(true); } if (c.Nodes.Count > 0) { if (delNode(c.Nodes, obj)) { return(true); } } } return(false); }
int getImageIndex(ICardObject obj) { if (obj is DF) { return(1); } else if (obj is EF) { return(2); } else if (obj is BSO) { return(0); } else if (obj is SecurityEnvironmenet) { return(3); } else { return(0); } }
public int GetHashCode(ICardObject obj) { return(obj.Type.GetHashCode()); }
void setOwner(ICardObject obj, IISO7816Card owner) { obj.Owner = owner; if (obj is DF) { DF df = obj as DF; foreach (var c in df.Childs) { setOwner(c, owner); } } }
private static void AddRecords(ICardObject obj, TreeNode node) { var recs = obj as IObjectWithDataRecords; int numRec = 0; if (recs.Data == null) return; foreach (var v in recs.Data) { var recNode = node.Nodes.Add("Record " + numRec.ToString()); recNode.Tag = new RecObj(recs, numRec); recNode.ImageIndex = recNode.SelectedImageIndex = 4; numRec++; } }
void card_objectChanged(ICard card, ICardObject obj, ChangeType change) { if (InvokeRequired) { BeginInvoke(new Action<Card, ICardObject, ChangeType>((a, b, c) => { card_objectChanged(a, b, c); }), card, obj, change); return; } if (change == ChangeType.Deleted) { delNode(treeView1.Nodes, obj); } if (change == ChangeType.Created) { TreeNodeCollection parentNode = null; if (obj.Parent == null) parentNode = treeView1.Nodes; else parentNode = objNodes[obj.Parent].Nodes; TreeNode node = parentNode.Add(obj.ID.ToString("X04") + " " + obj.Description); node.ImageIndex = getImageIndex(obj); node.SelectedImageIndex = node.ImageIndex; node.Tag = obj; objNodes[obj] = node; if (obj is IObjectWithDataRecords) { AddRecords(obj, node); } return; } else if (change == ChangeType.Selected) { objNodes[obj].NodeFont = selectedFont; return; } else if (change == ChangeType.Unselected) { objNodes[obj].NodeFont = DefaultFont; return; } else if (change == ChangeType.Modified) { if (obj is IObjectWithDataRecords) { objNodes[obj].Nodes.Clear(); AddRecords(obj, objNodes[obj]); } } }
public bool TurnUpCard(ICardObject card) { return(false); }
public bool Equals(ICardObject other) { return(m_comparer.Equals(this, other)); }
public void Add(ICardObject item) { m_cards.Push(item); }
private bool TurnUpCard(ICardObject card, GameObjectTransformModel deckTransformModel) { AddGameObjectToRenderQueue(card.CardGraphic, deckTransformModel.Position + new Vector3(25, 0), deckTransformModel.Rotation, deckTransformModel.Scale); return(true); }
public bool Contains(ICardObject item) { return(m_cards.Contains(item)); }
public bool Remove(ICardObject item) { throw new NotSupportedException(); }
public void RemoveChild(ICardObject obj) { int i = childs.IndexOf(obj); if (i >= 0) { childs.RemoveAt(i); owner.ObjectChanged(obj, ChangeType.Deleted); } }
public bool IsVerifiedAC(ICardObject obj,byte ac) { if (!(obj is IObjectWithAC)) throw new ISO7816Exception(Error.InternalError); IObjectWithAC acObj = obj as IObjectWithAC; byte condition = acObj.AC[ac]; if (condition == AC.Never) return false; if (condition == AC.Always) return true; BSO refrencedObject=obj is DF ? (obj as DF).GetChildBSO(condition, true) : obj.Parent.GetChildBSO(condition, true); if (context.securityStatus.ContainsKey(condition)) { BSO bso=context.securityStatus[condition]; if (refrencedObject == bso) { if (bso.CurValidityCounter == 0) { context.securityStatus.Remove((byte)bso.ID); return false; } else if (bso.CurValidityCounter != 0xff) { bso.CurValidityCounter--; } return true; } return false; } else { // potrebbe essereun logical if (refrencedObject == null) return false; if (refrencedObject.Algo == BSOAlgo.Logic) { int exprLen; return TestLogic(refrencedObject, refrencedObject.Data.Length - 1, out exprLen); } else return false; } }