-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCollectionManagement.cs
84 lines (79 loc) · 3.25 KB
/
CollectionManagement.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
81
82
83
84
// --------------------------------------------------------------------------------
// VariScan module
//
// Description:
//
// Environment: Windows 10 executable, 32 and 64 bit
//
// Usage: TBD
//
// Author: (REM) Rick McAlister, [email protected]
//
// Edit Log: Rev 1.0 Initial Version
//
// Date Who Vers Description
// ----------- --- ----- -------------------------------------------------------
//
// ---------------------------------------------------------------------------------
//
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
namespace VariScan
{
class CollectionManagement
{
public static void CreateCollection(string collectionPath)
{
//If the collection isn't already initialized, create a new collection file structure
Configuration cfg = new Configuration();
cfg.CollectionFolderPath = cfg.VariScanFolderPath + "\\" + collectionPath;
if (!Directory.Exists(cfg.CollectionFolderPath))
{
Directory.CreateDirectory(cfg.CollectionFolderPath);
cfg.TargetListPath = cfg.CollectionFolderPath + "\\" + "VariScanList.xml";
cfg.ColorListPath = cfg.CollectionFolderPath + "\\" + "ColorList.xml";
cfg.ImageBankFolder = cfg.CollectionFolderPath + "\\" + "Image Bank";
Directory.CreateDirectory(cfg.ImageBankFolder);
cfg.StarchiveFilePath = cfg.CollectionFolderPath + "\\" + "Starchive.xml";
cfg.LogFolder = cfg.CollectionFolderPath + "\\" + "Logs";
Directory.CreateDirectory(cfg.LogFolder);
}
else
{
DialogResult dr = MessageBox.Show("Overwrite existing target list?", "", MessageBoxButtons.OKCancel);
if (dr == DialogResult.OK)
{
File.Delete(cfg.TargetListPath);
}
}
return;
}
public static string OpenCollection(string collectionName)
{
//Change collection to an existing collection
// Return the path to the collection's target list)
Configuration cfg = new Configuration();
cfg.CollectionFolderPath = cfg.VariScanFolderPath + "\\" + collectionName;
cfg.TargetListPath = cfg.CollectionFolderPath + "\\" + "VariScanList.xml";
cfg.ColorListPath = cfg.CollectionFolderPath + "\\" + "ColorList.xml";
cfg.ImageBankFolder = cfg.CollectionFolderPath + "\\" + "Image Bank";
cfg.StarchiveFilePath = cfg.CollectionFolderPath + "\\" + "Starchive.xml";
cfg.LogFolder = cfg.CollectionFolderPath + "\\" + "Logs";
return cfg.TargetListPath;
}
public static List<string> ListCollections()
{
//Produces a list of collection names (not paths)
Configuration cfg = new Configuration();
List<string> cList = new List<string>();
string basepath = cfg.VariScanFolderPath;
foreach (string fd in Directory.EnumerateDirectories(basepath))
{
Path.GetFileName(fd);
cList.Add(Path.GetFileName(fd));
}
return cList;
}
}
}