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

📄 jclmsdossys.pas

📁 East make Tray Icon in delphi
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  Result := FNetWork;
end;

function TJclMsdosSys.GetUninstallDir: Char;
begin
  Result := FUninstallDir;
end;

function TJclMsdosSys.GetWinBootDir: string;
begin
  Result := FWinBootDir;
end;

function TJclMsdosSys.GetWinDir: string;
begin
  Result := FWinDir;
end;

function TJclMsdosSys.GetWinVer: string;
begin
  Result := FWinVer;
end;

procedure TJclMsdosSys.SetUninstallDir(AUninstallDir: Char);
begin
  if UninstallDir <> AUninstallDir then
  begin
    FUninstallDir := AUninstallDir;
    WriteMsdosSys;
  end;
end;

procedure TJclMsdosSys.SetWinDir(AWinDir: string);
begin
  SetString(FWinDir, AWinDir);
end;

procedure TJclMsdosSys.SetWinBootDir(AWinBootDir: string);
begin
  SetString(FWinBootDir, AWinBootDir);
end;

procedure TJclMsdosSys.SetHostWinBootDrv(AHostWinBootDrv: Char);
begin
  if HostWinBootDrv <> AHostWinBootDrv then
  begin
    FHostWinBootDrv := AHostWinBootDrv;
    WriteMsdosSys;
  end;
end;

procedure TJclMsdosSys.SetAutoScan(AAutoScan: Boolean);
begin
  SetBool(FAutoScan, AAutoScan);
end;

procedure TJclMsdosSys.SetBootDelay(ABootDelay: Cardinal);
begin
  if BootDelay <> ABootDelay then
  begin
    FBootDelay := ABootDelay;
    WriteMsdosSys;
  end;
end;

procedure TJclMsdosSys.SetBootGUI(ABootGUI: Boolean);
begin
  SetBool(FBootGUI, ABootGUI);
end;

procedure TJclMsdosSys.SetBootKeys(ABootKeys: Boolean);
begin
  SetBool(FBootKeys, ABootKeys);
end;

procedure TJclMsdosSys.SetBootMenu(ABootMenu: Boolean);
begin
  SetBool(FBootMenu, ABootMenu);
end;

procedure TJclMsdosSys.SetBootMenuDefault(ABootMenuDefault: Cardinal);
begin
  if BootMenuDefault <> ABootMenuDefault then
  begin
    FBootMenuDefault := ABootMenuDefault;
    WriteMsdosSys;
  end;
end;

procedure TJclMsdosSys.SetBootMenuDelay(ABootMenuDelay: Cardinal);
begin
  if BootMenuDelay <> ABootMenuDelay then
  begin
    FBootMenuDelay := ABootMenuDelay;
    WriteMsdosSys;
  end;
end;

procedure TJclMsdosSys.SetBootMulti(ABootMulti: Boolean);
begin
  SetBool(FBootMulti, ABootMulti);
end;

procedure TJclMsdosSys.SetBootSafe(ABootSafe: Boolean);
begin
  SetBool(FBootSafe, ABootSafe);
end;

procedure TJclMsdosSys.SetBootWarn(ABootWarn: Boolean);
begin
  SetBool(FBootWarn, ABootWarn);
end;

procedure TJclMsdosSys.SetBootWin(ABootWin: Boolean);
begin
  SetBool(FBootWin, ABootWin);
end;

procedure TJclMsdosSys.SetDBLSpace(ADBLSpace: Boolean);
begin
  SetBool(FDBLSpace, ADBLSpace);
end;

procedure TJclMsdosSys.SetDRVSpace(ADRVSpace: Boolean);
begin
  SetBool(FDRVSpace, ADRVSpace);
end;

procedure TJclMsdosSys.SetDoubleBuffer(ADoubleBuffer: Boolean);
begin
  SetBool(FDoubleBuffer, ADoubleBuffer);
end;

procedure TJclMsdosSys.SetLoadTop(ALoadTop: Boolean);
begin
  SetBool(FLoadTop, ALoadTop);
end;

procedure TJclMsdosSys.SetLogo(ALogo: Boolean);
begin
  SetBool(FLogo, ALogo);
end;

procedure TJclMsdosSys.SetNetwork(ANetwork: Boolean);
begin
  SetBool(FNetwork, ANetwork);
end;

procedure TJclMsdosSys.SetWinVer(AWinVer: string);
begin
  SetString(FWinVer, AWinVer);
end;

procedure TJclMsdosSys.SetBool(var ANew: Boolean; AOld: Boolean);
begin
  if ANew <> AOld then
  begin
    ANew := AOld;
    WriteMsdosSys;
  end;
end;

procedure TJclMsdosSys.SetString(var ANew: string; AOld: string);
begin
  if ANew <> AOld then
  begin
    ANew := AOld;
    WriteMsdosSys;
  end;
end;

procedure TJclMsdosSys.ReadMsdosSys;
var
  List: TStringList;
  Value: string;

  function BoolVal(const Name: string; const Def: Boolean): Boolean;
  var
    Val: string;
  begin
    Result := Def;
    Val := Trim(List.Values[Name]);
    if Val <> '' then
      if Val[1] = '0' then
        Result := False
      else
      if Val[1] = '1' then
        Result := True;
  end;

begin
  FUninstallDir := #0;
  FHostWinBootDrv := #0;
  List := TStringList.Create;
  try
    List.LoadFromFile(cMsDosSys);
    Value := Trim(List.Values['UninstallDir']);
    if Value <> '' then
      FUninstallDir := Value[1];
    FWinDir := Trim(List.Values['WinDir']);
    FWinBootDir := Trim(List.Values['WinBootDir']);
    Value := Trim(List.Values['HostWinBootDrv']);
    if Value <> '' then
      FHostWinBootDrv := Value[1];

    FAutoScan := BoolVal('AutoScan', True);
    FBootDelay := StrToIntDef(Trim(List.Values['BootDelay']), 2);
    FBootGUI := BoolVal('BootGUI', True);
    FBootKeys := BoolVal('BootKeys', True);
    FBootMenu := BoolVal('BootMenu', False);
    FBootMenuDefault := StrToIntDef(Trim(List.Values['BootMenuDefault']), 1);
    FBootMenuDelay := StrToIntDef(Trim(List.Values['BootMenuDelay']), 30);
    FBootMulti := BoolVal('BootMulti', False);
    FBootSafe := BoolVal('BootSafe', False);
    FBootWarn := BoolVal('BootWarn', True);
    FBootWin := BoolVal('BootWin', True);
    FDBLSpace := BoolVal('DBLSpace', True);
    FDRVSpace := BoolVal('DRVSpace', True);
    FDoubleBuffer := BoolVal('DoubleBuffer', False);
    FLoadTop := BoolVal('LoadTop', True);
    FLogo := BoolVal('Logo', True);
    FNetwork := BoolVal('Network', False);
    FWinVer := Trim(List.Values['WinVer']);
  finally
    List.Free;
  end;
end;

procedure TJclMsdosSys.WriteMsdosSys;
var
  Attributes: Integer;
  I: Char;
  Line: string;
begin
  if not FileExists(cMsDosSys) then
    Exit;
  with TStringList.Create do
  try
    Add('[Paths]');
    if UninstallDir <> #0 then
      Add('UninstallDir=' + UninstallDir);
    if WinDir <> '' then
      Add('WinDir=' + WinDir);
    if WinBootDir <> '' then
      Add('WinBootDir=' + WinBootDir);
    if HostWinBootDrv <> #0 then
      Add('HostWinBootDrv=' + HostWinBootDrv);
    Add('');

    Add('[Options]');
    if not AutoScan then
      Add('AutoScan=0');
    if BootDelay <> 2 then
      Add('BootDelay=' + IntToStr(BootDelay));
    if not BootGUI then
      Add('BootGUI=0');
    if not BootKeys then
      Add('BootKeys=0');
    if BootMenu then
      Add('BootMenu=1');
    if BootMenuDefault <> 1 then
      Add('BootMenuDefault=' + IntToStr(BootMenuDefault));
    if BootMenuDelay <> 30 then
      Add('BootMenuDelay=' + IntToStr(BootMenuDelay));
    if BootMulti then
      Add('BootMulti=1');
    if BootSafe then
      Add('BootSafe=1');
    if not BootWarn then
      Add('BootWarn=0');
    if not BootWin then
      Add('BootWin=0');
    if not DBLSpace then
      Add('DBLSpace=0');
    if not DRVSpace then
      Add('DRVSpace=0');
    if DoubleBuffer then
      Add('DoubleBuffer=1');
    if not LoadTop then
      Add('LoadTop=0');
    if not Logo then
      Add('Logo=0');
    if Network then
      Add('Network=1');
    if WinVer <> '' then
      Add('WinVer=' + WinVer);

    Add(';');
    Add(';The following lines are required for compatibility with other programs.');
    Add(';Do not remove them(MSDOS.SYS needs to be >1024 bytes).');
    Line := ';' + StringOfChar('x', 69);
    for I := 'a' to 's' do
      Add(Line+I);
    Attributes := FileGetAttr(cMsDosSys) and not faReadOnly;
    FileSetAttr(cMsDosSys, Attributes);
    SaveToFile(cMsDosSys);
    FileSetAttr(cMsDosSys, Attributes or faReadOnly);
  finally
    Free;
  end;
end;

// History:

// $Log: JclMsdosSys.pas,v $
// Revision 1.8  2005/02/25 07:20:16  marquardt
// add section lines
//
// Revision 1.7  2005/02/24 16:34:52  marquardt
// remove divider lines, add section lines (unfinished)
//
// Revision 1.6  2004/10/17 21:00:15  mthoma
// cleaning
//
// Revision 1.5  2004/08/09 06:38:08  marquardt
// add JvWStrUtils.pas as JclWideStrings.pas
//
// Revision 1.4  2004/05/05 07:33:49  rrossmair
// header updated according to new policy: initial developers & contributors listed
//
// Revision 1.3  2004/04/06 04:55:17  
// adapt compiler conditions, add log entry
//

end.

⌨️ 快捷键说明

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