Skip to content

Commit ad32ec0

Browse files
committed
fix libs by run BridgeNet Test Case
1 parent bd3ddef commit ad32ec0

10 files changed

Lines changed: 388 additions & 89 deletions

File tree

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Exception.lua‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ define("System.InvalidCastException", {
201201
end
202202
})
203203

204-
define("System.InvalidOperationException", {
204+
local InvalidOperationException = define("System.InvalidOperationException", {
205205
__tostring = toString,
206206
__inherits__ = { SystemException },
207207
__ctor__ = function(this, message, innerException)
@@ -249,6 +249,17 @@ define("System.TypeLoadException", {
249249
end
250250
})
251251

252+
define("System.ObjectDisposedException", {
253+
__tostring = toString,
254+
__inherits__ = { InvalidOperationException },
255+
__ctor__ = function(this, objectName, message, innerException)
256+
ctorOfException(this, message or "Cannot access a disposed object.", innerException)
257+
this.objectName = objectName
258+
if objectName and #objectName > 0 then
259+
this.message = this.message .. "\nObject name: '" .. objectName .. "'."
260+
end
261+
end
262+
})
252263

253264
local function toStringOfAggregateException(this)
254265
local t = { toString(this) }

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Reflection/Assembly.lua‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ define("System.Activator", {
966966
return T(unpack(args, 1, n))
967967
end
968968
end
969-
local i = findMatchCtor(T, n, function (i, ...) return select(i, ...) end, ...)
969+
local i = findMatchCtor(T, n, select, ...)
970970
if i and i ~= 1 then
971971
return System.new(T, i, ...)
972972
end

‎CSharp.lua/CoreSystem.Lua/CoreSystem/String.lua‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ local function throwFormatError()
163163
throw(FormatException("Input string was not in a correct format."))
164164
end
165165

166-
local function formatBuild(format, args, len)
166+
local function formatBuild(format, len, select, ...)
167167
local t, count = {}, 1
168168
local i, j, s = 1
169169
while true do
@@ -211,24 +211,28 @@ local function formatBuild(format, args, len)
211211
if not i then throwFormatError() end
212212
s = s + 1
213213
if s > len then throwFormatError() end
214-
s = args[s]
214+
s = select(s, ...)
215215
s = (s ~= nil and s ~= System.null) and s:ToString() or ""
216216
t[count] = s
217217
count = count + 1
218218
i = j + 1
219219
end
220220
end
221221

222+
local function selectTable(i, t)
223+
return t[i]
224+
end
225+
222226
local function format(format, ...)
223227
if format == nil then throw(ArgumentNullException()) end
224228
local len = select("#", ...)
225229
if len == 1 then
226230
local args = ...
227231
if System.isArrayLike(args) then
228-
return formatBuild(format, args, #args)
232+
return formatBuild(format, #args, selectTable, args)
229233
end
230234
end
231-
return formatBuild(format, { ... }, len)
235+
return formatBuild(format, len, select, ...)
232236
end
233237

234238
local function isNullOrEmpty(value)

0 commit comments

Comments
 (0)