private void TFSConnectB_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; RegistryProcessor.SetString(RegistryProcessor.TfsUrlParameter, TFSURLTB.Text); RegistryProcessor.SetString(RegistryProcessor.TfsUsernameParameter, TFSUsernameTB.Text); RegistryProcessor.SetPassword(RegistryProcessor.TfsPasswordParameter, TFSPasswordTB.Text); TFSStatusLabel.Text = "Not connected"; TfsServer = null; // Connect to TFS TfsServer = Utils.ConnectToTFS(); TFSStatusLabel.Text = "Connected to " + TFSURLTB.Text; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } finally { Cursor.Current = Cursors.Default; UpdateStatus(); } }
private IEnumerable <PrimaryWorkitem> GetPrimaryWorkitemsInComment(string comment) { var re = new Regex(RegistryProcessor.GetString(RegistryProcessor.V1RegexParameter, "[A-Z]{1,2}-[0-9]+")); var numbers = re.Matches(comment).Cast <Match>().Select(x => x.Value).ToList(); return(v1Component.Value.GetRelatedPrimaryWorkitems(numbers)); }
public static VersionOneSettings GetV1Settings() { return(new VersionOneSettings { Path = RegistryProcessor.GetString(RegistryProcessor.V1UrlParameter, string.Empty), Username = RegistryProcessor.GetString(RegistryProcessor.V1UsernameParameter, string.Empty), Password = RegistryProcessor.GetPassword(RegistryProcessor.V1PasswordParameter, string.Empty), Integrated = RegistryProcessor.GetBool(RegistryProcessor.V1WindowsAuthParameter, false), ProxySettings = GetProxySettings() }); }
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; } }
public ConfigForm() { InitializeComponent(); btnTestV1Connection.Click += btnTestV1Connection_Click; btnSaveVersionOneSettings.Click += btnSaveVersionOneSettings_Click; TFSConnectB.Click += TFSConnectB_Click; TFSUpdateB.Click += TFSUpdateB_Click; UnsubscribeB.Click += UnsubscribeB_Click; SaveSettingsB.Click += SaveSettingsB_Click; chkUseProxy.CheckedChanged += chkUseProxy_CheckedChanged; //Advanced setup RegExTB.Text = RegistryProcessor.GetString(RegistryProcessor.V1RegexParameter, "[A-Z]{1,2}-[0-9]+"); txtDebugDescription.Text = string.Format("Debug information is written to {0}", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); //V1 setup V1URLTB.Text = RegistryProcessor.GetString(RegistryProcessor.V1UrlParameter, "http://localhost/VersionOne/"); var username = WindowsIdentity.GetCurrent().Name; var pos = username.IndexOf("\\"); if (pos >= 0) { username = username.Substring(pos + 1); } V1UsernameTB.Text = RegistryProcessor.GetString(RegistryProcessor.V1UsernameParameter, username); V1PasswordTB.Text = RegistryProcessor.GetPassword(RegistryProcessor.V1PasswordParameter, string.Empty); UseIntegratedAuthenticationCB.Checked = RegistryProcessor.GetBool(RegistryProcessor.V1WindowsAuthParameter, false); chkUseProxy.Checked = RegistryProcessor.GetBool(RegistryProcessor.V1UseProxyParameter, false); txtProxyUrl.Text = RegistryProcessor.GetString(RegistryProcessor.V1ProxyUrlParameter, string.Empty); txtProxyUsername.Text = RegistryProcessor.GetString(RegistryProcessor.V1ProxyUsernameParameter, string.Empty); txtProxyPassword.Text = RegistryProcessor.GetString(RegistryProcessor.V1ProxyPasswordParameter, string.Empty); txtProxyDomain.Text = RegistryProcessor.GetString(RegistryProcessor.V1ProxyDomainParameter, string.Empty); SetProxyRelatedFieldsEnabled(chkUseProxy.Checked); //TFS setup TFSURLTB.Text = RegistryProcessor.GetString(RegistryProcessor.TfsUrlParameter, "http://localhost:8080"); TFSUsernameTB.Text = RegistryProcessor.GetString(RegistryProcessor.TfsUsernameParameter, WindowsIdentity.GetCurrent().Name); TFSPasswordTB.Text = RegistryProcessor.GetPassword(RegistryProcessor.TfsPasswordParameter, string.Empty); var port = RegistryProcessor.GetString(RegistryProcessor.ListenerPortParameter, "9090"); var folder = RegistryProcessor.GetString(RegistryProcessor.ListenerNameParameter, "VersionOne TFS Listener"); var host = Dns.GetHostName(); ListenerURLTB.Text = RegistryProcessor.GetString(RegistryProcessor.ListenerUrlParameter, "http://" + host + ":" + port + "/Service.svc"); // Debug Mode chkDebugMode.Checked = RegistryProcessor.GetBool(RegistryProcessor.DebugEnabledParameter, false); UpdateStatus(); }
private void btnSaveVersionOneSettings_Click(object sender, EventArgs e) { RegistryProcessor.SetString(RegistryProcessor.V1UrlParameter, V1URLTB.Text); RegistryProcessor.SetString(RegistryProcessor.V1UsernameParameter, V1UsernameTB.Text); RegistryProcessor.SetPassword(RegistryProcessor.V1PasswordParameter, V1PasswordTB.Text); RegistryProcessor.SetBool(RegistryProcessor.V1WindowsAuthParameter, UseIntegratedAuthenticationCB.Checked); RegistryProcessor.SetBool(RegistryProcessor.V1UseProxyParameter, chkUseProxy.Checked); RegistryProcessor.SetString(RegistryProcessor.V1ProxyUrlParameter, txtProxyUrl.Text); RegistryProcessor.SetString(RegistryProcessor.V1ProxyUsernameParameter, txtProxyUsername.Text); RegistryProcessor.SetString(RegistryProcessor.V1ProxyPasswordParameter, txtProxyPassword.Text); RegistryProcessor.SetString(RegistryProcessor.V1ProxyDomainParameter, txtProxyDomain.Text); }
// 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; } } }
private static ProxyConnectionSettings GetProxySettings() { if (!RegistryProcessor.GetBool(RegistryProcessor.V1UseProxyParameter, false)) { return(null); } return(new ProxyConnectionSettings { UseProxy = RegistryProcessor.GetBool(RegistryProcessor.V1UseProxyParameter, false), Url = RegistryProcessor.GetString(RegistryProcessor.V1ProxyUrlParameter, string.Empty), Username = RegistryProcessor.GetString(RegistryProcessor.V1ProxyUsernameParameter, string.Empty), Password = RegistryProcessor.GetString(RegistryProcessor.V1ProxyPasswordParameter, string.Empty), Domain = RegistryProcessor.GetString(RegistryProcessor.V1ProxyDomainParameter, string.Empty) }); }
// 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; } }
public static TfsTeamProjectCollection ConnectToTFS() { var url = RegistryProcessor.GetString(RegistryProcessor.TfsUrlParameter, string.Empty); var user = RegistryProcessor.GetString(RegistryProcessor.TfsUsernameParameter, string.Empty); var password = RegistryProcessor.GetPassword(RegistryProcessor.TfsPasswordParameter, string.Empty); var domain = string.Empty; var pos = user.IndexOf('\\'); if (pos >= 0) { domain = user.Substring(0, pos); user = user.Substring(pos + 1); } var creds = new NetworkCredential(user, password, domain); var tfsServer = new TfsTeamProjectCollection(new Uri(url), creds); tfsServer.Authenticate(); return(tfsServer); }
public static void Install() { var w3svc = new DirectoryEntry("IIS://localhost/w3svc"); var folder = RegistryProcessor.GetString("ListenerName", "VersionOne TFS Listener"); foreach (DirectoryEntry e in w3svc.Children) { if (e.SchemaClassName == "IIsWebServer" && e.Properties["ServerComment"].Value.ToString() == folder) { SetNetVersion(e, Environment.Version); foreach (DirectoryEntry f in e.Children) { if (f.SchemaClassName == "IIsWebVirtualDir") { SetNetVersion(f, Environment.Version); } } } } }
private void TFSUpdateB_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; var url = ListenerURLTB.Text; RegistryProcessor.SetString(RegistryProcessor.ListenerUrlParameter, url); // Get Eventing Service var eventService = (IEventService)TfsServer.GetService(typeof(IEventService)); // Set delivery preferences var dPref = new DeliveryPreference { Schedule = DeliverySchedule.Immediate, Address = url, Type = DeliveryType.Soap }; const string tag = "VersionOneTFSServer"; // Unsubscribe to all events foreach (var s in eventService.GetEventSubscriptions(TfsServer.AuthorizedIdentity.Descriptor, tag)) { eventService.UnsubscribeEvent(s.ID); } // Subscribe to checked events var filter = string.Empty; eventService.SubscribeEvent("CheckinEvent", filter, dPref, tag); eventService.SubscribeEvent("BuildCompletionEvent2", filter, dPref, tag); UpdateStatus(); } finally { Cursor.Current = Cursors.Default; } }
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); }
private void SaveSettingsB_Click(object sender, EventArgs e) { RegistryProcessor.SetString(RegistryProcessor.V1RegexParameter, RegExTB.Text); RegistryProcessor.SetBool(RegistryProcessor.DebugEnabledParameter, chkDebugMode.Checked); }
private void _login_btn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_username_Tb.Text) || string.IsNullOrEmpty(_password_Tb.Text)) { LogController.GetInstance().LogData(LogController. GetInstance().LogFormat.GetLoginFailedLine("Incorrect username or password")); MessageBox.Show("Login or password is empty"); } else { if (!CurrentContext.GetInstance().IsSessionDataLocked) { ThreadPool.QueueUserWorkItem(new WaitCallback((s) => { CurrentContext.GetInstance().IsSessionDataLocked = true; if (!WebProcessor.CheckInternetConnection()) { LogController.GetInstance().LogData(LogController. GetInstance().LogFormat.GetLoginFailedLine("Network unavailable")); this.Invoke((MethodInvoker) delegate() { MessageBox.Show("Network unavailable"); }); CurrentContext.GetInstance().IsSessionDataLocked = false; return; } LoginState loginState = LoginDataController.GetInstance().Login(_username_Tb.Text, _password_Tb.Text); if (loginState == LoginState.LOGGED) { this.Invoke((MethodInvoker) delegate() { LogController.GetInstance().LogData(LogController. GetInstance().LogFormat.GetLoginSuccessLine()); RegistryProcessor.SetToRegistry(CommonConst.REGISTRY_PATH, CommonConst.EMAIL_VALUE_NAME, CurrentContext.GetInstance().LoginData.Login, RegistryProcessor.RegistryParts.HKEY_CURRENT_USER); // AHMED EDITS string pwd = CurrentContext.GetInstance().LoginData.Password; pwd = StringCipher.Encrypt(pwd, CommonConst.DES_KEY); if (!string.IsNullOrEmpty(pwd)) { RegistryProcessor.SetToRegistry(CommonConst.REGISTRY_PATH, CommonConst.PWD_VALUE_NAME, pwd, RegistryProcessor.RegistryParts.HKEY_CURRENT_USER); } // AHMED EDITS MainForm mainForm = new MainForm(); mainForm.Show(); mainForm.Visible = false; mainForm.Left = this.Left; mainForm.Top = this.Top; mainForm.Size = this.Size; mainForm.Visible = true; IsHide = true; _balloon_ni.Visible = false; this.Hide(); LogController.GetInstance().LogData(LogController. GetInstance().LogFormat.GetNavigationLine("Main page")); LogController.GetInstance().RemoveLogHandler(this); }); } else { this.Invoke((MethodInvoker) delegate() { if (loginState == LoginState.CONNECTION_FAIL) { LogController.GetInstance().LogData(LogController. GetInstance().LogFormat.GetLoginFailedLine("Web server did not responded")); MessageBox.Show("Connection Error"); } else if (loginState == LoginState.LOGIN_FAIL) { LogController.GetInstance().LogData(LogController. GetInstance().LogFormat.GetLoginFailedLine("Incorrect username or password")); MessageBox.Show("Login Error"); } }); } CurrentContext.GetInstance().IsSessionDataLocked = false; })); } } }