Subversion Repositories oidplus

Rev

Rev 741 | Rev 743 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 741 Rev 742
Line 696... Line 696...
696
 
696
 
697
    FreeOidDef(oid);
697
    FreeOidDef(oid);
698
  until exitRequest;
698
  until exitRequest;
699
end;
699
end;
700
 
700
 
701
procedure CreateInitOIDFile(filename: string);
701
procedure CreateRootOIDFile(filename: string);
702
var
702
var
703
  oid: POID;
703
  oid: POID;
704
begin
704
begin
705
  CreateOidDef(oid);
705
  CreateOidDef(oid);
706
  oid^.Description := 'This is the root of the OID tree.' +#13#10 +
706
  oid^.Description := 'This is the root of the OID tree.' +#13#10 +
Line 714... Line 714...
714
  oid^.Parent      := ZeroPad(0, 8);
714
  oid^.Parent      := ZeroPad(0, 8);
715
  _WriteOidFile(filename, oid);
715
  _WriteOidFile(filename, oid);
716
  FreeOidDef(oid);
716
  FreeOidDef(oid);
717
end;
717
end;
718
 
718
 
719
function _GetInitFile: string;
719
function _GetRootFile(ShowErrorMessage: boolean): string;
720
var
720
var
721
  initFile: string;
721
  rootFile: string;
722
begin
722
begin
723
  initFile := ZeroPad(0, 8) + '.OID';
723
  rootFile := ZeroPad(0, 8) + '.OID';
724
  if not FileExists(initFile) then
724
  if not FileExists(rootFile) then
725
  begin
725
  begin
-
 
726
    {$I-}
726
    CreateInitOIDFile(initFile);
727
    CreateRootOIDFile(rootFile);
-
 
728
    {$I+}
-
 
729
  end;
-
 
730
  if not FileExists(rootFile) then
-
 
731
  begin
-
 
732
    _GetRootFile := '';
-
 
733
    if ShowErrorMessage then
-
 
734
    begin
-
 
735
      ShowMessage('Cannot create ' + rootfile + '! Is disk read-only?', 'ERROR', true);
-
 
736
      _Pause;
-
 
737
    end;
-
 
738
  end
-
 
739
  else
-
 
740
  begin
-
 
741
    _GetRootFile := rootFile;
727
  end;
742
  end;
728
  _GetInitFile := initFile;
-
 
729
end;
743
end;
730
 
744
 
731
procedure OP_ManageOIDs;
745
procedure OP_ManageOIDs;
-
 
746
var
-
 
747
  rootfile: string;
732
begin
748
begin
733
  ClrScr;
749
  ClrScr;
734
  DrawTitleBar('Manage Object Identifiers', TITLEBAR_LEFT_TEXT, '');
750
  DrawTitleBar('Manage Object Identifiers', TITLEBAR_LEFT_TEXT, '');
735
  DrawStatusBar('Loading data... please wait...');
751
  DrawStatusBar('Loading data... please wait...');
736
 
752
 
-
 
753
  (* This will try creating a new root file if it does not exist *)
-
 
754
  rootfile := _GetRootFile(true);
-
 
755
  if rootfile = '' then Exit;
-
 
756
 
737
  DisplayOIDFile(_GetInitFile);
757
  DisplayOIDFile(rootfile);
738
end;
758
end;
739
 
759
 
740
procedure OP_ManageRAs;
760
procedure OP_ManageRAs;
741
begin
761
begin
742
  ClrScr;
762
  ClrScr;
Line 817... Line 837...
817
 
837
 
818
procedure OP_TreeView;
838
procedure OP_TreeView;
819
var
839
var
820
  F: Text;
840
  F: Text;
821
  rootoid: POID;
841
  rootoid: POID;
-
 
842
  rootfile: string;
822
begin
843
begin
823
  ClrScr;
844
  ClrScr;
824
  DrawTitleBar('TreeView Export', TITLEBAR_LEFT_TEXT, '');
845
  DrawTitleBar('TreeView Export', TITLEBAR_LEFT_TEXT, '');
825
  DrawStatusBar('Exporting data... please wait...');
846
  DrawStatusBar('Exporting data... please wait...');
826
 
847
 
-
 
848
  (* This will try creating a new root file if it does not exist *)
-
 
849
  rootfile := _GetRootFile(true);;
-
 
850
  if rootfile = '' then Exit;
-
 
851
 
827
  Assign(F, 'OIDTREE.TXT');
852
  Assign(F, 'OIDTREE.TXT');
828
  Rewrite(F);
853
  Rewrite(F);
829
 
854
 
830
  CreateOidDef(rootoid);
855
  CreateOidDef(rootoid);
831
  _ReadOidFile(_GetInitFile, rootoid);
856
  _ReadOidFile(rootfile, rootoid);
832
  _RecTreeExport(rootoid, F, 0);
857
  _RecTreeExport(rootoid, F, 0);
833
  FreeOidDef(rootoid);
858
  FreeOidDef(rootoid);
834
 
859
 
835
  DrawStatusBar(DEFAULT_STATUSBAR);
860
  DrawStatusBar(DEFAULT_STATUSBAR);
836
  ShowMessage('TreeView successfully exported as OIDTREE.TXT', 'TREEVIEW EXPORT', true);
861
  ShowMessage('TreeView successfully exported as OIDTREE.TXT', 'TREEVIEW EXPORT', true);