public override void Awake() { _logger.Log("Begin"); var appName = AppDomain.CurrentDomain.FriendlyName; _logger.Log($"appName = {appName}"); var supportBasePath = Path.Combine(Environment.GetEnvironmentVariable("APPDATA"), "SymOntoClay", appName); _logger.Log($"supportBasePath = {supportBasePath}"); var logDir = Path.Combine(supportBasePath, "NpcLogs"); var invokingInMainThread = DefaultInvokerInMainThreadFactory.Create(); _world = WorldFactory.WorldInstance; var settings = new WorldSettings(); settings.SharedModulesDirs = new List <string>() { Path.Combine(Directory.GetCurrentDirectory(), "Source", "Modules") }; settings.ImagesRootDir = Path.Combine(supportBasePath, "Images"); settings.TmpDir = Path.Combine(Environment.GetEnvironmentVariable("TMP"), "SymOntoClay", appName); settings.HostFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\World\World.world"); settings.InvokerInMainThread = invokingInMainThread; settings.Logging = new LoggingSettings() { LogDir = logDir, RootContractName = "Hi1", PlatformLoggers = new List <IPlatformLogger>() { ConsoleLogger.Instance, CommonNLogLogger.Instance }, Enable = true, EnableRemoteConnection = true }; _logger.Log($"settings = {settings}"); _world.SetSettings(settings); _logger.Log("End"); }
private static void TstCLIRunHandler() { _logger.Log("Begin"); var args = new List <string>() { "run" //, //"%USERPROFILE%/source/repos/SymOntoClay/TestSandbox/Source/Npcs/PeaceKeeper/PeaceKeeper.sobj" //"%USERPROFILE%/source/repos/SymOntoClay/TestSandbox/Source" }.ToArray(); var targetDirectory = EVPath.Normalize("%USERPROFILE%/source/repos/SymOntoClay/TestSandbox/Source"); _logger.Log($"targetDirectory = {targetDirectory}"); Directory.SetCurrentDirectory(targetDirectory); var command = CLICommandParser.Parse(args); _logger.Log($"command = {command}"); var targetFiles = RunCommandFilesSearcher.Run(command); _logger.Log($"targetFiles = {targetFiles}"); //var logDir = Path.Combine(Directory.GetCurrentDirectory(), "NpcLogs"); var invokingInMainThread = DefaultInvokerInMainThreadFactory.Create(); var instance = WorldFactory.WorldInstance; var settings = new WorldSettings(); settings.SharedModulesDirs = new List <string>() { targetFiles.SharedModulesDir }; settings.ImagesRootDir = targetFiles.ImagesRootDir; settings.TmpDir = targetFiles.TmpDir; settings.HostFile = targetFiles.WorldFile; settings.InvokerInMainThread = invokingInMainThread; settings.Logging = new LoggingSettings() { //LogDir = logDir, RootContractName = "Hi1", PlatformLoggers = new List <IPlatformLogger>() { new CLIPlatformLogger() }, Enable = true, EnableRemoteConnection = true }; _logger.Log($"settings = {settings}"); instance.SetSettings(settings); var platformListener = new TstPlatformHostListener(); var npcSettings = new HumanoidNPCSettings(); npcSettings.Id = "#020ED339-6313-459A-900D-92F809CEBDC5"; //npcSettings.HostFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Hosts\PeaceKeeper\PeaceKeeper.host"); npcSettings.LogicFile = targetFiles.LogicFile; npcSettings.HostListener = platformListener; npcSettings.PlatformSupport = new PlatformSupportCLIStub(); _logger.Log($"npcSettings = {npcSettings}"); var npc = instance.GetHumanoidNPC(npcSettings); instance.Start(); Thread.Sleep(50000); _logger.Log("End"); }
private static void TstManageTempProject() { _logger.Log("Begin"); var initialDir = Directory.GetCurrentDirectory(); _logger.Log($"initialDir = {initialDir}"); initialDir = Path.Combine(initialDir, "TempProjects"); _logger.Log($"initialDir (2) = {initialDir}"); if (!Directory.Exists(initialDir)) { Directory.CreateDirectory(initialDir); } var testDir = Path.Combine(initialDir, $"TstDir{Guid.NewGuid().ToString("D").Replace("-", string.Empty)}"); _logger.Log($"testDir = {testDir}"); if (!Directory.Exists(testDir)) { Directory.CreateDirectory(testDir); } var projectName = "Example"; var worldSpaceCreationSettings = new WorldSpaceCreationSettings() { ProjectName = projectName }; _logger.Log($"worldSpaceCreationSettings = {worldSpaceCreationSettings}"); var wSpaceFile = WorldSpaceCreator.CreateWithOutWSpaceFile(worldSpaceCreationSettings, testDir , errorMsg => _logger.Error(errorMsg) ); _logger.Log($"wSpaceFile = {wSpaceFile}"); var wSpaceDir = wSpaceFile.DirectoryName; _logger.Log($"wSpaceDir = {wSpaceDir}"); var targetRelativeFileName = @"/Npcs/Example/Example.soc"; _logger.Log($"targetRelativeFileName = {targetRelativeFileName}"); if (targetRelativeFileName.StartsWith("/") || targetRelativeFileName.StartsWith("\\")) { targetRelativeFileName = targetRelativeFileName.Substring(1); } _logger.Log($"targetRelativeFileName (after) = {targetRelativeFileName}"); var targetFileName = Path.Combine(wSpaceDir, targetRelativeFileName); _logger.Log($"targetFileName = {targetFileName}"); var text = @"linvar logic for range [0, 1] { constraints: for inheritance; terms: minimal = L(0, 0.1); low = Trapezoid(0, 0.05, 0.3, 0.45); middle = Trapezoid(0.3, 0.4, 0.6, 0.7); high = Trapezoid(0.55, 0.7, 0.95, 1); maximal = S(0.9, 1); } linvar age for range (0, 150] { constraints: for relation age; terms: `teenager` = Trapezoid(10, 12, 17, 20); //`teenager` = L(5, 10); //`teenager` = S(12, 22); //`teenager` = S(12, 17, 22); } app PeaceKeeper is [very middle] exampleClass { {: >: {distance($x, $y)} -> { distance(I, $x, $y) } :} {: barrel(#a) :} {: see(I, #a) :} {: dog(#b) & bird(#f) :} {: cat(#с) :} {: animal(cat) :} //{: focus(I, friend) :} {: age(#Tom, 50) :} //{: value(distance(I, #Tom), 1) :} {: distance(I, #Tom, 12) :} on Init => { 'Begin from test!!!' >> @>log; //NULL >> @>log; //use @@self is [very middle] linux; //select {: { cat is animal } :} >> @>log; //select {: see(I, barrel) :} >> @>log; select {: son($x, $y) :} >> @>log; //select {: $z($x, $y) :} >> @>log; //select {: age(#Tom, `teenager`) :} >> @>log; select {: age(#Tom, $x) & distance(#Tom, $y) & $x is not $y :} >> @>log; //select {: value(distance(I, $x), $y) :} >> @>log; //select {: distance(I, #Tom, $x) :} >> @>log; //select {: distance(#Tom, $x) & $x is 12 :} >> @>log; //select {: distance(#Tom, $x) & $x > 5 :} >> @>log; //insert {: >: { bird (#1234) } :}; //insert {: see(I, #a) :}; //exampleClass is not human >> @>log; //exampleClass is human >> @>log; //@@host.`go`(to: #@[10]); 'End' >> @>log; } //on {: see(I, $x) & barrel($x) & !focus(I, friend) :} ($x >> @x) => { // @x >> @>log; //} //on {: see(I, #`gun 1`) :} => { // 'D' >> @>log; //} } "; File.WriteAllText(targetFileName, text); var supportBasePath = Path.Combine(testDir, "SysDirs"); _logger.Log($"supportBasePath = {supportBasePath}"); var logDir = Path.Combine(supportBasePath, "NpcLogs"); _logger.Log($"logDir = {logDir}"); var invokingInMainThread = DefaultInvokerInMainThreadFactory.Create(); var instance = WorldFactory.WorldInstance; var settings = new WorldSettings(); settings.EnableAutoloadingConvertors = true; settings.SharedModulesDirs = new List <string>() { Path.Combine(wSpaceDir, "Modules") }; settings.ImagesRootDir = Path.Combine(supportBasePath, "Images"); settings.TmpDir = Path.Combine(supportBasePath, "TMP"); settings.HostFile = Path.Combine(wSpaceDir, "World/World.world"); settings.InvokerInMainThread = invokingInMainThread; var callBackLogger = new CallBackLogger( message => { _logger.Log($"message = {message}"); }, error => { _logger.Log($"error = {error}"); } ); settings.Logging = new LoggingSettings() { LogDir = logDir, RootContractName = "Hi1", PlatformLoggers = new List <IPlatformLogger>() { callBackLogger }, Enable = true, EnableRemoteConnection = true }; _logger.Log($"settings = {settings}"); instance.SetSettings(settings); var platformListener = new object(); var npcSettings = new HumanoidNPCSettings(); npcSettings.Id = "#020ED339-6313-459A-900D-92F809CEBDC5"; npcSettings.LogicFile = Path.Combine(wSpaceDir, $"Npcs/{projectName}/{projectName}.sobj"); npcSettings.HostListener = platformListener; npcSettings.PlatformSupport = new PlatformSupportCLIStub(); _logger.Log($"npcSettings = {npcSettings}"); var npc = instance.GetHumanoidNPC(npcSettings); instance.Start(); Thread.Sleep(5000); Directory.Delete(testDir, true); _logger.Log("End"); }
public void Run(CLICommand command) { ConsoleWrapper.WriteText($"Loading {command.InputFile}..."); #if DEBUG //_logger.Info($"command = {command}"); #endif var targetFiles = RunCommandFilesSearcher.Run(command); #if DEBUG //_logger.Info($"targetFiles = {targetFiles}"); #endif var invokingInMainThread = DefaultInvokerInMainThreadFactory.Create(); var instance = WorldFactory.WorldInstance; world = instance; var settings = new WorldSettings(); settings.EnableAutoloadingConvertors = true; settings.SharedModulesDirs = new List <string>() { targetFiles.SharedModulesDir }; settings.ImagesRootDir = targetFiles.ImagesRootDir; settings.TmpDir = targetFiles.TmpDir; settings.HostFile = targetFiles.WorldFile; settings.InvokerInMainThread = invokingInMainThread; var logDir = Path.Combine(Environment.GetEnvironmentVariable("APPDATA"), "SymOntoClay", "CLI", "NpcLogs"); settings.Logging = new LoggingSettings() { LogDir = logDir, RootContractName = "Hi1", PlatformLoggers = new List <IPlatformLogger>() { new CLIPlatformLogger() }, Enable = true, EnableRemoteConnection = true }; #if DEBUG //_logger.Info($"settings = {settings}"); #endif instance.SetSettings(settings); var platformListener = this; var npcSettings = new HumanoidNPCSettings(); npcSettings.Id = "#020ED339-6313-459A-900D-92F809CEBDC5"; //npcSettings.HostFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Hosts\PeaceKeeper\PeaceKeeper.host"); npcSettings.LogicFile = targetFiles.LogicFile; npcSettings.HostListener = platformListener; npcSettings.PlatformSupport = new PlatformSupportCLIStub(); #if DEBUG //_logger.Info($"npcSettings = {npcSettings}"); #endif var npc = instance.GetHumanoidNPC(npcSettings); instance.Start(); ConsoleWrapper.WriteText("Press 'exit' and Enter for exit."); while (true) { var inputStr = Console.ReadLine(); ConsoleWrapper.WriteText(inputStr); if (inputStr == "exit") { ConsoleWrapper.WriteText("Are you sure? Type y/n and press Enter."); inputStr = Console.ReadLine(); if (inputStr == "y") { break; } } else { ConsoleWrapper.WriteError("Unknown command! Press 'exit' and Enter for exit."); } } }
protected void Example(string fileName, string fileContent) { if (string.IsNullOrWhiteSpace(fileContent)) { throw new ArgumentNullException(nameof(fileContent)); } _logger.Log($"fileContent = {fileContent}"); _logger.Log($"fileName = {fileName}"); var targetDirectoryName = string.Empty; if (fileName.EndsWith(".zip")) { targetDirectoryName = fileName.Replace(".zip", string.Empty); } else { targetDirectoryName = fileName; fileName = $"{fileName}.zip"; } WriteLineToReport("---------------------------------------------------------------------------------"); WriteLineToReport(targetDirectoryName); WriteLineToReport(" "); _logger.Log($"fileName (after) = {fileName}"); _logger.Log($"targetDirectoryName = {targetDirectoryName}"); var fullDestDirName = Path.Combine(_destDir, targetDirectoryName); var fullFileName = Path.Combine(_destDir, fileName); _logger.Log($"fullDestDirName = {fullDestDirName}"); _logger.Log($"fullFileName = {fullFileName}"); var relativeExampleHref = $"{_baseRelativeExampleHref}{fileName}"; _logger.Log($"relativeExampleHref = {relativeExampleHref}"); WriteLineToReport($"<code data-lng='soc' example-href='{relativeExampleHref}'>"); WriteLineToReport(fileContent); WriteLineToReport("</code>"); WriteLineToReport(" "); var testDir = Path.Combine(_rootDir, $"TstDir{Guid.NewGuid().ToString("D").Replace("-", string.Empty)}"); if (!Directory.Exists(testDir)) { Directory.CreateDirectory(testDir); } var worldSpaceCreationSettings = new WorldSpaceCreationSettings() { ProjectName = _projectName }; var wSpaceFile = WorldSpaceCreator.CreateWithOutWSpaceFile(worldSpaceCreationSettings, testDir , errorMsg => throw new Exception(errorMsg) ); var wSpaceDir = wSpaceFile.DirectoryName; _logger.Log($"testDir = {testDir}"); _logger.Log($"wSpaceDir = {wSpaceDir}"); var relativeFileName = _defaultRelativeFileName; if (relativeFileName.StartsWith("/") || relativeFileName.StartsWith("\\")) { relativeFileName = relativeFileName.Substring(1); } var targetFileName = Path.Combine(wSpaceDir, relativeFileName); File.WriteAllText(targetFileName, fileContent); var supportBasePath = Path.Combine(testDir, "SysDirs"); var logDir = Path.Combine(supportBasePath, "NpcLogs"); var invokingInMainThread = DefaultInvokerInMainThreadFactory.Create(); var instance = new WorldCore(); var settings = new WorldSettings(); settings.EnableAutoloadingConvertors = true; settings.SharedModulesDirs = new List <string>() { Path.Combine(wSpaceDir, "Modules") }; settings.ImagesRootDir = Path.Combine(supportBasePath, "Images"); settings.TmpDir = Path.Combine(supportBasePath, "TMP"); settings.HostFile = Path.Combine(wSpaceDir, "World/World.world"); settings.InvokerInMainThread = invokingInMainThread; var callBackLogger = new CallBackLogger( message => { WriteLineToReport(NormalizeTextForConsole(message)); _logger.Log(message); }, errorMsg => { _logger.Error(errorMsg); } ); settings.Logging = new LoggingSettings() { LogDir = logDir, RootContractName = "Hi1", PlatformLoggers = new List <IPlatformLogger>() { callBackLogger }, Enable = true, EnableRemoteConnection = true }; instance.SetSettings(settings); var platformListener = new object(); var npcSettings = new HumanoidNPCSettings(); npcSettings.Id = "#020ED339-6313-459A-900D-92F809CEBDC5"; npcSettings.LogicFile = Path.Combine(wSpaceDir, $"Npcs/{_projectName}/{_projectName}.sobj"); npcSettings.HostListener = platformListener; npcSettings.PlatformSupport = new PlatformSupportCLIStub(); var npc = instance.GetHumanoidNPC(npcSettings); WriteLineToReport("<console>"); instance.Start(); Thread.Sleep(_timeoutToEnd); WriteLineToReport("</console>"); Directory.Move(wSpaceDir, fullDestDirName); ZipFile.CreateFromDirectory(fullDestDirName, fullFileName); Directory.Delete(testDir, true); Directory.Delete(fullDestDirName, true); }
public void Run() { _logger.Log("Begin"); var complexContext = TstEngineContextHelper.CreateAndInitContext(); var context = complexContext.EngineContext; var worldContext = complexContext.WorldContext; //var dictionary = context.Dictionary; var platformTypesConvertorsRegistry = worldContext.PlatformTypesConvertorsRegistry; //var platformTypesConvertorsRegistry = new PlatformTypesConvertorsRegistry(context.Logger); //var convertor_1 = new Vector3AndWayPointValueConvertor(); //platformTypesConvertorsRegistry.AddConvertor(convertor_1); //var convertor_2 = new FloatAndNumberValueConvertor(); //platformTypesConvertorsRegistry.AddConvertor(convertor_2); var endpointsRegistries = new List <IEndpointsRegistry>(); var endpointsRegistry = new EndpointsRegistry(context.Logger); endpointsRegistries.Add(endpointsRegistry); var endpointsRegistry_2 = new EndpointsRegistry(context.Logger); //endpointsRegistries.Add(endpointsRegistry_2); var endpointsProxyRegistryForDevices = new EndpointsProxyRegistryForDevices(context.Logger, endpointsRegistry_2, new List <int>() { 1, 2, 3 }); endpointsRegistries.Add(endpointsProxyRegistryForDevices); var endPointsResolver = new EndPointsResolver(context.Logger, platformTypesConvertorsRegistry); var invokingInMainThread = DefaultInvokerInMainThreadFactory.Create(); var endPointActivator = new EndPointActivator(context.Logger, platformTypesConvertorsRegistry, invokingInMainThread); var platformListener = new TstPlatformHostListener(); var platformEndpointsList = EndpointDescriber.GetEndpointsInfoList(platformListener); endpointsRegistry.AddEndpointsRange(platformEndpointsList); var gunPlatformHostListener = new TstGunPlatformHostListener(); platformEndpointsList = EndpointDescriber.GetEndpointsInfoList(gunPlatformHostListener); endpointsRegistry_2.AddEndpointsRange(platformEndpointsList); //---------------------------------- var methodName = NameHelper.CreateName("go"); //var listener = new TstCoreHostListener(); var command = new Command(); command.Name = methodName; command.ParamsDict = new Dictionary <StrongIdentifierValue, Value>(); var param1Value = new WaypointValue(25, 36, context); var param1Name = NameHelper.CreateName("to"); command.ParamsDict[param1Name] = param1Value; //var param2Value = new NumberValue(12.4); //var param2Name = NameHelper.CreateName("speed", dictionary); //command.ParamsDict[param2Name] = param2Value; _logger.Log($"command = {command}"); //---------------------------------- var endPointInfo = endPointsResolver.GetEndpointInfo(command, endpointsRegistries); _logger.Log($"endPointInfo = {endPointInfo}"); if (endPointInfo != null) { var processInfo = endPointActivator.Activate(endPointInfo, command); _logger.Log($"processInfo = {processInfo}"); processInfo.Start(); Thread.Sleep(10000); _logger.Log("Cancel"); processInfo.Cancel(); Thread.Sleep(10000); } methodName = NameHelper.CreateName("shoot"); command = new Command(); command.Name = methodName; endPointInfo = endPointsResolver.GetEndpointInfo(command, endpointsRegistries); _logger.Log($"endPointInfo = {endPointInfo}"); if (endPointInfo != null) { var processInfo = endPointActivator.Activate(endPointInfo, command); _logger.Log($"processInfo = {processInfo}"); processInfo.Start(); Thread.Sleep(10000); _logger.Log("Cancel"); processInfo.Cancel(); Thread.Sleep(10000); } //---------------------------------- //var platformListener = new TstPlatformHostListener(); //var platformEndpointsList = EndpointDescriber.GetEndpointsInfoList(platformListener); //_logger.Log($"platformEndpointsList = {platformEndpointsList.WriteListToString()}"); //var goEndpoint = platformEndpointsList.FirstOrDefault(p => p.Name == "go"); //_logger.Log($"goEndpoint = {goEndpoint}"); //var tokenSource = new CancellationTokenSource(); //var token = tokenSource.Token; //var parameterList = new List<object>() { token, new Vector3(12, 15, 0), 25 }.ToArray(); //var task = new Task(() => //{ // try // { // goEndpoint.MethodInfo.Invoke(platformListener, parameterList); // } // catch(TargetInvocationException) // { // } // catch(Exception e) // { // _logger.Log($"e = {e}"); // } //}, token); //var processInfo = new PlatformProcessInfo(task, tokenSource, goEndpoint.Devices); //_logger.Log($"processInfo = {processInfo}"); //processInfo.Start(); //Thread.Sleep(10000); //_logger.Log("Cancel"); //processInfo.Cancel(); //Thread.Sleep(10000); //----------- //var tokenSource = new CancellationTokenSource(); //var token = tokenSource.Token; //var task = new Task(() => { // platformListener.GoToImpl(token, new Vector3(12, 15, 0)); //}, token); //task.Start(); //Thread.Sleep(10000); //_logger.Log("Cancel"); //tokenSource.Cancel(); //Thread.Sleep(10000); //var process = listener.CreateProcess(command); //_logger.Log($"process = {process}"); _logger.Log("End"); }
public bool Run(int timeoutToEnd, Action <string> logChannel, Action <string> error) { var result = true; var supportBasePath = Path.Combine(_testDir, "SysDirs"); var logDir = Path.Combine(supportBasePath, "NpcLogs"); var invokingInMainThread = DefaultInvokerInMainThreadFactory.Create(); var instance = new WorldCore(); var settings = new WorldSettings(); settings.EnableAutoloadingConvertors = true; settings.SharedModulesDirs = new List <string>() { Path.Combine(_wSpaceDir, "Modules") }; settings.ImagesRootDir = Path.Combine(supportBasePath, "Images"); settings.TmpDir = Path.Combine(supportBasePath, "TMP"); settings.HostFile = Path.Combine(_wSpaceDir, "World/World.world"); settings.InvokerInMainThread = invokingInMainThread; var callBackLogger = new CallBackLogger( message => { logChannel(message); }, errorMsg => { result = false; error(errorMsg); } ); settings.Logging = new LoggingSettings() { LogDir = logDir, RootContractName = "Hi1", PlatformLoggers = new List <IPlatformLogger>() { callBackLogger }, Enable = true, EnableRemoteConnection = true }; instance.SetSettings(settings); var platformListener = new object(); var npcSettings = new HumanoidNPCSettings(); npcSettings.Id = "#020ED339-6313-459A-900D-92F809CEBDC5"; npcSettings.LogicFile = Path.Combine(_wSpaceDir, $"Npcs/{_projectName}/{_projectName}.sobj"); npcSettings.HostListener = platformListener; npcSettings.PlatformSupport = new PlatformSupportCLIStub(); var npc = instance.GetHumanoidNPC(npcSettings); instance.Start(); Thread.Sleep(timeoutToEnd); return(result); }
public static TstComplexContext CreateAndInitContext() { var invokingInMainThread = DefaultInvokerInMainThreadFactory.Create(); var appName = AppDomain.CurrentDomain.FriendlyName; _logger.Log($"appName = {appName}"); var supportBasePath = Path.Combine(Environment.GetEnvironmentVariable("APPDATA"), "SymOntoClay", appName); _logger.Log($"supportBasePath = {supportBasePath}"); var result = new TstComplexContext(); var logDir = Path.Combine(Directory.GetCurrentDirectory(), "NpcLogs"); var worldSettings = new WorldSettings(); worldSettings.EnableAutoloadingConvertors = true; worldSettings.SharedModulesDirs = new List <string>() { Path.Combine(Directory.GetCurrentDirectory(), "Source", "Modules") }; worldSettings.ImagesRootDir = Path.Combine(Directory.GetCurrentDirectory(), "Images"); worldSettings.TmpDir = Path.Combine(Environment.GetEnvironmentVariable("TMP"), "SymOntoClay", appName); worldSettings.HostFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\World\HelloWorld.world"); worldSettings.Logging = new LoggingSettings() { LogDir = logDir, RootContractName = "Hi1", PlatformLoggers = new List <IPlatformLogger>() { ConsoleLogger.Instance /*, CommonNLogLogger.Instance */ }, Enable = true, EnableRemoteConnection = true }; worldSettings.InvokerInMainThread = invokingInMainThread; _logger.Log($"worldSettings = {worldSettings}"); var worldContext = new WorldContext(); worldContext.SetSettings(worldSettings); var npcSettings = new HumanoidNPCSettings(); npcSettings.Id = "#020ED339-6313-459A-900D-92F809CEBDC5"; //npcSettings.HostFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Hosts\PeaceKeeper\PeaceKeeper.host"); npcSettings.LogicFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Apps\PeaceKeeper\PeaceKeeper.sobj"); npcSettings.PlatformSupport = new PlatformSupportCLIStub(); _logger.Log($"npcSettings = {npcSettings}"); var entityLogger = new LoggerImpementation(); var tmpDir = Path.Combine(worldSettings.TmpDir, npcSettings.Id); Directory.CreateDirectory(worldSettings.TmpDir); //var standaloneStorageSettings = new StandaloneStorageSettings(); //standaloneStorageSettings.Id = npcSettings.Id; //standaloneStorageSettings.IsWorld = false; //standaloneStorageSettings.AppFile = npcSettings.HostFile; //standaloneStorageSettings.Logger = entityLogger; //standaloneStorageSettings.Dictionary = worldContext.SharedDictionary.Dictionary; //standaloneStorageSettings.ModulesStorage = worldContext.ModulesStorage.ModulesStorage; //standaloneStorageSettings.ParentStorage = worldContext.StandaloneStorage.StandaloneStorage; #if DEBUG //_logger.Log($"standaloneStorageSettings = {standaloneStorageSettings}"); #endif //var _hostStorage = new StandaloneStorage(standaloneStorageSettings); var coreEngineSettings = new EngineSettings(); coreEngineSettings.Id = npcSettings.Id; coreEngineSettings.AppFile = npcSettings.LogicFile; coreEngineSettings.Logger = entityLogger; coreEngineSettings.SyncContext = worldContext.ThreadsComponent; coreEngineSettings.ModulesStorage = worldContext.ModulesStorage.ModulesStorage; //coreEngineSettings.ParentStorage = _hostStorage; coreEngineSettings.TmpDir = tmpDir; coreEngineSettings.HostSupport = new TstHostSupportComponent(npcSettings.PlatformSupport); #if DEBUG _logger.Log($"coreEngineSettings = {coreEngineSettings}"); #endif #if DEBUG //_logger.Log($"Begin worldContext.Start()"); #endif worldContext.Start(); result.WorldContext = worldContext; #if DEBUG //_logger.Log($"After worldContext.Start()"); #endif var context = EngineContextHelper.CreateAndInitContext(coreEngineSettings); #if DEBUG //_logger.Log($"After var context = EngineContextHelper.CreateAndInitContext(coreEngineSettings);"); #endif context.CommonNamesStorage.LoadFromSourceCode(); #if DEBUG //_logger.Log($"After context.CommonNamesStorage.LoadFromSourceCode();"); #endif context.Storage.LoadFromSourceCode(); #if DEBUG //_logger.Log($"After context.Storage.LoadFromSourceCode();"); #endif context.StandardLibraryLoader.LoadFromSourceCode(); #if DEBUG //_logger.Log($"After context.StandardLibraryLoader.LoadFromSourceCode();"); #endif context.StatesStorage.LoadFromSourceCode(); #if DEBUG //_logger.Log($"After context.StatesStorage.LoadFromSourceCode();"); #endif context.InstancesStorage.LoadFromSourceFiles(); result.EngineContext = context; return(result); }