That's a nice library...I didn't notice any thing about locking the
file object. I'm assuming that that would be done outside the use of
the rio object.
I was also wondering if you thought you could use that library to read
files that have records that look like:
start line 1
line 2
line 3
end line4
and treat the above four lines as a record?
Mike B.
I used it to clean up some code that was converted from vb6 to vb.net
The converter left a bunch of comments in the code that started with
"UPGRADE". I also went ahead and change the old "On Error Go To
Handler", "ErrHandler", and "Resume Next" strings to vb.net's "Try",
"Catch ex as Exception" and "End Try" strings
This is what the code looks like
require 'rio'
rio('C://test').all.files('*.vb') do |f|
rio(f) <f.contents.gsub(/'UPGRADE.*\s/,"").gsub(/On Error GoTo
ErrHandler/,"Try").gsub(/ErrHandler:/,"Catch ex as Exception\n").gsub(/
Resume Next/,"End Try")
end
The second line tells rio to look at all the files ending in .vb in
the C://test folder
The third line does a string substitution in the currently open file
BTW, it was very fast.
Luis