-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
80 lines (74 loc) · 2.37 KB
/
Program.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
/*
* This comment block should only be in branch: DID001-branch-test
*
* This is for testing github branches, etc.
*
*/
namespace SnoValleyConverter
{
class Program
{
static string Convert(string ofxFile)
{
string qfxFile = ofxFile + ".qfx";
try
{
using (StreamReader reader = File.OpenText(ofxFile))
{
using (StreamWriter writer = new StreamWriter(qfxFile))
{
string line;
while ((line = reader.ReadLine()) != null)
{
if (line.ToUpper().Equals("<FID>33333333"))
{
line = "<FID>24399";
}
else if (line.ToUpper().Equals("<INTU.BID>33333333"))
{
line = "<INTU.BID>24399";
}
writer.WriteLine(line);
}
}
}
}
catch (Exception e)
{
Console.WriteLine(String.Format("Unable to convert {0} to {1}, error: {2}", ofxFile, qfxFile, e.Message));
qfxFile = null;
}
return qfxFile;
}
// Add a comment to for DID002
static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("Usage: SnoValleyConverter <OFX_File.ofx>");
}
else
{
Console.WriteLine(String.Format("Converting {0}...", args[0]));
string qfxPath = Convert(args[0]);
if (qfxPath != null)
{
if (Process.Start(qfxPath) == null)
{
Console.WriteLine("Unable to find and launch Quicken");
}
}
else
{
Console.WriteLine("Unable to convert OFX to QFX.");
}
}
}
}
}