-
Notifications
You must be signed in to change notification settings - Fork 3
/
GeneralRegistry.CS
133 lines (111 loc) · 4.1 KB
/
GeneralRegistry.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* Model Editor / GeneralRegistry
Created : 2011-04-07
Last Modified : 2011-04-27
Author : Tom Coleman
Copyright : 2011-2011
By : University of Mississippi Medical Center */
using System ;
using System.Drawing ;
using System.Windows.Forms ;
namespace ModelEditor
{ public class GeneralRegistry
{ private static String UseColorKey = "UseColor" ;
private static String SaveFilesKey = "SaveFiles" ;
private static String WaitForExitKey = "WaitOnSolver" ;
private static String UseTemplateFileKey = "UseTemplateFile" ;
private static String TemplateFileKey = "TemplateFile" ;
private static String RestoreFileTreeKey = "RestoreFileTree" ;
private static String InsertWideFormatKey = "InsertWideFormat" ;
private static bool UseColorDefault = true ;
private static bool SaveFilesDefault = true ;
private static bool WaitForExitDefault = false ;
private static bool UseTemplateFileDefault = false ;
private static String TemplateFileDefault = "None" ;
private static bool RestoreFileTreeDefault = true ;
private static bool InsertWideFormatDefault = false ;
public static void SetUseColor (bool State)
{ RegistryManager.SetValue (UseColorKey, (object) State.ToString ()) ;
}
public static bool GetUseColor ()
{ if (RegistryManager.HasKey (UseColorKey))
{ String Image = (String) RegistryManager.GetValue (UseColorKey) ;
return Convert.ToBoolean (Image) ;
}
else
{ return UseColorDefault ;
}
}
public static void SetSaveFiles (bool State)
{ RegistryManager.SetValue (SaveFilesKey, (object) State.ToString ()) ;
}
public static bool GetSaveFiles ()
{ if (RegistryManager.HasKey (SaveFilesKey))
{ String Image = (String) RegistryManager.GetValue (SaveFilesKey) ;
return Convert.ToBoolean (Image) ;
}
else
{ return SaveFilesDefault ;
}
}
public static void SetWaitForExit (bool State)
{ RegistryManager.SetValue (WaitForExitKey, (object) State.ToString ()) ;
}
public static bool GetWaitForExit ()
{ if (RegistryManager.HasKey (WaitForExitKey))
{ String Image = (String) RegistryManager.GetValue (WaitForExitKey) ;
return Convert.ToBoolean (Image) ;
}
else
{ return WaitForExitDefault ;
}
}
public static void SetUseTemplateFile (bool State)
{ RegistryManager.SetValue (UseTemplateFileKey, (object) State.ToString ()) ;
}
public static bool GetUseTemplateFile ()
{ if (RegistryManager.HasKey (UseTemplateFileKey))
{ String Image = (String) RegistryManager.GetValue (UseTemplateFileKey) ;
return Convert.ToBoolean (Image) ;
}
else
{ return UseTemplateFileDefault ;
}
}
public static void SetTemplateFile (String Filename)
{ RegistryManager.SetValue (TemplateFileKey, (object) Filename) ;
}
public static String GetTemplateFile ()
{ if (RegistryManager.HasKey (TemplateFileKey))
{ return (String) RegistryManager.GetValue (TemplateFileKey) ;
}
else
{ return TemplateFileDefault ;
}
}
public static void SetRestoreFileTree (bool State)
{ RegistryManager.SetValue (RestoreFileTreeKey, (object) State.ToString ()) ;
}
public static bool GetRestoreFileTree ()
{ if (RegistryManager.HasKey (RestoreFileTreeKey))
{ String Image = (String) RegistryManager.GetValue (RestoreFileTreeKey) ;
return Convert.ToBoolean (Image) ;
}
else
{ return RestoreFileTreeDefault ;
}
}
public static void SetInsertWideFormat (bool State)
{ RegistryManager.SetValue (InsertWideFormatKey, (object) State.ToString ()) ;
}
public static bool GetInsertWideFormat ()
{ if (RegistryManager.HasKey (InsertWideFormatKey))
{ String Image = (String) RegistryManager.GetValue (InsertWideFormatKey) ;
return Convert.ToBoolean (Image) ;
}
else
{ return InsertWideFormatDefault ;
}
}
}
}
/* End */