123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- unit ConfigDoc;
- interface
- uses
- Classes, IniFiles, UtilMethods;
- type
- TConfigInfo = class
- private
- FIniFile: TIniFile;
- FUnits: TStrings;
- FStandardXmLib: string;
- FStandardGclLib: string;
- FOutputPath: string;
- FAuditPath: string;
- FCompanyName: string;
- FAutoSave: Boolean;
- FAutoSaveInterval: Integer;
- FOverRangeType: Integer;
- FExcelWithMis: Boolean;
- procedure LoadSectionOfUnitList;
- procedure LoadSectionOfStdFile;
- procedure LoadSectionOfPath;
- procedure LoadSectionOfOptions;
- procedure LoadIniFile;
- procedure SaveIniFile;
- procedure SaveSectionOfStdFile;
- procedure SaveSectionOfOptions;
- function GetStandardGclLib: string;
- function GetStandardXmLib: string;
- procedure SetStandardGclLib(const Value: string);
- procedure SetStandardXmLib(const Value: string);
- function GetOutputPath: string;
- function GetAuditPath: string;
- public
- constructor Create(const AIniFile: string);
- destructor Destroy; override;
- property Units: TStrings read FUnits;
- property StandardXmLib: string read GetStandardXmLib write SetStandardXmLib;
- property StandardGclLib: string read GetStandardGclLib write SetStandardGclLib;
- // Path
- property AuditPath: string read GetAuditPath;
- property OutputPath: string read GetOutputPath;
- // Options
- property CompanyName: string read FCompanyName write FCompanyName;
- property AutoSave: Boolean read FAutoSave write FAutoSave;
- property AutoSaveInterval: Integer read FAutoSaveInterval write FAutoSaveInterval;
- property OverRangeType: Integer read FOverRangeType write FOverRangeType;
- property ExcelWithMis: Boolean read FExcelWithMis write FExcelWithMis;
- end;
- implementation
- { TConfigInfo }
- constructor TConfigInfo.Create(const AIniFile: string);
- begin
- FIniFile := TIniFile.Create(AIniFile);
- FUnits := TStringList.Create;
- LoadIniFile;
- end;
- destructor TConfigInfo.Destroy;
- begin
- SaveIniFile;
- FUnits.Free;
- FIniFile.Free;
- inherited;
- end;
- function TConfigInfo.GetAuditPath: string;
- begin
- Result := GetAppFilePath + FAuditPath;
- end;
- function TConfigInfo.GetOutputPath: string;
- begin
- Result := GetAppFilePath + FOutputPath;
- end;
- function TConfigInfo.GetStandardGclLib: string;
- begin
- Result := GetAppFilePath + '깃硫헌데\묏넋좆헌데\' + FStandardGclLib;
- end;
- function TConfigInfo.GetStandardXmLib: string;
- begin
- Result := GetAppFilePath + '깃硫헌데\淃커쌘헌데\' + FStandardXmLib;
- end;
- procedure TConfigInfo.LoadIniFile;
- begin
- LoadSectionOfUnitList;
- LoadSectionOfStdFile;
- LoadSectionOfPath;
- LoadSectionOfOptions;
- end;
- procedure TConfigInfo.LoadSectionOfOptions;
- begin
- FCompanyName := FIniFile.ReadString('Options', 'CompanyName', '');
- FAutoSave := FIniFile.ReadBool('Options', 'AutoSave', True);
- FAutoSaveInterval := FIniFile.ReadInteger('Options', 'AutoSaveInterval', 15);
- FOverRangeType := FIniFile.ReadInteger('Options', 'OverRangeType', 0);
- FExcelWithMis := FIniFile.ReadBool('Options', 'ExcelWithMis', False);
- end;
- procedure TConfigInfo.LoadSectionOfPath;
- begin
- FOutputPath := FIniFile.ReadString('Paths', 'Output', '돔놔匡숭\');
- FAuditPath := FIniFile.ReadString('Paths', 'AuditPath', '�괩툽릿匡숭\');
- end;
- procedure TConfigInfo.LoadSectionOfStdFile;
- begin
- FStandardXmLib := FIniFile.ReadString('StdFiles', 'XmLib', '');
- FStandardGclLib := FIniFile.ReadString('StdFiles', 'GclLib', '');
- end;
- procedure TConfigInfo.LoadSectionOfUnitList;
- var
- iIndex: Integer;
- begin
- if FIniFile.SectionExists('UnitList') then
- begin
- FIniFile.ReadSection('UnitList', FUnits);
- for iIndex := 0 to FUnits.Count - 1 do
- FUnits.Strings[iIndex] := FIniFile.ReadString('UnitList', FUnits.Strings[iIndex], '');
- end;
- end;
- procedure TConfigInfo.SaveIniFile;
- begin
- SaveSectionOfStdFile;
- SaveSectionOfOptions;
- end;
- procedure TConfigInfo.SaveSectionOfOptions;
- begin
- FIniFile.WriteString('Options', 'CompanyName', FCompanyName);
- FIniFile.WriteBool('Options', 'AutoSave', FAutoSave);
- FIniFile.WriteInteger('Options', 'AutoSaveInterval', FAutoSaveInterval);
- FIniFile.WriteInteger('Options', 'OverRangeType', FOverRangeType);
- FIniFile.WriteBool('Options', 'ExcelWithMis', FExcelWithMis);
- end;
- procedure TConfigInfo.SaveSectionOfStdFile;
- begin
- FIniFile.WriteString('StdFiles', 'XmLib', FStandardXmLib);
- FIniFile.WriteString('StdFiles', 'GclLib', FStandardGclLib);
- end;
- procedure TConfigInfo.SetStandardGclLib(const Value: string);
- begin
- FStandardGclLib := Value;
- SaveIniFile;
- end;
- procedure TConfigInfo.SetStandardXmLib(const Value: string);
- begin
- FStandardXmLib := Value;
- SaveIniFile;
- end;
- end.
|