Exemplo n.º 1
0
        /// <summary>
        ///     Aggregation用的$project和$order
        /// </summary>
        /// <returns></returns>
        public List <BsonDocument> GetAggregation()
        {
            //如果有改名的话,则其他没有改名的,也需要设定输出
            var projectAggr  = new BsonDocument();
            var suppressAggr = new BsonDocument();
            var project      = new BsonDocument();
            var suppress     = new BsonDocument();

            bool HasRename = false;

            foreach (var item in _mQueryFieldList)
            {
                var ctl = ((CtlFieldInfo)Controls.Find(item.ColName, true)[0]).QueryFieldItem;
                if (ctl.ColName == ConstMgr.KeyId)
                {
                    //id
                    if (!ctl.IsShow)
                    {
                        //id抑制
                        suppress.Add(new BsonElement(ConstMgr.KeyId, 0));
                    }
                }
                else
                {
                    //其他字段
                    if (ctl.IsShow)
                    {
                        if (string.IsNullOrEmpty(ctl.ProjectName))
                        {
                            project.Add(new BsonElement(ctl.ColName, 1));
                        }
                        else
                        {
                            project.Add(new BsonElement(ctl.ProjectName, "$" + ctl.ColName));
                            HasRename = true;
                        }
                    }
                    else
                    {
                        suppress.Add(new BsonElement(ctl.ColName, 0));
                    }
                }
            }
            var aggrDocList = new List <BsonDocument>();

            //如果有抑制操作和改名操作,则需要分开执行
            suppressAggr.Add(new BsonElement("$project", suppress));
            aggrDocList.Add(suppressAggr);

            if (!HasRename && suppress.Count() == 0)
            {
                //没有改名和抑制的时候,则project全部去除
                project.Clear();
            }

            projectAggr.Add(new BsonElement("$project", project));
            aggrDocList.Add(projectAggr);
            return(aggrDocList);
        }
Exemplo n.º 2
0
        private static void PromoteQueryToDollarAndForm(BsonDocument query, BsonElement clause)
        {
            var clauses = new BsonArray();

            foreach (var queryElement in query)
            {
                clauses.Add(new BsonDocument(queryElement));
            }
            clauses.Add(new BsonDocument(clause));
            query.Clear();
            query.Add("$and", clauses);
        }
Exemplo n.º 3
0
 protected override void UpdateDocument(BsonDocument document, Func<BsonDocument, UpdateCompiler> update)
 {
     var copy = document.DeepClone();
     try
     {
         update(document);
     }
     catch
     {
         document.Clear();
         document.AddRange(copy.AsBsonDocument);
         throw;
     }
 }
Exemplo n.º 4
0
        protected override void UpdateDocument(BsonDocument document, Func <BsonDocument, UpdateCompiler> update)
        {
            var copy = document.DeepClone();

            try
            {
                update(document);
            }
            catch
            {
                document.Clear();
                document.AddRange(copy.AsBsonDocument);
                throw;
            }
        }
Exemplo n.º 5
0
        protected override void UpdateDocument(BsonDocument document, Func <BsonDocument, UpdateCompiler> update)
        {
            var oldId = document[MyValue.Id];
            var copy  = document.DeepClone();

            try
            {
                update(document);

                BsonValue newId;
                if (!document.TryGetValue(MyValue.Id, out newId) || !oldId.Equals(newId))
                {
                    throw new InvalidOperationException("Modification of _id is not allowed.");
                }
            }
            catch
            {
                document.Clear();
                document.AddRange(copy.AsBsonDocument);
                throw;
            }
        }
Exemplo n.º 6
0
        public override async ETTask Run()
        {
            DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>();

            try
            {
                BsonDocument bsons     = BsonSerializer.Deserialize <BsonDocument>(this.Json);
                string       QueryJson = bsons["QueryJson"].ToJson();
                var          set       = bsons["UpdateJson"];
                bsons.Clear();
                bsons["$set"] = set;
                string UpdateJson = bsons.ToJson();
                FilterDefinition <ComponentWithId> queryFilter  = new JsonFilterDefinition <ComponentWithId>(QueryJson);
                UpdateDefinition <ComponentWithId> updateFilter = new JsonUpdateDefinition <ComponentWithId>(UpdateJson);
                await dbComponent.GetCollection(this.CollectionName).UpdateOneAsync(queryFilter, updateFilter);

                this.Tcs.SetResult();
            }
            catch (Exception e)
            {
                this.Tcs.SetException(new Exception($"更改数据库异常! {CollectionName} {this.Json}", e));
            }
        }
 private static void PromoteQueryToDollarAndForm(BsonDocument query, BsonElement clause)
 {
     var clauses = new BsonArray();
     foreach (var queryElement in query)
     {
         clauses.Add(new BsonDocument(queryElement));
     }
     clauses.Add(new BsonDocument(clause));
     query.Clear();
     query.Add("$and", clauses);
 }
 public void TestClear()
 {
     var document = new BsonDocument("x", 1);
     Assert.AreEqual(1, document.ElementCount);
     document.Clear();
     Assert.AreEqual(0, document.ElementCount);
 }
Exemplo n.º 9
0
        private void ReciveMonetize(object sender, DependencyPropertyChangedEventArgs e)
        {
            if ((sender as Grid).Visibility == Visibility.Visible)
            {
                SDK.SDK_PageDashboards.DashboardGame.PageStudios.ReciveMonetize(
                    result =>
                {
                    //Fill Payment
                    ContentPlacePay.Children.Clear();
                    foreach (var item in result["PaymentList"].AsBsonArray)
                    {
                        ContentPlacePay.Children.Add(new ModelPayment(item.AsBsonDocument));
                    }

                    //fill CurentMonetiz  & Frist monetiz
                    CurentMonetiz.Clear();
                    FristMonetiz.Clear();
                    foreach (var item in result)
                    {
                        CurentMonetiz.Add(item.Name, item.Value);

                        FristMonetiz.Add(item.Name, item.Value);
                    }

                    NewMonetiz = new BsonDocument
                    {
                        { "Players", 0 },
                        { "Leaderboards", 0 },
                        { "Apis", 0 },
                        { "Studios", 0 },
                        { "Logs", 0 },
                        { "Cash", 0 }
                    };

                    ReChange();
                    Cheackcash();

                    //frist insert
                    void ReChange()
                    {
                        //players
                        if (result["Players"].AsInt32 <= 999)
                        {
                            TextPlayerValue.Text = result["Players"].ToString();
                        }
                        else if (result["Players"].AsInt32 >= 1000 && result["Players"].AsInt32 <= 999999)
                        {
                            TextPlayerValue.Text = (result["Players"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Players"].AsInt32 >= 1000000)
                        {
                            TextPlayerValue.Text = (result["Players"].AsInt32 / 1000000).ToString() + "M";
                        }

                        //Leaderboard
                        if (result["Leaderboards"].AsInt32 <= 999)
                        {
                            TextLeaderboardsValue.Text = result["Leaderboards"].ToString();
                        }
                        else if (result["Leaderboards"].AsInt32 >= 1000 && result["Leaderboards"].AsInt32 <= 999999)
                        {
                            TextLeaderboardsValue.Text = (result["Leaderboards"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Leaderboards"].AsInt32 >= 1000000)
                        {
                            TextLeaderboardsValue.Text = (result["Players"].AsInt32 / 1000000).ToString() + "M";
                        }

                        //Apis
                        if (result["Apis"].AsInt32 <= 999)
                        {
                            TextApisValue.Text = result["Apis"].ToString();
                        }
                        else if (result["Apis"].AsInt32 >= 1000 && result["Apis"].AsInt32 <= 999999)
                        {
                            TextApisValue.Text = (result["Apis"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Apis"].AsInt32 >= 1000000)
                        {
                            TextApisValue.Text = (result["Apis"].AsInt32 / 1000000).ToString() + "M";
                        }

                        //Studios
                        if (result["Studios"].AsInt32 <= 999)
                        {
                            TextStudiosValue.Text = result["Studios"].ToString();
                        }
                        else if (result["Studios"].AsInt32 >= 1000 && result["Studios"].AsInt32 <= 999999)
                        {
                            TextStudiosValue.Text = (result["Studios"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Studios"].AsInt32 >= 1000000)
                        {
                            TextStudiosValue.Text = (result["Studios"].AsInt32 / 1000000).ToString() + "M";
                        }

                        //Logs
                        if (result["Logs"].AsInt32 <= 999)
                        {
                            TextLogsValue.Text = result["Logs"].ToString();
                        }
                        else if (result["Logs"].AsInt32 >= 1000 && result["Logs"].AsInt32 <= 999999)
                        {
                            TextLogsValue.Text = (result["Logs"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Logs"].AsInt32 >= 1000000)
                        {
                            TextLogsValue.Text = (result["Logs"].AsInt32 / 1000000).ToString() + "M";
                        }


                        TextCash.Text = result["Cash"].AsInt32.ToString("#,##0") + " T";

                        if (result["Cash"] <= 0)
                        {
                            TextNoCash.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            TextNoCash.Visibility = Visibility.Collapsed;
                        }

                        Cheackcash();
                    }
                },
                    () =>
                {
                    DashboardGame.Notifaction("Faild Recive", Notifaction.StatusMessage.Error);
                });
            }
        }
Exemplo n.º 10
0
        public PageSetting()
        {
            InitializeComponent();
            CurentPage      = PageSettings;
            CurentBTNHeader = BTNSetting;

            //fill frist Setting
            TextName.Text     = SettingUser.CurentDetailStudio["Name"].ToString();
            TextType.Text     = SettingUser.CurentDetailStudio["Type"].ToString();
            TextToken.Text    = SettingUser.CurentDetailStudio["Token"].ToString();
            TextCreator.Text  = SettingUser.CurentDetailStudio["Creator"].ToString();
            TextCreated.Text  = SettingUser.CurentDetailStudio["Created"].ToLocalTime().ToString();
            TextDatabase.Text = SettingUser.CurentDetailStudio["Database"].ToString();



            //action btn
            BTNPlayer.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Players"] = CurentMonetiz["Players"].AsInt32 + 1000;
                    NewMonetiz["Players"]    = NewMonetiz["Players"].AsInt32 + 1000;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 10000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 10000;

                    BTNRevite.Visibility = Visibility.Visible;
                }

                Cheackcash();
                RechangeNew();
            };

            BTNLeaderboards.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Leaderboards"] = CurentMonetiz["Leaderboards"].AsInt32 + 1;

                    NewMonetiz["Leaderboards"] = NewMonetiz["Leaderboards"].AsInt32 + 1;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 10000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 10000;

                    BTNRevite.Visibility = Visibility.Visible;
                }
                Cheackcash();
                RechangeNew();
            };

            BTNAPIs.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Apis"] = CurentMonetiz["Apis"].AsInt32 + 3000;

                    NewMonetiz["Apis"] = NewMonetiz["Apis"].AsInt32 + 3000;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 20000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 20000;


                    BTNRevite.Visibility = Visibility.Visible;
                }
                Cheackcash();
                RechangeNew();
            };

            BTNStudio.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Studios"] = CurentMonetiz["Studios"].AsInt32 + 1;

                    NewMonetiz["Studios"] = NewMonetiz["Studios"].AsInt32 + 1;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 60000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 60000;


                    BTNRevite.Visibility = Visibility.Visible;
                }
                Cheackcash();
                RechangeNew();
            };

            BTNLogs.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Logs"] = CurentMonetiz["Logs"].AsInt32 + 100;

                    NewMonetiz["Logs"] = NewMonetiz["Logs"].AsInt32 + 100;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 30000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 30000;


                    BTNRevite.Visibility = Visibility.Visible;
                }

                Cheackcash();
                RechangeNew();
            };


            BTNRevite.MouseDown += (s, obj) =>
            {
                NewMonetiz = new BsonDocument
                {
                    { "Players", 0 },
                    { "Leaderboards", 0 },
                    { "Apis", 0 },
                    { "Studios", 0 },
                    { "Logs", 0 },
                    { "Cash", 0 }
                };

                //change curentmonetize to defult
                CurentMonetiz.Clear();
                foreach (var item in FristMonetiz)
                {
                    CurentMonetiz.Add(item.Name, item.Value);
                }

                BTNRevite.Visibility = Visibility.Collapsed;

                Cheackcash();
                RechangeNew();

                TextPlayerNewValue.Text       = "";
                TextLeaderboardsNewValue.Text = "";
                TextApisNewValue.Text         = "";
                TextStudiosNewValue.Text      = "";
                TextLogsNewValue.Text         = "";
            };


            BTNPay.MouseDown += async(s, obj) =>
            {
                if (NewMonetiz == CurentMonetiz)
                {
                    DashboardGame.Notifaction("Not Change", StatusMessage.Warrning);
                }
                else
                {
                    if (await DashboardGame.DialogYesNo($"\" {NewMonetiz["Cash"].AsInt32.ToString("#,##0") } \" Tomans will be deducted from your account credit \n Are you sure ? ") == MessageBoxResult.Yes)
                    {
                        var Detail = new BsonDocument
                        {
                            { "Leaderboards", NewMonetiz["Leaderboards"].AsInt32 + CurentMonetiz["Leaderboards"].AsInt32 },
                            { "Apis", NewMonetiz["Apis"].AsInt32 + CurentMonetiz["Apis"].AsInt32 },
                            { "Studios", NewMonetiz["Studios"].AsInt32 + CurentMonetiz["Studios"].AsInt32 },
                            { "Logs", NewMonetiz["Logs"].AsInt32 + CurentMonetiz["Logs"].AsInt32 },
                            { "Players", NewMonetiz["Players"].AsInt32 + CurentMonetiz["Players"].AsInt32 },
                            { "Creator", SettingUser.CurentDetailStudio["Creator"] },
                            { "Cash", CurentMonetiz["Cash"].AsInt32 }
                        };


                        SDK.SDK_PageDashboards.DashboardGame.PageStudios.AddPayment(Detail, ResultPay =>
                        {
                            if (ResultPay)
                            {
                                DashboardGame.Notifaction("Tanks for buy", StatusMessage.Ok);
                                ReciveMonetize(PageMonetiz, new DependencyPropertyChangedEventArgs());

                                TextPlayerNewValue.Text       = "";
                                TextLeaderboardsNewValue.Text = "";
                                TextApisNewValue.Text         = "";
                                TextStudiosNewValue.Text      = "";
                                TextLogsNewValue.Text         = "";
                                TextTomanNumber.Text          = "0";
                                BTNRevite.Visibility          = Visibility.Collapsed;
                            }
                            else
                            {
                                DashboardGame.Notifaction("Fail Pay", StatusMessage.Error);
                            }
                        });
                    }
                    else
                    {
                        DashboardGame.Notifaction("Reject Pay", StatusMessage.Error);
                    }
                }
            };
        }
Exemplo n.º 11
0
 public void Clear()
 {
     _document.Clear();
 }
Exemplo n.º 12
0
 public void Clear()
 {
     Bson.Clear();
     Set.Clear();
     Unset.Clear();
 }
Exemplo n.º 13
0
        public static string Clientinfosender(string databaseip, string databaseport, string mac, string uremail, string uremailpass, string adminemail, string databseusername, string databasepass)
        {
            float[] driveinfo = new float[100];
            int     cputotal  = 0;
            float   ramtotal  = 0;

            float[]      totalRNET = new float[100];
            float[]      totalSNET = new float[100];
            bool         error     = false;
            BsonDocument doc       = new BsonDocument();

            doc.Clear();
            int i = 0;
            int b = 0;

            //NETWORK USAGE
            foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces().Where(nic => nic.OperationalStatus == OperationalStatus.Up))
            {
                totalRNET[i] = -(float)(ni.GetIPv4Statistics().BytesReceived) / (1024 * 1024);
                totalSNET[i] = -(float)(ni.GetIPv4Statistics().BytesSent) / (1024 * 1024);
                i++;
            }
            for (int c = 3; c != 0; c--)
            {
                cputotal += cpu();
                ramtotal += ram();
                Thread.Sleep(10000);
            }
            cputotal = cputotal / 3;
            ramtotal = ramtotal / 3;
            //NETWORK USAGE AGAIN FOR CALCULATE PER MIN
            foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces().Where(nic => nic.OperationalStatus == OperationalStatus.Up))
            {
                totalRNET[b] += (float)(ni.GetIPv4Statistics().BytesReceived) / (1024 * 1024);
                totalSNET[b] += (float)(ni.GetIPv4Statistics().BytesSent) / (1024 * 1024);
                if (totalRNET[b] != 0 || totalSNET[b] != 0)
                {
                    doc.Add(new BsonElement("Interface" + b, ni.Description));
                    doc.Add(new BsonElement("MBytes Sent for Interface " + b, totalSNET[b]));
                    doc.Add(new BsonElement("MBytes Rec for Interface" + b, totalRNET[b]));
                    if (totalRNET[b] > 100 || totalSNET[b] > 100)
                    {
                        error = true;
                    }
                }
                b++;
            }
            //GET DRIVETINFO
            foreach (DriveInfo drive in DriveInfo.GetDrives())
            {
                try
                {
                    if (drive.TotalFreeSpace != 0)
                    {
                        doc.Add(new BsonElement(drive.Name + "free space(GB): ", (drive.TotalFreeSpace) / 1e9));
                    }
                }
                catch { }
            }
            doc.Add(new BsonElement("total cpu usage: ", cputotal));
            doc.Add(new BsonElement("total free ram(MB): ", ramtotal));
            if (cputotal > 65 || ramtotal < 1000 || error)
            {
                var            dbClient             = new MongoClient("mongodb://" + databseusername + ":" + databasepass + "@" + databaseip + ":" + databaseport + "/admin");
                IMongoDatabase monitoringdatabase   = dbClient.GetDatabase("monitoring");
                var            monitoringcollection = monitoringdatabase.GetCollection <BsonDocument>(mac);
                monitoringcollection.InsertOne(doc);
                Console.WriteLine("send data");
                if (cputotal > 95 || ramtotal < 10)
                {
                    try
                    {
                        infosender.CreateTestMessage2(mac, doc, uremail, uremailpass, adminemail);
                        Console.WriteLine("send mail to admin");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Itry to send mail to my admin but I cant the error is :" + ex.GetType().ToString());
                    }
                }
                IMongoDatabase commandsdatabase  = dbClient.GetDatabase("commands");
                var            commadscollection = commandsdatabase.GetCollection <BsonDocument>(mac);
                var            filter            = Builders <BsonDocument> .Filter.Eq("name", "server");

                var    servercommand  = commadscollection.Find(filter).FirstOrDefault();
                string servercommand1 = servercommand.ElementAt(2).Value.ToString();
                var    update         = Builders <BsonDocument> .Update.Set("command", "");

                commadscollection.UpdateOne(filter, update);
                Console.WriteLine("system isnt stayble and i send info to database and check buffer for command i find: " + servercommand1);
                return(servercommand1);
            }
            else
            {
                Console.WriteLine("system stable");
                var dbClient = new MongoClient("mongodb://" + databseusername + ":" + databasepass + "@" + databaseip + ":" + databaseport + "/admin");
                ////create collection
                IMongoDatabase commandsdatabase = dbClient.GetDatabase("commands");
                ////creat Mac object
                var commadscollection = commandsdatabase.GetCollection <BsonDocument>(mac);
                var filter            = Builders <BsonDocument> .Filter.Eq("name", "server");

                var servercommand = commadscollection.Find(filter).FirstOrDefault();
                try
                {
                    string servercommand1 = servercommand.ElementAt(2).Value.ToString();
                    var    update         = Builders <BsonDocument> .Update.Set("command", "");

                    commadscollection.UpdateOne(filter, update);
                    Console.WriteLine("infoseder check buffer and find: " + servercommand1);
                    return(servercommand1);
                }
                catch
                {
                    Console.WriteLine("cant find and check buffer");
                    return(null);
                }
            }
        }
        public void HandleImageAttachmentCompletedSync(object args)
        {
            ImageAttachmentEventArgs evt = (ImageAttachmentEventArgs)args;

            if (evt.Attachment.type != AttachmentType.image || evt.Meta != ImageMeta.Origin)
            {
                return;
            }

            try
            {
                ThumbnailInfo small;
                ThumbnailInfo large;
                ThumbnailInfo square;
                string        origImgObjectId = evt.Attachment.object_id;

                using (Bitmap origImage = BuildBitmap(evt.Attachment.RawData))
                {
                    // release raw data immediately
                    evt.Attachment.RawData = new ArraySegment <byte>();

                    small = MakeThumbnail(origImage, ImageMeta.Small, evt.Attachment.Orientation,
                                          origImgObjectId, evt.Driver, evt.Attachment.file_name);
                    large = MakeThumbnail(origImage, ImageMeta.Large, evt.Attachment.Orientation,
                                          origImgObjectId, evt.Driver, evt.Attachment.file_name);
                    square = MakeThumbnail(origImage, ImageMeta.Square, evt.Attachment.Orientation,
                                           origImgObjectId, evt.Driver, evt.Attachment.file_name);
                }

                Attachment update = new Attachment
                {
                    object_id  = evt.Attachment.object_id,
                    image_meta = new ImageProperty
                    {
                        small  = small,
                        large  = large,
                        square = square
                    }
                };

                BsonDocument doc = AttachmentCollection.Instance.FindOneAs <BsonDocument>(
                    Query.EQ("_id", origImgObjectId));
                doc.DeepMerge(update.ToBsonDocument());
                AttachmentCollection.Instance.Save(doc);
                doc.Clear();
                doc = null;

                UpstreamThumbnail(small, evt.Attachment.group_id, evt.Attachment.object_id,
                                  ImageMeta.Small, evt.UserApiKey, evt.UserSessionToken);
                UpstreamThumbnail(large, evt.Attachment.group_id, evt.Attachment.object_id,
                                  ImageMeta.Large, evt.UserApiKey, evt.UserSessionToken);
                UpstreamThumbnail(square, evt.Attachment.group_id, evt.Attachment.object_id,
                                  ImageMeta.Square, evt.UserApiKey, evt.UserSessionToken);


                long newValue = Interlocked.Add(ref g_counter, 1L);
                if (newValue % 5 == 0)
                {
                    GC.Collect();
                }
            }
            catch (Exception e)
            {
                logger.Warn("Image attachment post processing unsuccess", e);
            }
        }
        public static void CreateTerminalprocess(string databaseip, string databaseport, string mac, string uremail, string uremailpass, string adminemail, string databseusername, string databasepass)
        {
            while (true)
            {
                string inputText = client.infosender.Clientinfosender(databaseip, databaseport, mac, uremail, uremailpass, adminemail, databseusername, databasepass);
                if (!String.IsNullOrEmpty(inputText))
                {
                    Process Terminalprocess = new Process();
                    Terminalprocess.StartInfo.FileName               = "/bin/bash";
                    Terminalprocess.StartInfo.UseShellExecute        = false;
                    Terminalprocess.StartInfo.RedirectStandardOutput = true;
                    Terminalprocess.StartInfo.RedirectStandardError  = true;
                    sendOutput     = new StringBuilder();
                    senderrOutput1 = new StringBuilder();
                    Terminalprocess.OutputDataReceived += SendOutputHandler;
                    Terminalprocess.ErrorDataReceived  += SenderrOutputHandler1;
                    Terminalprocess.StartInfo.RedirectStandardInput = true;
                    Terminalprocess.Start();
                    StreamWriter StreamWriter = Terminalprocess.StandardInput;
                    Terminalprocess.BeginOutputReadLine();
                    Terminalprocess.BeginErrorReadLine();
                    BsonDocument doc = new BsonDocument();
                    while (true)
                    {
                        doc.Add(new BsonElement("name", "client"));
                        doc.Add(new BsonElement("command", inputText));
                        sendOutput.Clear();
                        senderrOutput1.Clear();
                        try
                        {
                            Console.WriteLine(inputText);
                            StreamWriter.WriteLine(inputText);
                        }
                        catch
                        {
                            var dbClient1 = new MongoClient("mongodb://" + databseusername + ":" + databasepass + "@" + databaseip + ":" + databaseport + "/admin");
                            ////create collection
                            IMongoDatabase respondsdatabase1 = dbClient1.GetDatabase("responds");
                            ////creat Mac object
                            var respondscollection1 = respondsdatabase1.GetCollection <BsonDocument>(mac);
                            doc.Add(new BsonElement("respond", "i cant run ur command!"));
                            Console.WriteLine("i cant run ur command!");
                            respondsdatabase1.DropCollection(mac);
                            respondscollection1.InsertOne(doc);
                            doc.Clear();
                            StreamWriter.Close();
                            Terminalprocess.Kill();
                            Terminalprocess.Close();
                            break;
                        }
                        Thread.Sleep(3000);
                        if (!String.IsNullOrEmpty(sendOutput.ToString()))
                        {
                            using (StringReader reader = new StringReader(sendOutput.ToString()))
                            {
                                string line = string.Empty;
                                int    i    = 0;
                                do
                                {
                                    line = reader.ReadLine();
                                    if (line != null)
                                    {
                                        doc.Add(new BsonElement("outputline: " + i.ToString(), line));
                                        i++;
                                    }
                                } while (line != null);
                            }
                        }
                        if (!String.IsNullOrEmpty(senderrOutput1.ToString()))
                        {
                            using (StringReader reader = new StringReader(senderrOutput1.ToString()))
                            {
                                string line = string.Empty;
                                int    i    = 0;
                                do
                                {
                                    line = reader.ReadLine();
                                    if (line != null)
                                    {
                                        doc.Add(new BsonElement("erroroutputline: " + i.ToString(), line));
                                        i++;
                                    }
                                } while (line != null);
                            }
                        }
                        if (String.IsNullOrEmpty(sendOutput.ToString()) && String.IsNullOrEmpty(senderrOutput1.ToString()))
                        {
                            doc.Add(new BsonElement("respond", "ur command havent any output"));
                        }
                        var            dbClient           = new MongoClient("mongodb://" + databseusername + ":" + databasepass + "@" + databaseip + ":" + databaseport + "/admin");
                        IMongoDatabase respondsdatabase   = dbClient.GetDatabase("responds");
                        var            respondscollection = respondsdatabase.GetCollection <BsonDocument>(mac);
                        respondsdatabase.DropCollection(mac);
                        Console.WriteLine(doc);
                        respondscollection.InsertOne(doc);
                        doc.Clear();
                        IMongoDatabase commandsdatabase  = dbClient.GetDatabase("commands");
                        var            commadscollection = commandsdatabase.GetCollection <BsonDocument>(mac);
                        var            filter            = Builders <BsonDocument> .Filter.Eq("name", "server");

                        while (true)
                        {
                            var servercommand = commadscollection.Find(filter).FirstOrDefault();
                            inputText = servercommand.ElementAt(2).Value.ToString();
                            if (inputText != "")
                            {
                                var update = Builders <BsonDocument> .Update.Set("command", "");

                                commadscollection.UpdateOne(filter, update);
                                break;
                            }
                            Thread.Sleep(2000);
                        }
                        if (inputText == "mykill")
                        {
                            doc.Add(new BsonElement("name", "client"));
                            doc.Add(new BsonElement("command", inputText));
                            doc.Add(new BsonElement("respond", "ok, client return to normal state bye "));
                            respondsdatabase.DropCollection(mac);
                            respondscollection.InsertOne(doc);
                            doc.Clear();
                            StreamWriter.Close();
                            Terminalprocess.Kill();
                            Terminalprocess.Close();
                            inputText = null;
                            break;
                        }
                    }
                }
            }
        }
        private static BsonDocument processDetailPage(string url, BufferBlock<string> imageBlock)
        {
            Console.WriteLine("starting process: " + url + "....");
            var doc = WebpageHelper.GetHttpRequestDocument(url);
            var titleNode = doc.DocumentNode.SelectSingleNode("//div[@class='article-title']");
            if (titleNode == null)
                return null;
            bson.Clear();
            bson.Add("link", url);
            var titleNameNode = titleNode.SelectSingleNode(".//div[@class='h24']");
            if (titleNameNode != null)
            {
                bson.Add("title", titleNameNode.InnerText.Replace("\t", "")); //规格化文字,TODO 未完成
            }
            var titleSubItemsNodes = titleNode.SelectNodes(".//div[@class='sub']/span[@class='sub-item']");
            if(titleSubItemsNodes==null)
            {
                return null;
            }
            var subTitleList = new BsonArray();
            foreach (var subItemNode in titleSubItemsNodes)
            {
                if (subItemNode.SelectSingleNode(".//div[@class='en']") != null) //日期的要单独处理
                {
                    var dateNode = subItemNode.SelectSingleNode(".//div[@class='en'");
                    subTitleList.Add(dateNode.InnerText);
                }
                else
                {
                    subTitleList.Add(subItemNode.InnerText);
                }
            }
            bson.Add("subtitle", subTitleList);

            //开始读取内容
            var contentList = new BsonArray();
            var contentNodes = doc.DocumentNode.SelectNodes("//div[@class='article-cont']/p");
            if(contentNodes==null)
            {
                return null;
            }
            foreach (var node in contentNodes)
            {
                var lineDic = new BsonDocument();
                var picNode = node.SelectSingleNode(".//img");
                if (picNode != null)
                {
                    var imgUrl = WebpageHelper.GetSubUrl(picNode.Attributes["src"].Value);
                    lineDic["type"] = "img";
                    lineDic["content"] = imgUrl;
                    lineDic["compressImg"] = WebImageSaver.Instance.GetComressImageName(imgUrl);
                    imageBlock.Post(GetIhChina.MainPage + picNode.Attributes["src"].Value);
                }
                else
                {
                    lineDic["type"] = "text";
                    lineDic["content"] = node.InnerText;
                }
                contentList.Add(lineDic);
            }
            bson.Add("content", contentList);
            var authorNode = doc.DocumentNode.SelectSingleNode("//div[@class='author']");
            if (authorNode != null)
            {
                bson.Add("author", authorNode.InnerText);
            }
            //爬取底部相关阅读
            var relativeNews = doc.DocumentNode.SelectNodes("//div[@class='list-mod4']/a");
            if (relativeNews != null)
            {
                var relativeNewsList = new BsonArray();
                foreach (var node in relativeNews)
                {
                    var newsDic = new BsonDocument();
                    newsDic["link"] = node.Attributes["href"].Value;
                    var date = node.SelectSingleNode(".//div[@class='date']");
                    if (date != null)
                    {
                        newsDic["date"] = date.InnerText;
                    }
                    var title = node.SelectSingleNode(".//div[@class='p']");
                    if (title != null)
                    {
                        newsDic["title"] = title.InnerText;
                    }
                    relativeNewsList.Add(newsDic);
                }
                if (relativeNewsList.Count > 0)
                {
                    bson.Add("relativeNews", relativeNewsList);
                }
            }
            Console.WriteLine(bson);
            return bson;
        }
Exemplo n.º 17
0
        protected override void UpdateDocument(BsonDocument document, Func<BsonDocument, UpdateCompiler> update)
        {
            var oldId = document[MyValue.Id];
            var copy = document.DeepClone();
            try
            {
                update(document);

                BsonValue newId;
                if (!document.TryGetValue(MyValue.Id, out newId) || !oldId.Equals(newId))
                    throw new InvalidOperationException("Modification of _id is not allowed.");
            }
            catch
            {
                document.Clear();
                document.AddRange(copy.AsBsonDocument);
                throw;
            }
        }
Exemplo n.º 18
0
 public void Clear()
 {
     _bsonDocument.Clear();
 }
Exemplo n.º 19
0
        /// <summary>
        ///     Aggregation用的$project和$order
        /// </summary>
        /// <returns></returns>
        public List<BsonDocument> GetAggregation()
        {
            //如果有改名的话,则其他没有改名的,也需要设定输出
            var projectAggr = new BsonDocument();
            var suppressAggr = new BsonDocument();
            var project = new BsonDocument();
            var suppress = new BsonDocument();

            bool HasRename = false;

            foreach (var item in _mQueryFieldList)
            {
                var ctl = ((CtlFieldInfo)Controls.Find(item.ColName, true)[0]).QueryFieldItem;
                if (ctl.ColName == ConstMgr.KeyId)
                {
                    //id
                    if (!ctl.IsShow)
                    {
                        //id抑制
                        suppress.Add(new BsonElement(ConstMgr.KeyId, 0));
                    }
                }
                else
                {
                    //其他字段
                    if (ctl.IsShow)
                    {
                        if (string.IsNullOrEmpty(ctl.ProjectName))
                        {
                            project.Add(new BsonElement(ctl.ColName, 1));
                        }
                        else
                        {
                            project.Add(new BsonElement(ctl.ProjectName, "$" + ctl.ColName));
                            HasRename = true;
                        }
                    }
                    else
                    {
                        suppress.Add(new BsonElement(ctl.ColName, 0));
                    }
                }
            }
            var aggrDocList = new List<BsonDocument>();
            //如果有抑制操作和改名操作,则需要分开执行
            suppressAggr.Add(new BsonElement("$project", suppress));
            aggrDocList.Add(suppressAggr);

            if (!HasRename && suppress.Count() == 0)
            {
                //没有改名和抑制的时候,则project全部去除
                project.Clear();
            }

            projectAggr.Add(new BsonElement("$project", project));
            aggrDocList.Add(projectAggr);
            return aggrDocList;
        }
Exemplo n.º 20
0
        public PageSetting()
        {
            InitializeComponent();
            CurentPage      = PageSettings;
            CurentBTNHeader = BTNSetting;

            #region PageSetting
            //fill frist Setting
            TextName.Text     = SettingUser.CurentDetailStudio["Name"].ToString();
            TextType.Text     = SettingUser.CurentDetailStudio["Type"].ToString();
            TextID.Text       = SettingUser.CurentDetailStudio["Token"].ToString();
            TextToken.Text    = SettingUser.CurentDetailStudio["Creator"].ToString();
            TextCreated.Text  = SettingUser.CurentDetailStudio["Created"].ToLocalTime().ToString();
            TextDatabase.Text = SettingUser.CurentDetailStudio["Database"].ToString();

            //copys
            TextToken.MouseDown    += GlobalEvents.CopyText;
            TextDatabase.MouseDown += GlobalEvents.CopyText;
            TextID.MouseDown       += GlobalEvents.CopyText;

            //action btn state
            BTNState.MouseDown += (s, e) =>
            {
                SDK.SDK_PageDashboards.DashboardGame.PageStudios.Status(
                    result =>
                {
                    var Text = "";
                    foreach (var item in result)
                    {
                        Text += item.Name + ": " + item.Value.ToString() + "\n";
                    }

                    DashboardGame.Dialog(Text, "Server State");
                },
                    () =>
                {
                    DashboardGame.Notifaction("Faild Recive", StatusMessage.Error);
                });
            };
            //action btn update
            BTNUpdate.MouseDown += (s, e) =>
            {
                DashboardGame.Dashboard.Root.Children.Add(new SubPageUpdate.SubPageUpdate());
            };

            //action btn generateNew token
            BTNGeneretNewToken.MouseDown += async(s, e) =>
            {
                BTNGeneretNewToken.IsEnabled = false;

                if (await DashboardGame.DialogYesNo("Changing the current token causes a change in all studios \n are you sure ? ") == MessageBoxResult.Yes)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageStudios.GenerateNewToken(Result =>
                    {
                        if (Result)
                        {
                            DashboardGame.Notifaction("Token changed For more security please log in again", StatusMessage.Ok);

                            DashboardGame.Dashboard.Root.Children.Remove(this);
                            DashboardGame.Dashboard.Root.Children.Add(new Login());
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Change", StatusMessage.Error);
                            BTNGeneretNewToken.IsEnabled = true;
                        }
                    });
                }
                else
                {
                    BTNGeneretNewToken.IsEnabled = true;
                }
            };
            #endregion


            #region Page Monetize

            BTNPlayer.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Players"] = CurentMonetiz["Players"].AsInt32 + 1000;
                    NewMonetiz["Players"]    = NewMonetiz["Players"].AsInt32 + 1000;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 10000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 10000;

                    BTNRevite.Visibility = Visibility.Visible;
                }

                Cheackcash();
                RechangeNew();
            };

            BTNLeaderboards.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Leaderboards"] = CurentMonetiz["Leaderboards"].AsInt32 + 1;

                    NewMonetiz["Leaderboards"] = NewMonetiz["Leaderboards"].AsInt32 + 1;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 10000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 10000;

                    BTNRevite.Visibility = Visibility.Visible;
                }
                Cheackcash();
                RechangeNew();
            };

            BTNAPIs.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Apis"] = CurentMonetiz["Apis"].AsInt32 + 3000;

                    NewMonetiz["Apis"] = NewMonetiz["Apis"].AsInt32 + 3000;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 20000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 20000;


                    BTNRevite.Visibility = Visibility.Visible;
                    Debug.WriteLine(CurentMonetiz.ToString());
                }
                Cheackcash();
                RechangeNew();
            };

            BTNLogs.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Logs"] = CurentMonetiz["Logs"].AsInt32 + 100;

                    NewMonetiz["Logs"] = NewMonetiz["Logs"].AsInt32 + 100;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 30000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 30000;


                    BTNRevite.Visibility = Visibility.Visible;
                }

                Cheackcash();
                RechangeNew();
            };

            BTNAddAchievements.MouseDown += (s, e) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Achievements"] = CurentMonetiz["Achievements"].AsInt32 + 2;

                    NewMonetiz["Achievements"] = NewMonetiz["Achievements"].AsInt32 + 2;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 10000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 10000;


                    BTNRevite.Visibility = Visibility.Visible;
                }

                Cheackcash();
                RechangeNew();
            };

            BTNRevite.MouseDown += (s, obj) =>
            {
                NewMonetiz = new BsonDocument
                {
                    { "Players", 0 },
                    { "Leaderboards", 0 },
                    { "Apis", 0 },
                    { "Achievements", 0 },
                    { "Logs", 0 },
                    { "Cash", 0 }
                };

                //change curentmonetize to defult
                CurentMonetiz.Clear();
                foreach (var item in FristMonetiz)
                {
                    CurentMonetiz.Add(item.Name, item.Value);
                }

                BTNRevite.Visibility = Visibility.Collapsed;

                Cheackcash();
                RechangeNew();

                TextPlayerNewValue.Text       = "";
                TextLeaderboardsNewValue.Text = "";
                TextApisNewValue.Text         = "";
                TextLogsNewValue.Text         = "";
                TextAchievementsNewValue.Text = "";
            };

            //acatin btn pay/save
            BTNPay.MouseDown += async(s, obj) =>
            {
                if (NewMonetiz == CurentMonetiz)
                {
                    DashboardGame.Notifaction("Not Change", StatusMessage.Warrning);
                }
                else
                {
                    if (await DashboardGame.DialogYesNo($"\" {NewMonetiz["Cash"].AsInt32.ToString("#,##0") } \" Tomans will be deducted from your account credit \n Are you sure ? ") == MessageBoxResult.Yes)
                    {
                        var Detail = new BsonDocument
                        {
                            { "Leaderboards", CurentMonetiz["Leaderboards"].AsInt32 },
                            { "Apis", CurentMonetiz["Apis"].AsInt32 },
                            { "Logs", CurentMonetiz["Logs"].AsInt32 },
                            { "Achievements", CurentMonetiz["Achievements"].AsInt32 },
                            { "Players", CurentMonetiz["Players"].AsInt32 },
                            { "Creator", SettingUser.CurentDetailStudio["Creator"] },
                            { "Cash", CurentMonetiz["Cash"].AsInt32 }
                        };

                        SDK.SDK_PageDashboards.DashboardGame.PageStudios.AddPayment(Detail, ResultPay =>
                        {
                            if (ResultPay)
                            {
                                DashboardGame.Notifaction("Tanks for buy", StatusMessage.Ok);
                                ReciveMonetize(PageMonetiz, new DependencyPropertyChangedEventArgs());

                                TextPlayerNewValue.Text       = "";
                                TextLeaderboardsNewValue.Text = "";
                                TextApisNewValue.Text         = "";
                                TextLogsNewValue.Text         = "";
                                TextAchievementsNewValue.Text = "";
                                TextTomanNumber.Text          = "0";
                                BTNRevite.Visibility          = Visibility.Collapsed;


                                //log
                                SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("Payment", $"{NewMonetiz["Cash"].AsInt32.ToString("#,##0") } \" Tomans will be deducted from your account credit", NewMonetiz, false, result => { });
                            }
                            else
                            {
                                DashboardGame.Notifaction("Fail Pay", StatusMessage.Error);
                            }
                        });
                    }
                    else
                    {
                        DashboardGame.Notifaction("Reject Pay", StatusMessage.Error);
                    }
                }
            };

            BTNPayments.MouseDown += (s, e) =>
            {
                DoubleAnimation Anim = new DoubleAnimation(0, 400, TimeSpan.FromSeconds(0.3));

                Storyboard.SetTargetProperty(Anim, new PropertyPath("Height"));
                Storyboard.SetTargetName(Anim, PaymentList.Name);

                Storyboard storyboard = new Storyboard();
                storyboard.Children.Add(Anim);
                storyboard.Begin(this);
            };

            BTNCollaps.MouseDown += (s, e) =>
            {
                ClosePaymentList();
            };



            //page Charge Wallet
            BTNAddMoney.MouseDown += (s, e) =>
            {
                DoubleAnimation Anim = new DoubleAnimation(0, 400, TimeSpan.FromSeconds(0.3));

                Storyboard.SetTargetProperty(Anim, new PropertyPath("Height"));
                Storyboard.SetTargetName(Anim, PanelChargeMoney.Name);

                Storyboard storyboard = new Storyboard();
                storyboard.Children.Add(Anim);
                storyboard.Begin(this);
            };
            BTNCloseCharge.MouseDown += (s, e) =>
            {
                CloseCharge();
            };


            //Page Buy money
            BTNPaytoBank.MouseDown += (s, e) =>
            {
                try
                {
                    if (TextAmount_BackToBank.Text.Length < 5 && int.Parse(TextAmount_BackToBank.Text) < 10000)
                    {
                        throw new Exception("The amount is below 10,000 Rials");
                    }

                    if (TextName_BackToBank.Text.Length < 2)
                    {
                        throw new Exception("The name is short");
                    }

                    _ = long.Parse(TextPhone_BackToBank.Text);
                    _ = int.Parse(TextAmount_BackToBank.Text);
                    _ = new MailAddress(TextEamil_BackToBank.Text);
                    if (TextDesc_BackToBank.Text.Length <= 1)
                    {
                        TextDesc_BackToBank.Text = "N/A";
                    }

                    var Request = new BsonDocument()
                    {
                        { "amount", int.Parse(TextAmount_BackToBank.Text) },
                        { "order_id", new Random().Next() },
                        { "name", TextName_BackToBank.Text },
                        { "phone", TextPhone_BackToBank.Text },
                        { "mail", TextEamil_BackToBank.Text },
                        { "desc", TextDesc_BackToBank.Text },
                        { "callback", "http://193.141.64.203/payments/callback" }
                    };

                    SDK.SDK_PageDashboards.DashboardGame.PageStudios.OpenGatePaye(Request, result =>
                    {
                        if (result.ElementCount >= 1)
                        {
                            var Detail = new BsonDocument()
                            {
                                { "Request", Request },
                                { "DetailPay", result },
                                { "Detail", new BsonDocument {
                                      { "Studio", SettingUser.CurentDetailStudio["Database"] }, { "Token", SettingUser.Token }
                                  } }
                            };

                            SDK.SDK_PageDashboards.DashboardGame.PageStudios.AddPaytoList(Detail, async ResultAdd =>
                            {
                                if (ResultAdd)
                                {
                                    DashboardGame.Notifaction("You will be redirected to the payment page", StatusMessage.Ok);
                                    Process.Start(result["link"].AsString);

                                    var serilseDetailPay = new BsonDocument
                                    {
                                        { "id", result["id"] },
                                        { "order_id", Request["order_id"] }
                                    };

                                    var Result = new BsonDocument();

                                    while (true)
                                    {
                                        var Query = await SDK.SDK_PageDashboards.DashboardGame.PageStudios.CheackPay(serilseDetailPay);

                                        if (Query.ElementCount >= 1)
                                        {
                                            if (Query["status"].ToInt32() == 10)
                                            {
                                                SDK.SDK_PageDashboards.DashboardGame.PageStudios.VerifiePay(serilseDetailPay, ResultVerifiePay =>
                                                {
                                                    if (ResultVerifiePay)
                                                    {
                                                        DashboardGame.Notifaction("Payment is done.", StatusMessage.Ok);
                                                        ReciveMonetize(PageMonetiz, new DependencyPropertyChangedEventArgs());
                                                    }
                                                    else
                                                    {
                                                        DashboardGame.Notifaction("Payment failed.Please contact support", StatusMessage.Error);
                                                        ReciveMonetize(PageMonetiz, new DependencyPropertyChangedEventArgs());
                                                    }
                                                });
                                                break;
                                            }
                                            else if (Query["status"].ToInt32() == 7)
                                            {
                                                DashboardGame.Notifaction("Payment is Cancel", StatusMessage.Error);
                                                ReciveMonetize(PageMonetiz, new DependencyPropertyChangedEventArgs());
                                                CloseCharge();
                                                break;
                                            }
                                        }
                                        else
                                        {
                                            await Task.Delay(1);
                                        }
                                    }
                                }
                                else
                                {
                                    DashboardGame.Notifaction("Faild Pay", StatusMessage.Error);
                                }
                            });
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Pay", StatusMessage.Error);
                        }
                    });
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, StatusMessage.Error);
                }
            };

            #endregion
        }