diff --git a/LinkExtractor.sln b/LinkExtractor.sln index b0fcc65..6769a52 100644 --- a/LinkExtractor.sln +++ b/LinkExtractor.sln @@ -5,18 +5,48 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkExtractor", "LinkExtrac EndProject Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "LinkExtractorInstaller", "LinkExtractorInstaller\LinkExtractorInstaller.vdproj", "{A886FDFE-5636-49EB-B676-BA1F0E286565}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkExtractorAsLibrary", "LinkExtractorAsLibrary\LinkExtractorAsLibrary.csproj", "{857C0505-A133-4353-B0E6-E9147D00AF0A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Debug|Any CPU.ActiveCfg = Debug|x86 + {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Debug|Mixed Platforms.Build.0 = Debug|x86 {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Debug|x86.ActiveCfg = Debug|x86 {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Debug|x86.Build.0 = Debug|x86 + {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Release|Any CPU.ActiveCfg = Release|x86 + {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Release|Mixed Platforms.Build.0 = Release|x86 {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Release|x86.ActiveCfg = Release|x86 {A4764298-CCC6-44D7-8463-BD755ACF92C5}.Release|x86.Build.0 = Release|x86 + {A886FDFE-5636-49EB-B676-BA1F0E286565}.Debug|Any CPU.ActiveCfg = Debug + {A886FDFE-5636-49EB-B676-BA1F0E286565}.Debug|Any CPU.Build.0 = Debug + {A886FDFE-5636-49EB-B676-BA1F0E286565}.Debug|Mixed Platforms.ActiveCfg = Debug + {A886FDFE-5636-49EB-B676-BA1F0E286565}.Debug|Mixed Platforms.Build.0 = Debug {A886FDFE-5636-49EB-B676-BA1F0E286565}.Debug|x86.ActiveCfg = Debug + {A886FDFE-5636-49EB-B676-BA1F0E286565}.Release|Any CPU.ActiveCfg = Release + {A886FDFE-5636-49EB-B676-BA1F0E286565}.Release|Any CPU.Build.0 = Release + {A886FDFE-5636-49EB-B676-BA1F0E286565}.Release|Mixed Platforms.ActiveCfg = Release + {A886FDFE-5636-49EB-B676-BA1F0E286565}.Release|Mixed Platforms.Build.0 = Release {A886FDFE-5636-49EB-B676-BA1F0E286565}.Release|x86.ActiveCfg = Release + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Debug|x86.ActiveCfg = Debug|Any CPU + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Release|Any CPU.Build.0 = Release|Any CPU + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {857C0505-A133-4353-B0E6-E9147D00AF0A}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/LinkExtractor/MainForm.cs b/LinkExtractor/MainForm.cs index 4b7a6ed..2f7ab1b 100644 --- a/LinkExtractor/MainForm.cs +++ b/LinkExtractor/MainForm.cs @@ -12,285 +12,306 @@ namespace LinkExtractor { - public partial class MainForm : Form - { - /// - /// Webovy klient pro stazeni obsahu stranky - /// - protected WebClient client; + public partial class MainForm : Form + { + /// + /// Webovy klient pro stazeni obsahu stranky + /// + protected WebClient client; - /// - /// Seznam na nalezene linky - /// - protected List links; + /// + /// Seznam na nalezene linky + /// + protected List links; - /// - /// Seznam na filtrovane linky - /// - protected List filteredLinks; + /// + /// Seznam na filtrovane linky + /// + protected List filteredLinks; - /// - /// Obsah stazene stranky nebo obsah z primeho vstupu - /// - protected string content; + /// + /// Obsah stazene stranky nebo obsah z primeho vstupu + /// + protected string content; - /// - /// Form pro zadavani primeho vstupu - /// - protected Inputer frmDirectInput; + /// + /// Form pro zadavani primeho vstupu + /// + protected Inputer frmDirectInput; - /// - /// Form pro zobrazeni vybranych odkazu - /// - protected Inputer frmSubstractedLinks; + /// + /// Form pro zobrazeni vybranych odkazu + /// + protected Inputer frmSubstractedLinks; - /// - /// Form pro zobrazeni stazeneho obsahu - /// - protected Inputer frmContent; + /// + /// Form pro zobrazeni stazeneho obsahu + /// + protected Inputer frmContent; - public MainForm() - { - InitializeComponent(); + public MainForm() + { + InitializeComponent(); - this.client = new WebClient(); - this.links = new List(); - this.filteredLinks = new List(); - } + this.client = new WebClient(); + this.links = new List(); + this.filteredLinks = new List(); + } - /// - /// Najde vsechny linky v content a ulozi do links - /// - /// retezec obsahujici linky - public void FindLinks(string content) - { - if (!cbxAppend.Checked) - { - links.Clear(); - filteredLinks.Clear(); - } - - Regex rgx = new Regex("(https?://([0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?)"); - MatchCollection mc = rgx.Matches(TranslateEntities(content)); - - foreach (Match m in mc) - { - links.Add(m.Groups[0].Value); - } - } - - /// - /// Prelozi html entity na "klasicke" znaky - /// TODO: Vylepsit preklad :) - /// - /// text obsahujici entity - /// text s nahrazenymi html entitami - public string TranslateEntities(string content) - { - return content.Replace(@":", ":"); - } + /// + /// Najde vsechny linky v content a ulozi do links + /// + /// retezec obsahujici linky + public void FindLinks(string content) + { + if (!cbxAppend.Checked) + { + links.Clear(); + filteredLinks.Clear(); + } - /// - /// Nacte obsah z webu a vrati ho - /// - /// Url adresa odkud se bude cist - /// obsah zadane url - public string DownloadContent(string url) - { - StreamReader sr = new StreamReader(client.OpenRead(url)); - return sr.ReadToEnd(); - } + Regex rgx = new Regex("(https?://([0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?)"); + MatchCollection mc = rgx.Matches(TranslateEntities(content)); - /// - /// Naplni lvwLinks odkazy v links - /// Seznam odkazu k zobrazeni - /// - public void FillListView(List links) - { - Cursor lastCursor = this.Cursor; - try + foreach (Match m in mc) { - Cursor.Current = Cursors.WaitCursor; - try + String match = m.Groups[0].Value; + int index = match.IndexOf("http://"); + do { - lvwLinks.BeginUpdate(); - lvwLinks.Items.Clear(); - foreach (string link in links) + int end = match.IndexOf("http://", index + 1); + string lnk = ""; + if (end == -1) { - string[] cols = { "", link }; - ListViewItem lvi = new ListViewItem(cols); - lvi.Checked = true; - lvwLinks.Items.Add(lvi); + lnk = match.Substring(index, match.Length - index); } - Application.DoEvents(); - } - finally - { - lvwLinks.EndUpdate(); - } - } - catch (Exception ex) - { - MessageBox.Show(this, String.Format("Some Error occurs;{0}{1}{2}Please, contact author, thanks", Environment.NewLine, ex.Message, Environment.NewLine), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - finally - { - Cursor.Current = lastCursor; - } - } + else + { + lnk = match.Substring(index, end - index); + } + if (lnk.EndsWith(")")) + { + lnk = lnk.Substring(0, lnk.Length - 1); + } + links.Add(lnk); - /// - /// Zkontroluje zadany retezec je validni url adresa - /// - /// testovany retezec - /// true pokud je url validni url adresa, false v opacnem pripade - public bool ValidateUrl(string url) - { - Regex rgx = new Regex("https?://([0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?"); - return rgx.IsMatch(url); - } + index = end; + } while (index != -1); + } + } - /// - /// Provede filtrovani vyhledanych odkazu podle zadaneho vzoru - /// - /// vzor pro hledani odkazu - public void FilterLinks(string pattern) - { - Regex rgx = new Regex(".*" + pattern + ".*"); + /// + /// Prelozi html entity na "klasicke" znaky + /// TODO: Vylepsit preklad :) + /// + /// text obsahujici entity + /// text s nahrazenymi html entitami + public string TranslateEntities(string content) + { + return content.Replace(@":", ":"); + } - filteredLinks.Clear(); - foreach (string item in links) - { - if (rgx.IsMatch(item)) - { - filteredLinks.Add(item); - } - } + /// + /// Nacte obsah z webu a vrati ho + /// + /// Url adresa odkud se bude cist + /// obsah zadane url + public string DownloadContent(string url) + { + StreamReader sr = new StreamReader(client.OpenRead(url)); + return sr.ReadToEnd(); + } - FillListView(filteredLinks); - } + /// + /// Naplni lvwLinks odkazy v links + /// Seznam odkazu k zobrazeni + /// + public void FillListView(List links) + { + Cursor lastCursor = this.Cursor; + try + { + Cursor.Current = Cursors.WaitCursor; + try + { + lvwLinks.BeginUpdate(); + lvwLinks.Items.Clear(); + foreach (string link in links) + { + string[] cols = { "", link }; + ListViewItem lvi = new ListViewItem(cols); + lvi.Checked = true; + lvwLinks.Items.Add(lvi); + } + Application.DoEvents(); + } + finally + { + lvwLinks.EndUpdate(); + } + } + catch (Exception ex) + { + MessageBox.Show(this, String.Format("Some Error occurs;{0}{1}{2}Please, contact author, thanks", Environment.NewLine, ex.Message, Environment.NewLine), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + finally + { + Cursor.Current = lastCursor; + } + } - private void btnUrl_Click(object sender, EventArgs e) - { - if (ValidateUrl(tbxUrl.Text)) - { - this.Enabled = false; - this.Text = String.Format("LinkExtractor - Downloading content from {0} ...", tbxUrl.Text); + /// + /// Zkontroluje zadany retezec je validni url adresa + /// + /// testovany retezec + /// true pokud je url validni url adresa, false v opacnem pripade + public bool ValidateUrl(string url) + { + Regex rgx = new Regex("https?://([0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?"); + return rgx.IsMatch(url); + } - content = DownloadContent(tbxUrl.Text); + /// + /// Provede filtrovani vyhledanych odkazu podle zadaneho vzoru + /// + /// vzor pro hledani odkazu + public void FilterLinks(string pattern) + { + Regex rgx = new Regex(".*" + pattern + ".*"); - this.Enabled = true; - this.Text = "LinkExtractor"; + filteredLinks.Clear(); + foreach (string item in links) + { + if (rgx.IsMatch(item)) + { + filteredLinks.Add(item); + } + } - FindLinks(content); - if (tbxAdditionalFilter.Text.Equals("")) - { - FillListView(links); - } - else - { - FilterLinks(tbxAdditionalFilter.Text); - FillListView(filteredLinks); - } - } - else - { - MessageBox.Show("Inputed isn't a valid url address!", "Wrong Input", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } + FillListView(filteredLinks); + } - private void tbxAdditionalFilter_TextChanged(object sender, EventArgs e) - { - FilterLinks(tbxAdditionalFilter.Text); - } + private void btnUrl_Click(object sender, EventArgs e) + { + if (ValidateUrl(tbxUrl.Text)) + { + this.Enabled = false; + this.Text = String.Format("LinkExtractor - Downloading content from {0} ...", tbxUrl.Text); - private void btnPaste_Click(object sender, EventArgs e) - { - if (frmDirectInput == null) - { - frmDirectInput = new Inputer(); - frmDirectInput.Title = "Direct Input"; - } - if (frmDirectInput.WindowState == FormWindowState.Minimized) - { - frmDirectInput.WindowState = FormWindowState.Normal; - } - if (!frmDirectInput.Visible) - { - frmDirectInput.Show(); - } - frmDirectInput.BringToFront(); - frmDirectInput.FormClosed += delegate { frmDirectInput = null; }; - frmDirectInput.OkButtonClicked += delegate - { - content = frmDirectInput.Value; - FindLinks(content); - if (tbxAdditionalFilter.Text.Equals("")) - { - FillListView(links); - } - else - { - FilterLinks(tbxAdditionalFilter.Text); - FillListView(filteredLinks); - } - frmDirectInput.Close(); - }; - } + content = DownloadContent(tbxUrl.Text); - private void btnSubstractLinks_Click(object sender, EventArgs e) - { - if (frmSubstractedLinks == null) - { - frmSubstractedLinks = new Inputer(); - frmSubstractedLinks.Title = "Substracted Links"; + this.Enabled = true; + this.Text = "LinkExtractor"; - foreach (ListViewItem item in lvwLinks.Items) - { - if (item.Checked) - { - frmSubstractedLinks.Value += item.SubItems[1].Text + Environment.NewLine; - } - } - } - if (frmSubstractedLinks.WindowState == FormWindowState.Minimized) - { - frmSubstractedLinks.WindowState = FormWindowState.Normal; - } - if (!frmSubstractedLinks.Visible) - { - frmSubstractedLinks.Show(); - } - frmSubstractedLinks.BringToFront(); - frmSubstractedLinks.FormClosed += delegate { frmSubstractedLinks = null; }; - frmSubstractedLinks.OkButtonClicked += delegate - { - frmSubstractedLinks.Close(); - }; - } + FindLinks(content); + if (tbxAdditionalFilter.Text.Equals("")) + { + FillListView(links); + } + else + { + FilterLinks(tbxAdditionalFilter.Text); + FillListView(filteredLinks); + } + } + else + { + MessageBox.Show("Inputed isn't a valid url address!", "Wrong Input", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } - private void lnlShowHidePage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - if (frmContent == null) - { - frmContent = new Inputer(); - frmContent.Title = "Donwloaded Content"; - frmContent.Value = content; - } - if (frmContent.WindowState == FormWindowState.Minimized) - { - frmContent.WindowState = FormWindowState.Normal; - } - if (!frmContent.Visible) - { - frmContent.Show(); - } - frmContent.BringToFront(); - frmContent.FormClosed += delegate { frmContent = null; }; - frmContent.OkButtonClicked += delegate - { - frmContent.Close(); - }; - } - } + private void tbxAdditionalFilter_TextChanged(object sender, EventArgs e) + { + FilterLinks(tbxAdditionalFilter.Text); + } + + private void btnPaste_Click(object sender, EventArgs e) + { + if (frmDirectInput == null) + { + frmDirectInput = new Inputer(); + frmDirectInput.Title = "Direct Input"; + } + if (frmDirectInput.WindowState == FormWindowState.Minimized) + { + frmDirectInput.WindowState = FormWindowState.Normal; + } + if (!frmDirectInput.Visible) + { + frmDirectInput.Show(); + } + frmDirectInput.BringToFront(); + frmDirectInput.FormClosed += delegate { frmDirectInput = null; }; + frmDirectInput.OkButtonClicked += delegate + { + content = frmDirectInput.Value; + FindLinks(content); + if (tbxAdditionalFilter.Text.Equals("")) + { + FillListView(links); + } + else + { + FilterLinks(tbxAdditionalFilter.Text); + FillListView(filteredLinks); + } + frmDirectInput.Close(); + }; + } + + private void btnSubstractLinks_Click(object sender, EventArgs e) + { + if (frmSubstractedLinks == null) + { + frmSubstractedLinks = new Inputer(); + frmSubstractedLinks.Title = "Substracted Links"; + + foreach (ListViewItem item in lvwLinks.Items) + { + if (item.Checked) + { + frmSubstractedLinks.Value += item.SubItems[1].Text + Environment.NewLine; + } + } + } + if (frmSubstractedLinks.WindowState == FormWindowState.Minimized) + { + frmSubstractedLinks.WindowState = FormWindowState.Normal; + } + if (!frmSubstractedLinks.Visible) + { + frmSubstractedLinks.Show(); + } + frmSubstractedLinks.BringToFront(); + frmSubstractedLinks.FormClosed += delegate { frmSubstractedLinks = null; }; + frmSubstractedLinks.OkButtonClicked += delegate + { + frmSubstractedLinks.Close(); + }; + } + + private void lnlShowHidePage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + if (frmContent == null) + { + frmContent = new Inputer(); + frmContent.Title = "Donwloaded Content"; + frmContent.Value = content; + } + if (frmContent.WindowState == FormWindowState.Minimized) + { + frmContent.WindowState = FormWindowState.Normal; + } + if (!frmContent.Visible) + { + frmContent.Show(); + } + frmContent.BringToFront(); + frmContent.FormClosed += delegate { frmContent = null; }; + frmContent.OkButtonClicked += delegate + { + frmContent.Close(); + }; + } + } } diff --git a/LinkExtractorAsLibrary/Inputer.Designer.cs b/LinkExtractorAsLibrary/Inputer.Designer.cs new file mode 100644 index 0000000..3b30695 --- /dev/null +++ b/LinkExtractorAsLibrary/Inputer.Designer.cs @@ -0,0 +1,77 @@ +namespace LinkExtractor +{ + partial class Inputer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.rtbInput = new System.Windows.Forms.RichTextBox(); + this.btnOk = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // rtbInput + // + this.rtbInput.Anchor = ((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.rtbInput.AutoWordSelection = true; + this.rtbInput.DetectUrls = false; + this.rtbInput.Location = new System.Drawing.Point(12, 12); + this.rtbInput.Name = "rtbInput"; + this.rtbInput.Size = new System.Drawing.Size(452, 285); + this.rtbInput.TabIndex = 0; + this.rtbInput.Text = ""; + // + // btnOk + // + this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnOk.Location = new System.Drawing.Point(389, 303); + this.btnOk.Name = "btnOk"; + this.btnOk.Size = new System.Drawing.Size(75, 23); + this.btnOk.TabIndex = 1; + this.btnOk.Text = "OK"; + this.btnOk.UseVisualStyleBackColor = true; + this.btnOk.Click += new System.EventHandler(this.btnOk_Click); + // + // Inputer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(476, 338); + this.Controls.Add(this.btnOk); + this.Controls.Add(this.rtbInput); + this.Name = "Inputer"; + this.Text = "Inputer"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.RichTextBox rtbInput; + private System.Windows.Forms.Button btnOk; + } +} \ No newline at end of file diff --git a/LinkExtractorAsLibrary/Inputer.cs b/LinkExtractorAsLibrary/Inputer.cs new file mode 100644 index 0000000..85f92ce --- /dev/null +++ b/LinkExtractorAsLibrary/Inputer.cs @@ -0,0 +1,48 @@ +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; + +namespace LinkExtractor +{ + public delegate void ButtonClickHandler(object sender, EventArgs e); + + public partial class Inputer : Form + { + public event ButtonClickHandler OkButtonClicked; + + public string Value + { + get { return rtbInput.Text; } + set { rtbInput.Text = value; } + } + + public string Title + { + get { return this.Text; } + set { this.Text = value; } + } + + public Inputer() + { + InitializeComponent(); + } + + protected void Fire(Delegate dlg, params object[] pList) + { + if (dlg != null) + { + this.BeginInvoke(dlg, pList); + } + } + + private void btnOk_Click(object sender, EventArgs e) + { + Fire(OkButtonClicked, this, e); + } + } +} diff --git a/LinkExtractorAsLibrary/Inputer.resx b/LinkExtractorAsLibrary/Inputer.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/LinkExtractorAsLibrary/Inputer.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LinkExtractorAsLibrary/LinkExtractorAsLibrary.csproj b/LinkExtractorAsLibrary/LinkExtractorAsLibrary.csproj new file mode 100644 index 0000000..467acf0 --- /dev/null +++ b/LinkExtractorAsLibrary/LinkExtractorAsLibrary.csproj @@ -0,0 +1,97 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {857C0505-A133-4353-B0E6-E9147D00AF0A} + Library + Properties + LinkExtractorAsLibrary + LinkExtractorAsLibrary + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + Form + + + Inputer.cs + + + Form + + + MainForm.cs + + + + Resources.resx + True + True + + + Settings.settings + True + True + + + + + Inputer.cs + + + MainForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + \ No newline at end of file diff --git a/LinkExtractorAsLibrary/MainForm.Designer.cs b/LinkExtractorAsLibrary/MainForm.Designer.cs new file mode 100644 index 0000000..fa056e9 --- /dev/null +++ b/LinkExtractorAsLibrary/MainForm.Designer.cs @@ -0,0 +1,209 @@ +namespace LinkExtractor +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + this.tbxUrl = new System.Windows.Forms.TextBox(); + this.lblUrl = new System.Windows.Forms.Label(); + this.btnUrl = new System.Windows.Forms.Button(); + this.btnPaste = new System.Windows.Forms.Button(); + this.lvwLinks = new System.Windows.Forms.ListView(); + this.chdUse = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chdLink = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.lnlShowHidePage = new System.Windows.Forms.LinkLabel(); + this.btnSubstractLinks = new System.Windows.Forms.Button(); + this.lblAdditionalFilter = new System.Windows.Forms.Label(); + this.tbxAdditionalFilter = new System.Windows.Forms.TextBox(); + this.cbxAppend = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // tbxUrl + // + this.tbxUrl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tbxUrl.Location = new System.Drawing.Point(41, 14); + this.tbxUrl.Name = "tbxUrl"; + this.tbxUrl.Size = new System.Drawing.Size(375, 20); + this.tbxUrl.TabIndex = 0; + // + // lblUrl + // + this.lblUrl.AutoSize = true; + this.lblUrl.Location = new System.Drawing.Point(12, 17); + this.lblUrl.Name = "lblUrl"; + this.lblUrl.Size = new System.Drawing.Size(23, 13); + this.lblUrl.TabIndex = 1; + this.lblUrl.Text = "Url:"; + // + // btnUrl + // + this.btnUrl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnUrl.Location = new System.Drawing.Point(422, 12); + this.btnUrl.Name = "btnUrl"; + this.btnUrl.Size = new System.Drawing.Size(75, 23); + this.btnUrl.TabIndex = 2; + this.btnUrl.Text = "Open Url"; + this.btnUrl.UseVisualStyleBackColor = true; + this.btnUrl.Click += new System.EventHandler(this.btnUrl_Click); + // + // btnPaste + // + this.btnPaste.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnPaste.Location = new System.Drawing.Point(503, 12); + this.btnPaste.Name = "btnPaste"; + this.btnPaste.Size = new System.Drawing.Size(91, 23); + this.btnPaste.TabIndex = 3; + this.btnPaste.Text = "Direct Input"; + this.btnPaste.UseVisualStyleBackColor = true; + this.btnPaste.Click += new System.EventHandler(this.btnPaste_Click); + // + // lvwLinks + // + this.lvwLinks.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lvwLinks.CheckBoxes = true; + this.lvwLinks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chdUse, + this.chdLink}); + this.lvwLinks.FullRowSelect = true; + this.lvwLinks.GridLines = true; + this.lvwLinks.Location = new System.Drawing.Point(15, 41); + this.lvwLinks.Name = "lvwLinks"; + this.lvwLinks.Size = new System.Drawing.Size(704, 356); + this.lvwLinks.TabIndex = 4; + this.lvwLinks.UseCompatibleStateImageBehavior = false; + this.lvwLinks.View = System.Windows.Forms.View.Details; + // + // chdUse + // + this.chdUse.Text = "Use"; + this.chdUse.Width = 35; + // + // chdLink + // + this.chdLink.Text = "Link"; + this.chdLink.Width = 627; + // + // lnlShowHidePage + // + this.lnlShowHidePage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.lnlShowHidePage.AutoSize = true; + this.lnlShowHidePage.Location = new System.Drawing.Point(446, 408); + this.lnlShowHidePage.Name = "lnlShowHidePage"; + this.lnlShowHidePage.Size = new System.Drawing.Size(100, 13); + this.lnlShowHidePage.TabIndex = 5; + this.lnlShowHidePage.TabStop = true; + this.lnlShowHidePage.Text = "Show page content"; + this.lnlShowHidePage.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnlShowHidePage_LinkClicked); + // + // btnSubstractLinks + // + this.btnSubstractLinks.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnSubstractLinks.Location = new System.Drawing.Point(552, 403); + this.btnSubstractLinks.Name = "btnSubstractLinks"; + this.btnSubstractLinks.Size = new System.Drawing.Size(164, 23); + this.btnSubstractLinks.TabIndex = 6; + this.btnSubstractLinks.Text = "Substract selected links"; + this.btnSubstractLinks.UseVisualStyleBackColor = true; + this.btnSubstractLinks.Click += new System.EventHandler(this.btnSubstractLinks_Click); + // + // lblAdditionalFilter + // + this.lblAdditionalFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblAdditionalFilter.AutoSize = true; + this.lblAdditionalFilter.Location = new System.Drawing.Point(12, 408); + this.lblAdditionalFilter.Name = "lblAdditionalFilter"; + this.lblAdditionalFilter.Size = new System.Drawing.Size(81, 13); + this.lblAdditionalFilter.TabIndex = 7; + this.lblAdditionalFilter.Text = "Additional Filter:"; + // + // tbxAdditionalFilter + // + this.tbxAdditionalFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tbxAdditionalFilter.Location = new System.Drawing.Point(99, 405); + this.tbxAdditionalFilter.Name = "tbxAdditionalFilter"; + this.tbxAdditionalFilter.Size = new System.Drawing.Size(323, 20); + this.tbxAdditionalFilter.TabIndex = 8; + this.tbxAdditionalFilter.TextChanged += new System.EventHandler(this.tbxAdditionalFilter_TextChanged); + // + // cbxAppend + // + this.cbxAppend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.cbxAppend.AutoSize = true; + this.cbxAppend.Checked = true; + this.cbxAppend.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbxAppend.Location = new System.Drawing.Point(600, 16); + this.cbxAppend.Name = "cbxAppend"; + this.cbxAppend.Size = new System.Drawing.Size(116, 17); + this.cbxAppend.TabIndex = 9; + this.cbxAppend.Text = "Append New Links"; + this.cbxAppend.UseVisualStyleBackColor = true; + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(725, 440); + this.Controls.Add(this.cbxAppend); + this.Controls.Add(this.tbxAdditionalFilter); + this.Controls.Add(this.lblAdditionalFilter); + this.Controls.Add(this.btnSubstractLinks); + this.Controls.Add(this.lnlShowHidePage); + this.Controls.Add(this.lvwLinks); + this.Controls.Add(this.btnPaste); + this.Controls.Add(this.btnUrl); + this.Controls.Add(this.lblUrl); + this.Controls.Add(this.tbxUrl); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "MainForm"; + this.Text = "LinkExtractor"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox tbxUrl; + private System.Windows.Forms.Label lblUrl; + private System.Windows.Forms.Button btnUrl; + private System.Windows.Forms.Button btnPaste; + private System.Windows.Forms.ListView lvwLinks; + private System.Windows.Forms.ColumnHeader chdUse; + private System.Windows.Forms.ColumnHeader chdLink; + private System.Windows.Forms.LinkLabel lnlShowHidePage; + private System.Windows.Forms.Button btnSubstractLinks; + private System.Windows.Forms.Label lblAdditionalFilter; + private System.Windows.Forms.TextBox tbxAdditionalFilter; + private System.Windows.Forms.CheckBox cbxAppend; + } +} + diff --git a/LinkExtractorAsLibrary/MainForm.cs b/LinkExtractorAsLibrary/MainForm.cs new file mode 100644 index 0000000..c3de35a --- /dev/null +++ b/LinkExtractorAsLibrary/MainForm.cs @@ -0,0 +1,316 @@ +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.Net; +using System.Text.RegularExpressions; +using System.IO; + +namespace LinkExtractor +{ + public delegate void DetailButtonHandler(object sender, EventArgs e); + + public partial class MainForm : Form + { + public event ButtonClickHandler SubstractLinksButtonClicked; + + /// + /// Webovy klient pro stazeni obsahu stranky + /// + protected WebClient client; + + /// + /// Seznam na nalezene linky + /// + protected List links; + + /// + /// Seznam na filtrovane linky + /// + protected List filteredLinks; + + /// + /// Obsah stazene stranky nebo obsah z primeho vstupu + /// + protected string content; + + /// + /// Form pro zadavani primeho vstupu + /// + protected Inputer frmDirectInput; + + /// + /// Form pro zobrazeni vybranych odkazu + /// + protected Inputer frmSubstractedLinks; + + /// + /// Form pro zobrazeni stazeneho obsahu + /// + protected Inputer frmContent; + + public MainForm() + { + InitializeComponent(); + + this.client = new WebClient(); + this.links = new List(); + this.filteredLinks = new List(); + } + + /// + /// Najde vsechny linky v content a ulozi do links + /// + /// retezec obsahujici linky + public void FindLinks(string content) + { + if (!cbxAppend.Checked) + { + links.Clear(); + filteredLinks.Clear(); + } + + Regex rgx = new Regex("(https?://([0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?)"); + MatchCollection mc = rgx.Matches(TranslateEntities(content)); + + foreach (Match m in mc) + { + String match = m.Groups[0].Value; + int index = match.IndexOf("http://"); + do + { + int end = match.IndexOf("http://", index + 1); + string lnk = ""; + if (end == -1) + { + lnk = match.Substring(index, match.Length - index); + } + else + { + lnk = match.Substring(index, end - index); + } + if (lnk.EndsWith(")")) + { + lnk = lnk.Substring(0, lnk.Length - 1); + } + links.Add(lnk); + + index = end; + } while (index != -1); + } + } + + /// + /// Prelozi html entity na "klasicke" znaky + /// TODO: Vylepsit preklad :) + /// + /// text obsahujici entity + /// text s nahrazenymi html entitami + public string TranslateEntities(string content) + { + return content.Replace(@":", ":"); + } + + /// + /// Nacte obsah z webu a vrati ho + /// + /// Url adresa odkud se bude cist + /// obsah zadane url + public string DownloadContent(string url) + { + StreamReader sr = new StreamReader(client.OpenRead(url)); + return sr.ReadToEnd(); + } + + /// + /// Naplni lvwLinks odkazy v links + /// Seznam odkazu k zobrazeni + /// + public void FillListView(List links) + { + Cursor lastCursor = this.Cursor; + try + { + Cursor.Current = Cursors.WaitCursor; + try + { + lvwLinks.BeginUpdate(); + lvwLinks.Items.Clear(); + foreach (string link in links) + { + string[] cols = { "", link }; + ListViewItem lvi = new ListViewItem(cols); + lvi.Checked = true; + lvwLinks.Items.Add(lvi); + } + Application.DoEvents(); + } + finally + { + lvwLinks.EndUpdate(); + } + } + catch (Exception ex) + { + MessageBox.Show(this, String.Format("Some Error occurs;{0}{1}{2}Please, contact author, thanks", Environment.NewLine, ex.Message, Environment.NewLine), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + finally + { + Cursor.Current = lastCursor; + } + } + + /// + /// Zkontroluje zadany retezec je validni url adresa + /// + /// testovany retezec + /// true pokud je url validni url adresa, false v opacnem pripade + public bool ValidateUrl(string url) + { + Regex rgx = new Regex("https?://([0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?"); + return rgx.IsMatch(url); + } + + /// + /// Provede filtrovani vyhledanych odkazu podle zadaneho vzoru + /// + /// vzor pro hledani odkazu + public void FilterLinks(string pattern) + { + Regex rgx = new Regex(".*" + pattern + ".*"); + + filteredLinks.Clear(); + foreach (string item in links) + { + if (rgx.IsMatch(item)) + { + filteredLinks.Add(item); + } + } + + FillListView(filteredLinks); + } + + private void btnUrl_Click(object sender, EventArgs e) + { + if (ValidateUrl(tbxUrl.Text)) + { + this.Enabled = false; + this.Text = String.Format("LinkExtractor - Downloading content from {0} ...", tbxUrl.Text); + + content = DownloadContent(tbxUrl.Text); + + this.Enabled = true; + this.Text = "LinkExtractor"; + + FindLinks(content); + if (tbxAdditionalFilter.Text.Equals("")) + { + FillListView(links); + } + else + { + FilterLinks(tbxAdditionalFilter.Text); + FillListView(filteredLinks); + } + } + else + { + MessageBox.Show("Inputed isn't a valid url address!", "Wrong Input", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void tbxAdditionalFilter_TextChanged(object sender, EventArgs e) + { + FilterLinks(tbxAdditionalFilter.Text); + } + + private void btnPaste_Click(object sender, EventArgs e) + { + if (frmDirectInput == null) + { + frmDirectInput = new Inputer(); + frmDirectInput.Title = "Direct Input"; + } + if (frmDirectInput.WindowState == FormWindowState.Minimized) + { + frmDirectInput.WindowState = FormWindowState.Normal; + } + if (!frmDirectInput.Visible) + { + frmDirectInput.Show(); + } + frmDirectInput.BringToFront(); + frmDirectInput.FormClosed += delegate { frmDirectInput = null; }; + frmDirectInput.OkButtonClicked += delegate + { + content = frmDirectInput.Value; + FindLinks(content); + if (tbxAdditionalFilter.Text.Equals("")) + { + FillListView(links); + } + else + { + FilterLinks(tbxAdditionalFilter.Text); + FillListView(filteredLinks); + } + frmDirectInput.Close(); + }; + } + + private void btnSubstractLinks_Click(object sender, EventArgs e) + { + Fire(SubstractLinksButtonClicked, sender, e); + } + + protected void Fire(Delegate dlg, params object[] pList) + { + if (dlg != null) + { + this.BeginInvoke(dlg, pList); + } + } + + private void lnlShowHidePage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + if (frmContent == null) + { + frmContent = new Inputer(); + frmContent.Title = "Downloaded Content"; + frmContent.Value = content; + } + if (frmContent.WindowState == FormWindowState.Minimized) + { + frmContent.WindowState = FormWindowState.Normal; + } + if (!frmContent.Visible) + { + frmContent.Show(); + } + frmContent.BringToFront(); + frmContent.FormClosed += delegate { frmContent = null; }; + frmContent.OkButtonClicked += delegate + { + frmContent.Close(); + }; + } + + public List GetFilteredLinks() + { + List list = new List(); + foreach (ListViewItem item in lvwLinks.Items) + { + if (item.Checked) + { + list.Add(item.SubItems[1].Text); + } + } + return list; + } + } +} diff --git a/LinkExtractorAsLibrary/MainForm.resx b/LinkExtractorAsLibrary/MainForm.resx new file mode 100644 index 0000000..eb8be95 --- /dev/null +++ b/LinkExtractorAsLibrary/MainForm.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wEmJiYDOmc8c0hPSPdiZWL/aWtp/2prav8/bEHvPG8+z2pravdra2v3ZGRk9UpK + St8/Pz8x////Af///wFBlEcNOXk9w0pWS/+OkY7/q6yp/66urv+Xl5f/cXFx/3h4eP+Xl5f/rq6u/6mq + qe+NjY3vTU1N1////wFJoVINRptN0VR+Yf9rb23/09PO/3JtX/9EQ0L/RkZG/1FRUf9RUVH/RkZG/0JD + Qv9JXEr1xMTE/2dnZ+////8BTqhXsXbAjf9hfm3/goSC/9PTzv/BpWn/RkRB/729vf/Ozs7/wsLC/62t + rf9CRUP/ZqV5/8TExP+CgoL3VrRhR1OvXfu16tP/WJFg/3N3c//T087/eG1Z/01MS/9lZWX/kpKS/3l5 + ef9lZWX/S0xL/25+dv/ExMT/cnNy9Vq6ZrOS16//oN60/4LDb/92iWT/kZGR/+jo6P/d3d3/wcHB/4qE + ev+Kf2//2NfV/93d3f/ExMT/kZGR/0FeQuNev2rlsOnP/4PUkP+/3Ir/vcV//5+IX/+LiIL/np6e/4WA + dv+tgEz/sIJH/4SAdv+enp7/g4eE/4iml/8wdzPpYMNt977v3f9z0X3/kNFs/7zgnv/Hp17/07Be/8aZ + U//GvG7/r9F6/7TEbf+vqV//e6lX/1qjZ/+x487/MX4192HEbvW+8Nz/gdiD/3fbbf+/5Zr/zN+n/8qo + Xf/CvWz/uNqL/6bYYP930T//atBG/1m8UP9jq2z/suTO/zWCOfdhxG7js+zS/5viov+d6o3/1O23/9Dq + x//PuW7/zLFm/8vJdf9222f/ZtlN/2XXTf9s013/c7t+/6Xbwv85iD7nYcRurZjetf+168z/se+n/8nu + qf/R6sn/1c+N/9nLi//NtGb/vLxn/5rWcf+C3nP/etxx/5HQo/+IyKT/PY9DuWHEbj1hxG77wPPi/7Xv + tP+18Kz/we23/9Tjt//Z2Jz/2tOV/821bf/Hs23/tcuE/5Tfmv+v583/RptN/UKWSU////8BYcRupYfX + oP/A8t7/x/LW/9Xv1f/Q6c//1dum/9zeq//bzZD/18iL/8nBjv+91a//eseR/0qjU7f///8B////AWHE + bgVhxG7FjNii/8316P/U7dr/zu3T/8/fr//W3rX/1NSi/87Qof/E0Kr/h8mR/1OvXdFPqlkP////Af// + /wH///8BYcRuBWHEbqVhxG75peG7/7rqzP/F4L7/xdq0/73XsP+m16z/Xb5p+1q6ZrdXtmIN////Af// + /wH///8B////Af///wH///8BYcRuPWHEbqthxG7fYcRu9WHEbvlhxG7pYcRus2DCbUn///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/LinkExtractorAsLibrary/Properties/AssemblyInfo.cs b/LinkExtractorAsLibrary/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f8be129 --- /dev/null +++ b/LinkExtractorAsLibrary/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LinkExtractorAsLibrary")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("LinkExtractorAsLibrary")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1dd6f092-839e-4180-b702-eee6b6731efd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LinkExtractorAsLibrary/Properties/Resources.Designer.cs b/LinkExtractorAsLibrary/Properties/Resources.Designer.cs new file mode 100644 index 0000000..65f6fc2 --- /dev/null +++ b/LinkExtractorAsLibrary/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LinkExtractor.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LinkExtractor.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static System.Drawing.Bitmap world_link { + get { + object obj = ResourceManager.GetObject("world_link", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/LinkExtractorAsLibrary/Properties/Resources.resx b/LinkExtractorAsLibrary/Properties/Resources.resx new file mode 100644 index 0000000..2b84abe --- /dev/null +++ b/LinkExtractorAsLibrary/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\world_link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/LinkExtractorAsLibrary/Properties/Settings.Designer.cs b/LinkExtractorAsLibrary/Properties/Settings.Designer.cs new file mode 100644 index 0000000..4469110 --- /dev/null +++ b/LinkExtractorAsLibrary/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LinkExtractor.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings) (global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/LinkExtractorAsLibrary/Properties/Settings.settings b/LinkExtractorAsLibrary/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/LinkExtractorAsLibrary/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/LinkExtractorAsLibrary/Resources/world_link.png b/LinkExtractorAsLibrary/Resources/world_link.png new file mode 100644 index 0000000..b8edc12 Binary files /dev/null and b/LinkExtractorAsLibrary/Resources/world_link.png differ