Abstract ToBeTranslated and Updated words from LocStudio statistic files
来源:互联网 发布:网络暴力事例袁姗姗 编辑:程序博客网 时间:2024/04/30 12:30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WordCount
{
class Program
{
static int Main(string[] args)
{
//Console.WriteLine("Number of command line parameters = {0}", args.Length);
if (args.Length == 0)
{
Console.WriteLine("Please enter the folder that contians the statistic csv files./r/ne.g. WordCount.exe C://DailyDrop//04222011/r/nPress any key to continue...");
Console.ReadKey();
return 1;
}
else
{
string startFolder = args[0];
//string tableTitle = "File Name,Type,All,With Strings,Do Not Localize,New, Uploaded,AutoTranslated (100%),AutoTranslated Fuzzy,Copied,Previous Version,Pseudo Localized,Machine Translated,To Be Translated,Not Localized,Localized,Failed,Updated,Added Words,Deleted Words,Modified Words,Update Effort,Punctuation Only, Hotkey Only,AutoTranslated For Review,Postponed,Won't Fix,Size May Have Changed,Image May Have Changed";
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(startFolder);
IEnumerable<System.IO.FileInfo> fileList = dir.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
IEnumerable<System.IO.FileInfo> fileQuery =
from file in fileList
where file.Extension == ".csv"
//orderby file.Name
select file;
string fileName = "Total_Statistics.csv";
System.IO.File.Delete(fileName);
System.IO.File.AppendAllText(fileName, "lsProj Name," + "File Name," + "To Be Translated," + "Updated," + "Total/r/n");
foreach (System.IO.FileInfo fi in fileQuery)
{
string[] lines = System.IO.File.ReadAllLines(fi.FullName);
Console.WriteLine(fi.FullName);
string lsproj = fi.FullName;
//System.IO.File.AppendAllText(fileName, lsproj + ", " + ", " + ", " + "/r/n");
CountWord(lines, fileName);
RF(lsproj, fileName);
}
Console.WriteLine("Total_Statistics.csv written to disk. Press any key to exit");
Console.ReadKey();
return 0;
}
}
static void CountWord(IEnumerable<string> csvF, string fn)
{
IEnumerable<string> query =
from line in csvF
let x = line.Split(',')
where x.Contains("Words") && x[0] != "'TOTAL'"
select x[1] + ", " + x[0] + ", " + x[13] + ", " + x[17];
System.IO.File.AppendAllLines("tmp.txt", query.ToArray());
}
static void RF(string ls, string fn)
{
string[] tmpF = System.IO.File.ReadAllLines(@"tmp.txt");
var subqu = from subline in tmpF
let n = subline.Split(',')
select ls + "," + n[1] + "," + n[2] + "," + n[3] + "," + ("=" + n[2] + "+" + n[3]);
System.IO.File.AppendAllLines(fn, subqu.ToArray());
System.IO.File.Delete("tmp.txt");
}
}
}
- Abstract ToBeTranslated and Updated words from LocStudio statistic files
- words and expressions from friends
- Leetcode_remove-duplicates-from-sorted-list (updated c++ and python version)
- codeforces Trains and Statistic DP
- Android: Loading files from the Assets and Raw folders
- write to and read from files (读写文件)
- How to config (no)archivelog mode and manage archive log files by RMAN (Updated to 10G)
- statistic
- Updated SQL Server 2000 Sample Database Files
- The Difference between Probability and Statistic
- 【34.54%】【codeforces 675E】Trains and Statistic
- Computer Security Conference Ranking and Statistic
- Computer Security Conference Ranking and Statistic
- Words from the Heart
- words from the economist
- some words from website
- Words from Study
- Abstract from(1)
- 大小写转换函数,位运算的使用
- Ubuntu的启动项的修改
- 大小写转换的秘密
- 《网站建设&网页制作》精品课
- eclipse常用快捷键
- Abstract ToBeTranslated and Updated words from LocStudio statistic files
- read/write函数
- C 语言内存管理详解
- WebKit简介
- 常见网络拓扑结构
- Singleton Design Pattern
- Loadrunner基础知识
- VC除零异常(错误)捕获
- poco库交叉编译后使用注意