Beispiel #1
0
        private IReceipt SubmitReceipt(SubmitReceipt request)
        {
            //Check ticket is available
            var ticket = ticketRepo.GetTicket(request.TicketId);

            if (ticket == null)
            {
                throw new Exception(TicketMessage.TicketDoesNotFound);
            }
            if (ticket.Status.Equals((int)TicketConstant.Lock))
            {
                throw new Exception(TicketMessage.TicketIsNotAvail);
            }

            //Check departure date
            DateTime departureDate;

            if (!DateTime.TryParseExact(request.DepartureDate, "dd-MM-yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out departureDate))
            {
                throw new Exception(TicketMessage.InvalidDepartureDate);
            }

            //Check ticket does not booking before
            var status = ticketStatusRepo.GetTicketStatus(ticket.UserAuthId, ticket.Code, departureDate, ticket.DepartureTime);

            if (status.Status != (int)TicketStatusConstant.Available)
            {
                throw new Exception(TicketMessage.TicketIsNotAvail);
            }

            //Create new receipt
            var newReceipt = new Repository.Receipt();

            newReceipt.PopulateWith(ticket);
            newReceipt.AgentId       = Convert.ToInt32(UserSession.UserAuthId);
            newReceipt.DepartureDate = departureDate;
            newReceipt.Note          = request.Note;
            newReceipt.Status        = (int)ReceiptStatusConstant.Submited;

            //Generate new code
            var code = receiptRepo.GenerateNewCode(ConfigUtils.GetAppSetting("receipt.code.len", 6));

            newReceipt.Code = code;

            //Create new receipt
            var receipt = receiptRepo.CreateReceipt(newReceipt);

            //Update ticket status
            var newStatus = ticketStatusRepo.UpdateTicketStatus(ticket.UserAuthId, ticket.Code, departureDate, ticket.DepartureTime, (int)TicketStatusConstant.Booked);

            return(receipt);
        }
Beispiel #2
0
 public override AbstractConfigNode Find(string path)
 {
     path = ConfigUtils.CheckSearchPath(path, this);
     if (path == ".")
     {
         return(this);
     }
     else if (path.StartsWith(ConfigurationSettings.NODE_SEARCH_SEPERATOR))
     {
         return(Configuration.Find(path));
     }
     path = ConfigUtils.MaskSearchPath(path);
     string[] parts = path.Split(ConfigurationSettings.NODE_SEARCH_SEPERATOR);
     if (parts != null && parts.Length > 0)
     {
         List <string> pList = new List <string>();
         foreach (string part in parts)
         {
             if (String.IsNullOrWhiteSpace(part))
             {
                 continue;
             }
             string npart = ConfigUtils.UnmaskSearchPath(part);
             pList.Add(npart);
         }
         ConfigUtils.CheckSearchRoot(pList, Name, Configuration.Settings);
         List <AbstractConfigNode> nodes = new List <AbstractConfigNode>();
         foreach (AbstractConfigNode node in GetValues())
         {
             AbstractConfigNode sn = node.Find(pList, 0);
             if (sn != null)
             {
                 nodes.Add(sn);
             }
         }
         if (nodes.Count > 0)
         {
             if (nodes.Count == 1)
             {
                 return(nodes[0]);
             }
             else
             {
                 ConfigSearchResult result = new ConfigSearchResult();
                 result.Configuration = Configuration;
                 result.AddAll(nodes);
                 return(result);
             }
         }
     }
     return(null);
 }
Beispiel #3
0
    public override bool UpdateComponent(Orrb.RendererComponentConfig config)
    {
        int old_light_head_count = light_head_count_;

        ConfigUtils.GetProperties(this, config);

        if (old_light_head_count != light_head_count_)
        {
            BuildLightHeads();
        }

        return(true);
    }
Beispiel #4
0
        public BindingList <ProductItem> ProductAdd(int investigationId)
        {
            var    productItems    = new BindingList <ProductItem>();
            String sql             = $"exec sp_AddProduct @InvestigationId = {investigationId};";
            string connetionString = ConfigUtils.GetConfig()[AppConstants.ConnectionString];

            ReadListFromDatabase(productItems, ProductReadItems, connetionString, sql);
            if (productItems.Count > 0)
            {
                return(productItems);
            }
            return(null);
        }
Beispiel #5
0
        public InvestigationItem InvestigationAdd()
        {
            List <InvestigationItem> investigations = new List <InvestigationItem>();
            String sql             = $"exec sp_AddInvestigation ;";
            string connetionString = ConfigUtils.GetConfig()[AppConstants.ConnectionString];

            ReadListFromDatabase(investigations, InvestigationReadItems, connetionString, sql);
            if (investigations.Count > 0)
            {
                return(investigations[0]);
            }
            return(null);
        }
Beispiel #6
0
 private static void SetupLockUrlMinutes(AzureTableAliasRepository azureStorageRepo)
 {
     try
     {
         var lockUrlMinutes = ConfigUtils.GetAppSetting("LockUrlMinutes",
                                                        (int)azureStorageRepo.LockAge.TotalMinutes);
         azureStorageRepo.LockAge = TimeSpan.FromMinutes(lockUrlMinutes);
     }
     catch (FormatException exception)
     {
         Trace.TraceError("Failed to parse LockUrlMinutes. Exception: {0}", exception);
     }
 }
Beispiel #7
0
        /// <summary>
        /// Parses XML configuration file.
        /// </summary>
        public bool Parse(string name, string value, XmlNode node)
        {
            switch (name)
            {
            case "AssocCase":
                this.AssocCase = ConfigUtils.ParseInteger(value, Int32.MinValue, Int32.MaxValue, node);
                break;

            default:
                return(false);
            }
            return(true);
        }
 static FileSystemManager()
 {
     FileSystemManager.strRootFolder = ConfigUtils.GetAppSetting <string>("UploadFolder");
     if (string.IsNullOrEmpty(FileSystemManager.strRootFolder))
     {
         FileSystemManager.strRootFolder = "/Upload/";
     }
     FileSystemManager.strRootFolder = FileSystemManager.strRootFolder.TrimEnd(new char[]
     {
         '/'
     });
     FileSystemManager.strRootFolder = HttpContext.Current.Server.MapPath(FileSystemManager.strRootFolder);
 }
        private void SetupConfigFileAuthenticationDetailsProvider(ConfigFile configFile, FilePrivateKeySupplier keySupplier)
        {
            var provider = new SimpleAuthenticationDetailsProvider();

            provider.Fingerprint        = configFile.GetValue(ConfigUtils.FINGERPRINT) ?? throw new InvalidDataException($"missing {ConfigUtils.FINGERPRINT} in config");
            provider.TenantId           = configFile.GetValue(ConfigUtils.TENANCY) ?? throw new InvalidDataException($"missing {ConfigUtils.TENANCY} in config");
            provider.UserId             = configFile.GetValue(ConfigUtils.USER) ?? throw new InvalidDataException($"missing {ConfigUtils.USER} in config");
            provider.PrivateKeySupplier = keySupplier;
            Oci.Common.Region region;
            ConfigUtils.SetRegion(configFile, out region);
            provider.Region = region;
            authProvider    = provider;
        }
        public string RegisterMacAddress(string mac)
        {
            Random random = new Random();
            string name   = random.Next(303030, 909090).ToString();

            while (MacAddressMap.ContainsKey(name))
            {
                name = random.Next(303030, 909090).ToString();
            }
            MacAddressMap.Add(mac, name);
            ConfigUtils.SaveMacAddress(this);
            return(name);
        }
Beispiel #11
0
 static RedisConnectionPool()
 {
     _defaultSetting = new RedisPoolSetting
     {
         Host             = ConfigUtils.GetSetting("Redis.Host", "localhost"),
         MaxWritePoolSize = ConfigUtils.GetSetting("Redis.MaxWritePoolSize", 100),
         MaxReadPoolSize  = ConfigUtils.GetSetting("Redis.MaxReadPoolSize", 100),
         ConnectTimeout   = ConfigUtils.GetSetting("Redis.ConnectTimeout", 0),
         PoolTimeOut      = ConfigUtils.GetSetting("Redis.PoolTimeOut", 0),
         DbIndex          = ConfigUtils.GetSetting("Redis.Db", 0)
     };
     _defaultSetting.ReadOnlyHost = ConfigUtils.GetSetting("Redis.ReadHost", _defaultSetting.Host);
 }
Beispiel #12
0
        private static void InitSerializer()
        {
            string type = ConfigUtils.GetSetting("Cache.Serializer", "Protobuf");

            if (string.Equals(type, "json", StringComparison.OrdinalIgnoreCase))
            {
                serializer = new JsonCacheSerializer(Encoding.UTF8);
            }
            else
            {
                serializer = new ProtobufCacheSerializer();
            }
        }
Beispiel #13
0
    public override bool UpdateComponent(Orrb.RendererComponentConfig config)
    {
        string old_camera_name = camera_name_;

        ConfigUtils.GetProperties(this, config);

        if (!camera_name_.Equals(old_camera_name))
        {
            UpdateCamera();
        }

        return(true);
    }
Beispiel #14
0
 /// <summary>
 /// Find the node relative to this node instance for
 /// the specified search path.
 /// </summary>
 /// <param name="path">Search path relative to this node.</param>
 /// <returns>Config node instance</returns>
 public override AbstractConfigNode Find(string path)
 {
     path = ConfigUtils.CheckSearchPath(path, this);
     if (path == ".")
     {
         return(this);
     }
     else if (path.StartsWith(ConfigurationSettings.NODE_SEARCH_SEPERATOR))
     {
         return(Configuration.Find(path));
     }
     return(Find(path, NODE_ABBREVIATION));
 }
Beispiel #15
0
 private void InitConfig()
 {
     txtHost.Text      = ConfigUtils.GetSetting("User.Host");
     txtPort.Text      = ConfigUtils.GetSetting("User.Port");
     txtAction.Text    = ConfigUtils.GetSetting("User.ActionId");
     txtGameType.Text  = ConfigUtils.GetSetting("User.GameType");
     txtServerID.Text  = ConfigUtils.GetSetting("User.ServerID");
     txtRetailID.Text  = ConfigUtils.GetSetting("User.RetailID");
     txtPid.Text       = ConfigUtils.GetSetting("User.Pid");
     txtPwd.Text       = ConfigUtils.GetSetting("User.Pwd");
     _token.DeviceID   = ConfigUtils.GetSetting("User.DeviceID", "00-00-00-00-01");
     _token.MobileType = ConfigUtils.GetSetting("User.MobileType", "5").ToInt();
 }
Beispiel #16
0
        public X509Certificate2 LoadDatabaseCertificate(string configKey, string passwordKey)
        {
            var storedConfig = ConfigUtils.GetConfig(_db, configKey).Result;

            string storedConfigPassword = null;

            if (passwordKey != null)
            {
                storedConfigPassword = ConfigUtils.GetConfig(_db, passwordKey).Result.Value;
            }

            return(LoadCertificate(Convert.FromBase64String(storedConfig.Value), storedConfigPassword));
        }
Beispiel #17
0
 /// <summary>
 /// 删除配置
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgv1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex == 3)
     {
         DialogResult dr = MessageBox.Show("确定要删除第 " + (e.RowIndex + 1) + " 行配置吗?", "提示", MessageBoxButtons.OKCancel);
         if (dr == DialogResult.OK)
         {
             mConfigLst.RemoveAt(e.RowIndex);
             refreshRow();
             ConfigUtils.SaveUserConfig(mConfigLst);
         }
     }
 }
Beispiel #18
0
        // serviceName和serviceNamespace这2个parameter已经过时,只作为placeholder存在,值没有意义
        protected ServiceClientBase(string serviceName, string serviceNamespace, string subEnv)
            : this(ConnectionMode.Indirect)
        {
            string settingKey = GetServiceSettingKey(SERVICE_REGISTRY_SUBENV_KEY, ServiceName, ServiceNamespace);

            TestSubEnv = ConfigUtils.GetNullableAppSetting(settingKey);
            if (string.IsNullOrWhiteSpace(TestSubEnv))
            {
                TestSubEnv = ServiceRegistryTestSubEnv;
            }
            else
            {
                TestSubEnv = TestSubEnv.Trim().ToLower();
            }

            int count = -1;

            requestContext = DynamicRequestContextProvider.LoadSignalRRequestContext(ServiceFullName);
            while (count++ < initUrlRetryTimesProperty && (requestContext == null || requestContext.Servers == null || requestContext.Servers.Length < 1))
            {
                log.Info("Service url is null or empty, will retry after 200 ms", GetClientInfo());
                Thread.Sleep(200);
            }
            if (count >= initUrlRetryTimesProperty)
            {
                log.Error(string.Format("Service is null after retried {0} times", count), GetClientInfo());
            }
            else
            {
                string serviceUrl = GetServiceUrl(requestContext);
                if (string.IsNullOrWhiteSpace(serviceUrl))
                {
                    log.Error("Got null or empty service url.", GetClientInfo());
                    throw new Exception("Got null or empty service url.");
                }
                else
                {
                    _threadLocalBaseUri.Value = serviceUrl;
                    string message;
                    if (count > 0)
                    {
                        message = string.Format("Got service url {0} after retried {1} times", serviceUrl, count);
                    }
                    else
                    {
                        message = string.Format("Initialized client instance with indirect service url {0}", serviceUrl);
                    }
                    log.Info(message, GetClientInfo());
                }
            }
        }
Beispiel #19
0
        /// <summary>
        /// GridView.RowCommand 事件 .NET Framework (current version)  發生於在按一下按鈕時 GridView 控制項。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void WorkflowQueryGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            _rootRepo = RepositoryFactory.CreateRootRepo();
            GridViewRow row                    = (GridViewRow)((Control)e.CommandSource).NamingContainer;
            string      DocId                  = WorkflowQueryGridView.DataKeys[row.RowIndex].Values["SignDocID"].ToString();
            string      FormID                 = WorkflowQueryGridView.DataKeys[row.RowIndex].Values["FormID_FK"].ToString();
            string      employeeID             = WorkflowQueryGridView.DataKeys[row.RowIndex].Values["EmployeeID_FK"].ToString();
            string      UserName               = User.Identity.Name.ToString();
            string      CurrentSignLevelDeptID = WorkflowQueryGridView.DataKeys[row.RowIndex].Values["CurrentSignLevelDeptID_FK"].ToString();
            string      Remainder              = WorkflowQueryGridView.DataKeys[row.RowIndex].Values["Remainder"].ToString();
            string      ChiefID                = WorkflowQueryGridView.DataKeys[row.RowIndex].Values["ChiefID_Up"].ToString();

            if (e.CommandName == "Pump")
            {
                //Response.Write("<script language=javascript>alert('" + UserName + "')</script>");
                var responseMessage = String.Empty;
                try
                {
                    MailInfo info = new MailInfo()
                    {
                        AddresseeTemp = System.Web.Configuration.WebConfigurationManager.AppSettings["MailTemplate"],
                        DomainPattern = ConfigUtils.ParsePageSetting("Pattern")["DomainPattern"],
                    };
                    _rootRepo.PumpData(DocId, FormID, employeeID, UserName, CurrentSignLevelDeptID, Remainder);
                    info.To = (string)_rootRepo.QueryForEmployeeByEmpID(ChiefID)["ADAccount"];

                    info.Subject = String.Format("系統提醒!簽核單號 : {0} 已經由填單者抽單!", DocId);
                    info.Body.AppendFormat("{0}{1}", info.Subject, "此件為系統發送,請勿回覆!");

                    //mail
                    _mailer = new Mailer(info);
                    if (PublicRepository.CurrentWorkflowMode == Enums.WorkflowTypeEnum.RELEASE)
                    {
                        _mailer.SendMail();
                    }
                    //log
                    var cc = String.Join(",", info.To);
                    _log.Trace(String.Format("MailTo : {0}\r\ncc : {1}\r\nTitle : {2}\r\nContent : {3}\r\n", info.To, cc, info.Subject, info.Body));

                    Response.Write("<script language=javascript>alert('成功抽單!')</script>");
                }
                catch (Exception ex)
                {
                    Response.Write("<script language=javascript>alert('抽單失敗!\r\n錯誤訊息: '" + ex.Message + ")</script>");
                }
                finally
                {
                    Response.Write("<script language=javascript>window.location.href='WorkflowQueryList.aspx'</script>");
                }
            }
        }
Beispiel #20
0
        public async override Task <GitStatus> Run()
        {
            return(await Task.Run <GitStatus>(() =>
            {
                // save config
                _form.UpdateStatus(AppStatus.SavingConfig);
                ConfigUtils.Save(_form.Config);

                string wowPath = _form.Config.WowPath;

                // check wow directory
                _form.UpdateStatus(AppStatus.CheckingWow);
                if (!FileUtils.IsValidWowDirectory(wowPath))
                {
                    _form.UpdateStatus(AppStatus.InvalidWow);
                    return GitStatus.Failed;
                }

                // check appdata folder
                _form.UpdateStatus(AppStatus.CheckingDataFolder);
                if (!FileUtils.CheckAppDataFolder())
                {
                    _form.UpdateStatus(AppStatus.InvalidDataFolder);
                    return GitStatus.Failed;
                }

                // clone (or pull) into appdata folder
                _form.UpdateStatus(AppStatus.Pulling);
                GitStatus cloneResult = GitUtils.CloneRepo();

                // bail out if we failed
                if (cloneResult == GitStatus.Failed)
                {
                    _form.UpdateStatus(AppStatus.GitPullFailed);
                    return GitStatus.Failed;
                }

                // check existing elvui installation
                _form.UpdateStatus(AppStatus.CheckingElvUI);
                if (!FileUtils.CheckElvUIInstallation(wowPath))
                {
                    Debug.WriteLine($"Need to reinstall!");

                    // need to copy new files!
                    _form.UpdateStatus(AppStatus.Copying);
                    GitUtils.Install(wowPath);
                }

                return cloneResult;
            }));
        }
        private async Task <IApiResponse> SendEmailAsync(User user, string subject, string content)
        {
            try
            {
                var emailConfig = _config.GetSection("Email");
                var from        = emailConfig.GetSection("From").Value;
                var host        = emailConfig.GetSection("Host").Value;
                var port        = Convert.ToInt32(emailConfig.GetSection("Port").Value);
                var userName    = emailConfig.GetSection("UserName").Value;
                var password    = emailConfig.GetSection("Password").Value;
                var ssl         = Convert.ToBoolean(emailConfig.GetSection("SSL").Value);

                var passwordKey       = (await _db.CryptographyKeys.AsNoTracking().FirstOrDefaultAsync(k => k.Name == "EmailPassword"))?.Value;
                var decryptedPassword = passwordKey == null
                    ? password
                    : password.Base64ToByteArray().DecryptCamellia(passwordKey.Base64ToByteArray()).ToUTF8String();

                var key = CryptoUtils.CreateCamelliaKey();
                var encryptedPassword = decryptedPassword.UTF8ToByteArray().EncryptCamellia(key).ToBase64String();
                _db.CryptographyKeys.AddOrUpdate(new CryptographyKey {
                    Name = "EmailPassword", Value = key.ToBase64String()
                }, e => e.Name);
                await _db.SaveChangesAsync();

                await ConfigUtils.SetAppSettingValueAsync("Email:Password", encryptedPassword);

                var mailMessage = new MailMessage(from, user.Email)
                {
                    IsBodyHtml = true,
                    Body       = content,
                    Subject    = subject
                };

                var smtp = new SmtpClient(host, port)
                {
                    Credentials = new NetworkCredential {
                        UserName = userName, Password = decryptedPassword
                    },
                    EnableSsl = ssl
                };

                await smtp.SendMailAsync(mailMessage); // if this throws 5.7.0, go here: https://g.co/allowaccess

                return(new ApiResponse(StatusCodeType.Status200OK, "Email Sent Successfully", null));
            }
            catch (Exception ex)
            {
                return(new ApiResponse(StatusCodeType.Status500InternalServerError, "Sending Email Failed", null, null, ex));
            }
        }
Beispiel #22
0
        public static T Create(string formatType, string stepName)
        {
            string typeName = string.Format(formatType, stepName);
            string code     = string.Format(ConfigUtils.GetSetting("CaseStep.Script.Format", "Case.Step{0}.cs"), stepName);
            var    instance = ScriptEngines.Execute(code, typeName);

            //var instance = type.CreateInstance<CaseStep>();
            if (instance == null)
            {
                throw new NullReferenceException(string.Format("Get CaseStep object is null, type:{1}, script code:{0}", code, typeName));
            }
            instance.Action = stepName;
            return(instance);
        }
Beispiel #23
0
        //private MessageStructure _buffer;
        //private ParamGeter paramGeter;

        static TcpSocketReceiver()
        {
            EnableError          = ConfigUtils.GetSetting("Enable.Error").ToBool();
            ErrorNotFind         = ConfigUtils.GetSetting("Error.NotFind");
            ErrorConnected       = ConfigUtils.GetSetting("Error.Connected");
            ErrorTimeout         = ConfigUtils.GetSetting("Error.Timeout");
            ErrorUnknown         = ConfigUtils.GetSetting("Error.Unknown");
            ErrorCallAccessLimit = ConfigUtils.GetSetting("Error.CallAccessLimit");
            string[] ips = ConfigUtils.GetSetting("SocketServer.Ip.CallAccessLimit").Split(',');
            foreach (var ip in ips)
            {
                _accessLimitIp.Add(ip);
            }
        }
Beispiel #24
0
 private bool CheckAuthorize()
 {
     if (ConfigUtils.GetSetting("Environment") == "Development")
     {
         m_Player = new PlayerLogic();
         m_Player.SetUser(m_RequestPacket.AccountName);
         return(true);
     }
     else
     {
         //TODO
         return(false);
     }
 }
Beispiel #25
0
        public async Task <bool> Disconnect()
        {
            // This key can NOT be deleted without causing in CloudController#CompileCloudStatus, toggle its state instead.
            await ConfigUtils.CreateOrUpdateConfig(_db, ConfigKeys.CloudConnectStatus, false.ToString());

            // These are fair game to delete.
            await ConfigUtils.DeleteConfigIfExists(_db, ConfigKeys.CloudConnectIdentifier);

            await ConfigUtils.DeleteConfigIfExists(_db, ConfigKeys.CloudConnectNodeKey);

            await DeleteCloudUserIfExists();

            return(true);
        }
Beispiel #26
0
        private void ReportMonScheduler_Tick(object sender, EventArgs e)
        {
            string minutes = ConfigUtils.GetMinutes().Trim();
            string hours   = ConfigUtils.GetHours().Trim();

            if (DateTime.Now.Minute.ToString().Trim() == minutes &&
                DateTime.Now.Hour.ToString().Trim() == hours &&
                DateTime.Now.Date == this._lastdate.AddDays(1).Date)
            {
                ReportMonNotifyIcon.ShowBalloonTip(5000, "Informazioni..", "Processo  iniziato", ToolTipIcon.Info);

                SendMailsWorker.RunWorkerAsync();
            }
        }
Beispiel #27
0
 /// <summary>
 /// Сохранение текущего списка контрактов в файл
 /// </summary>
 private void SaveContracts()
 {
     try
     {
         var contractsFile = Path.Combine(Plugin.StoragePath, "HeadHunterContracts.cfg");
         //_ContractStorage.Save();
         ConfigUtils.Save <HeadHunterContractsStorage>(Plugin, ContractStorage, contractsFile);
         //Log.Info("contracts Saved.");
     }
     catch (IOException e)
     {
         Log.Warn(e, "contracts failed to save");
     }
 }
        /// <summary>
        /// 解析二维码图片
        /// </summary>
        /// <param name="text">非 null 字符串</param>
        /// <returns></returns>
        private async Task ImportShareLinks(string text)
        {
            loadProgressBar.Visibility      = Visibility.Visible;
            loadProgressBar.IsIndeterminate = true;
            LinkImportResult importResult;

            try
            {
                importResult = await ConfigUtils.ImportLinksAsync(text, p =>
                {
                    ShowWarningText("Saving...");
                    loadProgressBar.IsIndeterminate = false;
                    loadProgressBar.Value           = p;
                });
            }
            finally
            {
                loadProgressBar.Visibility = Visibility.Collapsed;
            }
            if (importResult.SavedCount > 0 || importResult.FailedCount > 0)
            {
                // Avoid reading clipboard after importing
                clipboardChanged = false;
                _ = UiUtils.NotifyUser(importResult.GenerateMessage());
                // Complete updates in background
                _ = importResult.Files.BatchCompleteUpdates();
                if (Frame.CanGoBack)
                {
                    Frame.GoBack();
                }
            }
            else if (importResult.UnrecognizedLines.Count > 0)
            {
                if (text.Length >= 30)
                {
                    ToolTipService.SetToolTip(warningText, text);
                    ShowWarningText($"No recognizable content. ({text.Substring(0, 30)}...)");
                }
                else
                {
                    ToolTipService.SetToolTip(warningText, null);
                    ShowWarningText($"No recognizable content. ({text})");
                }
            }
            else
            {
                ToolTipService.SetToolTip(warningText, null);
                ShowWarningText("No Content");
            }
        }
        public KVR_SwitchTwoState(InternalProp prop, ConfigNode configuration) : base(prop, configuration)
        {
            // collider game objects
            ColliderDownTransform  = ConfigUtils.GetTransform(prop, configuration, "colliderDownTransformName");
            colliderDownGameObject = ColliderDownTransform.gameObject;
            colliderDownGameObject.AddComponent <KVR_ActionableCollider>().module = this;

            ColliderUpTransform  = ConfigUtils.GetTransform(prop, configuration, "colliderUpTransformName");
            colliderUpGameObject = ColliderUpTransform.gameObject;
            colliderUpGameObject.AddComponent <KVR_ActionableCollider>().module = this;

            // set initial state
            fsmState = FSMState.IsDown;
        }
Beispiel #30
0
        /// <summary>
        /// 获取本地IP地址
        /// </summary>
        /// <returns></returns>
        public static string GetIpAddress()
        {
            //获取本地的IP地址
            string AddressIP = ConfigUtils.GetSetting("ServerIp") + "/";

            //foreach (var _IPAddress in System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList)
            //{
            //    if (_IPAddress.AddressFamily.ToString() == "InterNetwork")
            //    {
            //        AddressIP = _IPAddress.ToString();
            //    }
            //}
            return(AddressIP);
        }
        public static void Main(string[] args)
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);

            PrintSuccess("[>]=-- Zat's CSGO-ESP");
            KeyUtils = new KeyUtils();
            ConfigUtils = new CSGOConfigUtils();

            ConfigUtils.SetValue("espEnabled", true);
            ConfigUtils.SetValue("espBox", false);
            ConfigUtils.SetValue("espSkeleton", true);
            ConfigUtils.SetValue("espName", false);
            ConfigUtils.SetValue("espHealth", true);

            ConfigUtils.SetValue("aimEnabled", true);
            ConfigUtils.SetValue("aimKey", WinAPI.VirtualKeyShort.XBUTTON1);
            ConfigUtils.SetValue("aimToggle", false);
            ConfigUtils.SetValue("aimHold", true);
            ConfigUtils.SetValue("aimFov", 30f);
            ConfigUtils.SetValue("aimSmoothEnabled", true);
            ConfigUtils.SetValue("aimSmoothValue", 0.2f);
            ConfigUtils.SetValue("aimFilterSpotted", false);
            ConfigUtils.SetValue("aimFilterSpottedBy", false);
            ConfigUtils.SetValue("aimFilterEnemies", true);
            ConfigUtils.SetValue("aimFilterAllies", false);

            ConfigUtils.SetValue("rcsEnabled", true);
            ConfigUtils.SetValue("rcsForce", 100f);

            ConfigUtils.ReadSettingsFromFile("euc_csgo.cfg");

            PrintInfo("> Waiting for CSGO to start up...");
            while (!ProcUtils.ProcessIsRunning("csgo"))
                Thread.Sleep(250);

            ProcUtils = new ProcUtils("csgo", WinAPI.ProcessAccessFlags.VirtualMemoryRead | WinAPI.ProcessAccessFlags.VirtualMemoryWrite | WinAPI.ProcessAccessFlags.VirtualMemoryOperation);
            MemUtils = new ExternalUtilsCSharp.MemUtils();
            MemUtils.Handle = ProcUtils.Handle;

            PrintInfo("> Waiting for CSGOs window to show up...");
            while ((hWnd = WinAPI.FindWindowByCaption(hWnd, "Counter-Strike: Global Offensive")) == IntPtr.Zero)
                Thread.Sleep(250);

            ProcessModule clientDll, engineDll;
            PrintInfo("> Waiting for CSGO to load client.dll...");
            while ((clientDll = ProcUtils.GetModuleByName(@"bin\client.dll")) == null)
                Thread.Sleep(250);
            PrintInfo("> Waiting for CSGO to load engine.dll...");
            while ((engineDll = ProcUtils.GetModuleByName(@"engine.dll")) == null)
                Thread.Sleep(250);

            Framework = new Framework(clientDll, engineDll);

            PrintInfo("> Initializing overlay");
            using (SHDXOverlay = new SharpDXOverlay())
            {
                SHDXOverlay.Attach(hWnd);
                SHDXOverlay.TickEvent += overlay_TickEvent;

                InitializeComponents();
                SharpDXRenderer renderer = SHDXOverlay.Renderer;
                TextFormat smallFont = renderer.CreateFont("smallFont", "Century Gothic", 10f);
                TextFormat largeFont = renderer.CreateFont("largeFont", "Century Gothic", 14f);
                TextFormat heavyFont = renderer.CreateFont("heavyFont", "Century Gothic", 14f, FontStyle.Normal, FontWeight.Heavy);

                windowMenu.Font = smallFont;
                windowMenu.Caption.Font = largeFont;
                windowGraphs.Font = smallFont;
                windowGraphs.Caption.Font = largeFont;
                windowSpectators.Font = smallFont;
                windowSpectators.Caption.Font = largeFont;
                graphMemRead.Font = smallFont;
                graphMemWrite.Font = smallFont;
                for (int i = 0; i < ctrlPlayerESP.Length; i++)
                {
                    ctrlPlayerESP[i].Font = heavyFont;
                    SHDXOverlay.ChildControls.Add(ctrlPlayerESP[i]);
                }
                ctrlRadar.Font = smallFont;

                windowMenu.ApplySettings(ConfigUtils);

                SHDXOverlay.ChildControls.Add(ctrlRadar);
                SHDXOverlay.ChildControls.Add(windowMenu);
                SHDXOverlay.ChildControls.Add(windowGraphs);
                SHDXOverlay.ChildControls.Add(windowSpectators);
                SHDXOverlay.ChildControls.Add(cursor);
                PrintInfo("> Running overlay");
                System.Windows.Forms.Application.Run(SHDXOverlay);
            }
            ConfigUtils.SaveSettingsToFile("euc_csgo.cfg");
        }
 public override void ApplySettings(ConfigUtils config)
 {
     if (this.Tag != null)
         if (config.HasKey(this.Tag.ToString()))
             this.Key = config.GetValue<WinAPI.VirtualKeyShort>(this.Tag.ToString());
 }
 public override void ApplySettings(ConfigUtils config)
 {
     if (this.Tag != null)
         if (config.HasKey(this.Tag.ToString()))
             this.Value = config.GetValue<float>(this.Tag.ToString());
 }
 public override void ApplySettings(ConfigUtils config)
 {
     if (this.Tag != null)
         if (config.HasKey(this.Tag.ToString()))
             this.Color = UI.UIObjects.Color.FromFormat(config.GetValue<uint>(this.Tag.ToString()), UI.UIObjects.Color.ColorFormat.RGBA);
 }
Beispiel #35
0
 public IndexConfigBusi()
 {
     _utils = ConfigUtils<IndexConfig>.Instance();
 }
 public override void ApplySettings(ConfigUtils config)
 {
     base.ApplySettings(config);
     foreach (SharpDXControl control in ChildControls)
         control.ApplySettings(config);
 }