Advertisement
Advertisement
| 07.02.2008 at 06:34PM PDT, ID: 23535622 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: |
Program.cs
using System;
using System.Collections;
using System.Collections.Generic;
using GetFileStats;
namespace GetProjectStats
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string FilePath = string.Empty;
int NumberOfLines;
FileStats FileStat1 = new FileStats();
foreach (string s in args)
{
FilePath = s; // get one arg for now
}
NumberOfLines = FileStat1.ProcessFile(FilePath);
return;
}
}
}
GetFileStats.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Text;
using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace GetFileStats
{
public class FileStats
{
public int ProcessFile(string FilePath)
{
string line;
int linecount = 0;
try
{
//Pass the file path and file name to the StreamReader constructor StreamReader sr = new StreamReader(FilePath);
//Read the first line of text
line = sr.ReadLine();
//Continue to read until you reach end of file
while (line != null)
{
linecount++;
line = sr.ReadLine();
}
//close the file
sr.Close();
Console.ReadLine();
}
catch(Exception e)
{
Console.WriteLine("Exception: " + e.Message);
}
return linecount;
}
public int ProcessFolder(string FolderPath)
{
// For each folder call ProcessFile()
// ?????
return 0;
}
}
}
|