private void cmdAdd_Click(object sender, EventArgs e) { string str = Interaction.InputBox("Enter URL of Cydia Repos", "Add Cydia Repos", "", -1, -1); if (Operators.CompareString(Strings.Trim(str), "", false) != 0) { if (!str.StartsWith("http")) { str = string.Concat("http://", str); } int count = checked (this.lstCydia.Items.Count - 1); int num = 0; while (num <= count) { if (Operators.CompareString(this.lstCydia.Items[num].SubItems[1].Text, str, false) != 0) { num = checked (num + 1); } else { Interaction.MsgBox("Cydia existed!", MsgBoxStyle.OkOnly, "Error"); return; } } File.Delete("Release.txt"); string str1 = "Noname"; try { (new WebClient()).DownloadFile(string.Concat(str, "/Release"), "Release.txt"); string[] strArrays = File.ReadAllLines("Release.txt"); int num1 = Information.LBound(strArrays, 1); int num2 = Information.UBound(strArrays, 1); int num3 = num1; while (num3 <= num2) { if (!strArrays[num3].StartsWith("Label:")) { num3 = checked (num3 + 1); } else { str1 = strArrays[num3].Substring(6); break; } } } catch (Exception exception) { ProjectData.SetProjectError(exception); ProjectData.ClearProjectError(); } SQLiteCommand sQLiteCommand = new SQLiteCommand("INSERT INTO cydia_repos(name, path) VALUES(@name, @path)", AppConst.m_dbConnection); SQLiteParameterCollection parameters = sQLiteCommand.get_Parameters(); parameters.AddWithValue("@name", str1); parameters.AddWithValue("@path", str); parameters = null; sQLiteCommand.ExecuteNonQuery(); object objectValue = RuntimeHelpers.GetObjectValue(this.LoadCydiaRepos(str)); CydiaRepoManager.LoadPackages(str); if (File.Exists("Packages")) { CydiaRepoManager.ParsePackages(Conversions.ToInteger(objectValue), null, null, ""); } } else { Interaction.MsgBox("Incorrect URL", MsgBoxStyle.OkOnly, "Error"); } }
private void BackgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { Dictionary <int, string> .Enumerator enumerator = new Dictionary <int, string> .Enumerator(); Thread.Sleep(2000); UpdateCydia.ChangeTextsSafe changeTextsSafe = new UpdateCydia.ChangeTextsSafe(this.ChangeTexts); UpdateCydia.CompleteSafe completeSafe = new UpdateCydia.CompleteSafe(this.Complete); Dictionary <int, string> cydiaRepos = Database.GetCydiaRepos(false); try { enumerator = cydiaRepos.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <int, string> current = enumerator.Current; if (this.CrrLoadCydiaId != -1) { if (this.CrrLoadCydiaId != current.Key) { goto Label1; } } if (!this.bAsync) { base.Invoke(changeTextsSafe, new object[] { current.Value, 0 }); } File.Delete("Packages"); CydiaRepoManager.LoadPackages(current.Value); if (File.Exists("Packages")) { string str = string.Concat("DELETE FROM list_app WHERE cydia_repos=", Conversions.ToString(current.Key)); (new SQLiteCommand(str, AppConst.m_dbConnection)).ExecuteNonQuery(); if (!this.bAsync) { CydiaRepoManager.ParsePackages(current.Key, this, changeTextsSafe, current.Value); } else { CydiaRepoManager.ParsePackages(current.Key, null, null, current.Value); } } if (this.BackgroundWorker1.CancellationPending) { if (!this.bAsync) { base.Invoke(completeSafe, new object[] { true }); } return; } Label1: } } finally { ((IDisposable)enumerator).Dispose(); } if (!this.bAsync) { base.Invoke(completeSafe, new object[] { false }); } }