Documentos de Académico
Documentos de Profesional
Documentos de Cultura
INTRODUCTION
1.1 PROBLEM DEFINITION
As technologies continue to evolve and new content distribution methods are
developed, there still remains a need to be able to handle, parse, manipulate, and
aggregate data. For example, suppose we want to aggregate the local weather for 10
business locations from a website you visit regularly. In order to accomplish such a task,
we would have to open a web browser, connect to the website, and run 10 queries
through the site's front-end in order to obtain the desired data. We handle this problem
with the use of RSS provided by the websites.
Another scenario is searching for contents spread among several million web
pages are common now a day.
individual content or file, even though information on a topic is often spread across
multiple pages. Search Engines list the pages they ranked according to the given
keyword. But the exact link to a file available on a website is not usually provided to the
user. Search Engines usually provide links to the page and the user has to navigate the
webpage and find the link to the file and gets downloaded.
Training etc.,. The Company is a high technology driven organization founded and
managed by efficient and highly respected visionaries with wide range of experience and
expertise in the IT related industry. Our company mission is to solve traditional business
problems in new ways and how to address the new set of issues that come with progress.
We have the technology and business expertise to make it a reality.
The company is specializing in the areas like Web development using J2EE
Technologies, .Net Technologies and so on. The company also involves in the areas like
client server technologies, distributed computing, data warehousing and WAP
technologies. The company has a software development centre at Chennai has a 24 X 7
support facility for our clients. The Company has its Corporate Office at: New No: 12,
United India Colony, 3rd Cross Street, Kodambakkam, Chennai - 600 024.
Our company is engaged in the activities of Software Development, Systems
Integration, Consultancy Services and Corporate Training. We have developed many Web
Portals, Application Products, Conversion Projects,
range of mini ERP solutions to various medium range industries. Also we involved in
migration of applications from DOS based applications to GUI based applications.
We have developed some applications like Automation software for Super
Market, Software for Textile Industries, Software for Travel Industries and Account
Management Software for various companies. We have also set up web based intranet
solutions to its clients.
2. PROBLEM DESCRIPTION
This project entitled BEYOND SINGLE PAGE WEBSEARCH minimizes the
time spent on searching files and information on the internet. This project has been
developed using C#.NET as front end and XML file for storing the links retrieved.
This project has three modules,
RSS (Rich Site Summary) is a format for delivering regularly changing web
content. Many news-related sites, web blogs and other online publishers syndicate their
content as an RSS Feed to whoever wants it. RSS solves a problem for people who
regularly use the web. It allows you to easily stay informed by retrieving the latest
content from the sites you are interested in. You save time by not needing to visit each
site individually. You ensure your privacy, by not needing to join each site's email
newsletter. The number of sites offering RSS feeds is growing rapidly. We use XML file
to store the RSS feeds.
This project also has provision to save the links to the files this might be useful if
the user wants to download the file another time. This project has a internal browser and a
download manager, which downloads file asynchronously.
Downloader and Browser:
This project also has a facility to download a file and view html documents thru
the built in browser. Downloader gets the download link wherever the user selects
download this file and then downloads starts. User can select the download folder.
Browser displays the web pages using the link obtained from the search results.
3. SYSTEM STUDY
3.1 EXISTING SYSTEM
As technologies continue to evolve and new content distribution methods are
developed, there still remains a need to be able to handle, parse, manipulate, and
aggregate data. For example, suppose we want to aggregate the local weather for 10
business locations from a website you visit regularly. In order to accomplish such a task,
we would have to open a web browser, connect to the website, and run 10 queries
through the site's front-end in order to obtain the desired data. Existing system degrades
in search and takes more time.
USER INTERFACE
QUERY
SEARCH ENGINE
PROCESS
RSS FEEDS
PAGE COMPOSING
RSS MANIPULATION
PANEL DISPLAY
Videos
Images
Integrated
SEARCH PARAMETERS
PARAMETERS
APP ID
QUERY
RESULTS
START
FORMAT
LANGUAGE
DATA TYPE
String
String
Short
Int
String
String
DESCRIPTION
Web service identifies our application
Search Query
No of results perpage
Starting No for URL
File Format to be retrieved
Language results will be displayed
WEB RESPONSE
TITLE
SUMMARY
URL
ADDRESS
Feed Created
Feed Viewed
4. SYSTEM CONFIGURATION
4.1 HARDWARE SPECIFICATION
Processor
Main Memory
256 MB RAM
Processing Speed :
500 MHZ
40 GB
Monitor
Key Board
104 keys
Mouse
Front End
: CSharp 2.0(c#.net)(2005)
10
.NET FRAMEWORK
The .NET Framework is the infrastructure for the new Microsoft .NET Platform.
The .NET Framework is language neutral. Currently it supports C++, C#, Visual
Basic, JScript (The Microsoft version of JavaScript) and COBOL. Third-party
languages - like Eiffel, Perl, Python, Smalltalk, and others - will also be available
for building future .NET Framework applications.
The .NET plan includes a new version of the Windows operating system, a new
version of Office, and a variety of new development software for programmers to
build Web-based applications.
The background for .NET is part of Microsoft's new strategy to keep Windows the
dominant operating system in the market, as computing begins to move away
11
C#.NET
The explicit use of pointers, on the other hand, is restricted to sections of code
that have been designated as unsafe. With the support of a garbage collector, frustrating
memory leaks and dangling pointers are a non-issue. The C# language also supports
multi-threading in order to promote efficient interactive applications such as graphics,
input/output, and so on. Other modern features in C# include Just-in-Time (JIT)
compilation from bytecode to native code, exceptions for error handling, namespaces for
preventing type collisions, and documentation comments
C# FEATURES
There are no global variables or functions. All methods and members must be
declared within classes. It is possible, however, to use static methods/variables
within public classes instead of global variables/functions.
C# supports a strict boolean type, bool. Statements that take conditions, such as
while and if, require an expression of a boolean type. While C++ also has a
boolean type, it can be freely converted to and from integers, and expressions
such as if(a) require only that a is convertible to bool, allowing a to be an int, or a
pointer.
In C#, memory address pointers can only be used within blocks specifically
marked as unsafe, and programs with unsafe code need appropriate permissions to
run. Most object access is done through safe references, which cannot be made
invalid. An unsafe pointer can point to an instance of a value-type, array, string, or
a block of memory allocated on a stack. Code that is not marked as unsafe can
still store and manipulate pointers through the System.IntPtr type, but cannot
dereference them.
13
Multiple inheritance is not supported, although a class can implement any number
of interfaces. This was a design decision by the language's lead architect to avoid
complication.
C# is more typesafe than C++. The only implicit conversions by default are those
which are considered safe, such as widening of integers and conversion from a
derived type to a base type. This is enforced at compile-time, during JIT, and, in
some cases, at runtime.
C# also support interface, a mean of making a contract with a class for services
that the interface stipulates. C# a class inherits from only a single parent, but a
class can implement multiple interfaces.
C# also provides support for structs, a concept whose meaning has changed
significantly form c++. A struct cant inherit from a class or be inherited form ,
but a struct can implement an interface in the world of Generics.
14
15
SEARCH
RSS READER
NEW
WEB
EDIT
IMAGES
VIEW
VIDEO
DELETE
NEWS
LOCAL
INTEGRATION
BROWSER
DOWNLOADER
16
PERFORMANCE TESTING
Performance has always been a great concern and a driving force of computer evolution.
Performance evaluation of a software system usually includes: resource usage,
throughput, stimulus-response time and queue lengths detailing the average or maximum
number of tasks waiting to be serviced by selected resources. Typical resources that need
to be considered include network bandwidth requirements, CPU cycles, disk space, disk
access operations, and memory usage. The goal of performance testing can be
performance bottleneck identification, performance comparison and evaluation, etc.
This project performs well since it uses multithreading to search for information
while the user reads some other information. It uses minimum resources, gives stimulus
responses.
RELIABILITY TESTING
Software reliability refers to the probability of failure-free operation of a system.
It is related to many aspects of software, including the testing process. Directly
estimating software reliability by quantifying its related factors can be difficult. Testing is
an effective sampling method to measure software reliability. Guided by the operational
profile, software testing (usually black-box testing) can be used to obtain failure data, and
an estimation model can be further used to analyze the data to estimate the present
reliability and predict future reliability. Therefore, based on the estimation, the developers
can decide whether to release the software, and the users can decide whether to adopt and
use the software.
17
18
8. CONCLUSION
19
20
REFERENCES
BOOKS
S.NO:
1.
2.
AUTHOR :
Matthew
MacDonald and
Mario Szpuszta,
Andrew Troelsen
TITLE:
Pro ASP.NET 2.0 in Csharp 2005
PUBLICATION:
Apress
Pro.C.Sharp.with.dot.NET.3.0.
Apress
WEBSITE
www.codeproject.com
21
ANNEXURE
A. SOURCE CODE
Main Form
using
using
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Text;
System.Windows.Forms;
System.Threading;
System.Collections;
System.Net;
Yahoo.API;
namespace BeyondSinglePage
{
public partial class MainWindow : Form
{
private SearchType searchType;
private Search search;
private DataSet dsResults;
private byte pageno=0;
bool checkInternet;
FileDownloader downloader;
private integrate Integrate;
public MainWindow()
{
InitializeComponent();
dsResults = new DataSet();
searchType = SearchType.web;
btnNext.Enabled = false;
btnPrevious.Enabled = false;
grpResults.Visible = false;
downloader = new FileDownloader();
images1.Visible = false;
Integrate = new integrate();
22
{
}
this.webBrowser1.GoBack();
23
}
private void buttonDoSearch_Click(object sender, EventArgs e)
{
if (this.txtSearchTerm.Text != String.Empty)
{
search = new Search();
callSearch();
btnNext.Enabled = true;
grpResults.Visible = true;
}
else
{
24
}
else
btnPrevious.Enabled = false;
}
private void btnNext_Click(object sender, EventArgs e)
{
pageno++;
callSearch();
if (pageno > 0)
btnPrevious.Enabled = true;
}
private void callSearch()
{
dsResults = search.GetSearchTerms(txtSearchTerm.Text,
searchType, pageno);
if (searchType == SearchType.images)
images1.getUrls(dsResults.Tables[0]);
else if (searchType == SearchType.integrated)
{
Integrate.getUrls(dsResults.Tables[0]);
this.webBrowser1.Navigate("c:\\a.html");
this.mainTab.SelectedTab = tabBrowser;
}
else
dataGridView1.DataSource = dsResults.Tables[0];
}
private void closeResultsToolStripMenuItem_Click(object sender,
EventArgs e)
{
this.grpResults.Visible = false;
}
private void selectAllToolStripMenuItem_Click(object sender,
EventArgs e)
{
this.dataGridView1.SelectAll();
}
private void downloadSelectedToolStripMenuItem_Click(object sender,
EventArgs e)
{
downloadSelected();
}
private void viewInBrowserToolStripMenuItem_Click(object sender,
EventArgs e)
{
string
url=this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
webBrowser1.Navigate(url);
toolStripTextBoxAddress.Text = url;
25
mainTab.SelectedTab = this.tabBrowser;
26
downloader.DownloadProgressChanged += new
EventHandler<FileDownloadProgressChangedEventArgs>(downloader_DownloadPr
ogressChanged);
downloader.DownloadStatusChanged += new
EventHandler<FileDownloadStatusChangedEventArgs>(downloader_DownloadStat
usChanged);
downloader.DownloadAsync(txtFileUrl.Text);
}
catch (Exception ex)
{
txtStatus.Text += ex.Message +
System.Environment.NewLine;
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
try
{
downloader.DownloadAsyncCancel();
}
catch
{
}
27
Search.cs
28
using
using
using
using
using
System;
System.Collections.Generic;
System.Text;
Yahoo.API;
System.Data;
namespace BeyondSinglePage
{
class Search
{
private YahooSearchService yahoo;
public DataSet GetSearchTerms(string searchTerm,SearchType
type,byte pageno)
{
DataSet dsStoreResults = new DataSet();
DataTable dtStoreResults = new DataTable();
dsStoreResults.Tables.Add(dtStoreResults);
DataColumn dcTitle = new
DataColumn("Title",Type.GetType("System.String"));
DataColumn dcSummary = new DataColumn("Summary",
Type.GetType("System.String"));
DataColumn dcUrl = new DataColumn("Url",
Type.GetType("System.String"));
dtStoreResults.Columns.Add(dcTitle);
dtStoreResults.Columns.Add(dcSummary);
dtStoreResults.Columns.Add(dcUrl);
DataRow dr = null;
yahoo = new YahooSearchService();
switch (type)
{
case SearchType.web:
Yahoo.API.WebSearchResponse.ResultSet resultset =
yahoo.WebSearch("sample", searchTerm, "all",10, pageno*10+1, "any",
true, true, "en");
foreach (Yahoo.API.WebSearchResponse.ResultType
resultType in resultset.Result)
{
dr=dtStoreResults.NewRow();
dr[0] = resultType.Title.ToString();
dr[1] = resultType.Summary.ToString();
dr[2] = resultType.Url.ToString();
dtStoreResults.Rows.Add(dr);
}
break;
case SearchType.local:
yahoo = new YahooSearchService();
Yahoo.API.LocalSearchResponse.ResultSet resultSet =
yahoo.LocalSearch("sample", searchTerm, 10, pageno * 10 + 1,
(float)10.0, "", "Trichy", "Tamil Nadu", "", "");
foreach (Yahoo.API.LocalSearchResponse.ResultType
resultType in resultSet.Result)
{
dr = dtStoreResults.NewRow();
dr[0] = resultType.Title.ToString();
dr[1] = resultType.Address.ToString();
dr[2] = resultType.Url.ToString();
29
dtStoreResults.Rows.Add(dr);
}
break;
case SearchType.images:
yahoo = new YahooSearchService();
Yahoo.API.ImageSearchResponse.ResultSet resultSet1 =
yahoo.ImageSearch("sample", searchTerm, "all", 10, pageno * 10, "any",
true);
foreach (Yahoo.API.ImageSearchResponse.ResultType
resultType in resultSet1.Result)
{
dr = dtStoreResults.NewRow();
dr[0] = resultType.Title.ToString();
dr[1] = resultType.Summary.ToString();
dr[2] = resultType.Url.ToString();
dtStoreResults.Rows.Add(dr);
}
break;
case SearchType.video:
yahoo = new YahooSearchService();
Yahoo.API.VideoSearchResponse.ResultSet resultSet2 =
yahoo.VideoSearch("sample", searchTerm, "all", 10, pageno * 10, "any",
true);
foreach (Yahoo.API.VideoSearchResponse.ResultType
resultType in resultSet2.Result)
{
dr = dtStoreResults.NewRow();
dr[0] = resultType.Title.ToString();
dr[1] = resultType.Summary.ToString();
dr[2] = resultType.Url.ToString();
dtStoreResults.Rows.Add(dr);
}
break;
case SearchType.news:
yahoo = new YahooSearchService();
Yahoo.API.NewsSearchResponse.ResultSet resultSet3 =
yahoo.NewsSearch("sample", searchTerm, "all", 10, pageno * 10, "rank",
"en");
foreach (Yahoo.API.NewsSearchResponse.ResultType
resultType in resultSet3.Result)
{
dr = dtStoreResults.NewRow();
dr[0] = resultType.Title.ToString();
dr[1] = resultType.Summary.ToString();
dr[2] = resultType.Url.ToString();
dtStoreResults.Rows.Add(dr);
}
break;
case SearchType.integrated:
Yahoo.API.WebSearchResponse.ResultSet resultset4 =
yahoo.WebSearch("sample", searchTerm, "all", 10, pageno * 10 + 1, "any",
true, true, "en");
foreach (Yahoo.API.WebSearchResponse.ResultType
resultType in resultset4.Result)
30
dr = dtStoreResults.NewRow();
dr[0] = resultType.Title.ToString();
dr[1] = resultType.Summary.ToString();
dr[2] = resultType.Url.ToString();
dtStoreResults.Rows.Add(dr);
}
break;
}
return dsStoreResults;
}
}
}
Image.cs
31
using
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Drawing;
System.Data;
System.Text;
System.Windows.Forms;
System.Net;
System.IO;
System.Threading;
namespace BeyondSinglePage
{
public partial class images : UserControl
{
string[] urls = new string[10];
public images()
{
InitializeComponent();
}
public void getUrls(DataTable dt)
{
for(int i=0;i<10;i++)
urls[i] = dt.Rows[i][2].ToString();
Thread t1 =
Thread t2 =
Thread t3 =
Thread t4 =
Thread t5 =
t1.Start();
t2.Start();
t3.Start();
t4.Start();
t5.Start();
new
new
new
new
new
Thread(new
Thread(new
Thread(new
Thread(new
Thread(new
ThreadStart(getImage));
ThreadStart(getImage1));
ThreadStart(getImage2));
ThreadStart(getImage3));
ThreadStart(getImage4));
}
private void images_Load(object sender, EventArgs e)
{
}
private void getImage()
{
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(urls[0]);
HttpWebResponse response =
(HttpWebResponse)request.GetResponse();
Stream str = response.GetResponseStream();
pictureBox1.Image= Image.FromStream(str);
pictureBox1.Tag = urls[0];
}
private void getImage1()
{
32
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(urls[1]);
HttpWebResponse response =
(HttpWebResponse)request.GetResponse();
Stream str = response.GetResponseStream();
pictureBox2.Image = Image.FromStream(str);
pictureBox2.Tag = urls[1];
}
private void getImage2()
{
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(urls[2]);
HttpWebResponse response =
(HttpWebResponse)request.GetResponse();
Stream str = response.GetResponseStream();
pictureBox3.Image = Image.FromStream(str);
pictureBox3.Tag = urls[2];
}
private void getImage3()
{
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(urls[3]);
HttpWebResponse response =
(HttpWebResponse)request.GetResponse();
Stream str = response.GetResponseStream();
pictureBox4.Image = Image.FromStream(str);
pictureBox4.Tag = urls[3];
}
private void getImage4()
{
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(urls[4]);
HttpWebResponse response =
(HttpWebResponse)request.GetResponse();
Stream str = response.GetResponseStream();
pictureBox5.Image = Image.FromStream(str);
pictureBox5.Tag = urls[4];
}
RSS FEEDS
public void LoadFeedTree()
{
try
33
int nCurrentGroupNodeIndex=0;
XmlDocument xDoc=new XmlDocument();
xDoc.Load(strBaseDir);
//clear existing nodes
trvFeed.Nodes[0].Nodes.Clear();
for(int
i=0;i<xDoc.DocumentElement.ChildNodes.Count;i++)
{
//Create Group Nodes
TreeNode tnGroup=new
TreeNode(xDoc.DocumentElement.ChildNodes[i].Attributes["id"].Value);
tnGroup.Tag = "Group" +
xDoc.DocumentElement.ChildNodes[i].Attributes["id"].Value;
tnGroup.ImageIndex=4;
tnGroup.SelectedImageIndex=4;
trvFeed.Nodes[0].Nodes.Add(tnGroup);
//trvFeed.Nodes[0].Expand();
//create child nodes for group
string
strSearchXPath="Library/Group[@id='" +
xDoc.DocumentElement.ChildNodes[i].Attributes["id"].Value + "']";
CreateFeedNodes(strSearchXPath,
nCurrentGroupNodeIndex);
nCurrentGroupNodeIndex=nCurrentGroupNodeIndex+1;
}
}
catch(Exception e)
{
MessageBox.Show(e.Message + ":" + e.StackTrace);
}
}
public void CreateFeedNodes(string strSearchXPath, int
nCurrentGroupNodeIndex)
{
try
{
XmlDocument xDoc=new XmlDocument();
xDoc.Load(strBaseDir);
XmlNodeList
xnListFeeds=xDoc.SelectSingleNode(strSearchXPath).ChildNodes;
foreach (XmlNode xNode in xnListFeeds)
{
//Create Feed Nodes
TreeNode tnFeed=new
TreeNode(xNode.Attributes["id"].Value);
34
if(xNode.Attributes[1].Name.Equals("URL"))
{
tnFeed.Tag = "URL:" +
xNode.Attributes["URL"].Value;
tnFeed.ImageIndex=2;
tnFeed.SelectedImageIndex=2;
}
else
if(xNode.Attributes[1].Name.Equals("SITE"))
{
tnFeed.Tag = "SITE:" +
xNode.Attributes["SITE"].Value;
tnFeed.ImageIndex=3;
tnFeed.SelectedImageIndex=3;
}
trvFeed.Nodes[0].Nodes[nCurrentGroupNodeIndex].Nodes.Add(tnFeed);
//trvFeed.Nodes[0].Nodes[nCurrentGroupNode
Index].Expand();
trvFeed.Nodes[0].Nodes[nCurrentGroupNodeIndex].EnsureVisible();
}
trvFeed.Nodes[0].Nodes[nCurrentGroupNodeIndex].Text =
trvFeed.Nodes[0].Nodes[nCurrentGroupNodeIndex].Text + " (" +
trvFeed.Nodes[0].Nodes[nCurrentGroupNodeIndex].Nodes.Count.ToString() +
")";
}
catch(Exception e)
{
MessageBox.Show(e.Message + ":" + e.StackTrace);
}
}
e)
try
{
if(frmGroup.ShowDialog().Equals(DialogResult.OK))
{
if(!strNewGroup.Trim().Equals(""))
{
bool bFound=false;
for(int
i=0;i<trvFeed.Nodes[0].Nodes.Count;i++)
{
if(trvFeed.Nodes[0].Nodes[i].Text.ToLower().Equals(strNewGroup.Trim().To
Lower()))
35
{
}
bFound=true;
break;
}
if(!bFound)
{
//Filtering the Unwanted chars
to make the node text XML coplient
strNewGroup=strNewGroup.Trim(strGroupTextFilter.ToCharArray());
TreeNode tnGroup=new
TreeNode(strNewGroup);
tnGroup.Tag="Group" +
strNewGroup.Trim();
tnGroup.ImageIndex=4;
tnGroup.SelectedImageIndex=4;
trvFeed.Nodes[0].Nodes.Add(tnGroup);
trvFeed.Nodes[0].Expand();
trvFeed.Nodes[0].EnsureVisible();
AddGroupNodeToXMLLibrary(strNewGroup.Trim());
}
ex.StackTrace);
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message + ":" +
}
36
if(trvFeed.SelectedNode.Nodes[i].Text.ToLower().Equals(strNewFeed.Trim()
.ToLower()))
{
bFound=true;
break;
}
}
if(!bFound)
{
//Filtering the Unwanted chars
strNewFeed=strNewFeed.Trim(strFeedTextFilter.ToCharArray());
TreeNode tnFeed=new
TreeNode(strNewFeed);
tnFeed.Tag="URL:" +
strNewFeedURL.Trim();
tnFeed.ImageIndex=2;
tnFeed.SelectedImageIndex=2;
trvFeed.SelectedNode.Nodes.Add(tnFeed);
trvFeed.SelectedNode.Expand();
trvFeed.SelectedNode.EnsureVisible();
strCurrentSelectedNodeTag="URL:" + strNewFeedURL.Trim();
int
nFilterCharIndex=trvFeed.SelectedNode.Text.LastIndexOf(" (");
string
strGroupNodeText=trvFeed.SelectedNode.Text;
if(nFilterCharIndex>=0)
{
strGroupNodeText=trvFeed.SelectedNode.Text.Substring(0,nFilterCharIndex)
;
}
AddFeedNodeToXMLLibrary(strGroupNodeText,strNewFeed.Trim(),strNewFeedURL
.Trim());
trvFeed.SelectedNode.Text =
strGroupNodeText + " (" + trvFeed.SelectedNode.Nodes.Count.ToString() +
")";
FetchFeedInfo(strNewFeedURL.Trim(),"item");
}
}
}
}
37
ex.StackTrace);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message + ":" +
}
FetchFeedInfo(e.Node.Tag.ToString().Substring(e.Node.Tag.ToString().Inde
xOf("URL:")+4) ,"item");
//update the view History for the node begin
//feed
int
nFilterCharIndex=e.Node.Parent.Text.LastIndexOf(" (");
string strGroupText=e.Node.Parent.Text;
if(nFilterCharIndex>=0)
{
strGroupText=strGroupText.Substring(0,nFilterCharIndex);
}
string strChildText=e.Node.Text;
UpdateNodeViewHistory(strGroupText,
strChildText,true);
38
end
}
}
if(e.Node.Tag.ToString().IndexOf("SITE:")!=-1)
{
if(!
strCurrentSelectedNodeTag.Equals(e.Node.Tag.ToString()))
{
strCurrentSelectedNodeTag=e.Node.Tag.ToString();
FetchSiteInfo(e.Node.Text,e.Node.Tag.ToString().Substring(e.Node.Tag.ToS
tring().IndexOf("SITE:")+5));
//update the view History for the node begin
//site
int
nFilterCharIndex=e.Node.Parent.Text.LastIndexOf(" (");
string strGroupText=e.Node.Parent.Text;
if(nFilterCharIndex>=0)
{
strGroupText=strGroupText.Substring(0,nFilterCharIndex);
}
string strChildText=e.Node.Text;
UpdateNodeViewHistory(strGroupText,
strChildText,false);
//update the view History for the node end
//Load the view History to the Listviewbegin
LoadNodeViewHistory(strGroupText,
strChildText,false);
//Load the view History to the Listviewend
}
}
}
private void dgFeed_DoubleClick(object sender,
System.EventArgs e)
{
}
public void FetchFeedInfo(string strFeedURL, string
SearchNodeText)
{
try
{
if(!SearchNodeText.Trim().Equals(""))
{
ClearFeedList();
39
this.Cursor=Cursors.WaitCursor;
XmlDocument xDoc=new XmlDocument();
xDoc.Load(strFeedURL);
//xDoc.Load("http://msdn.microsoft.com/rss
.xml");
//xDoc.Load("http://surya.somee.com/rss/rs
s.xml");
XmlNodeList xnList=
xDoc.DocumentElement["channel"].SelectNodes(SearchNodeText);
foreach(XmlNode xNode in xnList)
{
ListViewItem lstFeedItem=new
ListViewItem();
for(int
i=0;i<xNode.ChildNodes.Count;i++)
{
//lstFeedItem.Text=Convert.ToS
tring(lstvFeed.Items.Count+1);
lstFeedItem.ImageIndex=0;
if(i==0)
{
lstFeedItem.SubItems.Add(xNode.ChildNodes[0].InnerText);
lstFeedItem.SubItems.Add("");
lstFeedItem.SubItems.Add("");
lstFeedItem.SubItems.Add("");
}
if(i==1)
{
lstFeedItem.SubItems.Add(xNode.ChildNodes[1].InnerText.Substring(0,10));
}
if(i==2)
{
lstFeedItem.SubItems.Add(xNode.ChildNodes[2].InnerText);
lstFeedItem.Tag=
xNode.ChildNodes[2].InnerText;
}
}
lstvFeed.Items.Add(lstFeedItem);
}
this.Cursor=Cursors.Default;
//navigate to the first item
if(lstvFeed.Items.Count>0)
{
Object o=null;
lstvFeed.Items[0].Selected=true;
40
axWebBrowserFeed.Navigate(lstvFeed.SelectedItems[0].Tag.ToString(),ref
o,ref o,ref o,ref o);
}
}
else
{
//
}
catch(Exception ex)
{
this.Cursor=Cursors.Default;
MessageBox.Show(ex.Message + " : " +
ex.StackTrace);
strSiteURL)
ex.StackTrace);
try
{
ClearFeedList();
this.Cursor=Cursors.WaitCursor;
//navigate to the first item
Object o=null;
axWebBrowserFeed.Navigate(strSiteURL,ref o,ref
this.Cursor=Cursors.Default;
}
catch(Exception ex)
{
this.Cursor=Cursors.Default;
MessageBox.Show(ex.Message + " : " +
}
}
private void lstvFeed_DoubleClick(object sender,
System.EventArgs e)
{
Object o=null;
axWebBrowserFeed.Navigate(lstvFeed.SelectedItems[0].Tag.ToString(),ref
o,ref o,ref o,ref o);
}
41
lstvFeed.Items.Clear();
XmlElement eFeed=xDoc.CreateElement("Feed");
xDoc.SelectSingleNode(strSearchXPath).AppendChild(eFeed);
//attribute - Id
XmlAttribute xaId=xDoc.CreateAttribute("id");
xaId.Value=strFeedNodeText;
eFeed.SetAttributeNode(xaId);
//attribute - URL
XmlAttribute xaURL=xDoc.CreateAttribute("URL");
xaURL.Value=strURL;
eFeed.SetAttributeNode(xaURL);
//attribute - created
XmlAttribute
xaCreated=xDoc.CreateAttribute("created");
42
xaCreated.Value=DateTime.Now.ToShortDateString();
eFeed.SetAttributeNode(xaCreated);
//attribute - Viewed
XmlAttribute
xaViewed=xDoc.CreateAttribute("viewed");
xaViewed.Value="1";
eFeed.SetAttributeNode(xaViewed);
xDoc.Save(strBaseDir);
}
catch(Exception e)
{
MessageBox.Show(e.Message + ":" + e.StackTrace);
}
}
public void AddSiteNodeToXMLLibrary(string
strGroupNodeText,string strSiteNodeText,string strSiteURL)
{
try
{
XmlDocument xDoc=new XmlDocument();
xDoc.Load(strBaseDir);
string strSearchXPath="Library/Group[@id='" +
strGroupNodeText.Substring(strGroupNodeText.IndexOf(" (")+1) + "']";
XmlElement eSite=xDoc.CreateElement("Site");
xDoc.SelectSingleNode(strSearchXPath).AppendChild(eSite);
//attribute - Id
XmlAttribute xaId=xDoc.CreateAttribute("id");
xaId.Value=strSiteNodeText;
eSite.SetAttributeNode(xaId);
//attribute - URL
XmlAttribute xaURL=xDoc.CreateAttribute("SITE");
xaURL.Value=strSiteURL;
eSite.SetAttributeNode(xaURL);
//attribute - created
XmlAttribute
xaCreated=xDoc.CreateAttribute("created");
xaCreated.Value=DateTime.Now.ToShortDateString();
eSite.SetAttributeNode(xaCreated);
//attribute - Viewed
XmlAttribute
xaViewed=xDoc.CreateAttribute("viewed");
xaViewed.Value="1";
eSite.SetAttributeNode(xaViewed);
43
xDoc.Save(strBaseDir);
}
catch(Exception e)
{
MessageBox.Show(e.Message + ":" + e.StackTrace);
}
}
e)
if(!
lstvFeed.SelectedItems[0].Tag.ToString().Trim().Equals(""))
{
Object o=null;
axWebBrowserFeed.Navigate(lstvFeed.SelectedItems[0].Tag.ToString(),ref
o,ref o,ref o,ref o);
}
}
private void mnuNewSite_Click(object sender,
System.EventArgs e)
{
try
{
frmAddSite frmSite=new frmAddSite();
if(frmSite.ShowDialog().Equals(DialogResult.OK))
{
if(!strNewSite.Trim().Equals(""))
{
bool bFound=false;
for(int
i=0;i<trvFeed.SelectedNode.Nodes.Count;i++)
{
if(trvFeed.SelectedNode.Nodes[i].Text.ToLower().Equals(strNewSite.Trim()
.ToLower()))
{
bFound=true;
break;
}
}
if(!bFound)
{
//Filtering the Unwanted chars
strNewSite=strNewSite.Trim(strSiteTextFilter.ToCharArray());
44
TreeNode tnSite=new
TreeNode(strNewSite);
tnSite.Tag="SITE:" +
strNewSiteURL.Trim();
tnSite.ImageIndex=3;
tnSite.SelectedImageIndex=3;
trvFeed.SelectedNode.Nodes.Add(tnSite);
trvFeed.SelectedNode.Expand();
trvFeed.SelectedNode.EnsureVisible();
strCurrentSelectedNodeTag="SITE:" + strNewSiteURL.Trim();
int
nFilterCharIndex=trvFeed.SelectedNode.Text.LastIndexOf(" (");
string
strGroupNodeText=trvFeed.SelectedNode.Text;
if(nFilterCharIndex>=0)
{
strGroupNodeText=trvFeed.SelectedNode.Text.Substring(0,nFilterCharIndex)
;
}
AddSiteNodeToXMLLibrary(strGroupNodeText
,strNewSite.Trim(),strNewSiteURL.Trim());
trvFeed.SelectedNode.Text =
strGroupNodeText + " (" + trvFeed.SelectedNode.Nodes.Count.ToString() +
")";
FetchSiteInfo(strNewSite,strNewSiteURL.Trim());
//Load the view History to the
Listview- begin
LoadNodeViewHistory(strGroupNodeText, strNewSite,false);
//Load the view History to the
Listview- end
}
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message + " : " +
ex.StackTrace);
}
}
public void UpdateNodeViewHistory(string GroupText, string
ChildText, bool IsFeed)
{
try
45
string strSearchXPath;
if(IsFeed)
{
strSearchXPath="Library/Group[@id='" +
GroupText + "']/Feed[@id='" + ChildText + "']";
}
else
{
strSearchXPath="Library/Group[@id='" +
GroupText + "']/Site[@id='" + ChildText + "']";
}
int
nUpdatedViewCount=Convert.ToInt32(xDoc.SelectSingleNode(strSearchXPath).
Attributes["viewed"].Value) + 1;
xDoc.SelectSingleNode(strSearchXPath).Attributes["viewed"].Value =
nUpdatedViewCount.ToString();
xDoc.Save(strBaseDir);
}
catch(Exception e)
{
MessageBox.Show(e.Message + ":" + e.StackTrace);
}
}
lstFeedItem.SubItems.Add(xDoc.SelectSingleNode(strSearchXPath).Attribute
s["created"].Value);
46
lstFeedItem.SubItems.Add(xDoc.SelectSingleNode(strSearchXPath).Attribute
s["viewed"].Value + " times");
lstFeedItem.SubItems.Add("");
lstFeedItem.SubItems.Add("");
lstFeedItem.SubItems.Add(xDoc.SelectSingleNode(strSearchXPath).Attribute
s["SITE"].Value);
lstFeedItem.Tag="";
lstvFeed.Items.Add(lstFeedItem);
}
e)
}
catch(Exception e)
{
MessageBox.Show(e.Message + ":" + e.StackTrace);
}
ImportLibrary();
}
public void ImportLibrary()
{
if(openFlDlg.ShowDialog().Equals(DialogResult.OK))
{
SetLibrary(Path.GetFullPath(openFlDlg.FileName));
LoadFeedTree();
}
}
47
int nIP = 0;
foreach(IPAddress ipaddress in
iphostentry.AddressList)
{
//Console.WriteLine("IP #" + ++nIP + ": " +
ipaddress.ToString());
MessageBox.Show("IP #" + ++nIP + ": " +
ipaddress.ToString());
}
}
private void trvFeed_AfterExpand(object sender,
System.Windows.Forms.TreeViewEventArgs e)
{
if(e.Node.Tag.ToString().IndexOf("Group")!=-1)
{
if(e.Node.IsExpanded)
{
e.Node.ImageIndex =1;
//trvFeed.SelectedNode.SelectedImageIndex=
1;
}
else
{
e.Node.ImageIndex=4;
//trvFeed.SelectedNode.SelectedImageIndex=
1;
}
}
}
private void trvFeed_AfterCollapse(object sender,
System.Windows.Forms.TreeViewEventArgs e)
{
if(e.Node.Tag.ToString().IndexOf("Group")!=-1)
{
if(e.Node.IsExpanded)
{
e.Node.ImageIndex =1;
//trvFeed.SelectedNode.SelectedImageIndex=
1;
}
else
{
e.Node.ImageIndex=4;
//trvFeed.SelectedNode.SelectedImageIndex=
1;
}
}
}
private void cMenuTrv_Popup(object sender, System.EventArgs
e)
{
if(trvFeed.SelectedNode.Tag.ToString().IndexOf("SITE")!=-1)
48
else
}
menuItem12.Enabled=true;
menuItem12.Enabled=false;
49
B. SCREEN INTERFACES
Main Window
50
51
52
53
54
Downloading a file
55
56
57
RSS FEEDs
58
59