⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipdsgn.pas

📁 胜天进销存源码,国产优秀的进销存
💻 PAS
字号:
unit ipdsgn;
{
//
// Description : Picture Mask Design Time Access
//
// Copyright (c) 1995-2001 by Woll2Woll Software
//
}
interface

uses classes, registry, inifiles;

Procedure wwOpenPictureIni;
Procedure wwClosePictureIni;
Function wwIniGetPictureDescription(Mask: string): string;
Function wwIniGetRegexDescription(Mask: string): string;
Procedure wwVerifyPictureKeyValue(var Key, Value: string);

Function IniPict: TIniFile;

implementation

var Ini: TIniFile;
//var
//    inicount: integer;

Function IniPict: TIniFile;
begin
   if ini=nil then wwOpenPictureIni;
   result:= ini;
end;

procedure wwVerifyPictureKeyValue(var Key, Value: string);
var i: integer;
    tempValue: string;
begin
   for i:= 1 to length(Key) do
     if (ord(key[i])<32) or (key[i]='=') then key[i]:= ' ';
   tempValue:= '';

   for i:= 1 to length(Value) do
      if not (ord(Value[i])<32) or (Value[i]='=') then tempValue:= tempValue + Value[i];
   Value:= tempValue;
end;


Function wwIniGetPictureDescription(Mask: string): string;
var i: integer;
    masks: TStringList;
begin
   masks:= TStringList.create;
   iniPict.ReadSectionValues('Picture Masks', masks);
   result:= '';
   for i:= 0 to masks.count-1 do
   begin
      if masks.Values[masks.Names[i]] = Mask then
      begin
         result:= masks.Names[i];
      end;
   end;
   masks.free;
end;

Function wwIniGetRegexDescription(Mask: string): string;
var i: integer;
    masks: TStringList;
begin
   masks:= TStringList.create;
   iniPict.ReadSectionValues('Regex Masks', masks);
   result:= '';
   for i:= 0 to masks.count-1 do
   begin
      if masks.Values[masks.Names[i]] = Mask then
      begin
         result:= masks.Names[i];
      end;
   end;
   masks.free;
end;

Procedure wwOpenPictureIni;
const DefaultINI = 'InfoPowerMasks.ini';
var ipreg: TRegIniFile;
    FileName: string;
begin
   if ini<>nil then exit;

   ipreg := TRegIniFile.create('');
   FileName:= ipreg.ReadString('\Software\Woll2Woll\InfoPower', 'Masks IniFile', DefaultINI);
   if FileName='' then FileName:=DefaultIni;
   ipreg.free;
   ini:= TIniFile.create(FileName);
end;

Procedure wwClosePictureIni;
begin
{  dec(inicount);
  if inicount<=0 then
  begin
     inipict.free;
     inipict:= nil;
  end
  else }
  ini.UpdateFile;
end;

initialization
finalization
   ini.Free;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -