Beispiel #1
0
 public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
 {
     if (Value.ToString() != "")
     {
         return(d.CreateTextNode(((DateTime)Value).ToString("s")));
     }
     else
     {
         return(d.CreateTextNode(""));
     }
 }
        public static System.Xml.XmlElement CreateTextElement(this System.Xml.XmlDocument doc, string name, string text)
        {
            var element = doc.CreateElement(name);

            element.AppendChild(doc.CreateTextNode(text));
            return(element);
        }
Beispiel #3
0
 public virtual System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
 {
     if (this._dataType.DBType == DBTypes.Ntext)
     {
         return(d.CreateCDataSection(this.Value.ToString()));
     }
     return(d.CreateTextNode(Value.ToString()));
 }
Beispiel #4
0
 // TODO: This is not really an extension, more a helper and so should be moved...
 public static System.Xml.XmlElement CreateXmlElement(string tag, string content)
 {
     System.Xml.XmlDocument doc     = new System.Xml.XmlDocument();
     System.Xml.XmlElement  element = doc.CreateElement(tag);
     doc.AppendChild(element);
     element.AppendChild(doc.CreateTextNode(content));
     return(doc.DocumentElement);
 }
 // TODO: This is not really an extension, more a helper and so should be moved...
 public static System.Xml.XmlElement CreateXmlElement( string tag, string content )
 {
     System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
     System.Xml.XmlElement element = doc.CreateElement(tag);
     doc.AppendChild(element);
     element.AppendChild(doc.CreateTextNode(content));
     return doc.DocumentElement;
 }
Beispiel #6
0
        public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
        {
            if (Value != null && Value.ToString() != "")
            {
                if (Value is DateTime)
                {
                    return(d.CreateTextNode(((DateTime)Value).ToString("s")));
                }

                DateTime convertedDate;
                if (DateTime.TryParse(Value.ToString(), out convertedDate))
                {
                    return(d.CreateTextNode(convertedDate.ToString("s")));
                }
            }

            return(d.CreateTextNode(""));
        }
Beispiel #7
0
        AddStringToDict(
            System.Xml.XmlDocument doc,
            System.Xml.XmlElement dict,
            string value)
        {
            var element = doc.CreateElement("string");
            var text    = doc.CreateTextNode(value);

            element.AppendChild(text);
            dict.AppendChild(element);
        }
Beispiel #8
0
        public void Save(string path)
        {
            System.Xml.XmlDocument doc          = new System.Xml.XmlDocument();
            System.Xml.XmlElement  project_root = doc.CreateElement("Root");

            {
                var e = doc.CreateElement("Target");
                e.AppendChild(doc.CreateTextNode(Target.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("Port");
                e.AppendChild(doc.CreateTextNode(Port.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("AutoConnect");
                e.AppendChild(doc.CreateTextNode(AutoConnect.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("SendOnLoad");
                e.AppendChild(doc.CreateTextNode(SendOnLoad.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("SendOnEdit");
                e.AppendChild(doc.CreateTextNode(SendOnEdit.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("SendOnSave");
                e.AppendChild(doc.CreateTextNode(SendOnSave.ToString()));
                project_root.AppendChild(e);
            }

            doc.AppendChild(project_root);

            var dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);

            doc.InsertBefore(dec, project_root);

            // For failing to save
            try
            {
                doc.Save(path);
            }
            catch
            {
            }
        }
Beispiel #9
0
        public static bool LoadFrom(string path)
        {
            path = System.IO.Path.GetFullPath(path);

            if (!System.IO.File.Exists(path))
            {
                return(false);
            }
            SelectedNode = null;

            FullPath = path;

            var doc = new System.Xml.XmlDocument();

            doc.Load(path);

            if (doc.ChildNodes.Count != 2)
            {
                return(false);
            }
            if (doc.ChildNodes[1].Name != "EffekseerProject")
            {
                return(false);
            }

            if (OnBeforeLoad != null)
            {
                OnBeforeLoad(null, null);
            }

            uint toolVersion = 0;

            if (doc["EffekseerProject"]["ToolVersion"] != null)
            {
                var fileVersion    = doc["EffekseerProject"]["ToolVersion"].GetText();
                var currentVersion = Core.Version;

                toolVersion = ParseVersion(fileVersion);

                if (toolVersion > ParseVersion(currentVersion))
                {
                    throw new Exception("Version Error : \nファイルがより新しいバージョンのツールで作成されています。\n最新バージョンのツールを使用してください。");
                }
            }

            // 互換性のための変換
            {
                // Stripe→Ribbon
                var innerText = doc.InnerXml;
                innerText = innerText.Replace("<Stripe>", "<Ribbon>").Replace("</Stripe>", "</Ribbon>");
                doc       = new System.Xml.XmlDocument();
                doc.LoadXml(innerText);
            }

            // 互換性のための変換
            {
                // GenerationTime
                // GenerationTimeOffset

                Action <System.Xml.XmlNode> replace = null;
                replace = (node) =>
                {
                    if ((node.Name == "GenerationTime" || node.Name == "GenerationTimeOffset") &&
                        node.ChildNodes.Count > 0 &&
                        node.ChildNodes[0] is System.Xml.XmlText)
                    {
                        var name  = node.Name;
                        var value = node.ChildNodes[0].Value;

                        node.RemoveAll();

                        var center = doc.CreateElement("Center");
                        var max    = doc.CreateElement("Max");
                        var min    = doc.CreateElement("Min");

                        center.AppendChild(doc.CreateTextNode(value));
                        max.AppendChild(doc.CreateTextNode(value));
                        min.AppendChild(doc.CreateTextNode(value));

                        node.AppendChild(center);
                        node.AppendChild(max);
                        node.AppendChild(min);
                    }
                    else
                    {
                        for (int i = 0; i < node.ChildNodes.Count; i++)
                        {
                            replace(node.ChildNodes[i]);
                        }
                    }
                };

                replace(doc);
            }

            var root = doc["EffekseerProject"]["Root"];

            if (root == null)
            {
                return(false);
            }

            var behaviorElement = doc["EffekseerProject"]["Behavior"];

            if (behaviorElement != null)
            {
                var o = effectBehavior as object;
                Data.IO.LoadObjectFromElement(behaviorElement as System.Xml.XmlElement, ref o, false);
            }

            var cullingElement = doc["EffekseerProject"]["Culling"];

            if (cullingElement != null)
            {
                var o = culling as object;
                Data.IO.LoadObjectFromElement(cullingElement as System.Xml.XmlElement, ref o, false);
            }

            StartFrame = 0;
            EndFrame   = doc["EffekseerProject"]["EndFrame"].GetTextAsInt();
            StartFrame = doc["EffekseerProject"]["StartFrame"].GetTextAsInt();
            IsLoop     = bool.Parse(doc["EffekseerProject"]["IsLoop"].GetText());
            IsLoop     = true;

            int version = 0;

            if (doc["EffekseerProject"]["Version"] != null)
            {
                version = doc["EffekseerProject"]["Version"].GetTextAsInt();
            }

            var root_node = new Data.NodeRoot() as object;

            Data.IO.LoadObjectFromElement(root as System.Xml.XmlElement, ref root_node, false);

            // 互換性のための変換(テクスチャ周り)
            if (version < 3)
            {
                Action <Data.NodeBase> convert = null;
                convert = (n) =>
                {
                    var n_ = n as Data.Node;

                    if (n_ != null)
                    {
                        if (n_.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Sprite)
                        {
                            n_.RendererCommonValues.ColorTexture.SetAbsolutePathDirectly(n_.DrawingValues.Sprite.ColorTexture.AbsolutePath);
                            n_.RendererCommonValues.AlphaBlend.SetValueDirectly(n_.DrawingValues.Sprite.AlphaBlend.Value);
                        }
                        else if (n_.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ring)
                        {
                            n_.RendererCommonValues.ColorTexture.SetAbsolutePathDirectly(n_.DrawingValues.Ring.ColorTexture.AbsolutePath);
                            n_.RendererCommonValues.AlphaBlend.SetValueDirectly(n_.DrawingValues.Ring.AlphaBlend.Value);
                        }
                        else if (n_.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ribbon)
                        {
                            n_.RendererCommonValues.ColorTexture.SetAbsolutePathDirectly(n_.DrawingValues.Ribbon.ColorTexture.AbsolutePath);
                            n_.RendererCommonValues.AlphaBlend.SetValueDirectly(n_.DrawingValues.Ribbon.AlphaBlend.Value);
                        }
                    }

                    for (int i = 0; i < n.Children.Count; i++)
                    {
                        convert(n.Children[i]);
                    }
                };

                convert(root_node as Data.NodeBase);
            }

            Root = root_node as Data.NodeRoot;
            Command.CommandManager.Clear();
            IsChanged = false;

            if (OnAfterLoad != null)
            {
                OnAfterLoad(null, null);
            }

            return(true);
        }
Beispiel #10
0
        public static bool LoadFromXml(System.Xml.XmlDocument doc, string basePath)
        {
            basePath = System.IO.Path.GetFullPath(basePath);

            SelectedNode = null;

            FullPath = basePath;

            if (doc.ChildNodes.Count != 2)
            {
                return(false);
            }
            if (doc.ChildNodes[1].Name != "EffekseerProject")
            {
                return(false);
            }

            if (OnBeforeLoad != null)
            {
                OnBeforeLoad(null, null);
            }

            uint toolVersion = 0;

            if (doc["EffekseerProject"]["ToolVersion"] != null)
            {
                var fileVersion    = doc["EffekseerProject"]["ToolVersion"].GetText();
                var currentVersion = Core.Version;

                toolVersion = ParseVersion(fileVersion);

                if (toolVersion > ParseVersion(currentVersion))
                {
                    switch (Language)
                    {
                    case Language.English:
                        throw new Exception("Version Error : \nThe file is created with a newer version of the tool.\nPlease use the latest version of the tool.");
                        break;

                    case Language.Japanese:
                        throw new Exception("Version Error : \nファイルがより新しいバージョンのツールで作成されています。\n最新バージョンのツールを使用してください。");
                        break;
                    }
                }
            }

            // For compatibility
            {
                // Stripe→Ribbon
                var innerText = doc.InnerXml;
                innerText = innerText.Replace("<Stripe>", "<Ribbon>").Replace("</Stripe>", "</Ribbon>");
                doc       = new System.Xml.XmlDocument();
                doc.LoadXml(innerText);
            }

            // For compatibility
            {
                // GenerationTime
                // GenerationTimeOffset

                Action <System.Xml.XmlNode> replace = null;
                replace = (node) =>
                {
                    if ((node.Name == "GenerationTime" || node.Name == "GenerationTimeOffset") &&
                        node.ChildNodes.Count > 0 &&
                        node.ChildNodes[0] is System.Xml.XmlText)
                    {
                        var name  = node.Name;
                        var value = node.ChildNodes[0].Value;

                        node.RemoveAll();

                        var center = doc.CreateElement("Center");
                        var max    = doc.CreateElement("Max");
                        var min    = doc.CreateElement("Min");

                        center.AppendChild(doc.CreateTextNode(value));
                        max.AppendChild(doc.CreateTextNode(value));
                        min.AppendChild(doc.CreateTextNode(value));

                        node.AppendChild(center);
                        node.AppendChild(max);
                        node.AppendChild(min);
                    }
                    else
                    {
                        for (int i = 0; i < node.ChildNodes.Count; i++)
                        {
                            replace(node.ChildNodes[i]);
                        }
                    }
                };

                replace(doc);
            }

            var root = doc["EffekseerProject"]["Root"];

            if (root == null)
            {
                return(false);
            }

            culling      = new Data.EffectCullingValues();
            globalValues = new Data.GlobalValues();

            // Adhoc code
            effectBehavior.Reset();

            var behaviorElement = doc["EffekseerProject"]["Behavior"];

            if (behaviorElement != null)
            {
                var o = effectBehavior as object;
                Data.IO.LoadObjectFromElement(behaviorElement as System.Xml.XmlElement, ref o, false);
            }

            var cullingElement = doc["EffekseerProject"]["Culling"];

            if (cullingElement != null)
            {
                var o = culling as object;
                Data.IO.LoadObjectFromElement(cullingElement as System.Xml.XmlElement, ref o, false);
            }

            var globalElement = doc["EffekseerProject"]["Global"];

            if (globalElement != null)
            {
                var o = globalValues as object;
                Data.IO.LoadObjectFromElement(globalElement as System.Xml.XmlElement, ref o, false);
            }

            var dynamicElement = doc["EffekseerProject"]["Dynamic"];

            if (dynamicElement != null)
            {
                var o = dynamic_ as object;
                Data.IO.LoadObjectFromElement(dynamicElement as System.Xml.XmlElement, ref o, false);
            }

            // recording option (this option is stored in local or global)
            if (doc["EffekseerProject"]["Recording"] != null)
            {
                var o = recording as object;
                Data.IO.LoadObjectFromElement(doc["EffekseerProject"]["Recording"] as System.Xml.XmlElement, ref o, false);
            }

            StartFrame = 0;
            EndFrame   = doc["EffekseerProject"]["EndFrame"].GetTextAsInt();
            StartFrame = doc["EffekseerProject"]["StartFrame"].GetTextAsInt();
            IsLoop     = bool.Parse(doc["EffekseerProject"]["IsLoop"].GetText());
            IsLoop     = true;

            int version = 0;

            if (doc["EffekseerProject"]["Version"] != null)
            {
                version = doc["EffekseerProject"]["Version"].GetTextAsInt();
            }

            var root_node = new Data.NodeRoot() as object;

            Data.IO.LoadObjectFromElement(root as System.Xml.XmlElement, ref root_node, false);

            // For compatibility
            if (version < 3)
            {
                Action <Data.NodeBase> convert = null;
                convert = (n) =>
                {
                    var n_ = n as Data.Node;

                    if (n_ != null)
                    {
                        if (n_.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Sprite)
                        {
                            n_.RendererCommonValues.ColorTexture.SetAbsolutePathDirectly(n_.DrawingValues.Sprite.ColorTexture.AbsolutePath);
                            n_.RendererCommonValues.AlphaBlend.SetValueDirectly(n_.DrawingValues.Sprite.AlphaBlend.Value);
                        }
                        else if (n_.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ring)
                        {
                            n_.RendererCommonValues.ColorTexture.SetAbsolutePathDirectly(n_.DrawingValues.Ring.ColorTexture.AbsolutePath);
                            n_.RendererCommonValues.AlphaBlend.SetValueDirectly(n_.DrawingValues.Ring.AlphaBlend.Value);
                        }
                        else if (n_.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ribbon)
                        {
                            n_.RendererCommonValues.ColorTexture.SetAbsolutePathDirectly(n_.DrawingValues.Ribbon.ColorTexture.AbsolutePath);
                            n_.RendererCommonValues.AlphaBlend.SetValueDirectly(n_.DrawingValues.Ribbon.AlphaBlend.Value);
                        }
                    }

                    for (int i = 0; i < n.Children.Count; i++)
                    {
                        convert(n.Children[i]);
                    }
                };

                convert(root_node as Data.NodeBase);
            }

            Root = root_node as Data.NodeRoot;
            Command.CommandManager.Clear();
            IsChanged = false;

            if (OnAfterLoad != null)
            {
                OnAfterLoad(null, null);
            }

            return(true);
        }
Beispiel #11
0
        public ActionResult Sonuc()
        {
            var e = Request.Form.GetEnumerator();

            while (e.MoveNext())
            {
                String xkey = (String)e.Current;
                String xval = Request.Form.Get(xkey);
                Response.Write("<tr><td>" + xkey + "</td><td>" + xval + "</td></tr>");
            }

            String hashparams = Request.Form.Get("HASHPARAMS");
            String hashparamsval = Request.Form.Get("HASHPARAMSVAL");
            String storekey = "XXXX";     //Sizin Storkey Adresiniz
            String paramsval = "";
            int    index1 = 0, index2 = 0;

            // hash hesaplamada kullanılacak değerler ayrıştırılıp değerleri birleştiriliyor.
            do
            {
                index2 = hashparams.IndexOf(":", index1);
                String val = Request.Form.Get(hashparams.Substring(index1, index2 - index1)) == null ? "" : Request.Form.Get(hashparams.Substring(index1, index2 - index1));
                paramsval += val;
                index1     = index2 + 1;
            }while (index1 < hashparams.Length);

            //out.println("hashparams="+hashparams+"<br/>");
            //out.println("hashparamsval="+hashparamsval+"<br/>");
            //out.println("paramsval="+paramsval+"<br/>");
            String hashval   = paramsval + storekey;           //elde edilecek hash değeri için paramsval e store key ekleniyor. (işyeri anahtarı)
            String hashparam = Request.Form.Get("HASH");

            System.Security.Cryptography.SHA1 sha = new System.Security.Cryptography.SHA1CryptoServiceProvider();
            byte[] hashbytes  = System.Text.Encoding.GetEncoding("ISO-8859-9").GetBytes(hashval);
            byte[] inputbytes = sha.ComputeHash(hashbytes);

            String hash = Convert.ToBase64String(inputbytes);                //Güvenlik ve kontrol amaçlı oluşturulan hash

            if (!paramsval.Equals(hashparamsval) || !hash.Equals(hashparam)) //oluşturulan hash ile gelen hash ve hash parametreleri değerleri ile ayrıştırılıp edilen edilen aynı olmalı.
            {
                Response.Write("<h4>Güvenlik Uyarısı. Sayısal İmza Geçerli Değil</h4>");
            }
            // Ödeme için gerekli parametreler
            String nameval     = "xxxx";                                                                                                         //İşyeri kullanıcı adı
            String passwordval = "xxxx";                                                                                                         //İşyeri şifresi
            String clientidval = Request.Form.Get("clientid");                                                                                   // İşyeri numarası
            String modeval     = "P";                                                                                                            //P olursa gerçek işlem, T olursa test işlemi yapar.
            String typeval     = "Auth";                                                                                                         //Auth PreAuth PostAuth Credit Void olabilir.
            String expiresval  = Request.Form.Get("Ecom_Payment_Card_ExpDate_Month") + "/" + Request.Form.Get("Ecom_Payment_Card_ExpDate_Year"); //Kredi Kartı son kullanım tarihi mm/yy formatından olmalı
            String cv2val      = Request.Form.Get("cv2");                                                                                        //Güvenlik Kodu
            String totalval    = Request.Form.Get("amount");                                                                                     //Tutar
            String numberval   = Request.Form.Get("md");                                                                                         //Kart numarası olarak 3d sonucu dönem md parametresi kullanılır.
            String taksitval   = "";                                                                                                             //Taksit sayısı peşin satışlar da boş olarak gönderilmelidir.
            String currencyval = "949";                                                                                                          //ytl için
            String orderidval  = "";                                                                                                             //Sipariş numarası


            String mdstatus = Request.Form.Get("mdStatus");                                                   // mdStatus 3d işlemin sonucu ile ilgili bilgi verir. 1,2,3,4 başarılı, 5,6,7,8,9,0 başarısızdır.

            if (mdstatus.Equals("1") || mdstatus.Equals("2") || mdstatus.Equals("3") || mdstatus.Equals("4")) //3D Onayı alınmıştır.
            {
                Response.Write("<h5>3D İşlemi Başarılı</h5><br/>");
                String cardholderpresentcodeval   = "13";
                String payersecuritylevelval      = Request.Form.Get("eci");
                String payertxnidval              = Request.Form.Get("xid");
                String payerauthenticationcodeval = Request.Form.Get("cavv");



                String ipaddressval = "";
                String emailval     = "";
                String groupidval   = "";
                String transidval   = "";
                String useridval    = "";

                //Fatura Bilgileri
                String billnameval       = "";    //Fatur İsmi
                String billstreet1val    = "";    //Fatura adres 1
                String billstreet2val    = "";    //Fatura adres 2
                String billstreet3val    = "";    //Fatura adres 3
                String billcityval       = "";    //Fatura şehir
                String billstateprovval  = "";    //Fatura eyalet
                String billpostalcodeval = "";    //Fatura posta kodu

                //Teslimat Bilgileri
                String shipnameval       = "";    //isim
                String shipstreet1val    = "";    //adres 1
                String shipstreet2val    = "";    //adres 2
                String shipstreet3val    = "";    //adres 3
                String shipcityval       = "";    //şehir
                String shipstateprovval  = "";    //eyalet
                String shippostalcodeval = "";    //posta kodu


                String extraval = "";



                //Ödeme için gerekli xml yapısı oluşturuluyor

                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();

                System.Xml.XmlDeclaration dec =
                    doc.CreateXmlDeclaration("1.0", "ISO-8859-9", "yes");

                doc.AppendChild(dec);


                System.Xml.XmlElement cc5Request = doc.CreateElement("CC5Request");
                doc.AppendChild(cc5Request);

                System.Xml.XmlElement name = doc.CreateElement("Name");
                name.AppendChild(doc.CreateTextNode(nameval));
                cc5Request.AppendChild(name);

                System.Xml.XmlElement password = doc.CreateElement("Password");
                password.AppendChild(doc.CreateTextNode(passwordval));
                cc5Request.AppendChild(password);

                System.Xml.XmlElement clientid = doc.CreateElement("ClientId");
                clientid.AppendChild(doc.CreateTextNode(clientidval));
                cc5Request.AppendChild(clientid);

                System.Xml.XmlElement ipaddress = doc.CreateElement("IPAddress");
                ipaddress.AppendChild(doc.CreateTextNode(ipaddressval));
                cc5Request.AppendChild(ipaddress);

                System.Xml.XmlElement email = doc.CreateElement("Email");
                email.AppendChild(doc.CreateTextNode(emailval));
                cc5Request.AppendChild(email);

                System.Xml.XmlElement mode = doc.CreateElement("Mode");
                mode.AppendChild(doc.CreateTextNode(modeval));
                cc5Request.AppendChild(mode);

                System.Xml.XmlElement orderid = doc.CreateElement("OrderId");
                orderid.AppendChild(doc.CreateTextNode(orderidval));
                cc5Request.AppendChild(orderid);

                System.Xml.XmlElement groupid = doc.CreateElement("GroupId");
                groupid.AppendChild(doc.CreateTextNode(groupidval));
                cc5Request.AppendChild(groupid);

                System.Xml.XmlElement transid = doc.CreateElement("TransId");
                transid.AppendChild(doc.CreateTextNode(transidval));
                cc5Request.AppendChild(transid);

                System.Xml.XmlElement userid = doc.CreateElement("UserId");
                userid.AppendChild(doc.CreateTextNode(useridval));
                cc5Request.AppendChild(userid);

                System.Xml.XmlElement type = doc.CreateElement("Type");
                type.AppendChild(doc.CreateTextNode(typeval));
                cc5Request.AppendChild(type);

                System.Xml.XmlElement number = doc.CreateElement("Number");
                number.AppendChild(doc.CreateTextNode(numberval));
                cc5Request.AppendChild(number);

                System.Xml.XmlElement expires = doc.CreateElement("Expires");
                expires.AppendChild(doc.CreateTextNode(expiresval));
                cc5Request.AppendChild(expires);

                System.Xml.XmlElement cvv2val = doc.CreateElement("Cvv2Val");
                cvv2val.AppendChild(doc.CreateTextNode(cv2val));
                cc5Request.AppendChild(cvv2val);

                System.Xml.XmlElement total = doc.CreateElement("Total");
                total.AppendChild(doc.CreateTextNode(totalval));
                cc5Request.AppendChild(total);

                System.Xml.XmlElement currency = doc.CreateElement("Currency");
                currency.AppendChild(doc.CreateTextNode(currencyval));
                cc5Request.AppendChild(currency);

                System.Xml.XmlElement taksit = doc.CreateElement("Taksit");
                taksit.AppendChild(doc.CreateTextNode(taksitval));
                cc5Request.AppendChild(taksit);

                System.Xml.XmlElement payertxnid = doc.CreateElement("PayerTxnId");
                payertxnid.AppendChild(doc.CreateTextNode(payertxnidval));
                cc5Request.AppendChild(payertxnid);

                System.Xml.XmlElement payersecuritylevel = doc.CreateElement("PayerSecurityLevel");
                payersecuritylevel.AppendChild(doc.CreateTextNode(payersecuritylevelval));
                cc5Request.AppendChild(payersecuritylevel);

                System.Xml.XmlElement payerauthenticationcode = doc.CreateElement("PayerAuthenticationCode");
                payerauthenticationcode.AppendChild(doc.CreateTextNode(payerauthenticationcodeval));
                cc5Request.AppendChild(payerauthenticationcode);

                System.Xml.XmlElement cardholderpresentcode = doc.CreateElement("CardholderPresentCode");
                cardholderpresentcode.AppendChild(doc.CreateTextNode(cardholderpresentcodeval));
                cc5Request.AppendChild(cardholderpresentcode);

                System.Xml.XmlElement billto = doc.CreateElement("BillTo");
                cc5Request.AppendChild(billto);

                System.Xml.XmlElement billname = doc.CreateElement("Name");
                billname.AppendChild(doc.CreateTextNode(billnameval));
                billto.AppendChild(billname);

                System.Xml.XmlElement billstreet1 = doc.CreateElement("Street1");
                billstreet1.AppendChild(doc.CreateTextNode(billstreet1val));
                billto.AppendChild(billstreet1);

                System.Xml.XmlElement billstreet2 = doc.CreateElement("Street2");
                billstreet2.AppendChild(doc.CreateTextNode(billstreet2val));
                billto.AppendChild(billstreet2);

                System.Xml.XmlElement billstreet3 = doc.CreateElement("Street3");
                billstreet3.AppendChild(doc.CreateTextNode(billstreet3val));
                billto.AppendChild(billstreet3);

                System.Xml.XmlElement billcity = doc.CreateElement("City");
                billcity.AppendChild(doc.CreateTextNode(billcityval));
                billto.AppendChild(billcity);

                System.Xml.XmlElement billstateprov = doc.CreateElement("StateProv");
                billstateprov.AppendChild(doc.CreateTextNode(billstateprovval));
                billto.AppendChild(billstateprov);

                System.Xml.XmlElement billpostalcode = doc.CreateElement("PostalCode");
                billpostalcode.AppendChild(doc.CreateTextNode(billpostalcodeval));
                billto.AppendChild(billpostalcode);



                System.Xml.XmlElement shipto = doc.CreateElement("ShipTo");
                cc5Request.AppendChild(shipto);

                System.Xml.XmlElement shipname = doc.CreateElement("Name");
                shipname.AppendChild(doc.CreateTextNode(shipnameval));
                shipto.AppendChild(shipname);

                System.Xml.XmlElement shipstreet1 = doc.CreateElement("Street1");
                shipstreet1.AppendChild(doc.CreateTextNode(shipstreet1val));
                shipto.AppendChild(shipstreet1);

                System.Xml.XmlElement shipstreet2 = doc.CreateElement("Street2");
                shipstreet2.AppendChild(doc.CreateTextNode(shipstreet2val));
                shipto.AppendChild(shipstreet2);

                System.Xml.XmlElement shipstreet3 = doc.CreateElement("Street3");
                shipstreet3.AppendChild(doc.CreateTextNode(shipstreet3val));
                shipto.AppendChild(shipstreet3);

                System.Xml.XmlElement shipcity = doc.CreateElement("City");
                shipcity.AppendChild(doc.CreateTextNode(shipcityval));
                shipto.AppendChild(shipcity);

                System.Xml.XmlElement shipstateprov = doc.CreateElement("StateProv");
                shipstateprov.AppendChild(doc.CreateTextNode(shipstateprovval));
                shipto.AppendChild(shipstateprov);

                System.Xml.XmlElement shippostalcode = doc.CreateElement("PostalCode");
                shippostalcode.AppendChild(doc.CreateTextNode(shippostalcodeval));
                shipto.AppendChild(shippostalcode);


                System.Xml.XmlElement extra = doc.CreateElement("Extra");
                extra.AppendChild(doc.CreateTextNode(extraval));
                cc5Request.AppendChild(extra);
                String xmlval = doc.OuterXml;         //Oluşturulan xml string olarak alınıyor.
                                                      // Ödeme için bağlantı kuruluyor. ve post ediliyor
                String url = "https://<DonusApiAdresi>/fim/api";
                System.Net.HttpWebResponse resp = null;
                try
                {
                    System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);

                    string postdata      = "DATA=" + xmlval.ToString();
                    byte[] postdatabytes = System.Text.Encoding.GetEncoding("ISO-8859-9").GetBytes(postdata);
                    request.Method        = "POST";
                    request.ContentType   = "application/x-www-form-urlencoded";
                    request.ContentLength = postdatabytes.Length;
                    System.IO.Stream requeststream = request.GetRequestStream();
                    requeststream.Write(postdatabytes, 0, postdatabytes.Length);
                    requeststream.Close();

                    resp = (System.Net.HttpWebResponse)request.GetResponse();
                    System.IO.StreamReader responsereader = new System.IO.StreamReader(resp.GetResponseStream(), System.Text.Encoding.GetEncoding("ISO-8859-9"));



                    String gelenXml = responsereader.ReadToEnd();     //Gelen xml string olarak alındı.


                    System.Xml.XmlDocument gelen = new System.Xml.XmlDocument();
                    gelen.LoadXml(gelenXml);        //string xml dökumanına çevrildi.

                    System.Xml.XmlNodeList list = gelen.GetElementsByTagName("Response");
                    String xmlResponse          = list[0].InnerText;
                    list = gelen.GetElementsByTagName("AuthCode");
                    String xmlAuthCode = list[0].InnerText;
                    list = gelen.GetElementsByTagName("HostRefNum");
                    String xmlHostRefNum = list[0].InnerText;
                    list = gelen.GetElementsByTagName("ProcReturnCode");
                    String xmlProcReturnCode = list[0].InnerText;
                    list = gelen.GetElementsByTagName("TransId");
                    String xmlTransId = list[0].InnerText;
                    list = gelen.GetElementsByTagName("ErrMsg");
                    String xmlErrMsg = list[0].InnerText;
                    if ("Approved".Equals(xmlResponse))
                    {
                        Response.Write("Ödeme başarıyla gerçekleştirildi");
                    }
                    else
                    {
                        Response.Write("Ödemede hata oluştu");
                    }
                    resp.Close();
                }
                catch (Exception ex)
                {
                    Console.Write(ex.ToString());
                }
                finally
                {
                    if (resp != null)
                    {
                        resp.Close();
                    }
                }
            }
            else
            {
                Response.Write("3D Onayı alınamadı");
            }
            return(View());
        }
Beispiel #12
0
        public static bool LoadFrom(string path)
        {
            path = System.IO.Path.GetFullPath(path);

            if (!System.IO.File.Exists(path)) return false;
            SelectedNode = null;

            FullPath = path;

            var doc = new System.Xml.XmlDocument();

            doc.Load(path);

            if (doc.ChildNodes.Count != 2) return false;
            if (doc.ChildNodes[1].Name != "EffekseerProject") return false;

            if (OnBeforeLoad != null)
            {
                OnBeforeLoad(null, null);
            }

            uint toolVersion = 0;
            if (doc["EffekseerProject"]["ToolVersion"] != null)
            {
                var fileVersion = doc["EffekseerProject"]["ToolVersion"].GetText();
                var currentVersion = Core.Version;

                toolVersion = ParseVersion(fileVersion);

                if (toolVersion > ParseVersion(currentVersion))
                {
                    throw new Exception("Version Error : \nファイルがより新しいバージョンのツールで作成されています。\n最新バージョンのツールを使用してください。");
                }
            }

            // 互換性のための変換
            {
                // Stripe→Ribbon
                var innerText = doc.InnerXml;
                innerText = innerText.Replace("<Stripe>", "<Ribbon>").Replace("</Stripe>", "</Ribbon>");
                doc = new System.Xml.XmlDocument();
                doc.LoadXml(innerText);
            }

            // 互換性のための変換
            {
                // GenerationTime
                // GenerationTimeOffset

                Action<System.Xml.XmlNode> replace = null;
                replace = (node) =>
                    {
                        if ((node.Name == "GenerationTime" || node.Name == "GenerationTimeOffset") &&
                            node.ChildNodes.Count > 0 &&
                            node.ChildNodes[0] is System.Xml.XmlText)
                        {
                            var name = node.Name;
                            var value = node.ChildNodes[0].Value;

                            node.RemoveAll();

                            var center = doc.CreateElement("Center");
                            var max = doc.CreateElement("Max");
                            var min = doc.CreateElement("Min");

                            center.AppendChild(doc.CreateTextNode(value));
                            max.AppendChild(doc.CreateTextNode(value));
                            min.AppendChild(doc.CreateTextNode(value));

                            node.AppendChild(center);
                            node.AppendChild(max);
                            node.AppendChild(min);
                        }
                        else
                        {
                            for(int i = 0; i < node.ChildNodes.Count; i++)
                            {
                                replace(node.ChildNodes[i]);
                            }
                        }
                    };

                replace(doc);
            }

            var root = doc["EffekseerProject"]["Root"];
            if (root == null) return false;

            var behaviorElement = doc["EffekseerProject"]["Behavior"];
            if (behaviorElement != null)
            {
                var o = effectBehavior as object;
                Data.IO.LoadObjectFromElement(behaviorElement as System.Xml.XmlElement, ref o, false);
            }

            var cullingElement = doc["EffekseerProject"]["Culling"];
            if (cullingElement != null)
            {
                var o = culling as object;
                Data.IO.LoadObjectFromElement(cullingElement as System.Xml.XmlElement, ref o, false);
            }

            StartFrame = 0;
            EndFrame = doc["EffekseerProject"]["EndFrame"].GetTextAsInt();
            StartFrame = doc["EffekseerProject"]["StartFrame"].GetTextAsInt();
            IsLoop = bool.Parse(doc["EffekseerProject"]["IsLoop"].GetText());
            IsLoop = true;

            int version = 0;
            if (doc["EffekseerProject"]["Version"] != null)
            {
                version = doc["EffekseerProject"]["Version"].GetTextAsInt();
            }

            var root_node = new Data.NodeRoot() as object;
            Data.IO.LoadObjectFromElement(root as System.Xml.XmlElement, ref root_node, false);

            // 互換性のための変換(テクスチャ周り)
            if (version < 3)
            {
                Action<Data.NodeBase> convert = null;
                convert = (n) =>
                    {
                        var n_ = n as Data.Node;

                        if (n_ != null)
                        {
                            if (n_.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Sprite)
                            {
                                n_.RendererCommonValues.ColorTexture.SetAbsolutePathDirectly(n_.DrawingValues.Sprite.ColorTexture.AbsolutePath);
                                n_.RendererCommonValues.AlphaBlend.SetValueDirectly(n_.DrawingValues.Sprite.AlphaBlend.Value);
                            }
                            else if (n_.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ring)
                            {
                                n_.RendererCommonValues.ColorTexture.SetAbsolutePathDirectly(n_.DrawingValues.Ring.ColorTexture.AbsolutePath);
                                n_.RendererCommonValues.AlphaBlend.SetValueDirectly(n_.DrawingValues.Ring.AlphaBlend.Value);
                            }
                            else if (n_.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ribbon)
                            {
                                n_.RendererCommonValues.ColorTexture.SetAbsolutePathDirectly(n_.DrawingValues.Ribbon.ColorTexture.AbsolutePath);
                                n_.RendererCommonValues.AlphaBlend.SetValueDirectly(n_.DrawingValues.Ribbon.AlphaBlend.Value);
                            }
                        }

                        for (int i = 0; i < n.Children.Count; i++)
                        {
                            convert(n.Children[i]);
                        }
                    };

                convert(root_node as Data.NodeBase);
            }

            Root = root_node as Data.NodeRoot;
            Command.CommandManager.Clear();
            IsChanged = false;

            if (OnAfterLoad != null)
            {
                OnAfterLoad(null, null);
            }

            return true;
        }
Beispiel #13
0
        public void SaveDruzina(TreeNode tnode)
        {
            String file = tnode.Tag.ToString();

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.AppendChild(doc.CreateXmlDeclaration("1.0", "UTF-8", ""));

            System.Xml.XmlElement root = doc.CreateElement("druzina");
            System.Xml.XmlAttribute att = doc.CreateAttribute("nazev");
            att.Value = tnode.Text;
            root.Attributes.Append(att);

            foreach (TreeNode n in tnode.Nodes)
            {
                ((Postava)n.Tag).Save();
                System.Xml.XmlNode node = doc.CreateElement("postava");
                node.AppendChild(doc.CreateTextNode(((Postava)n.Tag).xmlFileName));
                root.AppendChild(node);
            }
            doc.AppendChild(root);

            doc.Save(file);
        }