{
 $Id$
}

{wme beta 22}

Procedure Bbs14;
Type
   faccess = Record
     security    : Word;
     flags       : Longint;
     filecredits : Integer;
     bytecredits : Integer;
   end;

   WMERec = Record
      Areanaam      : array[0..59] of Char;
      Directory     : array[0..59] of Char;
      FilesBBS      : array[0..79] of Char;
      Opties        : Word;
      SecShow       : Word;
      FlagShow      : Longint;
      secRun        : Word;
      FlagRun       : Longint;
      Upload        : Faccess;
      Download      : Faccess;
      AreaNummer    : Integer;
      CatalogusNaam : Array[0..79] of Char;
      Combinatie    : Integer;
      Paswoord      : Array[0..39] of Char;
      Fill          : Array[1..154] of char;
   End;
Var
  FFile : File of WMErec;
  F     : WMERec;
  Tel   : Word;
  x     : word;

Begin
  Writeln('Converting Wme beta 2611 file areas.',#10#13);

  Assign(Ffile, BbsPath + 'FILEAREA.WME');
  {$I-} Reset(Ffile); {$I+}
  If ioresult <> 0 then
    Begin
      Writeln('Cannot find '+bbspath+'FILEAREA.WME!');
      Halt;
    End;

  AddToFile(false);

  Tel := 0;
  While not eof(ffile) do
    Begin
      Fillchar(f,sizeof(f),#0);

      {$I-} Read(Ffile,F); {$I+}
      If ioresult <> 0 then
        Begin
          Writeln('Error reading '+bbspath+'FILEAREA.WME!');
          Halt;
        End;

      Inc(Tel);
      If F.areanaam[0] <> #0 then
        Begin

          fillchar(bbs,sizeof(bbs),#0);

          X := 0;
          While (F.areanaam[x] <> #0) and (X < 60) do
          Begin
            Bbs.Name := Bbs.name + f.areanaam[x];
            Inc(x);
          End;

          X := 0;
          While (F.Directory[x] <> #0) and (X < 60) do
          Begin
            Bbs.path := Bbs.path + f.directory[x];
            Inc(x);
          End;

          Inc(Number);
          Bbs.on   := False;
          Bbs.nr   := Tel;

          AddToFile(saveset);
        End;
    End;
  Close(Ffile);
End;

