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

📄 adxlbmdm.pas

📁 测试用例
💻 PAS
📖 第 1 页 / 共 3 页
字号:
          WriteLine('    <OpenHandset Sequence = "' + XMLizeInt(PLmModemCommand(OpenHandset[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(OpenHandset[I]).Command) + '</OpenHandset>');
      for I := 0 to pred(SpeakerPhoneDisable.Count) do
          WriteLine('    <SpeakerPhoneDisable Sequence = "' + XMLizeInt(PLmModemCommand(SpeakerPhoneDisable[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(SpeakerPhoneDisable[I]).Command) + '</SpeakerPhoneDisable>');
      for I := 0 to pred(SpeakerPhoneEnable.Count) do
          WriteLine('    <SpeakerPhoneEnable Sequence = "' + XMLizeInt(PLmModemCommand(SpeakerPhoneEnable[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(SpeakerPhoneEnable[I]).Command) + '</SpeakerPhoneEnable>');
      for I := 0 to pred(SpeakerPhoneMute.Count) do
          WriteLine('    <SpeakerPhoneMute Sequence = "' + XMLizeInt(PLmModemCommand(SpeakerPhoneMute[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(SpeakerPhoneMute[I]).Command) + '</SpeakerPhoneMute>');
      for I := 0 to pred(SpeakerPhoneSetVolumeGain.Count) do
          WriteLine('    <SpeakerPhoneSetVolumeGain Sequence = "' + XMLizeInt(PLmModemCommand(SpeakerPhoneSetVolumeGain[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(SpeakerPhoneSetVolumeGain[I]).Command) + '</SpeakerPhoneSetVolumeGain>');
      for I := 0 to pred(SpeakerPhoneUnMute.Count) do
          WriteLine('    <SpeakerPhoneUnMute Sequence = "' + XMLizeInt(PLmModemCommand(SpeakerPhoneUnMute[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(SpeakerPhoneUnMute[I]).Command) + '</SpeakerPhoneUnMute>');
      for I := 0 to pred(StartPlay.Count) do
          WriteLine('    <StartPlay Sequence = "' + XMLizeInt(PLmModemCommand(StartPlay[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(StartPlay[I]).Command) + '</StartPlay>');
      for I := 0 to pred(StartRecord.Count) do
          WriteLine('    <StartRecord Sequence = "' + XMLizeInt(PLmModemCommand(StartRecord[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(StartRecord[I]).Command) + '</StartRecord>');
      for I := 0 to pred(StopPlay.Count) do
          WriteLine('    <StopPlay Sequence = "' + XMLizeInt(PLmModemCommand(StopPlay[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(StopPlay[I]).Command) + '</StopPlay>');
      for I := 0 to pred(StopRecord.Count) do
          WriteLine('    <StopRecord Sequence = "' + XMLizeInt(PLmModemCommand(StopRecord[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(StopRecord[I]).Command) + '</StopRecord>');
      for I := 0 to pred(VoiceAnswer.Count) do
          WriteLine('    <VoiceAnswer Sequence = "' + XMLizeInt(PLmModemCommand(VoiceAnswer[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(VoiceAnswer[I]).Command) + '</VoiceAnswer>');
      for I := 0 to pred(VoiceDialNumberSetup.Count) do
          WriteLine('    <VoiceDialNumberSetup Sequence = "' + XMLizeInt(PLmModemCommand(VoiceDialNumberSetup[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(VoiceDialNumberSetup[I]).Command) + '</VoiceDialNumberSetup>');
      for I := 0 to pred(VoiceToDataAnswer.Count) do
          WriteLine('    <VoiceToDataAnswer Sequence = "' + XMLizeInt(PLmModemCommand(VoiceToDataAnswer[I]).Sequence) +
            '">' + XMLize(PLmModemCommand(VoiceToDataAnswer[I]).Command) + '</VoiceToDataAnswer>');

      with WaveDriver do begin
        WriteLine('      <WaveDriver>');
        WriteLine('        BaudRate = "' + XMLize(  BaudRate) + '"');
        WriteLine('        WaveHardwareID = "' + XMLize(WaveHardwareID) + '"');
        WriteLine('        WaveDevices = "' + XMLize(WaveDevices) + '"');
        WriteLine('        LowerMid = "' + XMLize(LowerMid) + '"');
        WriteLine('        LowerWaveInPid = "' + XMLize(LowerWaveInPid) + '"');
        WriteLine('        LowerWaveOutPid = "' + XMLize(LowerWaveOutPid) + '"');
        WriteLine('        WaveOutMixerDest = "' + XMLize(WaveOutMixerDest) + '"');
        WriteLine('        WaveOutMixerSource = "' + XMLize(WaveOutMixerSource) + '"');
        WriteLine('        WaveInMixerDest = "' + XMLize(WaveInMixerDest) + '"');
        WriteLine('        WaveInMixerSource = "' + XMLize(WaveInMixerSource) + '"');

        for I := 0 to pred(WaveFormat.Count) do
          WriteLine('        <WaveFormat ChipSet = "' + PLmWaveFormat(WaveFormat[I]).Chipset
            + '" Speed = "' + PLmWaveFormat(WaveFormat[I]).Speed
            + '" SampleSize = "' + PLmWaveFormat(WaveFormat[I]).SampleSize
            + '"/>');
        WriteLine('      </WaveDriver>');
      end;
      WriteLine('    </Voice>');
    end;

    for I := 0 to pred(Modem.Hangup.Count) do
      WriteLine('    <Hangup Sequence = "' + XMLizeInt(PLmModemCommand(Modem.Hangup[I]).Sequence) +
        '">' + XMLize(PLmModemCommand(Modem.Hangup[I]).Command) + '</Hangup>');

    for I := 0 to pred(Modem.Init.Count) do
      WriteLine('    <Init Sequence = "' + XMLizeInt(PLmModemCommand(Modem.Init[I]).Sequence) +
        '">' + XMLize(PLmModemCommand(Modem.Init[I]).Command) + '</Init>');

    for I := 0 to pred(Modem.Monitor.Count) do
      WriteLine('    <Monitor Sequence = "' + XMLizeInt(PLmModemCommand(Modem.Monitor[I]).Sequence) +
        '">' + XMLize(PLmModemCommand(Modem.Monitor[I]).Command) + '</Monitor>');

    with Modem.Settings do begin
      WriteLine('    <Settings');
      WriteLine('      Prefix = "' + XMLize(Prefix) + '"');
      WriteLine('      Terminator = "' + XMLize(Terminator) + '"');
      WriteLine('      DialPrefix = "' + XMLize(DialPrefix) + '"');
      WriteLine('      DialSuffix = "' + XMLize(DialSuffix) + '"');
      WriteLine('      SpeakerVolume_High = "' + XMLize(SpeakerVolume_High) + '"');
      WriteLine('      SpeakerVolume_Low = "' + XMLize(SpeakerVolume_Low) + '"');
      WriteLine('      SpeakerVolume_Med = "' + XMLize(SpeakerVolume_Med) + '"');
      WriteLine('      SpeakerMode_Dial = "' + XMLize(SpeakerMode_Dial) + '"');
      WriteLine('      SpeakerMode_Off = "' + XMLize(SpeakerMode_Off) + '"');
      WriteLine('      SpeakerMode_On = "' + XMLize(SpeakerMode_On) + '"');
      WriteLine('      SpeakerMode_Setup = "' + XMLize(SpeakerMode_Setup) + '"');
      WriteLine('      FlowControl_Hard = "' + XMLize(FlowControl_Hard) + '"');
      WriteLine('      FlowControl_Off = "' + XMLize(FlowControl_Off) + '"');
      WriteLine('      FlowControl_Soft = "' + XMLize(FlowControl_Soft) + '"');
      WriteLine('      ErrorControl_Forced = "' + XMLize(ErrorControl_Forced) + '"');
      WriteLine('      ErrorControl_Off = "' + XMLize(ErrorControl_Off) + '"');
      WriteLine('      ErrorControl_On = "' + XMLize(ErrorControl_On) + '"');
      WriteLine('      ErrorControl_Cellular = "' + XMLize(ErrorControl_Cellular) + '"');
      WriteLine('      ErrorControl_Cellular_Forced = "' + XMLize(ErrorControl_Cellular_Forced) + '"');
      WriteLine('      Compression_Off = "' + XMLize(Compression_Off) + '"');
      WriteLine('      Compression_On = "' + XMLize(Compression_On) + '"');
      WriteLine('      Modulation_Bell = "' + XMLize(Modulation_Bell) + '"');
      WriteLine('      Modulation_CCITT = "' + XMLize(Modulation_CCITT) + '"');
      WriteLine('      Modulation_CCITT_V23 = "' + XMLize(Modulation_CCITT_V23) + '"');
      WriteLine('      SpeedNegotiation_On = "' + XMLize(SpeedNegotiation_On) + '"');
      WriteLine('      SpeedNegotiation_Off = "' + XMLize(SpeedNegotiation_Off) + '"');
      WriteLine('      Pulse = "' + XMLize(Pulse) + '"');
      WriteLine('      Tone = "' + XMLize(Tone) + '"');
      WriteLine('      Blind_Off = "' + XMLize(Blind_Off) + '"');
      WriteLine('      Blind_On = "' + XMLize(Blind_On) + '"');
      WriteLine('      CallSetupFailTimer = "' + XMLize(CallSetupFailTimer) + '"');
      WriteLine('      InactivityTimeout = "' + XMLize(InactivityTimeout) + '"');
      WriteLine('      CompatibilityFlags = "' + XMLize(CompatibilityFlags) + '"');
      WriteLine('      ConfigDelay = "' + XMLizeInt(ConfigDelay) + '"/>');
    end;

    with Modem.Hardware do begin
      WriteLine('    <Hardware>');
      WriteLine('      AutoConfigOverride = "' + XMLize(AutoConfigOverride) + '"');
      WriteLine('      ComPort = "' + XMLize(ComPort) + '"');
      WriteLine('      InvalidRDP = "' + XMLize(InvalidRDP) + '"');
      WriteLine('      IoBaseAddress = "' + XMLizeInt(IoBaseAddress) + '"');
      WriteLine('      InterruptNumber = "' + XMLizeInt(InterruptNumber) + '"');
      WriteLine('      PermitShare = "' + XMLizeBool(PermitShare) + '"');
      WriteLine('      RxFIFO = "' + XMLize(RxFIFO) + '"');
      WriteLine('      RxTxBufferSize = "' + XMLizeInt(RxTxBufferSize) + '"');
      WriteLine('      TxFIFO = "' + XMLize(TxFIFO) + '"');
      WriteLine('      Pcmcia = "' + XMLize(Pcmcia) + '"');
      WriteLine('      BusType = "' + XMLize(BusType) + '"');
      WriteLine('      PCCARDAttributeMemoryAddress = "' + XMLizeInt(PCCARDAttributeMemoryAddress) + '"');
      WriteLine('      PCCARDAttributeMemorySize = "' + XMLizeInt(PCCARDAttributeMemorySize) + '"');
      WriteLine('      PCCARDAttributeMemoryOffset = "' + XMLizeInt(PCCARDAttributeMemoryOffset) + '"');
      WriteLine('    </Hardware>');
    end;

    for I := 0 to pred(Modem.BaudRates.Count) do
      WriteXMLStr('    <BaudRates>', Modem.BaudRates[I]);

    for I := 0 to pred(Modem.Options.Count) do
      WriteXMLStr('    <Options>', Modem.Options[I]);


    WriteLine('  </Modem>');
    Result := ecOK;
  except
    Result := ecDeviceWrite;
  end;

end;

procedure TApdModemCapDetail.FixupModemcap(var List: TStringList);
  { calculate totals, sort and add modem detail file list }
const
  ModemFileStr = 'ModemFile = "';
var
  X, I : Integer;
  FileList : TStringList;
  S : string;
begin
  { count the modem records and file references... }
  X := pred(List.Count);
  I := X;
  FileList := nil;
  try
    FileList := TStringList.Create;
    FileList.Sorted := True;
    FileList.Duplicates := dupIgnore;
    while (Pos('<ModemRecord ModemName = "', List[X]) > 0) do begin
      S := Copy(List[X], ApxRPos(ModemFileStr, List[X]) + Length(ModemFileStr),
        Length(List[x]));
      S := Copy(S, 1, Pos('"', S) - 1);
      FileList.Add(S);
      dec(X);
    end;
    X := I - X;
    { ... and add the total line }
    S := '  <Totals Files = "' + IntToStr(FileList.Count) +
         '" Modems = "' + IntToStr(X) + '"/>';
    List.Add(S);
    { add the modem file list }
    List.Add('  <ModemFileList>');
    for I := 0 to pred(FileList.Count) do begin
      List.Add('    <ModemFile>' + FileList[I] + '</ModemFile>')
    end;
    List.Add('  </ModemFileList>');
    List.Add('</ModemCap>');
  finally
    FileList.Free;
  end;
end;

function TApdModemCapDetail.ReadLine : string;
  { a method to read a #13#10 terminated line from the stream }
var
  C : Char;
begin
  Result := '';
  repeat
    DetailStream.ReadBuffer(C, 1);
    Result := Result + C;
  until (Pos(#13#10, Result) > 0) or (AtEOF);
end;

function TApdModemCapDetail.UnXMLize(const S: string): string;
  { a method to convert an XMLized string to a regular one }
var
  Psn : Integer;
begin
  { fix up the modemname with any XML stuff }
  Result := S;
  while Pos('&amp;', Result) > 0 do
    Delete(Result, Pos('&amp;', Result) + 1, 4);
  while Pos('&quot;', Result) > 0 do begin
    Psn := Pos('&quot;', Result);
    Delete(Result, Pos('&quot;', Result), 6);
    Insert('"', Result, Psn);
  end;
end;

procedure TApdModemCapDetail.WriteLine(const Str: string);
  { a method to write a #13#10 terminated string to the stream }
  { no XML translations }
begin
  if Pos('""', Str) > 0 then
    { don't write entries without data }
    Exit;
  if Str = '>' then
    { it's a terminating '>', remove the preceding #13#10 }
    DetailStream.Position := DetailStream.Position - 2;
  DetailStream.WriteBuffer(Str[1], Length(Str));
  DetailStream.WriteBuffer(#13#10, 2);
end;

procedure TApdModemCapDetail.WriteXMLStr(const Str, sVal : string);
  { writes a string and another string, the first string is the }
  { start-end tag, the second is the value }
var
  S : string;
begin
  if sVal = '' then
    { nothing to add... }
    Exit;
  S := Str;
  while S[1] = ' ' do
    Delete(S, 1, 1);
  Assert(S[1] = '<', 'Need brackets ' + S);
  Insert('/', S, 2);
  WriteLine(Str + XMLize(sVal) + S);
end;

function TApdModemCapDetail.XMLize(const S: string): string;
  { a method to convert a regular string to an XML string }
var
  i : integer;
begin
  result := '';
  for i := 1 to Length (s) do
    case s[i] of
      '<' : result := result + '&lt;';
      '>' : result := result + '&gt;';
      {' ' : result := result + '&nbsp;';}
      '&' : result := result + '&amp;';
      '"' : result := result + '&quot;';
      else
        result := result + copy (s, i, 1);
    end;
end;

function TApdModemCapDetail.XMLizeInt(I: Integer): string;
  { numbers aren't escaped, just return the string }
begin
  Result := IntToStr(I);
end;

function TApdModemCapDetail.XMLizeBool(B: Boolean): string;
begin
  if B then
    Result := '1'
  else
    Result := '0';
end;

end.

⌨️ 快捷键说明

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