Skip to content

Commit 9126bb7

Browse files
authored
Merge pull request #27 from dmpas/develop
oscript 2-rc7 (#26)
2 parents c741a78 + 8d2bf63 commit 9126bb7

File tree

8 files changed

+46
-38
lines changed

8 files changed

+46
-38
lines changed

NUnitTests/EngineHelpWrapper.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This Source Code Form is subject to the terms of the
1313
using ScriptEngine.HostedScript;
1414
using ScriptEngine.HostedScript.Extensions;
1515
using ScriptEngine.Hosting;
16+
using OneScript.Execution;
1617

1718
namespace NUnitTests
1819
{
@@ -26,6 +27,8 @@ public EngineHelpWrapper()
2627

2728
private IValue TestRunner { get; set; }
2829

30+
private IBslProcess Process { get; set; }
31+
2932
public void StartEngine()
3033
{
3134
var builder = DefaultEngineBuilder.Create();
@@ -46,10 +49,11 @@ public void StartEngine()
4649

4750
var hosted = new HostedScriptEngine(Engine);
4851
hosted.Initialize();
49-
52+
5053
var cs = Engine.GetCompilerService();
5154
var testrunnerSource = LoadCodeFromAssemblyResource("NUnitTests.Tests.testrunner.os");
52-
var testRunner = Engine.AttachedScriptsFactory.LoadFromString(cs, testrunnerSource);
55+
Process = Engine.NewProcess();
56+
var testRunner = Engine.AttachedScriptsFactory.LoadFromString(cs, testrunnerSource, Process);
5357

5458
TestRunner = (IValue)testRunner;
5559

@@ -58,26 +62,26 @@ public void StartEngine()
5862
public void RunTestScript(string resourceName)
5963
{
6064
var source = LoadCodeFromAssemblyResource(resourceName);
61-
var test = Engine.AttachedScriptsFactory.LoadFromString(Engine.GetCompilerService(), source);
65+
var test = Engine.AttachedScriptsFactory.LoadFromString(Engine.GetCompilerService(), source, Process);
6266

6367
ArrayImpl testArray;
6468
{
6569
var methodIndex = test.GetMethodNumber("ПолучитьСписокТестов");
66-
test.CallAsFunction(methodIndex, new IValue[] { TestRunner }, out var ivTests);
70+
test.CallAsFunction(methodIndex, new IValue[] { TestRunner }, out var ivTests, Process);
6771
testArray = ivTests as ArrayImpl;
6872
}
6973

7074
foreach (var ivTestName in testArray)
7175
{
72-
string testName = ivTestName.AsString();
76+
string testName = ivTestName.ExplicitString();
7377
var methodIndex = test.GetMethodNumber(testName);
7478
if (methodIndex == -1)
7579
{
7680
// Тест указан, но процедуры нет или она не экспортирована
7781
continue;
7882
}
7983

80-
test.CallAsProcedure(methodIndex, new IValue[] { });
84+
test.CallAsProcedure(methodIndex, new IValue[] { }, Process);
8185
}
8286
}
8387

NUnitTests/NUnitTests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
1212
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
1313

14-
<PackageReference Include="OneScript" Version="2.0.0-rc6" />
15-
<PackageReference Include="OneScript.StandardLibrary" Version="2.0.0-rc6" />
16-
<PackageReference Include="OneScript.CoreLib" Version="2.0.0-rc6" />
17-
<PackageReference Include="OneScript.Hosting" Version="2.0.0-rc6" />
14+
<PackageReference Include="OneScript" Version="2.0.0-rc.7" />
15+
<PackageReference Include="OneScript.StandardLibrary" Version="2.0.0-rc.7" />
16+
<PackageReference Include="OneScript.CoreLib" Version="2.0.0-rc.7" />
17+
<PackageReference Include="OneScript.Hosting" Version="2.0.0-rc.7" />
1818
</ItemGroup>
1919

2020
<ItemGroup>

TestApp/TestApp.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="OneScript" Version="2.0.0-rc6" />
14-
<PackageReference Include="OneScript.CoreLib" Version="2.0.0-rc6" />
15-
<PackageReference Include="OneScript.Hosting" Version="2.0.0-rc6" />
13+
<PackageReference Include="OneScript" Version="2.0.0-rc.7" />
14+
<PackageReference Include="OneScript.CoreLib" Version="2.0.0-rc.7" />
15+
<PackageReference Include="OneScript.Hosting" Version="2.0.0-rc.7" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 1.0.7-{build}
1+
version: 1.0.8-{build}
22
image: Visual Studio 2022
33
environment:
44
main_project: v8unpack
@@ -15,7 +15,7 @@ install:
1515
1616
cd os2
1717
18-
appveyor DownloadFile https://oscript.io/downloads/2_0_0_rc6/OneScript-2.0.0-rc6-fdd-x64.zip -FileName fdd.zip
18+
appveyor DownloadFile https://oscript.io/downloads/night-build/OneScript-2.0.0-rc.7+599-fdd-x64.zip -FileName fdd.zip
1919
2020
7z x fdd.zip > NUL
2121

oslib/packagedef

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
Описание
22
.Имя("v8unpack")
3-
.Версия("1.0.7")
3+
.Версия("1.0.8")
44
.Автор("Sergey Batanov")
55
.АдресАвтора("sergey.batanov@dmpas.ru")
66
.Описание("Компонента работы с файлами формата 8")
7-
//.ВерсияСреды("2.0.0")
87
.ВключитьФайл("Components")
98
.ВключитьФайл("package-loader.os")
109
;

v8unpack/File8Collection.cs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ This Source Code Form is subject to the terms of the
88
Author: disa_da
99
E-mail: disa_da2@mail.ru
1010
/**
11-
2014-2017 dmpas sergey(dot)batanov(at)dmpas(dot)ru
11+
2014-2025 dmpas sergey(dot)batanov(at)dmpas(dot)ru
1212
*/
13-
using System;
14-
using ScriptEngine.Machine.Contexts;
15-
using System.Collections.Generic;
16-
using ScriptEngine.Machine;
17-
using System.Linq;
18-
using System.Collections;
19-
using OneScript.Commons;
2013
using OneScript.Contexts;
2114
using OneScript.Exceptions;
15+
using OneScript.Execution;
2216
using OneScript.Types;
17+
using ScriptEngine.Machine;
18+
using ScriptEngine.Machine.Contexts;
19+
using System;
20+
using System.Collections;
21+
using System.Collections.Generic;
22+
using System.Linq;
2323

2424
namespace v8unpack
2525
{
@@ -48,22 +48,26 @@ public int Count()
4848
return _data.Count;
4949
}
5050

51-
/// <summary>
52-
/// Получает файл по имени или индексу.
53-
/// </summary>
54-
/// <param name="index">Номер или имя.</param>
55-
[ContextMethod("Получить")]
51+
public int Count(IBslProcess process)
52+
{
53+
return Count();
54+
}
55+
56+
/// <summary>
57+
/// Получает файл по имени или индексу.
58+
/// </summary>
59+
/// <param name="index">Номер или имя.</param>
60+
[ContextMethod("Получить")]
5661
public File8 Get(IValue index)
5762
{
58-
var rawIndex = index.GetRawValue();
59-
if (rawIndex.SystemType == BasicTypes.Number)
63+
if (index.SystemType == BasicTypes.Number)
6064
{
61-
return Get((int)rawIndex.AsNumber());
65+
return Get((int)index.AsNumber());
6266
}
6367

64-
if (rawIndex.SystemType == BasicTypes.String)
68+
if (index.SystemType == BasicTypes.String)
6569
{
66-
return Get(rawIndex.AsString());
70+
return Get(index.ExplicitString());
6771
}
6872

6973
throw RuntimeException.InvalidArgumentType(nameof(index));

v8unpack/File8Reader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public void Close()
179179
public static IRuntimeContextInstance Constructor(IValue filename, IValue dataPacked = null)
180180
{
181181
const int MAGIC_SIZE = 100 * 1024;
182-
var fileStream = new FileStream(filename.AsString(), FileMode.Open);
182+
var fileStream = new FileStream(filename.ExplicitString(), FileMode.Open);
183183
if (fileStream.Length >= MAGIC_SIZE)
184184
{
185185
return new File8Reader(fileStream, dataPacked?.AsBoolean() ?? true);

v8unpack/v8unpack.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="OneScript" Version="2.0.0-rc6" />
15-
<PackageReference Include="OneScript.CoreLib" Version="2.0.0-rc6" />
14+
<PackageReference Include="OneScript" Version="2.0.0-rc.7" />
15+
<PackageReference Include="OneScript.CoreLib" Version="2.0.0-rc.7" />
16+
<PackageReference Include="OneScript.StandardLibrary" Version="2.0.0-rc.7" />
1617
</ItemGroup>
1718

1819
</Project>

0 commit comments

Comments
 (0)