.NET Open Source Softwares

Open source softwares written in VB .NET and C#

Proxy Log Analyzer

Proxy log analyzer can parse various web proxy logĀ  formats and display it in a spreadsheet form. Using this software, Administrator can monitor frequent sites visited by each internet user. The software can maintain list of IPs and its corresponding owner. Each column on the spreadsheet can be sorted so the administrator can view the proxy log by IP, owner, datetime and website visited.

AUTHOR
foxtrot0911

PLATFORM

Framework: Microsoft .NET Framework 3.5
IDE: Visual C# 2008 Express Edition

BEST PRACTICE FOR

Reading files using StreamReader
Use of LINQ to query from Collection

SAMPLE SCREENSHOTS

Proxy log reader

Proxy log reader

Spreadsheet viewer

Spreadsheet viewer

SAMPLE CODES/TECHNIQUES
Below is the code for reading the log file. It uses StreamReader namespace to parse the file line by line.

private bool ReadLog(string LogPath)
{
bool lreturn = true;

FileInfo[] d;
DirectoryInfo dir = new DirectoryInfo(@LogPath);
if (dir.Exists)
{
d = dir.GetFiles(Settings.Default.LOG_EXTENSION);

foreach (FileInfo f in d)
{
try
{
WriteLog(“Reading file ” + f.Name + “…”);
StreamReader tmpstream = File.OpenText(@f.FullName);
string strraw = tmpstream.ReadLine();
while (strraw != null)
{
string[] strinfo1 = strraw.Split(new string[] { ” – - ” }, StringSplitOptions.None);
string[] strcmd = ReadRaw(strinfo1[1]).Split(new char[] { ‘|’ });
WriteLog(“Inserting to database the reading from ” + strinfo1[0] + “…”);
if (SaveToDB(strinfo1[0], strcmd))
{
WriteLog(“Successfully inserted.”, Color.Blue);
}
strraw = tmpstream.ReadLine();

}
tmpstream.Close();
WriteLog(“Moving file to ” + @Settings.Default.FINISH_FOLDER);
f.MoveTo(@Settings.Default.FINISH_FOLDER + “\\” + f.Name);
}
catch (Exception ex)
{
lreturn = false;
WriteLog(“Error while reading file. ” + ex.Message, Color.Red);
}
}
}
else
{
WriteLog(“Directory does not exist. “, Color.Red);
}
return lreturn;
}

Query from Class collection using LINQ

clsAccountables accs = new clsAccountables();
var linqaccs = (from clsAccountable o in accs
where o.Accountable.Trim().ToLower() != “test”
select o.Accountable).Distinct();
cboAccountable.Items.Clear();
cboAccountable.Items.Add(“Unknown”);
foreach (var linqacc in linqaccs)
{
cboAccountable.Items.Add(linqacc.ToString());
}

DOWNLOAD URL
You can download the full source code on the following location:

From Mediafire

From FileFactory

From morefreesoftware.com

Filed under: C# , , , , , , , ,

Hello wordpress! ~foxtrot0911

Hi! I am fryan the owner of www.fryan0911.com. Today, i will launch my new blog here at wordpress. This blog will contain open source softwares that were created using Microsoft .NET technology. Most of these softwares were originally developed by myself but I will also try to post some sourcecodes from other people which I think will be useful for .NET beginners. My target readers are those who are starting to know .NET programming such asVB.NET and C#. Although users who just want to download useful free software or those who simply interested are very welcome too. Each of my post will be in the following format:

TITLE

DESCRIPTION

AUTHOR

PLATFORM

BEST PRACTICE FOR

SAMPLE SCREENSHOTS

SAMPLE CODES/TECHNIQUES

DOWNLOAD URL

Aside from this blog, you can also visit my other sites:

Tech Blog – www.fryan0911.com

Free Software Collection – www.morefreesoftware.com

Beginner Guides Portal – www.beginnerguideplus.com

My goal is to help readers as many as I can. That’s it for my first post. Good luck to us all!

Filed under: C#, VB .NET , , , , , ,