Exemplo n.º 1
0
        private void SicherheitSecurity_Load(object sender, EventArgs e)
        {
            //var version = "";
            //if (ApplicationDeployment.IsNetworkDeployed)
            //{
            //    version = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
            //}
            //else
            //{
            //    version = Environment.Version.ToString();
            //}
            //lblversion.Text = "";
            //lblversion.Visible = false;
            //bibConfig.Image = Resources.config;
            //bibConfig.Visible = false;
            //serverurl = RegistryUtil.GetConfigValueFromRegistry(RegistryType.ServerUrl);
            serverurl = "http://h2618679.stratoserver.net:8080";
            SetFormTitle();
            SetKeyRegistry();

            var connectStatus = RegistryUtil.GetConfigValueFromRegistry(RegistryType.ConnectStatus);

            //Conect to server
            if (connectStatus == "false")
            {
                Connect();
            }

            CheckPort();
            //PortLog();
            InitExchangeScheduler();
            InitUpdateSchedulerAndRun();
            LogUtil.WriteLog(strLog.ToString());
        }
Exemplo n.º 2
0
        private void SettingForm()
        {
            var link = RegistryUtil.GetConfigValueFromRegistry(RegistryType.ServerUrl);

            if (string.IsNullOrEmpty(link))
            {
                DialogResult dr = MessageBox.Show("This application cannot be start. Would you like to config the application now?", "Config", MessageBoxButtons.OK);
                if (DialogResult.OK == dr)
                {
                    (new Config()).ShowDialog();
                }
            }
        }
Exemplo n.º 3
0
        private void PortLog()
        {
            try
            {
                var ipaddress   = infoDevice.GetLocalIPAddress();
                var logtime     = RegistryUtil.GetConfigValueFromRegistry(RegistryType.LogTime);
                var logSend     = RegistryUtil.GetConfigValueFromRegistry(RegistryType.LogSend);
                var datelogsend = RegistryUtil.GetConfigValueFromRegistry(RegistryType.DateLogSend);
                var timesend    = Convert.ToDateTime(logtime);
                var timenow     = DateTime.Now;

                if (timenow > timesend)
                {
                    var filename = timenow.ToString("yyyy.MM.dd");
                    if (filename != datelogsend)
                    {
                        var logPath = Application.StartupPath + "\\logs\\" + filename + ".txt";
                        if (File.Exists(logPath))
                        {
                            var postlog = Upload(serverurl + "/api/logs/upload", ipaddress, logPath);
                            if (postlog)
                            {
                                RegistryUtil.SetCongifValueToRegistry(RegistryType.DateLogSend, timenow.ToString("yyyy.MM.dd"));
                                RegistryUtil.SetCongifValueToRegistry(RegistryType.LogSend, "false");
                            }
                        }
                    }
                    else
                    {
                        if (logSend == "true")
                        {
                            var logPath = Application.StartupPath + "\\logs\\" + filename + ".txt";
                            if (File.Exists(logPath))
                            {
                                var postlog = Upload(serverurl + "/api/logs/upload", ipaddress, logPath);
                                if (postlog)
                                {
                                    RegistryUtil.SetCongifValueToRegistry(RegistryType.DateLogSend, timenow.ToString("yyyy.MM.dd"));
                                    RegistryUtil.SetCongifValueToRegistry(RegistryType.LogSend, "false");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }