$PBExportHeader$n_directory.sru $PBExportComments$Datastore to hold library directory forward global type n_directory from datastore end type end forward global type n_directory from datastore string dataobject = "d_directory" end type global n_directory n_directory forward prototypes public function long of_importstring (string as_string) public subroutine of_directory (string as_libname) public function string of_replaceall (string as_oldstring, string as_findstr, string as_replace) public subroutine of_load () end prototypes public function long of_importstring (string as_string);String ls_newstring Long ll_rc // remove returns in comments ls_newstring = of_replaceall(as_string, "~r~n", " ") // import string ll_rc = this.ImportString(ls_newstring, 1, 99999, 1, 3, 3) Return ll_rc end function public subroutine of_directory (string as_libname);String ls_dir Long ll_rc this.Object.libname.Initial = as_libname this.Object.objtype.Initial = "application" ls_dir = LibraryDirectory(as_libname, DirApplication!) ll_rc = this.of_importstring(ls_dir) this.Object.objtype.Initial = "datawindow" ls_dir = LibraryDirectory(as_libname, DirDataWindow!) ll_rc = this.of_importstring(ls_dir) this.Object.objtype.Initial = "function" ls_dir = LibraryDirectory(as_libname, DirFunction!) ll_rc = this.of_importstring(ls_dir) this.Object.objtype.Initial = "menu" ls_dir = LibraryDirectory(as_libname, DirMenu!) ll_rc = this.of_importstring(ls_dir) this.Object.objtype.Initial = "userobject" ls_dir = LibraryDirectory(as_libname, DirUserObject!) ll_rc = this.of_importstring(ls_dir) this.Object.objtype.Initial = "window" ls_dir = LibraryDirectory(as_libname, DirWindow!) ll_rc = this.of_importstring(ls_dir) Return end subroutine public function string of_replaceall (string as_oldstring, string as_findstr, string as_replace);String ls_newstring Long ll_findstr, ll_replace, ll_pos // get length of strings ll_findstr = Len(as_findstr) ll_replace = Len(as_replace) // find first occurrence ls_newstring = as_oldstring ll_pos = Pos(ls_newstring, as_findstr) Do While ll_pos > 0 // replace old with new ls_newstring = Replace(ls_newstring, ll_pos, ll_findstr, as_replace) // find next occurrence ll_pos = Pos(ls_newstring, as_findstr, (ll_pos + ll_replace)) Loop Return ls_newstring end function public subroutine of_load ();Integer li_cnt, li_max String ls_libname, ls_msg this.Reset() li_max = UpperBound(gs_libnames) FOR li_cnt = 1 TO li_max ls_libname = gs_libnames[li_cnt] ls_msg = "Loading directory " + String(li_cnt) + " of " ls_msg += String(li_max) + " for " + ls_libname gw_frame.SetMicroHelp(ls_msg) this.of_directory(ls_libname) NEXT gw_frame.SetMicroHelp(String(this.RowCount()) + " files were found!") end subroutine on n_directory.create call super::create TriggerEvent( this, "constructor" ) end on on n_directory.destroy TriggerEvent( this, "destructor" ) call super::destroy end on
File: n_directory.sru
Size: 3053
Date: Sat, 09 Feb 2019 22:07:28 +0100
Size: 3053
Date: Sat, 09 Feb 2019 22:07:28 +0100