public void Test() { // 生成操作对象实例、组装链式结构 IHandler handler1 = new InternalHandler(); IHandler handler2 = new DiscountHandler(); IHandler handler3 = new MailHandler(); IHandler handler4 = new RegularHandler(); handler1.Successors = new List <IHandler> { handler3 }; handler3.Successors = new List <IHandler> { handler2 }; handler2.Successors = new List <IHandler> { handler4 }; IHandler head = handler1; handler1.HasBreakPoint = true; handler1.Break += Break; handler3.HasBreakPoint = true; handler3.Break += Break; Request request = new Request(20, PurchaseType.Regular); head.Handle(request); Console.WriteLine(currentType.ToString()); currentType = PurchaseType.Internal; // 为第一个断点做的准备 Console.WriteLine(request.Price); Console.WriteLine(currentType.ToString()); }
public Dictionary <string, object> Serialize() { Dictionary <string, object> result = new Dictionary <string, object>(); result.Add("@id", Id); result.Add("@purchaseType", PurchaseType.ToString()); result.Add("name", name); result.Add("description", description); result.Add("platforms", platformBundles); return(result); }
public XmlDocument ToXmlDoc() { XmlDocument doc = new XmlDocument(); XmlElement docEl = _licUtils.CreateLicElement(doc, PragmaLicElements.PragmaLicense); doc.AppendChild(docEl); XmlElement e = _licUtils.CreateLicElement(doc, PragmaLicElements.Product); e.InnerText = _product.ToString(); docEl.AppendChild(e); e = _licUtils.CreateLicElement(doc, PragmaLicElements.ProductCodeName); e.InnerText = _productCodeName.ToString(); docEl.AppendChild(e); e = _licUtils.CreateLicElement(doc, PragmaLicElements.ActivationKey); e.InnerText = _activationKey; docEl.AppendChild(e); e = _licUtils.CreateLicElement(doc, PragmaLicElements.LicType); e.InnerText = _licType.ToString(); docEl.AppendChild(e); e = _licUtils.CreateLicElement(doc, PragmaLicElements.PurchaseType); e.InnerText = _purchaseType.ToString(); docEl.AppendChild(e); e = _licUtils.CreateLicElement(doc, PragmaLicElements.ValidFrom); e.InnerText = !_validFrom.HasValue ? String.Empty : GetSimpleDate(_validFrom.Value); docEl.AppendChild(e); e = _licUtils.CreateLicElement(doc, PragmaLicElements.ValidTo); e.InnerText = !_validTo.HasValue ? String.Empty : GetSimpleDate(_validTo.Value); docEl.AppendChild(e); e = _licUtils.CreateLicElement(doc, PragmaLicElements.MachineKey); e.InnerText = _machineKey.Key; docEl.AppendChild(e); e = _licUtils.CreateLicElement(doc, PragmaLicElements.MachineIdType); e.InnerText = _machineIdType.ToString(); docEl.AppendChild(e); e = _licUtils.CreateLicElement(doc, PragmaLicElements.EMail); e.InnerText = _email; docEl.AppendChild(e); return(doc); }
public void ToXml(dynamic xmlParent, IConfiguration configuration = null) { var creditCard = CreditCard.GetType().GetField(CreditCard.ToString()).GetAttribute <DescriptionAttribute>(); var purchaseType = PurchaseType.GetType().GetField(PurchaseType.ToString()).GetAttribute <DescriptionAttribute>(); xmlParent.forma_pagamento(Xml.Fragment(c => { c.bandeira(creditCard.Description); c.produto(purchaseType.Description); c.parcelas(Installments); })); }
public Dictionary <string, object> Serialize() { Dictionary <string, object> result = new Dictionary <string, object>(); result.Add("@id", Id); result.Add("@purchaseType", PurchaseType.ToString()); result.Add("name", name); result.Add("description", description); // MiniJson doesn't handle enum dictionary keys. var stringPlatforms = new Dictionary <string, object>(); foreach (var item in platformBundles) { stringPlatforms.Add(item.Key.ToString(), item.Value); } result.Add("platforms", stringPlatforms); return(result); }
public string DecryptActivationKey(string key, PurchaseType type) { return(Decrypt(key, PKey + "_" + type.ToString())); }
public string GenerateEncryptedActivationKey(string key, PurchaseType type) { return(Encrypt(key, PKey + "_" + type.ToString())); }