private void TbChat_TextChanged(object sender, TextChangedEventArgs e) { Clear(); foreach (var var in _collection) { if (!string.IsNullOrEmpty(tb_search.GetText()) && var.Value.Name != null && var.Value.Name.ToLower().Contains(tb_search.GetText().ToLower())) { Add(var.Value); } } if (tb_search.GetText() == "") { foreach (var args in _collection) { CardInfos c = CardManager.GetCard(args.Key); if (c == null) { args.Value.Name = "Id inconnue : " + args.Key; continue; } args.Value.Name = c.Name; Add(args.Value); } } }
private void SearchList_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); bool selected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected); int index = e.Index; if (index >= 0 && index < m_searchList.Items.Count) { string text = m_searchList.Items[index].ToString(); Graphics g = e.Graphics; if (!Program.CardData.ContainsKey(Int32.Parse(text))) { m_searchList.Items.Remove(text); } else { CardInfos card = Program.CardData[Int32.Parse(text)]; g.FillRectangle((selected) ? new SolidBrush(Color.Blue) : new SolidBrush(Color.White), e.Bounds); // Print text g.DrawString((card.Name == "" ? card.Id.ToString(CultureInfo.InvariantCulture) : card.Name), e.Font, (selected) ? Brushes.White : Brushes.Black, m_searchList.GetItemRectangle(index).Location); } } e.DrawFocusRectangle(); }
private void convertList_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); bool selected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected); int index = e.Index; if (index >= 0 && index < convertList.Items.Count) { var data = (string[])convertList.Items[index]; Graphics g = e.Graphics; CardInfos card = CardManager.GetCard(Int32.Parse(data[0])); g.FillRectangle((selected) ? new SolidBrush(Color.Blue) : new SolidBrush(Color.White), e.Bounds); // Print text string format = (card.Ot & 0x1) > 0 ? "OCG" : (card.Ot & 0x2) > 0 ? "TCG" : (card.Ot & 0x3) > 2 ? "TCG/OCG" : "???"; g.DrawString((card.Name == "" ? "???" : card.Name) + " - " + format + " > " + data[1], e.Font, (selected) ? Brushes.White : Brushes.Black, convertList.GetItemRectangle(index).Location); } e.DrawFocusRectangle(); }
/// <summary> /// Insert credit card in Navision /// </summary> /// <param name="user">User information</param> /// <param name="pos">market</param> /// <param name="comcode">customer code</param> /// <param name="cc1">analytical code 1</param> /// <param name="percode">traveler code</param> /// <param name="service">product</param> /// <param name="retval">value returned</param> /// <param name="cardInfos">card informations</param> /// <param name="forceWarning">force warning flag</param> /// <param name="contextSource">context source for transactional card</param> /// <param name="context">context information for transactional card</param> public static void InsertPaymentCard(UserInfo user, string pos, string comcode, string cc1, string percode, string service, InsertCardInNavisionResult retval, CardInfos cardInfos, int forceWarning, string contextSource, string context) { Navision nws = null; try { // Define a new navision ws connection nws = new Navision(); // prepare output Nav_InsertPaymentCard ni = new Nav_InsertPaymentCard(); // insert credit card nws.InsertPaymentCard(NavWsLogin, NavWsPassword, pos, comcode, String.IsNullOrEmpty(percode) ? string.Empty : percode , String.IsNullOrEmpty(cc1) ? string.Empty : cc1 , Util.ConvertDateToString(cardInfos.GetExpirationDate(), Const.DateFormat_yyyysMMsdd), cardInfos.GetNavisionCardType(), cardInfos.GetDescription(), cardInfos.GetNavisionLodgedCard(), Util.CorrectServiceForNavision(service), user.GetLogin(), cardInfos.GetToken(), cardInfos.GetTruncatedPAN(), cardInfos.GetFirstCardReference(), cardInfos.IsNavisionTransactional(), forceWarning, contextSource, context, ref ni); // set value retval.SetValues(ni); } finally { // Let's dispose now if (nws != null) { nws.Dispose(); } } }
public InsertPaymentCardResponse(UserInfo user, string pos, string customer, string cc1, string percode, string token , string servicegroup, CardInfos cardInfos, int contextSource, string context, int forceWarning) { //InsertCardResponse card = new InsertCardResponse(); NavService.Nav_InsertPaymentCard o = new Nav_InsertPaymentCard(); //RequestedService ss = new RequestedService(); // initialisation this.StartDate = DateTime.Now; //>> EGE-66896 this.argPos = pos; this.argCostCenter = cc1; this.argComcode = customer; this.argPercode = percode; this.argServiceslist = servicegroup; this.argPos = String.IsNullOrEmpty(pos) ? pos : ((String.Compare(pos, "null", true) == 0) ? String.Empty : pos); //this.argCostCenter = String.IsNullOrEmpty(cc1) ? cc1 : ((String.Compare(cc1, "null", true) == 0) ? String.Empty : cc1); //this.argComcode = String.IsNullOrEmpty(comcode) ? comcode : ((String.Compare(comcode, "null", true) == 0) ? String.Empty : comcode); //this.argPercode = String.IsNullOrEmpty(percode) ? percode : ((String.Compare(percode, "null", true) == 0) ? String.Empty : percode); //this.argServiceslist = String.IsNullOrEmpty(argServiceslist) ? argServiceslist : ((String.Compare(argServiceslist, "null", true) == 0) ? String.Empty : argServiceslist); //>> EGE-66896 }
public void UpdateCards(int[] list) { Dictionary <int, PlayerCard> dcards = new Dictionary <int, PlayerCard>(); for (int i = 0; i < list.Count(); i++) { CardInfos infos = CardManager.GetCard(list[i]); if (infos == null) { infos = new CardInfos(); infos.Id = list[i]; infos.Name = "Id inconnu :" + infos.Id; } if (!dcards.ContainsKey(infos.Id)) { dcards.Add(infos.Id, new PlayerCard { Id = infos.Id, Name = infos.Name, Quantity = 1 }); } else { dcards[infos.Id].Quantity++; } } List <PlayerCard> cardsToSort = dcards.Values.ToList(); cardsToSort.Sort(new PlayerCardComparerNewsFirst()); cards = cardsToSort.ToArray(); StartCardAnimation(); }
public void UpdateCollection(Dictionary <int, PlayerCard> collection) { lv.Items.Clear(); _collection = collection; foreach (var args in _collection) { CardInfos c = CardManager.GetCard(args.Key); if (c == null) { args.Value.Name = "Id inconnue : " + args.Key; continue; } args.Value.Name = c.Name; Add(args.Value); } tb_search.tbChat.IsEnabled = true; if (listViewSortCol != null) { SortColumn(listViewSortCol); SortColumn(listViewSortCol); } }
public static bool SaveCard(CardInfos card, SqliteConnection connection, int loadedid, bool overwrite) { try { SqliteCommand command; if (overwrite) { command = DatabaseHelper.CreateCommand("UPDATE datas" + " SET id= @id, ot = @ot, alias= @alias, setcode= @setcode, type= @type, atk= @atk, def= @def, level= @level, race= @race, attribute= @attribute, category= @category WHERE id = @loadedid", connection); } else { command = DatabaseHelper.CreateCommand("INSERT INTO datas (id,ot,alias,setcode,type,atk,def,level,race,attribute,category)" + " VALUES (@id, @ot, @alias, @setcode, @type, @atk, @def, @level, @race, @attribute, @category)", connection); } command.Parameters.Add(new SqliteParameter("@loadedid", loadedid)); command.Parameters.Add(new SqliteParameter("@id", card.Id)); command.Parameters.Add(new SqliteParameter("@ot", card.Ot)); command.Parameters.Add(new SqliteParameter("@alias", card.AliasId)); command.Parameters.Add(new SqliteParameter("@setcode", card.SetCode)); command.Parameters.Add(new SqliteParameter("@type", card.Type)); command.Parameters.Add(new SqliteParameter("@atk", card.Atk)); command.Parameters.Add(new SqliteParameter("@def", card.Def)); command.Parameters.Add(new SqliteParameter("@level", card.GetLevelCode())); command.Parameters.Add(new SqliteParameter("@race", card.Race)); command.Parameters.Add(new SqliteParameter("@attribute", card.Attribute)); command.Parameters.Add(new SqliteParameter("@category", card.Category)); DatabaseHelper.ExecuteNonCommand(command); if (overwrite) { command = DatabaseHelper.CreateCommand("UPDATE texts" + " SET id= @id,name= @name,desc= @des,str1= @str1,str2= @str2,str3= @str3,str4= @str4,str5= @str5,str6= @str6,str7= @str7,str8= @str8,str9= @str9,str10= @str10,str11= @str11,str12= @str12,str13= @str13,str14= @str14,str15= @str15,str16= @str16 WHERE id= @loadedid", connection); } else { command = DatabaseHelper.CreateCommand("INSERT INTO texts (id,name,desc,str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11,str12,str13,str14,str15,str16)" + " VALUES (@id,@name,@des,@str1,@str2,@str3,@str4,@str5,@str6,@str7,@str8,@str9,@str10,@str11,@str12,@str13,@str14,@str15,@str16)", connection); } command.Parameters.Add(new SqliteParameter("@loadedid", loadedid)); command.Parameters.Add(new SqliteParameter("@id", card.Id)); command.Parameters.Add(new SqliteParameter("@name", card.Name)); command.Parameters.Add(new SqliteParameter("@des", card.Description)); var parameters = new List <SqliteParameter>(); for (int i = 0; i < 16; i++) { parameters.Add(new SqliteParameter("@str" + (i + 1), (i < card.EffectStrings.Length ? card.EffectStrings[i].ToString() : string.Empty))); } command.Parameters.AddRange(parameters.ToArray()); return(DatabaseHelper.ExecuteNonCommand(command)); } catch (Exception ex) { Console.WriteLine("[Database ERROR]: {0}", ex.Message); return(false); } }
public int Compare(CollectionCardItem x, CollectionCardItem y) { if (x.Rarity != y.Rarity) { return(y.Rarity.CompareTo(x.Rarity)); } CardInfos xInfo = CardManager.GetCard(x.Id); CardInfos yInfo = CardManager.GetCard(y.Id); if (yInfo.Level != xInfo.Level) { return(yInfo.Level.CompareTo(xInfo.Level)); } if (xInfo.IsMonster() && yInfo.IsMonster()) { return(yInfo.Name.CompareTo(xInfo.Name)); } if (xInfo.IsMonster() && yInfo.IsTrap()) { return(0); } if (xInfo.IsMonster() && yInfo.IsSpell()) { return(0); } if (xInfo.IsTrap() && yInfo.IsTrap()) { return(yInfo.Name.CompareTo(xInfo.Name)); } if (xInfo.IsTrap() && yInfo.IsSpell()) { return(1); } if (xInfo.IsTrap() && yInfo.IsMonster()) { return(1); } if (xInfo.IsSpell() && yInfo.IsSpell()) { return(yInfo.Name.CompareTo(xInfo.Name)); } if (xInfo.IsSpell() && yInfo.IsTrap()) { return(0); } if (xInfo.IsSpell() && yInfo.IsMonster()) { return(1); } return(yInfo.Name.CompareTo(xInfo.Name)); }
public void SelectCards() { CardInfos c1 = cards[Random.Range(0, cards.Count)]; CardInfos c2 = cards[Random.Range(0, cards.Count)]; CardInfos c3 = cards[Random.Range(0, cards.Count)]; this.slot1.AddCardInfo(c1); this.slot2.AddCardInfo(c2); this.slot3.AddCardInfo(c3); }
public static void UpdateOrAddCard(CardInfos card) { if (ContainsCard(card.Id)) { CardData[card.Id] = card; } else { CardData.Add(card.Id, card); } }
private void lb_cards_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count < 1) { return; } CardInfos card = filter_cards[lb_cards.Items.IndexOf(e.AddedItems[0])]; DisplayCardInfo.SetCard(card); }
/// <summary> /// Insertion de la carte rejetée /// dans la table des traces /// </summary> /// <param name="card">Informations carte</param> /// <param name="orderCode">Numéro de la transaction BIBIT</param> /// <param name="status">Statut</param> /// <param name="fullError">Error complète</param> /// <param name="completeResponse">Response complète</param> public void LogCard(CardInfos card, string orderCode, string status, string fullError, string completeResponse) { string request = "INSERT INTO CreditCardLog (ComCode,PerCode,Service,Token,TruncatedPAN" + ",Source,OrderCode,Status,Error,CompleteResponse" + ",CreationDate,CreationUser,CardType) VALUES (@comcode, @percode, @service, @token, @truncatedPAN, " + "@source, @orderCode, @status, @fullError, @completeResponse, @creationDate, @creationUser,@cardType)"; // objet command SqlCommand command = new SqlCommand(request, GetConnection()); try { command.Parameters.Add("@comcode", SqlDbType.VarChar, 20); command.Parameters.Add("@percode", SqlDbType.VarChar, 20); command.Parameters.Add("@service", SqlDbType.VarChar, 50); command.Parameters.Add("@token", SqlDbType.VarChar, 50); command.Parameters.Add("@truncatedPAN", SqlDbType.VarChar, 20); command.Parameters.Add("@source", SqlDbType.VarChar, 50); command.Parameters.Add("@orderCode", SqlDbType.VarChar, 50); command.Parameters.Add("@status", SqlDbType.VarChar, 50); command.Parameters.Add("@fullError", SqlDbType.VarChar, 200); command.Parameters.Add("@completeResponse", SqlDbType.VarChar, 4000); command.Parameters.Add("@creationDate", SqlDbType.DateTime); command.Parameters.Add("@creationUser", SqlDbType.VarChar, 100); command.Parameters.Add("@cardType", SqlDbType.VarChar, 50); command.Parameters["@comcode"].Value = Util.Nvl(card.GetCustomerCode(), string.Empty); command.Parameters["@percode"].Value = Util.Nvl(card.GetTravellerCode(), string.Empty); command.Parameters["@service"].Value = Util.Nvl(card.GetService(), string.Empty); command.Parameters["@token"].Value = Util.Nvl(card.GetToken(), string.Empty); command.Parameters["@truncatedPAN"].Value = Util.Nvl(card.GetTruncatedPAN(), string.Empty); command.Parameters["@source"].Value = GetApplicationName(); command.Parameters["@orderCode"].Value = Util.Nvl(orderCode, string.Empty); command.Parameters["@status"].Value = status; command.Parameters["@fullError"].Value = Util.Nvl(fullError, string.Empty); command.Parameters["@completeResponse"].Value = Util.Nvl(completeResponse, string.Empty); command.Parameters["@creationDate"].Value = DateTime.Now; command.Parameters["@creationUser"].Value = GetLogin(); command.Parameters["@cardType"].Value = card.GetCardType(); // Exécution de la requête command.ExecuteNonQuery(); } catch (Exception e) { // Une exception a été levée lors de l'insertion throw new Exception(GetMessages().GetString("CreditCardLogConnection.LogCard.Error", e.Message, true)); } finally { DisposeCommand(command); } }
private void Img_card_MouseEnter(object sender, MouseEventArgs e) { try { CardInfos info = CardManager.GetCard(_idCardShow); SetCard(info); this.cardinfos_popup.IsOpen = true; } catch (Exception ex) { logger.Error("POPUP PURCHASE - {0}", ex.ToString()); } }
void GenerateAllCards() { for (int i = 0; i < 8; i++) { Vector2 finalDir = Vector2.zero; switch (i) { case 0: finalDir = new Vector2(-1, 0); break; case 1: finalDir = new Vector2(-1, 1); break; case 2: finalDir = new Vector2(0, 1); break; case 3: finalDir = new Vector2(1, 1); break; case 4: finalDir = new Vector2(1, 0); break; case 5: finalDir = new Vector2(1, -1); break; case 6: finalDir = new Vector2(0, -1); break; case 7: finalDir = new Vector2(-1, -1); break; } for (int j = 1; j < 4; j++) { CardInfos card = new CardInfos(); card.direction = finalDir; card.nb_squares = j; card.id = cards.Count; cards.Add(card); } } }
/// <summary> /// Check credit card with online API /// provided by partners /// </summary> /// <param name="user">User</param> /// <param name="ri">Credit card</param> /// <param name="cardId">Creadit card id</param> /// <param name="timeout">Time out</param> /// <returns>Credit card validation result</returns> private static ProviderVerifierResult CheckCard(UserInfo user, CardInfos ri, int cardId, int timeout) { if (ri.IsBibitCheck(user)) { // Validation RBS ri.SetRBSPaymentMethod(GetRBSPaymentMethod(cardId)); // Allons vérifier en ligne la validité de cette carte // et récupérons la réponse return(BibitVerifier.CheckCard(user, ri, timeout)); } // No need to validate credit card with online API return(null); }
private void btn_found_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (lb_cards.SelectedItem == null) { return; } CardInfos card = filter_cards[lb_cards.Items.IndexOf(lb_cards.SelectedItem)]; FormExecution.Client.Send(PacketType.SearchCard, new StandardClientSearchCard { Id = card.Id }); }
private void SaveDeck(bool isStructureOrStartingDeck) { List <int> main = new List <int>(); List <int> extra = new List <int>(); foreach (PlayerCard pcard in cards) { CardInfos card = CardManager.GetCard(pcard.Id); if (card.GetCardTypes().Contains(CardType.Synchro) || card.GetCardTypes().Contains(CardType.Xyz) || card.GetCardTypes().Contains(CardType.Fusion) || card.GetCardTypes().Contains(CardType.Link)) { if (!extra.Contains(card.Id)) { extra.Add(card.Id); } } else { if (!main.Contains(card.Id)) { main.Add(card.Id); } } } string deck = "#created by purchase " + _infos.PurchaseTag; deck += Environment.NewLine + "#main"; foreach (int id in main) { deck += Environment.NewLine + id.ToString(); } deck += Environment.NewLine + "#extra"; foreach (int id in extra) { deck += Environment.NewLine + id.ToString(); } deck += Environment.NewLine + "!side"; if (isStructureOrStartingDeck) { File.WriteAllText(System.IO.Path.Combine(FormExecution.path, "BattleCityAlpha", "deck", _infos.Name + ".ydk"), deck); } else { File.WriteAllText(System.IO.Path.Combine(FormExecution.path, "BattleCityAlpha", "deck", "new_cards.ydk"), deck); } }
private void ReadDeck(string deck) { var lines = File.ReadAllLines(deck); foreach (string nonTrimmerLine in lines) { string line = nonTrimmerLine.Trim(); if (line.Equals(string.Empty)) { continue; } if (line.StartsWith("#")) { if (line.Contains("main")) { DeckList.Items.Add("--Main--"); } if (line.Contains("extra")) { DeckList.Items.Add("--Extra--"); } continue; } if (line.StartsWith("!")) { DeckList.Items.Add("--Side--"); continue; } CardInfos card = LauncherHelper.CardManager.FromId(Int32.Parse(line)); if (card == null) { continue; } if (CardList.ContainsKey(card.Name)) { CardList[card.Name].Amount++; } else { CardList.Add(card.Name, (CardInfos)card.Clone()); DeckList.Items.Add(card.Name); CardList[card.Name].Amount++; } } }
public void SetValues(UserInfo useri, string pan) { SetUser(useri); this.PAN = pan; // On vérifier le numéro de carte (test de Luhn) CardInfos ci = Services.CheckCreditCard(useri, pan, Const.EmptyDate, null, null, string.Empty, false, //>>EGE-76833 : [BO] Lodged Card - First card rejected on 1€ check // false, null, null, null, null, false, 0); false, null, null, null, null, 0, string.Empty); //>>EGE-76833 : [BO] Lodged Card - First card rejected on 1€ check this.TruncatedPAN = ci.GetTruncatedPAN();//CreditCardVerifier.TruncatePan(pan); this.shortCardType = ci.GetShortCardType(); this.cardType = ci.GetCardType(); }
public void SetValues(CardInfos card) { SetExpirationDate(Util.ConvertDateToString(card.GetExpirationDate(), Const.DateFormat_ddMMyyyyHHmmss)); // Short Expiration SetShortExpirationDate(card.GetShortExpirationDate()); // Type de carte SetCardType(card.GetCardType()); // Type de carte (court) SetShortCardType(card.GetShortCardType()); // PAN tronqué SetTruncatedPan(card.GetTruncatedPAN()); // MII SetMII(card.GetMII()); // MII Issuer Category SetMIIIssuerCategory(card.GetMIIIssuerCategory()); this.ci = card; }
private void ParseMsg() { for (int i = 0; i < _messages.Length; i++) { if (_messages[i].Message.Contains("(")) { string[] parts = _messages[i].Message.Split('('); string id = parts[1].Split(')')[0]; CardInfos c = CardManager.GetCard(Convert.ToInt32(id)); if (c == null) { continue; } _messages[i].Message = parts[0] + "(" + c.Name + parts[1].Substring(id.Length); } } }
private void lb_cards_SelectionChanged(object sender, SelectionChangedEventArgs e) { _cardShow = null; foreach (CardInfos card in cards) { if (lb_cards.SelectedItem != null && card.Name == lb_cards.SelectedItem.ToString()) { _cardShow = card; break; } } if (_cardShow != null) { img_card.Source = FormExecution.AssetsManager.GetPics(new string[] { "BattleCityAlpha", "pics", _cardShow.Id.ToString() + ".jpg" }); } }
private void DeckList_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); bool selected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected); int index = e.Index; if (index >= 0 && index < DeckList.Items.Count) { string text = DeckList.Items[index].ToString(); Graphics g = e.Graphics; if (!CardList.ContainsKey(text)) { g.FillRectangle(new SolidBrush(Color.White), e.Bounds); g.DrawString(text, e.Font, (selected) ? Brushes.Blue : Brushes.Black, DeckList.GetItemRectangle(index).Location); e.DrawFocusRectangle(); return; } CardInfos card = CardList[text]; Color itemcolor = (card.HasType(CardType.Trap) ? Color.Violet : (card.HasType(CardType.Spell) ? Color.LawnGreen : (card.HasType(CardType.Synchro) ? Color.White : (card.HasType(CardType.Xyz) ? Color.Gray : (card.HasType(CardType.Ritual) ? Color.CornflowerBlue : (card.HasType(CardType.Fusion) ? Color.MediumPurple : (card.HasType(CardType.Effect) ? Color.Orange : (card.HasType(CardType.Normal) ? Color.Yellow : Color.Red)))))))); g.FillRectangle(new SolidBrush(itemcolor), e.Bounds); // Print text g.DrawString(text + " x" + card.Amount, e.Font, (selected) ? Brushes.Blue : Brushes.Black, DeckList.GetItemRectangle(index).Location); } e.DrawFocusRectangle(); }
/// <summary> /// Vérification du Code de sécurité de la carte /// </summary> /// <param name="user">Compte utilisateur</param> /// <param name="card">Informations carte</param> /// <param name="csc">CSV</param> public static void IsValidCSC(UserInfo user, CardInfos card, string csc) { // Vérifions le csc if (String.IsNullOrEmpty(csc)) { // Le csc est vide! // On s'arrête la throw new Exception(user.GetMessages().GetString("EmptyCSC", true)); } // Le csc a été renseigné, on va le vérifier plus en détail if (!Util.IsDigit(csc)) { // Le csc doit être numérique throw new Exception(user.GetMessages().GetString("NotNumericCSC", true)); } // On va valider le CSC en fonction du type de carte switch (card.GetNavisionCardType()) { case CreditCardVerifier.NavisionCardTypeVisa: case CreditCardVerifier.NavisionCardTypeEurocardMastercard: // CVV2 // 3 chiffres if (csc.Length != 3) { throw new Exception(user.GetMessages().GetString("InvalidCSCLenght", true)); } break; case CreditCardVerifier.NavisionCardTypeAmericanExpress: // CID // 4 chiffres if (csc.Length != 4) { throw new Exception(user.GetMessages().GetString("InvalidCSCLenght", true)); } break; default: break; } }
/// <summary> /// Affectation des valeurs /// </summary> /// <param name="BOtoken">Token FrontOffice</param> /// <param name="pan">Numéro de carte</param> /// <param name="expirationDate">Date d'expiration</param> /// <param name="ri">Information validation numéro de carte</param> public void SetValues(string token, string pan, string csc, CardInfos ri) { this.Token = token; this.PAN = pan; this.CSC = csc; if (ri != null) { this.TruncatedPAN = ri.GetTruncatedPAN(); this.CardType = ri.GetCardType(); this.ShortCardType = ri.GetShortCardType(); this.MII = ri.GetMII(); this.MIIIssuerCategory = ri.GetMIIIssuerCategory(); } else { this.TruncatedPAN = CreditCardVerifier.TruncatePan(pan); } }
public void SetCard(CardInfos card) { tb_cardname.Text = card.Name; CardType[] typeArray = card.GetCardTypes(); string level = ""; string atkdef = ""; string attribute = ""; if (typeArray.Contains(CardType.Magie) || typeArray.Contains(CardType.Piège)) { } else { if (!typeArray.Contains(CardType.Link)) { if (typeArray.Contains(CardType.Pendule)) { level = string.Format("◊{0} {1}◊", card.LScale, card.RScale); } else { level = card.Level + "★"; } atkdef = string.Format("{0}/{1}", card.Atk, card.Def); } else { LinkMarker[] markers = card.GetLinkMarkers(); atkdef = card.Atk + "/LINK-" + markers.Count(); level = GetStringLinksMarkers(markers); } attribute = string.Format("{0}|{1}", card.GetRace(), card.GetAttribute()); } tb_cardlevel.Text = level; tb_cardatkdef.Text = atkdef; tb_cardattribute.Text = attribute; tb_cardtype.Text = card.GetCardType(); tb_carddesc.Text = card.Description; img_card.Source = FormExecution.AssetsManager.GetPics(new string[] { "BattleCityAlpha", "pics", card.Id + ".jpg" }); }
private void SetCard(CardInfos card) { tb_cardname.Text = card.Name; CardType[] typeArray = card.GetCardTypes(); string level = ""; string atkdef = ""; string attribute = ""; if (typeArray.Contains(CardType.Magie) || typeArray.Contains(CardType.Piège)) { } else { if (!typeArray.Contains(CardType.Link)) { if (typeArray.Contains(CardType.Pendule)) { level = string.Format("◊{0} {1}◊", card.LScale, card.RScale); } else { level = card.Level + "★"; } atkdef = string.Format("{0}/{1}", card.Atk, card.Def); } else { LinkMarker[] markers = card.GetLinkMarkers(); atkdef = card.Atk + "/LINK-" + markers.Count(); level = GetStringLinksMarkers(markers); } attribute = string.Format("{0}|{1}", card.GetRace(), card.GetAttribute()); } tb_cardlevel.Text = level; tb_cardatkdef.Text = atkdef; tb_cardattribute.Text = attribute; tb_cardtype.Text = card.GetCardType(); tb_carddesc.Text = card.Description; }
public void AddCard(Owner _owner) { CardInfos cardInfos = Pioche.Instance.DrawCard(); cardInfos.owner = _owner; Pioche.Instance.RemoveFirstCard(); GameMaster.Instance.OnPlayerEndTurn(); GameObject Host = GameObject.Instantiate(cardPrefab); Host.transform.SetParent(cardParent); Card visualCard = Host.GetComponent <Card>(); visualCard.cardInfos = cardInfos; visualCard.onCardIsPlayed += RemoveCard; Host.transform.localScale = Vector3.one; cards.Add(visualCard); }
private void DeckList_SelectedIndexChanged(object sender, EventArgs e) { if (!CardList.ContainsKey(DeckList.SelectedItem.ToString())) { CardName.Text = ""; CardID.Text = ""; CardDetails.Text = ""; return; } CardInfos card = CardList[DeckList.SelectedItem.ToString()]; if (card == null) { return; } CardName.Text = card.Name; CardID.Text = card.Id.ToString(CultureInfo.InvariantCulture); CardDetails.Text = ""; CardDetails.Text += card.GetCardTypes() + " "; if (card.HasType(CardType.Monster)) { string level = string.Empty; for (int i = 0; i < card.Level; i++) { level = level + "*"; } CardDetails.Text += card.GetCardRace() + Environment.NewLine + (card.HasType(CardType.Xyz) ? "Rank " : "Level ") + card.Level + " " + "[" + level + "] " + ((card.Atk == -2) ? "?" : card.Atk.ToString(CultureInfo.InvariantCulture)) + "/" + ((card.Def == -2) ? "?" : card.Def.ToString(CultureInfo.InvariantCulture)) + Environment.NewLine; } else { CardDetails.Text += Environment.NewLine; } CardDetails.Text += card.Description; }
private bool LoadCard(int cardid) { DataGridViewRow datarow = null; DataGridViewRow textrow = null; foreach (DataGridViewRow row in cdbdata.Rows) { if (row.Cells["id"].Value == null) continue; if (row.Cells["id"].Value.ToString() == cardid.ToString()) { datarow = row; } } foreach (DataGridViewRow row in cdbenglishtext.Rows) { if (row.Cells["id"].Value == null) continue; if (row.Cells["id"].Value.ToString() == cardid.ToString()) { textrow = row; } } if (datarow == null && textrow == null) { MessageBox.Show("Card not found."); return false; } CardInfos info = new CardInfos(datarow, textrow); CardID.Text = info.Id.ToString(); Alias.Text = info.AliasId.ToString(); for (int i = 0; i < Formats.Count;i++ ) { if (Formats[i] == info.Ot) { CardFormats.SelectedIndex = i; break; } } Level.SelectedIndex = info.Level - 1; for (int i = 0; i < CardRaces.Count; i++) { if (CardRaces[i] == info.Race) { Race.SelectedIndex = i; break; } } for (int i = 0; i < CardAttributes.Count; i++) { if (CardAttributes[i] == info.Attribute) { CardAttribute.SelectedIndex = i; break; } } ATK.Text = info.Atk.ToString(); DEF.Text = info.Def.ToString(); CardName.Text = info.Name; CardDescription.Text = info.Description; foreach (string effect in info.EffectStrings) EffectList.Items.Add(effect); SetCardTypes(info.GetCardTypes()); int index = this.SetCodes.IndexOf(info.SetCode & 0xffff); this.SetCodeLst.SelectedIndex = index; index = this.SetCodes.IndexOf(info.SetCode >> 0x10); this.OtherSetCodeLst.SelectedIndex = index; SetCategoryCheckBoxs(info.Category); LoadedCard = info.Id; return true; }
public void AddCardInPile(CardInfos cardInfo) { cards.Add(cardInfo); }
void GenerateAllCards() { for ( int i = 0; i < 8; i++) { Vector2 finalDir = Vector2.zero; switch ( i ) { case 0: finalDir = new Vector2(-1, 0); break; case 1: finalDir = new Vector2(-1, 1); break; case 2: finalDir = new Vector2(0, 1); break; case 3: finalDir = new Vector2(1, 1); break; case 4: finalDir = new Vector2(1, 0); break; case 5: finalDir = new Vector2(1, -1); break; case 6: finalDir = new Vector2(0, -1); break; case 7: finalDir = new Vector2(-1, -1); break; } for (int j = 1; j < 4; j++) { CardInfos card = new CardInfos(); card.direction = finalDir; card.nb_squares = j; card.id = cards.Count; cards.Add(card); } } }
static void Main(string[] args) { CardInfos ci = new CardInfos(); try { StreamReader sr = new StreamReader("card.config"); string line; while ((line = sr.ReadLine()) != null) { string[] attr = line.Split(','); String[] ccPair = attr[0].Split('='); String[] icard = attr[1].Split('='); CardConfig cc = new CardConfig() { Name = ccPair[1].Trim() }; ICard card = (ICard)Assembly.GetExecutingAssembly().CreateInstance(icard[1].Trim()); cc.Card = card; ci.Add(cc); } sr.Close(); } catch(Exception e) { String config = JsonConvert.SerializeObject(new Ret() { Err="卡配置文件错误。"}); Console.Write(config); Log.Debug(config); return; } int BaudRate = int.Parse(Config.GetConfig("Baud")); short Port = short.Parse(Config.GetConfig("Port")); Log.Debug(String.Join(" ", args)); GenericService service = new GenericService(ci, Port, BaudRate); Object obj = null; switch(args[0]) { case "ReadCard": obj = service.ReadCard(); break; case "WriteGasCard": obj = service.WriteGasCard(args[1], args[2], args[3], args[4], int.Parse(args[5]), int.Parse(args[6]), int.Parse(args[7]), short.Parse(args[8]), int.Parse(args[9]), int.Parse(args[10]), int.Parse(args[11]), int.Parse(args[12]), args[13], args[14], int.Parse(args[15]), int.Parse(args[16]), args[17], args[18] ); break; case "WriteNewCard": obj = service.WriteNewCard(args[1], args[2], short.Parse(args[3]), args[4], args[5], args[6],args[7], int.Parse(args[8]), int.Parse(args[9]), int.Parse(args[10]), short.Parse(args[11]), int.Parse(args[12]), short.Parse(args[13]), int.Parse(args[14]), int.Parse(args[15]), int.Parse(args[16]), int.Parse(args[17]), args[18], args[19], int.Parse(args[20]), int.Parse(args[21]), args[22], args[23] ); break; case "FormatGasCard": obj = service.FormatGasCard(args[1], args[2], args[3], args[4]); break; case "OpenCard": obj = service.OpenCard(args[1], args[2], args[3], args[4]); break; default: return; } String result = JsonConvert.SerializeObject(obj); Console.Write(result); Log.Debug(result); return; }
public GenericService(CardInfos ci, short port, int br) { this.Cards = ci; this.Port = port; this.Baud = br; }
void worker_DoWork(object sender, DoWorkEventArgs e) { Log.Debug("in do work"); try { //获取本地端口号,波特率 Port = short.Parse(Config.GetConfig("Port")); Baud = int.Parse(Config.GetConfig("Baud")); Log.Debug("Port,Baud" + Port + Baud); //获取后台ip地址 string ip = Config.GetConfig("RemoteIP"); //从后台获取所有文件信息 WebClient client = new WebClient(); string str = client.DownloadString(ip + "/rs/card"); Log.Debug("download str" + str); string[] infos = str.Split('|'); //对于每一个文件,检查时间是否一致,不一致则到后台获取文件 foreach (string item in infos) { string[] items = item.Split(','); string fpath = items[0]; Log.Debug("find fpath is " + fpath); long ftime = long.Parse(items[1]); DateTime from1970 = new DateTime(1970, 1, 1, 8, 0, 0, DateTimeKind.Local); DateTime time = from1970.AddMilliseconds(ftime); //如果与本地文件时间不同,去后台获取文件 int index = fpath.LastIndexOf('\\'); string fname = fpath.Substring(index + 1); Log.Debug("find fname is " + fname); DateTime local = File.GetLastWriteTime(fname); Log.Debug("time = " + time.ToString()); Log.Debug("local = " + local.ToString()); if (local != time) { Log.Debug("load file " + fname); client.DownloadFile(ip + "/rs/card/" + fpath.Replace("\\", "^"), fname); File.SetLastWriteTime(fname, time); } } //加载xaml文件 StreamReader reader = new StreamReader("Card.xaml"); string s = reader.ReadToEnd(); ResourceDictionary dic = (ResourceDictionary)XamlServices.Parse(s); Cards = (CardInfos)dic["CardInfos"]; Log.Debug(Cards.Count + ""); } catch (Exception ex) { Log.Debug(ex.Message); } }