Subversion Repository Public Repository

ChrisCompleteCodeTrunk

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
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Reflection.Emit;
using System.IO;
using Newtonsoft.Json;

namespace SCExport
{
    class Program
    {
        static void Main(string[] args)
        {

            FileInfo settingFile = new FileInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Data\\settings.json"));
            if (settingFile.Exists)
            {
                using (StreamReader file = File.OpenText(settingFile.FullName))
                {
                    JsonSerializer serializer = new JsonSerializer();
                    Settings settings = null;
                    try
                    {
                        settings = (Settings)serializer.Deserialize(file, typeof(Settings));
                        Exporter ex = new Exporter(settings);
                        try
                        {
                            ex.ExportDocuments();
                        }
                        catch
                        {
                            Console.WriteLine("Export failed.");
                        }
                    }
                    catch
                    {
                        Console.WriteLine("Settings file is not valid");
                        return;
                    }
                }
            }
            else
            {
                Console.WriteLine("Can not find setting file. Please create a settings files in the Data directory where your executable lives.");
                return;
            }

        }
    }
}

Commits for ChrisCompleteCodeTrunk/SCExport/SCExport/Program.cs

Diff revisions: vs.
Revision Author Commited Message
1 BBDSCHRIS picture BBDSCHRIS Wed 22 Aug, 2018 20:08:03 +0000