Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var orders = new List <Product>();

        if (IsPostBack)
        {
            return;
        }
        var incrementId = Request.GetFriendlyUrlSegments()[0];

        lblNumOrdine.Text = incrementId;
        var orderDetail = _repository.GetOrderInfos(int.Parse(incrementId));
        var serializer  = new Conversive.PHPSerializationLibrary.Serializer();

        foreach (var orderProduct in orderDetail.items)
        {
            var deserializedProductOptionsBuyRequest = (Hashtable)serializer.Deserialize(orderProduct.product_options);
            var deserializedProductOptions           = (Hashtable)deserializedProductOptionsBuyRequest["info_buyRequest"];
            var p = new Product
            {
                product_id = (string)deserializedProductOptions["product_id"],
                price      = (string)deserializedProductOptions["price"],
                qty        = (string)deserializedProductOptions["qty"],
                name       = (string)deserializedProductOptions["name"],
                imageurl   = string.Empty
            };
            orders.Add(p);
        }
        BindOrderToForm(orderDetail);
        lvOrders.DataSource = orders;
        lvOrders.DataBind();
    }
    private static void phpDeserializer(string product_options)
    {
        Conversive.PHPSerializationLibrary.Serializer php = new Conversive.PHPSerializationLibrary.Serializer();
        Hashtable ht = (Hashtable)php.Deserialize(product_options);

        htDumper(ht);
        return;
    }
Ejemplo n.º 3
0
    private static Hashtable DeserializeOrderInfos(OrderProduct orderProduct)
    {
        // deserializza le informazioni ottenute
        var serializer = new Conversive.PHPSerializationLibrary.Serializer();
        var deserializedProductOptions = serializer.Deserialize(orderProduct.product_options) as Hashtable;

        if (deserializedProductOptions == null)
        {
            return(null);
        }
        var deserializedBuyRequest = deserializedProductOptions["info_buyRequest"] as Hashtable;

        if (deserializedBuyRequest == null)
        {
            return(null);
        }
        return(deserializedBuyRequest);
    }
Ejemplo n.º 4
0
Archivo: NNET.cs Proyecto: rj128x/PIMVC
        public void init(NNETMODEL name)
        {
            Serializer serializer=new Serializer();

            switch (name) {
                case NNETMODEL.vges_nb:
                    nnetObj = serializer.Deserialize(nnet.vges_nb);
                    break;
            }

            Hashtable nnetArr=nnetObj as Hashtable;
            l1c = this.readListListDouble(nnetArr["l1c"]);
            l2c = this.readListListDouble(nnetArr["l2c"]);
            l1w = this.readListListDouble(nnetArr["l1w"]);
            l2w = this.readListListDouble(nnetArr["l2w"]);
            l1b = this.readListDouble(nnetArr["l1b"]);
            l2b = this.readListDouble(nnetArr["l2b"]);
        }
        /// <summary>
        /// Packages up the Stats ArrayList (and other arguements) into a massive string of XML for
        /// the XMLRPC Post
        /// </summary>
        /// <param name="logFile">The log file.</param>
        /// <param name="mapName">Name of the map.</param>
        /// <param name="kills">The kills.</param>
        /// <param name="stats">The stats.</param>
        /// <param name="xmlRPCServer">The XML RPC server.</param>
        /// <param name="xmlRPCKey">The XML RPC key.</param>
        /// <param name="serverID">The server ID.</param>
        /// <returns>
        /// a 0 if everything is ok - any other number if not
        /// </returns>
        public int PackageStatsForXMLRPC(string logFile, string mapName, int kills, ArrayList stats, string xmlRPCServer, string xmlRPCKey, string serverID)
        {
            // ArrayList Players = new ArrayList();
            Hashtable players = new Hashtable();
            Serializer serializer = new Serializer();

            // Get Player List
            try
            {
                foreach (StatisticCollection stat in stats)
                {
                    /*Player ThisPlayer = new Player();
                    ThisPlayer.GamerName = Stat.GamerName;
                    ThisPlayer.SteamID = Stat.SteamID;*/

                    if (players.Contains(stat.SteamID))
                    {
                        // Skip it as its a duplicate
                    }
                    else
                    {
                        // Players.Add(Stat.SteamID, ThisPlayer);
                        //players.Add(stat.SteamID, System.Security.SecurityElement.Escape(stat.GamerName));
                        string GamerName = stat.GamerName.Replace("<", "");
                        GamerName = GamerName.Replace("\\", "&#92;");
                        players.Add(stat.SteamID, GamerName);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message.ToString());
            }

            string serializedPlayers = serializer.Serialize(players);

            // XML Post string
            string xmlString = "<L4DStats><GAME><MAP>"
                                + mapName +
                                "</MAP><KILLS>"
                                + kills +
                                "</KILLS><LOGPREFIX>"
                                + logFile +
                                "</LOGPREFIX><PLAYERS>"
                                + serializedPlayers +
                                "</PLAYERS><SERVERID>"
                                + serverID +
                                "</SERVERID><STATS>";

            foreach (StatisticCollection stat in stats)
            {
                xmlString += "<STAT><STEAMID>"
                                + stat.SteamID +
                                "</STEAMID><AREAID>"
                                + stat.AreaID +
                                "</AREAID><KILLED>" +
                                stat.KilledEntity +
                                "</KILLED><WEAPON>"
                                + stat.Weapon +
                                "</WEAPON><HEADSHOT>"
                                + stat.HeadShot +
                                "</HEADSHOT></STAT>\r\n";
            }

            xmlString += "</STATS></GAME></L4DStats>";

            Console.WriteLine("XML String POST Size: " + (xmlString.Length * 2));

            // Post the data
            Console.WriteLine("Performing XMLRPC Request via HTTP");
            string httpReturn = this.HttpPost(xmlRPCServer, xmlString, xmlRPCKey);

            // Evaluate the return - I could do proper XML evaluation but I cba
            if (httpReturn == "<L4DStats><ERR></ERR><SUCCESS>true</SUCCESS></L4DStats>")
            {
                Console.WriteLine("XMLRPC Post Successful\r\n");

                //Move the files
                this.MoveFiles();
            }
            else
            {
                Console.WriteLine("XMLRPC Post Failed\r\n");
                Console.WriteLine("Log Files have not been moved to old/\r\n");
                Console.WriteLine(httpReturn + "\r\n");
            }

            // tell everyone its ok
            return 0;
        }