TypeConfig.pas 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. unit TypeConfig;
  2. interface
  3. uses
  4. Classes, Forms, Windows;
  5. const
  6. cfgTypeFile = 'Type.txt';
  7. Flag_Version_0 = 0;
  8. type
  9. TCfgType = class
  10. private
  11. FVersion_0: string;
  12. FStrList: TStringList;
  13. public
  14. constructor Create;
  15. destructor Destroy; override;
  16. function GetAppType(const AType: Integer): string;
  17. property Version_0: string read FVersion_0;
  18. end;
  19. var
  20. CfgManager: TCfgType;
  21. implementation
  22. uses SysUtils;
  23. { TCfgType }
  24. constructor TCfgType.Create;
  25. var
  26. I: Integer;
  27. sName: string;
  28. begin
  29. FStrList := TStringList.Create;
  30. sName := ExtractFilePath(Application.ExeName);
  31. sName := sName + cfgTypeFile;
  32. if FileExists(sName) then
  33. begin
  34. FStrList.LoadFromFile(sName);
  35. FVersion_0 := FStrList.Strings[0];
  36. end
  37. else
  38. begin
  39. FVersion_0 := '°æ±¾0';
  40. end;
  41. end;
  42. destructor TCfgType.Destroy;
  43. begin
  44. FStrList.Free;
  45. inherited;
  46. end;
  47. function TCfgType.GetAppType(const AType: Integer): string;
  48. begin
  49. if AType = Flag_Version_0 then
  50. Result := FVersion_0;
  51. end;
  52. initialization
  53. CfgManager := TCfgType.Create;
  54. finalization
  55. CfgManager.Free;
  56. end.