public void SetPluginVariable(string variable, string value)
        {
            int i;

            switch (variable)
            {
            case VariableName.PunishCommand:
                _punishCommand = value.ToArray();
                break;

            case VariableName.ForgiveCommand:
                _forgiveCommand = value.ToArray();
                break;

            case VariableName.AllowKillersToApologizeToAvoidPunishment:
                _allowKillersToApologizeToAvoidPunishment = value.ToEnum <enumBoolYesNo>();
                break;

            case VariableName.SorryCommand:
                _sorryCommand = value.ToArray();
                break;

            case VariableName.ShameCommand:
                _shameCommand = value.ToArray();
                break;

            case VariableName.KillerMessages:
                _killerMessages = value.ToArray();
                break;

            case VariableName.VictimMessages:
                _victimMessages = value.ToArray();
                break;

            case VariableName.PunishedMessage:
                _punishedMessage = value;
                break;

            case VariableName.ForgivenMessage:
                _forgivenMessage = value;
                break;

            case VariableName.ApologizedMessage:
                _apologizedMessage = value;
                break;

            case VariableName.KickMessage:
                _kickMessage = value;
                break;

            case VariableName.NoOneToPunishMessage:
                _noOneToPunishMessage = value;
                break;

            case VariableName.NoOneToForgiveMessage:
                _noOneToForgiveMessage = value;
                break;

            case VariableName.NoOneToApologizeToMessage:
                _noOneToApologizeToMessage = value;
                break;

            case VariableName.ShameAllOnRoundEnd:
                _shameAllOnRoundEnd = value.ToEnum <enumBoolYesNo>();
                break;

            case VariableName.NoOneToShameOnRoundEndMessage:
                _noOneToShameOnRoundEndMessage = value;
                break;

            case VariableName.NoOneToShameMessage:
                _noOneToShameMessage = value;
                break;

            case VariableName.VictimWindow:

                if (!int.TryParse(value, out i))
                {
                    return;
                }

                if (i < VictimWindowMin)
                {
                    i = VictimWindowMin;
                }

                if (i > VictimWindowMax)
                {
                    i = VictimWindowMax;
                }

                _victimWindow = TimeSpan.FromSeconds(i);

                break;

            case VariableName.AutoAction:
                _autoAction = value.ToEnum <Action>();
                break;

            case VariableName.HasPunishLimit:
                _hasPunishLimit = value.ToEnum <enumBoolYesNo>();
                break;

            case VariableName.PunishLimit:

                if (!int.TryParse(value, out i))
                {
                    return;
                }

                if (i < PunishLimitMin)
                {
                    i = PunishLimitMin;
                }

                if (i > PunishLimitMax)
                {
                    i = PunishLimitMax;
                }

                _punishLimit = i;

                break;

            case VariableName.PlayerCountThresholdForKick:

                if (!int.TryParse(value, out i))
                {
                    return;
                }

                if (i < PlayerCountThresholdForKickMin)
                {
                    i = PlayerCountThresholdForKickMin;
                }

                if (i > PlayerCountThresholdForKickMax)
                {
                    i = PlayerCountThresholdForKickMax;
                }

                _playerCountThresholdForKick = i;

                break;

            case VariableName.Protected:
                _protect = value.ToEnum <Protect>();
                break;

            case VariableName.Whitelist:
                _whitelist = value.ToArray();
                break;

            case VariableName.ShouldSuicideCountAsATeamKill:
                _shouldSuicideCountAsATeamKill = value.ToEnum <enumBoolYesNo>();
                break;

            case VariableName.OutputToChat:
                _outputToChat = value.ToEnum <Chat>();
                break;

            case VariableName.UseAdKats:
                _useAdKats = value.ToEnum <enumBoolYesNo>();

                if (_useAdKats == enumBoolYesNo.Yes && !IsAdKatsAvailable())
                {
                    WriteConsole("^8\"Use AdKats\" is \"Yes\", but AdKats is either not enabled or not yet fully initialized.^0");
                }

                break;
            }
        }
예제 #2
0
 static extern int VirtualAllocEx(IntPtr hProcess, int lpBaseAddress, int dwSize, AllocationType flAllocationType, Protect flProtect);
예제 #3
0
 public static extern Int32 VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, AllocType flAllocationType, Protect flProtect);
 // Token: 0x06000062 RID: 98 RVA: 0x00002F04 File Offset: 0x00002F04
 protected override void OnStartup(StartupEventArgs e)
 {
     if (this.HasCriticalException)
     {
         this.HandleCriticalError(this.criticalException);
         return;
     }
     base.OnStartup(e);
     try
     {
         bool      flag             = true;
         Process[] processesByName  = Process.GetProcessesByName("r5Apex");
         IntPtr    value            = WinAPI.FindWindow("CryENGINE", "Warface");
         Process[] processesByName2 = Process.GetProcessesByName("Game");
         Process[] processesByName3 = Process.GetProcessesByName("GameCenter");
         if (processesByName2.Length != 0 || value != IntPtr.Zero || processesByName.Length != 0)
         {
             flag = false;
         }
         if (processesByName3.Length != 0)
         {
             Protect.KillProcesses(new string[]
             {
                 "GameCenter"
             });
         }
         if (flag)
         {
             if (!util.IsConnectedToInternet())
             {
                 base.Dispatcher.Invoke(delegate()
                 {
                     CustomMessageBox.Show(CLanguage.GetTranslateText("errorconnect"), CLanguage.GetTranslateText("err_header_msg"), MessageBoxButton.OK, false);
                 });
                 flag = false;
             }
             if (!util.IsRunAsAdmin())
             {
                 Process.Start(new ProcessStartInfo(Process.GetCurrentProcess().MainModule.FileName)
                 {
                     Verb = "runas"
                 });
                 flag = false;
             }
         }
         if (flag)
         {
             this.appMutex = new INFMutex(new Func <bool>(this.InitializeProgram));
             flag          = this.appMutex.InitializeProgramOrSendMessage();
         }
         if (!flag)
         {
             this.Cleanup();
             App.AppExit();
         }
     }
     catch (Exception)
     {
         this.Cleanup();
         App.AppExit();
     }
 }
예제 #5
0
        private void LoadDesignerAndWorkflow(string fileName = null)
        {
            isLoadingXaml = true;
            Encrypt       = false;
            mustSave      = false;

            if (wd != null)
            {
                MainLayout.Children.Remove(this.wd.View);
                MainLayout.Children.Remove(this.wd.PropertyInspectorView);
                this.wd.ModelChanged -= wd_ModelChanged;
                this.wd = null;
            }
            //Create an instance of WorkflowDesigner class.
            this.wd = new WorkflowDesigner();

            DesignerConfigurationService configService = this.wd.Context.Services.GetService <DesignerConfigurationService>();

            configService.TargetFrameworkName = new FrameworkName(".NETFramework", new Version(4, 5));
            configService.LoadingFromUntrustedSourceEnabled = true;

            this.wd.ModelChanged += new EventHandler(wd_ModelChanged);

            //Place the designer canvas in the middle column of the grid.
            Grid.SetRow(this.wd.View, 1);
            Grid.SetColumn(this.wd.View, 2);

            AddPropertyInspector();

            if (string.IsNullOrEmpty(fileName))
            {
                this.wd.Load(new Sequence());
                wd.Flush();
                lastSavedXaml = wd.Text;
                mustSave      = true;
            }
            else
            {
                password = null;
                string errorMessage = null;
                if (XamlFileProviderFactory.IsXamlFileEncrypted(fileName))
                {
                    if (!GetPassword())
                    {
                        errorMessage = string.Format("The file '{0}' is protected and requires the correct password to open.", xamlFile);
                    }
                    else
                    {
                        Encrypt = true;
                    }
                }

                if (string.IsNullOrEmpty(errorMessage))
                {
                    try
                    {
                        IXamlFileProvider provider = XamlFileProviderFactory.GetXamlFileProvider(fileName, password);
                        provider.LoadXamlFile(fileName, password);
                        this.wd.Load(provider.XamlDocument);
                        wd.Flush();
                        lastSavedXaml = wd.Text;
                    }
                    catch (Exception ex)
                    {
                        errorMessage = ex.Message;
                        if (errorMessage == "The encrypted string was not in a valid format.")
                        {
                            errorMessage = "The password you specified was incorrect.";
                        }
                        errorMessage = string.Format("The following error occurred while trying to open '{0}' : \n\n{1}", xamlFile, errorMessage);
                    }
                }
                if (!string.IsNullOrEmpty(errorMessage))
                {
                    xamlFile = string.Empty;
                    ShowErrorMessage(errorMessage, "Failed to load file");
                    this.wd.Load(new Sequence());
                    password = null;
                    mustSave = true;
                    Encrypt  = false;
                }
            }

            busyGettingPassword = true;
            Protect.GetBindingExpression(System.Windows.Controls.Primitives.ToggleButton.IsCheckedProperty).UpdateTarget();
            busyGettingPassword = false;

            //Add the designer canvas to the grid.
            MainLayout.Children.Add(this.wd.View);

            StatusBarText.Text = "";
            ToggleDocumentHasChangesVisual(mustSave);

            isLoadingXaml = false;
        }
예제 #6
0
        private void Balance_Simpay_Insert_Send(LOGSEND log, decimal balance)
        {
            //thoi gian he thong
            string strNow      = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
            string strNowTitle = string.Format("{0:yyyy-MM-dd}", DateTime.Now);

            //lay title Email la ruleName
            Helpers.Connection.sConnectionStringDatabase = ConfigurationManager.ConnectionStrings["sConnectionString_SystemWarning"].ConnectionString;
            string titleEmail = DataOut.SW_RULES_SelectByID(log.RULE_AUTOID).Tables[0].Rows[0][RULE.COLUMN_RULE_NAME].ToString().Trim();

            titleEmail += " " + strNowTitle;

            //lay noi dung gui la gia tri cua cac conditions
            string  strContentSend = null;
            DataSet dsContent      = new DataSet();

            dsContent = DataOut.SW_RULEDETAIL_BALANCESSIMPAY_All(log.RULE_AUTOID);

            for (int i = 0; i < dsContent.Tables[0].Rows.Count; i++)
            {
                //chi lay cac conditions da Active
                if (Convert.ToBoolean(dsContent.Tables[0].Rows[i][RULEDETAIL.COLUMN_RULEDETAIL_ISACTIVE].ToString().Trim()) == true)
                {
                    //truong hop condition "so du tai khoan"
                    if (Convert.ToInt64(dsContent.Tables[0].Rows[i][RULEDETAIL.COLUMN_CONDITION_AUTOID].ToString().Trim()) == 3)
                    {
                        strContentSend += (dsContent.Tables[0].Rows[i]["CONDITION_NAME"].ToString().Trim()) + ": " + balance.ToString("#,##0 VNĐ") + " " + (dsContent.Tables[0].Rows[i]["KEY_NOTE2"].ToString().Trim())
                                          + " " + Convert.ToDecimal(dsContent.Tables[0].Rows[i]["KEYVALUE"].ToString().Trim()).ToString("#,##0 VNĐ") + "; ";
                    }
                    //truong hop condition "nha cung cap"
                    else if (Convert.ToInt64(dsContent.Tables[0].Rows[i][RULEDETAIL.COLUMN_CONDITION_AUTOID].ToString().Trim()) == 2)
                    {
                        strContentSend += (dsContent.Tables[0].Rows[i]["CONDITION_NAME"].ToString().Trim()) + ": " + (dsContent.Tables[0].Rows[i]["KEYVALUE"].ToString().Trim()) + "; ";
                    }
                    //truong hop condition "thoi diem"
                    else if (Convert.ToInt64(dsContent.Tables[0].Rows[i][RULEDETAIL.COLUMN_CONDITION_AUTOID].ToString().Trim()) == 4)
                    {
                        //truong hop la ngay co dinh
                        if (Convert.ToInt64(dsContent.Tables[0].Rows[i][RULEDETAIL.COLUMN_RULEDETAIL_TYPE].ToString().Trim()) == 3)
                        {
                            strContentSend += (dsContent.Tables[0].Rows[i]["CONDITION_NAME"].ToString().Trim()) + ": " + (dsContent.Tables[0].Rows[i]["KEYVALUE"].ToString().Trim()) + "; ";
                        }
                        //truong hop chon thu
                        else
                        {
                            strContentSend += (dsContent.Tables[0].Rows[i]["CONDITION_NAME"].ToString().Trim()) + ": " + (dsContent.Tables[0].Rows[i]["CONDITIONDETAIL_VALUE"].ToString().Trim()) + "; ";
                        }
                    }
                }
            }


            //send message
            Helpers.Connection.sConnectionStringDatabase = ConfigurationManager.ConnectionStrings["sConnectionString_Crm"].ConnectionString;
            //SMS
            if (log.ACTION_AUTOID == 1)
            {
                //insert vao DB SMS
                Librarys.CRM.TRANSACTION trans = new Librarys.CRM.TRANSACTION();
                trans.RECEIVEACCOUNT = log.USERSEND_HANDPHONE;
                trans.FROMACCOUNT    = "";
                trans.LASTUPDATE     = DateTime.Now;
                trans.CODE           = 1;
                trans.STATUS         = 1;
                trans.VALUE          = Protect.RemoveVNString(strContentSend).Trim();
                trans.TRANSTYPECODE  = 4;
                trans.RECEIVEID      = DateTime.Now.Ticks.ToString();
                trans.COMSIMID       = 0;
                DataIn.CRM_TRANSACTION_InsertUpdate(trans);
            }
            //EMAIL
            else if (log.ACTION_AUTOID == 2)
            {
                //insert vao DB EMAIL
                Librarys.CRM.TRANSACTION trans = new Librarys.CRM.TRANSACTION();
                trans.RECEIVEACCOUNT = log.USERSEND_EMAIL;
                trans.FROMACCOUNT    = "*****@*****.**";
                trans.LASTUPDATE     = DateTime.Now;
                trans.CODE           = 1;
                trans.STATUS         = 1;
                trans.VALUE          = string.Format("{0}##{1}", titleEmail, strNow + "; " + strContentSend);
                trans.TRANSTYPECODE  = 10;
                trans.RECEIVEID      = "<" + Guid.NewGuid().ToString() + "@simpay.com.vn>";
                trans.COMSIMID       = 0;
                DataIn.CRM_TRANSACTION_InsertUpdate(trans);
            }
        }