Stupid attachments got messed up. Fixed the download link.
You will also notice I got rid of the "Pending" and "Completed" graphics in this version. I decided I hated them.Thank you. That was an eyesore.
You will also notice I got rid of the "Pending" and "Completed" graphics in this version. I decided I hated them.Thank you. That was an eyesore.
Is there anything (feature wise) you want adding Phil?Wasn't able to test the latest creation yet, but I plan to use RegaLink to save custom queries and send to a search engine.
Uninstallation[/b][/color]and user.config in %AppData%
Delete the folder that contains the executable and text list.


Ah, didn't realise that Phil...Will get it to save that info within the app. (In the next update)No you shouldn't, unless you need/want/install RegaLink to be portable, only then it should save settings in the current directory.
Ah, didn't realise that Phil...Will get it to save that info within the app. (In the next update)No you shouldn't, unless you need/want/install RegaLink to be portable, only then it should save settings in the current directory.



#region usings
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;
using System.IO;
using RegaLink.Properties;
using Microsoft.VisualBasic;
using RegaLink;
using RegaLinnk;
#endregion
#region namespace
namespace RegaLink
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
#endregion
#region formload
private void Form1_Load(object sender, EventArgs e)
{
BrowserForm browserForm = new BrowserForm();
Settings.Default.DefaultSearch = Settings.Default.DefaultSearch;
if (Settings.Default.WindowLocation != null)
{
this.Location = Settings.Default.WindowLocation;
}
if (Settings.Default.WindowSize != null)
{
this.Size = Settings.Default.WindowSize;
}
this.splitContainer1.SplitterDistance = Settings.Default.SplitterDis;
FileStream yaNew = File.Open("URL.txt", FileMode.Open, FileAccess.Read);
StreamReader yaRead = new StreamReader(yaNew);
string yaView = yaRead.ReadToEnd();
FileStream yaNew3 = File.Open("Visited.txt", FileMode.Open, FileAccess.Read);
StreamReader yaRead3 = new StreamReader(yaNew3);
string yaView3 = yaRead3.ReadToEnd();
yaRead.Close();
yaNew.Close();
yaRead3.Close();
yaNew3.Close();
string[] sep1 = yaView3.Split(new[] { '|' });
string[] sep = new string[1] { "\r\n" };
String[] yaArray = yaView.Split(sep, StringSplitOptions.RemoveEmptyEntries);
String[] yaArray3 = yaView3.Split(sep, StringSplitOptions.RemoveEmptyEntries);
try
{
string[] lines = File.ReadAllLines("Visited.txt");
foreach (string line in lines)
{
string[] URLandDATE = line.Split('|');
ListViewItem ListFeeder = new ListViewItem(URLandDATE[0]);
for (int i = 1; i < URLandDATE.Length; i++)
ListFeeder.SubItems.Add(URLandDATE[i]);
listView3.Items.Add(ListFeeder);
}
}
catch
{
}
try
{
string[] lines1 = File.ReadAllLines("URL.txt");
foreach (string line1 in lines1)
{
string[] URLandDATE1 = line1.Split('|');
ListViewItem ListFeeder1 = new ListViewItem(URLandDATE1[0]);
for (int i = 1; i < URLandDATE1.Length; i++)
ListFeeder1.SubItems.Add(URLandDATE1[i]);
listView1.Items.Add(ListFeeder1);
}
}
catch
{
}
}
#endregion
#region Left Doubleclick
private void list1_DoubleClick(object sender, EventArgs e)
{
string[] prefixes = { "http", "https", "www", "ftp" };
if (prefixes.Any(prefix => listView1.SelectedItems[0].SubItems[0].Text.StartsWith(prefix)))
{
System.Diagnostics.Process.Start(listView1.SelectedItems[0].SubItems[0].Text);
}
else
{
System.Diagnostics.Process.Start(Settings.Default.DefaultSearch.ToString() + listView1.SelectedItems[0].SubItems[0].Text);
}
while (listView1.SelectedItems.Count > 0)
{
ListViewItem temp = listView1.SelectedItems[0];
listView1.Items.Remove(temp);
ListViewItem lvItem = listView3.Items.Insert(0, temp);
lvItem.SubItems.Add(new ListViewItem.ListViewSubItem(lvItem, DateTime.Now.ToString()));
}
#region SaveFile2
using (StreamWriter writer1 = new StreamWriter("URL.txt"))
{
StringBuilder line = new StringBuilder();
foreach (ListViewItem item in listView1.Items)
{
line.Clear();
for (int i = 0; i < item.SubItems.Count; i++)
{
if (i > 0)
line.Append("|");
line.Append(item.SubItems[i].Text);
}
writer1.WriteLine(line);
}
}
using (StreamWriter writer = new StreamWriter("Visited.txt"))
{
StringBuilder line = new StringBuilder();
foreach (ListViewItem item in listView3.Items)
{
line.Clear();
for (int i = 0; i < item.SubItems.Count; i++)
{
if (i > 0)
line.Append("|");
line.Append(item.SubItems[i].Text);
}
writer.WriteLine(line);
}
}
#endregion
}
#endregion
#region Right Doubleclick
private void list2_DoubleClick(object sender, EventArgs e)
{
while (listView3.SelectedItems.Count > 0)
{
ListViewItem temp = listView3.SelectedItems[0];
listView3.Items.Remove(temp);
ListViewItem lvItem = listView1.Items.Insert(0, temp);
lvItem.SubItems.Add(new ListViewItem.ListViewSubItem(lvItem, DateTime.Now.ToString()));
}
#region SaveFile2
using (StreamWriter writer1 = new StreamWriter("URL.txt"))
{
StringBuilder line = new StringBuilder();
foreach (ListViewItem item in listView1.Items)
{
line.Clear();
for (int i = 0; i < item.SubItems.Count; i++)
{
if (i > 0)
line.Append("|");
line.Append(item.SubItems[i].Text);
}
writer1.WriteLine(line);
}
}
using (StreamWriter writer = new StreamWriter("Visited.txt"))
{
StringBuilder line = new StringBuilder();
foreach (ListViewItem item in listView3.Items)
{
line.Clear();
for (int i = 0; i < item.SubItems.Count; i++)
{
if (i > 0)
line.Append("|");
line.Append(item.SubItems[i].Text);
}
writer.WriteLine(line);
}
}
#endregion
}
#endregion
#region Context Menus Items
private void listView1_ItemDrag(object sender, ItemDragEventArgs e)
{
listView1.DoDragDrop(listView1.SelectedItems, DragDropEffects.Move);
}
private void listView1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
int len = e.Data.GetFormats().Length - 1;
int i;
for (i = 0; i <= len; i++)
{
if (e.Data.GetFormats()[i].Equals("System.Windows.Forms.ListView+SelectedListViewItemCollection"))
{
e.Effect = DragDropEffects.Move;
}
}
}
private void listView1_DragDrop(object sender, DragEventArgs e)
{
string gelen = (string)e.Data.GetData(typeof(string));
if (!string.IsNullOrEmpty(gelen))
listView1.Items.Add(gelen);
#region savefile
using (StreamWriter sw = new StreamWriter("Visited.txt"))
{
foreach (ListViewItem item in listView2.Items)
{
sw.WriteLine(item.Text);
}
}
using (StreamWriter sw = new StreamWriter("Visited.txt"))
{
foreach (ListViewItem item in listView2.Items)
{
sw.Write(item.Text);
for (int i = 1; i < item.SubItems.Count; i++)
sw.Write("," + item.SubItems[i].Text + "\r\n");
sw.Write("\r\n");
}
}
using (StreamWriter sw = new StreamWriter("URL.txt"))
{
foreach (ListViewItem item in listView1.Items)
{
sw.WriteLine(item.Text);
}
}
using (StreamWriter sw = new StreamWriter("URL.txt"))
{
foreach (ListViewItem item in listView1.Items)
{
sw.Write(item.Text);
for (int i = 1; i < item.SubItems.Count; i++)
sw.Write("," + item.SubItems[i].Text + "\r\n");
sw.Write("\r\n");
}
}
#endregion
if (listView1.SelectedItems.Count == 0)
{
return;
}
Point cp = listView1.PointToClient(new Point(e.X, e.Y));
ListViewItem dragToItem = listView1.GetItemAt(cp.X, cp.Y);
if (dragToItem == null)
{
return;
}
int dragIndex = dragToItem.Index;
ListViewItem[] sel = new ListViewItem[listView1.SelectedItems.Count];
//for (int i = 0; i <= listView1.SelectedItems.Count - 1; i++)
for (int i = 0; i < listView1.SelectedItems.Count; i++)
{
sel[i] = listView1.SelectedItems[i];
}
for (int i = 0; i < sel.GetLength(0); i++)
{
ListViewItem dragItem = sel[i];
int itemIndex = dragIndex;
if (itemIndex == dragItem.Index)
{
return;
}
if (dragItem.Index < itemIndex)
itemIndex++;
else
itemIndex = dragIndex + i;
ListViewItem insertItem = (ListViewItem)dragItem.Clone();
listView1.Items.Insert(itemIndex, insertItem);
listView1.Items.Remove(dragItem);
}
}
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
while (listView1.SelectedItems.Count > 0)
{
ListViewItem temp = listView1.SelectedItems[0];
listView1.Items.Remove(temp);
notifyIcon1.BalloonTipText = "You successfully deleted an item!!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "Item Deleted!";
notifyIcon1.ShowBalloonTip(500);
}
}
private void clearEntireListToolStripMenuItem_Click(object sender, EventArgs e)
{
listView1.Items.Clear();
notifyIcon1.BalloonTipText = "You successfully cleared the list of pending websites!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "Pending List Cleared!";
notifyIcon1.ShowBalloonTip(500);
}
private void deleteThisItemToolStripMenuItem_Click(object sender, EventArgs e)
{
while (listView2.SelectedItems.Count > 0)
{
ListViewItem temp = listView2.SelectedItems[0];
listView2.Items.Remove(temp);
notifyIcon1.BalloonTipText = "You successfully deleted an item!!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "Item Deleted!";
notifyIcon1.ShowBalloonTip(500);
}
}
#endregion
#region Clear Items
private void clearListToolStripMenuItem_Click(object sender, EventArgs e)
{
listView2.Items.Clear();
notifyIcon1.BalloonTipText = "You successfully cleared the list of visited websites!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "Visited List Cleared!";
notifyIcon1.ShowBalloonTip(500);
}
#endregion
#region Form Closed
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
Properties.Settings.Default.Save();
}
#endregion
#region Form Closing
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Settings.Default.DefaultSearch = Settings.Default.DefaultSearch;
Settings.Default.WindowLocation = this.Location;
if (this.WindowState == FormWindowState.Normal)
{
Settings.Default.WindowSize = this.Size;
}
else
{
Settings.Default.WindowSize = this.RestoreBounds.Size;
}
Settings.Default.SplitterDis = this.splitContainer1.SplitterDistance;
Settings.Default.Save();
#region SaveFile2
using (StreamWriter writer1 = new StreamWriter("URL.txt"))
{
StringBuilder line = new StringBuilder();
foreach (ListViewItem item in listView1.Items)
{
line.Clear();
for (int i = 0; i < item.SubItems.Count; i++)
{
if (i > 0)
line.Append("|");
line.Append(item.SubItems[i].Text);
}
writer1.WriteLine(line);
}
}
using (StreamWriter writer = new StreamWriter("Visited.txt"))
{
StringBuilder line = new StringBuilder();
foreach (ListViewItem item in listView3.Items)
{
line.Clear();
for (int i = 0; i < item.SubItems.Count; i++)
{
if (i > 0)
line.Append("|");
line.Append(item.SubItems[i].Text);
}
writer.WriteLine(line);
}
}
#endregion
}
#endregion
#region Show Window
private void restoreThisWindowToolStripMenuItem_Click(object sender, EventArgs e)
{
Show();
}
#endregion
#region Hide Window
private void button2_Click(object sender, EventArgs e)
{
Hide();
notifyIcon1.BalloonTipText = "I ran away, but don't worry! If you right click me, I am sure I will come back out to play!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "Hi There!!";
notifyIcon1.ShowBalloonTip(500);
}
#endregion
private void aDDURLToolStripMenuItem_Click(object sender, EventArgs e)
{
string[] prefixes = { "http", "https", "www", "ftp" };
string input = Interaction.InputBox("Enter URL to add to the pending list.", "Add URL To Pending List", "");
if (input.Length == 0)
{
MessageBox.Show("You forgot to add anything!");
}
else
{
ListViewItem lvItem = listView1.Items.Insert(0, input);
lvItem.SubItems.Add(new ListViewItem.ListViewSubItem(lvItem, DateTime.Now.ToString()));
}
}
private void button3_Click(object sender, EventArgs e)
{
Process.Start("URL.txt");
}
private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
{
this.splitContainer1.SplitterDistance = 285;
}
private void saveCurrentListAsToolStripMenuItem_Click(object sender, EventArgs e)
{
string[] prefixes = { "http", "https", "www", "ftp" };
string input = Interaction.InputBox("Save your list to a text file contained within the application folder.", "Save pending list!", "");
if (input.Length == 0)
{
MessageBox.Show("Oops...You forgot to specify a file name!");
}
else
{
using (StreamWriter writer1 = new StreamWriter(input + ".txt"))
{
StringBuilder line = new StringBuilder();
foreach (ListViewItem item in listView1.Items)
{
line.Clear();
for (int i = 0; i < item.SubItems.Count; i++)
{
if (i > 0)
line.Append("|");
line.Append(item.SubItems[i].Text);
}
writer1.WriteLine(line);
notifyIcon1.BalloonTipText = input + ".txt" + " has been saved to the same folder as I am located!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "RegaLink Polite Notice";
notifyIcon1.ShowBalloonTip(500);
}
}
}
}
private void loadListToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog1.InitialDirectory = "";
openFileDialog1.Filter = "URL List (.txt)|*.txt";
openFileDialog1.Title = "Select a URL List file";
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
System.IO.StreamReader sr = new
System.IO.StreamReader(openFileDialog1.FileName);
listView1.Items.Add(sr.ReadToEnd());
sr.Close();
Application.Restart();
}
}
private void button1_Click_1(object sender, EventArgs e)
{
if (listView1.Enabled == true)
{
listView1.Enabled = false;
listView3.Enabled = false;
button1.Text = "UnLock";
}
else
{
listView1.Enabled = true;
listView3.Enabled = true;
button1.Text = "Lock";
}
}
private void editItemToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count > 0)
{
string input = Interaction.InputBox("You are currently editing the item named: " + this.listView1.SelectedItems[0].Text.ToString() + " | Please enter a new URL or Search Term below and click OK", "Edit Selected Item", "");
string[] prefixes = { "http", "https", "www", "ftp" };
if (input.Length == 0)
{
MessageBox.Show("You forgot to add anything!");
}
else
{
this.listView1.SelectedItems[0].Text = input;
}
}
else
{
}
using (StreamWriter writer1 = new StreamWriter("URL.txt"))
{
StringBuilder line = new StringBuilder();
foreach (ListViewItem item in listView1.Items)
{
line.Clear();
for (int i = 0; i < item.SubItems.Count; i++)
{
if (i > 0)
line.Append("|");
line.Append(item.SubItems[i].Text);
}
writer1.WriteLine(line);
}
}
}
private void button4_Click(object sender, EventArgs e)
{
SettingsDialog sd = new SettingsDialog();
sd.ShowDialog();
}
private void quitToolStripMenuItem_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Save();
Application.Exit();
}
private void toolStripMenuItem5_Click(object sender, EventArgs e)
{
for (int i = 0; i < listView3.Items.Count; i++)
{
if (listView3.Items[i].Selected)
{
listView3.Items[i].Remove();
i--;
notifyIcon1.BalloonTipText = "You successfully deleted an item!!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "Item Deleted!";
notifyIcon1.ShowBalloonTip(500);
}
}
}
private void toolStripMenuItem6_Click(object sender, EventArgs e)
{
listView3.Items.Clear();
notifyIcon1.BalloonTipText = "You successfully cleared the list of visited websites!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "List Cleared!";
notifyIcon1.ShowBalloonTip(500);
}
private void settingsToolStripMenuItem1_Click(object sender, EventArgs e)
{
SettingsDialog sd = new SettingsDialog();
sd.ShowDialog();
}
private void lockWindowsToolStripMenuItem1_Click(object sender, EventArgs e)
{
if (listView1.Enabled == true)
{
listView1.Enabled = false;
listView3.Enabled = false;
lockWindowsToolStripMenuItem1.Text = "Unlock Windows";
}
else
{
listView1.Enabled = true;
listView3.Enabled = true;
lockWindowsToolStripMenuItem1.Text = "Lock Windows";
}
}
private void donateToAuthorToolStripMenuItem1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("http://www.donationcoder.com/forum/index.php?action=dlist;sa=search;search=254145;fields=uid");
}
private void previewItemToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count > 0)
{
Preview pv = new Preview();
pv.Navigate(listView1.SelectedItems[0].Text);
pv.Show();
string[] prefixes = { "http", "https", "www", "ftp" };
if (prefixes.Any(prefix => listView1.SelectedItems[0].SubItems[0].Text.StartsWith(prefix)))
{
pv.Text = "Previewing: " + listView1.SelectedItems[0].SubItems[0].Text;
pv.Navigate(listView1.SelectedItems[0].SubItems[0].Text);
}
else
{
pv.Text = "Previewing: " + Settings.Default.DefaultSearch.ToString() + listView1.SelectedItems[0].SubItems[0].Text;
pv.Navigate(Settings.Default.DefaultSearch.ToString() + listView1.SelectedItems[0].SubItems[0].Text);
}
}
else
{
}
}
private void saveCurrentListToolStripMenuItem_Click(object sender, EventArgs e)
{
string[] prefixes = { "http", "https", "www", "ftp" };
string input = Interaction.InputBox("Save your list to a text file contained within the application folder.", "Save Visited List!", "");
if (input.Length == 0)
{
MessageBox.Show("Oops...You forgot to specify a file name!");
}
else
{
using (StreamWriter writer1 = new StreamWriter(input + ".txt"))
{
StringBuilder line = new StringBuilder();
foreach (ListViewItem item in listView3.Items)
{
line.Clear();
for (int i = 0; i < item.SubItems.Count; i++)
{
if (i > 0)
line.Append("|");
line.Append(item.SubItems[i].Text);
}
writer1.WriteLine(line);
notifyIcon1.BalloonTipText = input + ".txt" + " has been saved to the same folder as I am located!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "RegaLink Polite Notice";
notifyIcon1.ShowBalloonTip(500);
}
}
}
}
private void minimizeToSystemTrayToolStripMenuItem_Click(object sender, EventArgs e)
{
Hide();
notifyIcon1.BalloonTipText = "I ran away, but don't worry! If you right click me, I am sure I will come back out to play!";
notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon1.BalloonTipTitle = "Hi There!!";
notifyIcon1.ShowBalloonTip(500);
}
private void testToolStripMenuItem_Click(object sender, EventArgs e)
{
RegaLinnk.Main.OpenMainForm();
}
private void renameWindowToolStripMenuItem_Click(object sender, EventArgs e)
{
string input = Interaction.InputBox("Change The Window Title", "Edit Mode", "");
if (input.Length == 0)
{
MessageBox.Show("Oops...You forgot to specify a window name!");
}
else
{
this.Text = input;
}
}
#region End
}
}
#endregion








Original address: https://www.donationcoder.com/forum/index.php?topic=34461.0