|
21 | 21 | interface
|
22 | 22 |
|
23 | 23 | Uses Classes, DSSClassDefs, DSSObject, DSSClass, ParserDel, Hashlist, PointerList,
|
24 |
| - UComplex, Arraydef, CktElement, Circuit, IniRegSave, {$IFNDEF FPC}Graphics,{$ENDIF} |
| 24 | + UComplex, Arraydef, CktElement, Circuit, IniRegSave, {$IFNDEF FPC}Graphics,{$ENDIF} System.IOUtils, inifiles, |
25 | 25 |
|
26 | 26 | {Some units which have global vars defined here}
|
27 | 27 | Spectrum,
|
@@ -109,7 +109,12 @@ interface
|
109 | 109 | DLLDebugFile :TextFile;
|
110 | 110 | ProgramName :String;
|
111 | 111 | DSS_Registry :TIniRegSave; // Registry (See Executive)
|
112 |
| - |
| 112 | + |
| 113 | + // Global variables for the DSS visualization tool |
| 114 | + DSS_Viz_installed :Boolean=False; // DSS visualization tool (flag of existance) |
| 115 | + DSS_Viz_path: String; |
| 116 | + DSS_Viz_enable: Boolean=False; |
| 117 | + |
113 | 118 | IsDLL,
|
114 | 119 | NoFormsAllowed :Boolean;
|
115 | 120 |
|
@@ -772,6 +777,39 @@ function IsDirectoryWritable(const Dir: String): Boolean;
|
772 | 777 | ReallocMem(p, newsize);
|
773 | 778 | End;
|
774 | 779 |
|
| 780 | +// Advance visualization tool check |
| 781 | +function GetIni(s,k: string; d: string; f: string=''): string; overload; |
| 782 | +var |
| 783 | + ini: TMemIniFile; |
| 784 | +begin |
| 785 | + Result := d; |
| 786 | + if f = '' then |
| 787 | + begin |
| 788 | + ini := TMemIniFile.Create(lowercase(ChangeFileExt(ParamStr(0),'.ini'))); |
| 789 | + end |
| 790 | + else |
| 791 | + begin |
| 792 | + if not FileExists(f) then Exit; |
| 793 | + ini := TMemIniFile.Create(f); |
| 794 | + end; |
| 795 | + if ini.ReadString(s,k,'') = '' then |
| 796 | + begin |
| 797 | + ini.WriteString(s,k,d); |
| 798 | + ini.UpdateFile; |
| 799 | + end; |
| 800 | + Result := ini.ReadString(s,k,d); |
| 801 | + FreeAndNil(ini); |
| 802 | +end; |
| 803 | + |
| 804 | +function CheckDSSVisualizationTool: Boolean; |
| 805 | +begin |
| 806 | + DSS_Viz_path:=GetIni('Application','path','', TPath.GetHomePath+'\OpenDSS Visualization Tool\settings.ini'); |
| 807 | + Result:=true; |
| 808 | + if DSS_Viz_path='' then |
| 809 | + Result:=false; |
| 810 | +end; |
| 811 | +// End of visualization tool check |
| 812 | + |
775 | 813 | initialization
|
776 | 814 |
|
777 | 815 | {Various Constants and Switches}
|
@@ -881,6 +919,8 @@ initialization
|
881 | 919 |
|
882 | 920 | //WriteDLLDebugFile('DSSGlobals');
|
883 | 921 |
|
| 922 | + DSS_Viz_installed:= CheckDSSVisualizationTool; // DSS visualization tool (flag of existance) |
| 923 | + |
884 | 924 | Finalization
|
885 | 925 |
|
886 | 926 | // Dosimplemsg('Enter DSSGlobals Unit Finalization.');
|
|
0 commit comments