|
using System;
using System.IO;
namespace TODOListConverter
{
class MainClass
{
[STAThread]
static int Main(string[] args)
{
string msg = @"**********************************************
TODOLIST Generator for Microsoft Project 2002
Created By : Maharishi Bhatia
Created Date : 13 May 2005
Version : 1.0
Description : Converter for Microsoft Project 2002 xml file to TODOLIST xml file.
**********************************************";
Console.WriteLine(msg);
string file = "";
#if DEBUG
file = @"D:\ToDoList\Converter\TODOListConverter\MSProjectPro2003XMLOutput.xml";
#else
if(args.Length == 0){
msg = @"Usage : TODOListConverter.exe <Full Path of the File to be Converted>";
goto error;
}
file = args[0];
#endif
FileInfo f = new FileInfo(file);
if(f.Exists){
StreamReader s = new StreamReader(f.FullName);
string xml = s.ReadToEnd();
xml = System.Text.RegularExpressions.Regex.Replace(xml, "(s*)xmlns=\"http://schemas.microsoft.com/project\"(s*)",string.Empty);
XmlTransformer transform = new XmlTransformer();
xml = transform.Transform(xml);
if(xml != null && xml.Length > 0){
System.Text.StringBuilder str = new System.Text.StringBuilder(xml);
str.Remove(0,106);
xml = str.ToString();
StreamWriter write = new StreamWriter(f.Directory+"\\"+"TODO_"+f.Name+".tdl",false,System.Text.Encoding.ASCII);
write.WriteLine(xml,write.NewLine);
write.Flush();
write.Close();
}else{
msg = "Error : No data after transformation.";
goto error;
}
}else{
msg = "Error : Not a valid File";
goto error;
}
#if DEBUG
Console.ReadLine();
return 0;
#else
Console.WriteLine("TODOList File {0} successfully created at {1} directory.","TODO_"+f.Name,f.Directory);
return 0;
#endif
error:{
Console.WriteLine(msg);
return -1;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I have been working in software industry for the past 11 years, though i am trained to be a pharmacist. Enjoy working on complex and new technologies. Also cleared my SCJP and MCP certification examinations.