Exemplo n.º 1
0
        private void SetEmailFromRegistry()
        {
            string email = string.Empty;

            RegistryProcessor.GetFromRegistry(CommonConst.REGISTRY_PATH,
                                              CommonConst.EMAIL_VALUE_NAME, ref email, RegistryProcessor.RegistryParts.HKEY_CURRENT_USER);
            if (!string.IsNullOrEmpty(email))
            {
                _username_Tb.Text = email;
            }
        }
Exemplo n.º 2
0
        // AHMED EDIT
        private void SetPasswordFromRegistry()
        {
            string pwd = string.Empty;

            RegistryProcessor.GetFromRegistry(CommonConst.REGISTRY_PATH,
                                              CommonConst.PWD_VALUE_NAME, ref pwd, RegistryProcessor.RegistryParts.HKEY_CURRENT_USER);
            if (!string.IsNullOrEmpty(pwd))
            {
                pwd = StringCipher.Decrypt(pwd, CommonConst.DES_KEY);
                if (!string.IsNullOrEmpty(pwd))
                {
                    _password_Tb.Text = pwd;
                }
            }
        }
Exemplo n.º 3
0
        // AHMED EDIT

        private void GetSavedEmailAndDetectVersion()
        {
            try
            {
                VersionController.GetInstance();
                string email = string.Empty;
                RegistryProcessor.GetFromRegistry(CommonConst.REGISTRY_PATH,
                                                  CommonConst.EMAIL_VALUE_NAME, ref email, RegistryProcessor.RegistryParts.HKEY_CURRENT_USER);
                if (!WebProcessor.CheckInternetConnection())
                {
                    LogController.GetInstance().LogData(LogController.
                                                        GetInstance().LogFormat.GetNetworkLine("Connection Error"));
                    MessageBox.Show("Connection Error");
                    CurrentContext.GetInstance().VersionData.State = VersionState.UNKNOWN;
                    IsInternetExists = false;
                    return;
                }
                else
                {
                    IsInternetExists = true;
                }

                if (!string.IsNullOrEmpty(email))
                {
                    CurrentContext.GetInstance().VersionData.VersionDetected =
                        VersionController.GetInstance().GetVersionData(email);
                }
                else
                {
                    CurrentContext.GetInstance().VersionData.VersionDetected =
                        VersionController.GetInstance().GetVersionData(string.Empty);
                }

                if (CurrentContext.GetInstance().VersionData.VersionDetected)
                {
                    _new_version_lb.TextAlign = ContentAlignment.MiddleCenter;
                    DetectVersionState();
                }
                else
                {
                    CurrentContext.GetInstance().VersionData.State = VersionState.UNKNOWN;
                }
            }
            catch
            { CurrentContext.GetInstance().VersionData.State = VersionState.UNKNOWN; }
        }
Exemplo n.º 4
0
        public string SendBugReport(string report, bool isCrashReport)
        {
            if (!WebProcessor.CheckInternetConnection())
            {
                return("Internet Connection Error");
            }

            string url = SessionController.GetInstance().ServerApiProvider.CreateBugReportUrl();

            string email = "*****@*****.**";

            if (CurrentContext.GetInstance().LoginData != null &&
                !string.IsNullOrEmpty(CurrentContext.GetInstance().LoginData.Login))
            {
                email = CurrentContext.GetInstance().LoginData.Login;
            }
            else
            {
                string regEmail = string.Empty;
                RegistryProcessor.GetFromRegistry(CommonConst.REGISTRY_PATH,
                                                  CommonConst.EMAIL_VALUE_NAME, ref regEmail, RegistryProcessor.RegistryParts.HKEY_CURRENT_USER);
                if (!string.IsNullOrEmpty(regEmail))
                {
                    email = regEmail;
                }
            }

            string currVersion = "1.00";

            if (CurrentContext.GetInstance().VersionData != null)
            {
                currVersion = CurrentContext.GetInstance().VersionData.CurrentVersion.ToString();
            }

            string token = CommonConst.BUG_REPORT_TOKEN;

            string logFile = LogController.GetInstance().IsLogFileExists();

            NameValueCollection postParams = new NameValueCollection();

            postParams.Add("from", email);
            postParams.Add("body", report);
            postParams.Add("tracker_version", currVersion);
            postParams.Add("token", token);
            if (isCrashReport)
            {
                postParams.Add("crash_report", "1");
            }

            List <string> logFilePath = new List <string>();

            logFilePath.Add(logFile);
            string resp = WebProcessor.UploadFileWithParams(url,
                                                            SessionController.GetInstance().ServerApiProvider.
                                                            PrepareFilesData(logFilePath, "activity_log", "text/plain"), postParams);

            LogController.GetInstance().LogData(LogController.
                                                GetInstance().LogFormat.GetNavigationLine("Server reply: " + resp));

            return(resp);
        }