@@ -18,52 +18,70 @@ class IBMi
18
18
private static Boolean _getList = false ;
19
19
private static List < string > _list = new List < string > ( ) ;
20
20
21
+ private static void CheckExist ( string key , string value )
22
+ {
23
+ if ( ! _config . ContainsKey ( key ) )
24
+ _config . Add ( key , value ) ;
25
+ }
26
+
21
27
public static void LoadConfig ( string FileLoc , string System = "mysystem" )
22
28
{
23
29
_config . Clear ( ) ;
24
30
_ConfigFile = FileLoc ;
25
31
string [ ] data ;
26
32
if ( ! File . Exists ( _ConfigFile ) )
27
33
{
28
- _config . Add ( "system" , System ) ;
29
- _config . Add ( "username" , "myuser" ) ;
30
- _config . Add ( "password" , "mypass" ) ;
31
- _config . Add ( "datalibl" , "SYSTOOLS" ) ;
32
- _config . Add ( "curlib" , "SYSTOOLS" ) ;
33
- _config . Add ( "installlib" , "QGPL" ) ;
34
- _config . Add ( "experimental" , "false" ) ;
35
-
36
- _config . Add ( "localDefintionsInstalled" , "false" ) ;
37
-
38
- _config . Add ( "binds" , "MBR_CRTBNDRPG|MBR_CRTSQLRPGI|MBR_CRTBNDCL|MBR_CRTBNDC|IFS_CRTBNDRPG" ) ;
39
- _config . Add ( "MBR_CRTBNDRPG" , "CRTBNDRPG PGM(%openlib%/%openmbr%) SRCFILE(%openlib%/%openspf%) OPTION(*EVENTF) DBGVIEW(*SOURCE)|ERRORS %openlib% %openmbr%" ) ;
40
- _config . Add ( "MBR_CRTSQLRPGI" , "CRTSQLRPGI OBJ(%openlib%/%openmbr%) SRCFILE(%openlib%/%openspf%) COMMIT(*NONE) OPTION(*EVENTF *XREF)|ERRORS %openlib% %openmbr%" ) ;
41
- _config . Add ( "MBR_CRTBNDCL" , "CRTBNDCL PGM(%openlib%/%openmbr%) SRCFILE(%openlib%/%openspf%) OPTION(*EVENTF)|ERRORS %openlib% %openmbr%" ) ;
42
- _config . Add ( "MBR_CRTBNDC" , "CRTBNDC PGM(%openlib%/%openmbr%) SRCFILE(%openlib%/%openspf%) DBGVIEW(*SOURCE)|ERRORS %openlib% %openmbr%" ) ;
43
- _config . Add ( "IFS_CRTBNDRPG" , "CRTBNDRPG PGM(%curlib%/%file%) SRCSTMF('%file%.%ext%') OPTION(*EVENTF) DBGVIEW(*SOURCE)|ERRORS %curlib% %file%" ) ;
34
+ CheckExist ( "system" , System ) ;
35
+ CheckExist ( "username" , "myuser" ) ;
36
+ CheckExist ( "password" , "mypass" ) ;
37
+ CheckExist ( "datalibl" , "SYSTOOLS" ) ;
38
+ CheckExist ( "curlib" , "SYSTOOLS" ) ;
39
+ CheckExist ( "clrcdlen" , "80" ) ;
40
+ CheckExist ( "installlib" , "QGPL" ) ;
41
+ CheckExist ( "experimental" , "false" ) ;
42
+
43
+ CheckExist ( "localDefintionsInstalled" , "false" ) ;
44
+
45
+ CheckExist ( "binds" , "MBR_CRTBNDRPG|MBR_CRTSQLRPGI|MBR_CRTBNDCL|MBR_CRTBNDC|IFS_CRTBNDRPG" ) ;
46
+ CheckExist ( "MBR_CRTBNDRPG" , "CRTBNDRPG PGM(%openlib%/%openmbr%) SRCFILE(%openlib%/%openspf%) OPTION(*EVENTF) DBGVIEW(*SOURCE)|ERRORS %openlib% %openmbr%" ) ;
47
+ CheckExist ( "MBR_CRTSQLRPGI" , "CRTSQLRPGI OBJ(%openlib%/%openmbr%) SRCFILE(%openlib%/%openspf%) COMMIT(*NONE) OPTION(*EVENTF *XREF)|ERRORS %openlib% %openmbr%" ) ;
48
+ CheckExist ( "MBR_CRTBNDCL" , "CRTBNDCL PGM(%openlib%/%openmbr%) SRCFILE(%openlib%/%openspf%) OPTION(*EVENTF)|ERRORS %openlib% %openmbr%" ) ;
49
+ CheckExist ( "MBR_CRTBNDC" , "CRTBNDC PGM(%openlib%/%openmbr%) SRCFILE(%openlib%/%openspf%) DBGVIEW(*SOURCE)|ERRORS %openlib% %openmbr%" ) ;
50
+ CheckExist ( "IFS_CRTBNDRPG" , "CRTBNDRPG PGM(%curlib%/%file%) SRCSTMF('%file%.%ext%') OPTION(*EVENTF) DBGVIEW(*SOURCE)|ERRORS %curlib% %file%" ) ;
44
51
45
52
PrintConfig ( ) ;
46
53
47
54
MessageBox . Show ( "You will now be prompted to enter in a Remote System." ) ;
48
55
Main . RemoteSetup ( ) ;
49
56
}
50
-
51
- _config . Clear ( ) ;
52
-
53
- foreach ( string Line in File . ReadAllLines ( _ConfigFile ) )
57
+ else
54
58
{
55
- data = Line . Split ( '=' ) ;
56
- for ( int i = 0 ; i < data . Length ; i ++ ) data [ i ] = data [ i ] . Trim ( ) ;
57
-
58
- if ( _config . ContainsKey ( data [ 0 ] ) )
59
- {
60
- _config [ data [ 0 ] ] = data [ 1 ] ;
61
- }
62
- else
59
+ foreach ( string Line in File . ReadAllLines ( _ConfigFile ) )
63
60
{
64
- _config . Add ( data [ 0 ] , data [ 1 ] ) ;
61
+ data = Line . Split ( '=' ) ;
62
+ for ( int i = 0 ; i < data . Length ; i ++ ) data [ i ] = data [ i ] . Trim ( ) ;
63
+
64
+ if ( _config . ContainsKey ( data [ 0 ] ) )
65
+ {
66
+ _config [ data [ 0 ] ] = data [ 1 ] ;
67
+ }
68
+ else
69
+ {
70
+ _config . Add ( data [ 0 ] , data [ 1 ] ) ;
71
+ }
65
72
}
73
+
74
+ CheckExist ( "system" , System ) ;
75
+ CheckExist ( "username" , "myuser" ) ;
76
+ CheckExist ( "password" , "mypass" ) ;
77
+ CheckExist ( "datalibl" , "SYSTOOLS" ) ;
78
+ CheckExist ( "curlib" , "SYSTOOLS" ) ;
79
+ CheckExist ( "clrcdlen" , "80" ) ;
80
+ CheckExist ( "installlib" , "QGPL" ) ;
81
+ CheckExist ( "experimental" , "false" ) ;
66
82
}
83
+
84
+
67
85
}
68
86
69
87
private static void PrintConfig ( )
0 commit comments