File tree Expand file tree Collapse file tree
CSharp.lua/CoreSystem.Lua Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,8 +34,10 @@ local ostime = os.time
3434local osdifftime = os.difftime
3535local osdate = os.date
3636local tonumber = tonumber
37+ local math = math
3738local floor = math.floor
3839local log10 = math.log10
40+ local modf = math.modf
3941
4042-- http://referencesource.microsoft.com/#mscorlib/system/datetime.cs
4143local DateTime = {}
@@ -414,7 +416,7 @@ local function parse(s)
414416 milliseconds = milliseconds / (10 ^ (n - 3 ))
415417 else
416418 local ticks = milliseconds / (10 ^ (n - 7 ))
417- local _ , decimal = math. modf (ticks )
419+ local _ , decimal = modf (ticks )
418420 if decimal > 0.5 then
419421 ticks = ticks + 1
420422 end
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ local each = System.each
2020
2121local io = io
2222local open = io.open
23+ local remove = os.remove
2324
2425local IOException = System .define (" System.IO.IOException" , {
2526 __tostring = System .Exception .ToString ,
@@ -94,4 +95,11 @@ function File.Exists(path)
9495 return file ~= nil
9596end
9697
98+ function File .Delete (path )
99+ local ok , err = remove (path )
100+ if not ok then
101+ throw (IOException (err ))
102+ end
103+ end
104+
97105System .define (" System.IO.File" , File )
Original file line number Diff line number Diff line change @@ -17,9 +17,6 @@ limitations under the License.
1717local System = System
1818local throw = System .throw
1919local Object = System .Object
20- local Char = System .Char
21- local Int = System .Int
22- local Double = System .Double
2320local String = System .String
2421local Boolean = System .Boolean
2522local Delegate = System .Delegate
Original file line number Diff line number Diff line change @@ -296,7 +296,7 @@ local function testIO()
296296 File .WriteAllText (path , s )
297297 local text = File .ReadAllText (path )
298298 assert (text == s )
299- os.remove (path )
299+ File . Delete (path )
300300end
301301
302302local function testStringBuilder ()
@@ -366,9 +366,9 @@ test(testDelegate, "Delegate")
366366test (testLinq , " Linq" )
367367test (testGroupBy , " GroupBy" )
368368test (testType , " Type" )
369- -- test(testNumCast, "NumCast")
370- -- test(testSplit, "testSplit")
371- -- test(testStringBuilder, "StringBuilder")
369+ test (testNumCast , " NumCast" )
370+ test (testSplit , " testSplit" )
371+ test (testStringBuilder , " StringBuilder" )
372+ test (testIO , " IO" )
372373-- test(testConsole, "Console")
373- -- test(testIO, "IO")
374374-- test(testAsync, "Async")
You can’t perform that action at this time.
0 commit comments