public void GoToImpl(CancellationToken cancellationToken, [EndpointParam("To", KindOfEndpointParam.Position)] Vector3 point, float speed = 12) { //var name = NameHelper.GetNewEntityNameString(); var name = string.Empty; _logger.Log($"Begin {name}"); _logger.Log($"{name} point = {point}"); _logger.Log($"{name} speed = {speed}"); var n = 0; while (true) { n++; if (n > 10) { break; } Thread.Sleep(1000); _logger.Log($"{name} Hi! n = {n}"); cancellationToken.ThrowIfCancellationRequested(); } //Thread.Sleep(5000); _logger.Log($"End {name}"); }
public void Run() { _logger.Log("Begin"); var componentsList = new List <TstMonoBehaviour>() { new TstHumanoidNPC(), new TstWord(), new TstGameObject() }; ExecuteList(componentsList); _logger.Log("End"); }
public override void Awake() { _logger.Log("Begin"); _tstRayScaner = new TstRayScaner(); var platformListener = new TstPlatformHostListener(); _id = "#`Test 1`"; var npcSettings = new HumanoidNPCSettings(); npcSettings.Id = _id; npcSettings.InstanceId = 1; //npcSettings.HostFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Hosts\PeaceKeeper\PeaceKeeper.host"); npcSettings.LogicFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Npcs\PeaceKeeper\PeaceKeeper.sobj"); npcSettings.HostListener = platformListener; npcSettings.VisionProvider = _tstRayScaner; npcSettings.PlatformSupport = new PlatformSupportCLIStub(); _logger.Log($"npcSettings = {npcSettings}"); _npc = WorldFactory.WorldInstance.GetHumanoidNPC(npcSettings); _logger.Log($"_npc == null = {_npc == null}"); _tstRayScaner.SetNPC(_npc); _logger.Log("End"); }
public void Run() { _logger.Log("Begin"); var commonActiveContext = new ActivePeriodicObjectCommonContext(); var dateTimeProvider = new DateTimeProvider(_logger, commonActiveContext); dateTimeProvider.LoadFromSourceCode(); dateTimeProvider.Start(); Thread.Sleep(10000); _logger.Log($"dateTimeProvider.CurrentTiks = {dateTimeProvider.CurrentTiks}"); _logger.Log("End"); }
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"); }
public override void Awake() { _logger.Log("Begin"); var platformListener = new TstPlatformHostListener(); var settings = new GameObjectSettings(); _id = "#Gun 1"; settings.Id = _id; settings.InstanceId = 2; settings.HostFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Npcs\Barrel\Barrel.sobj"); settings.HostListener = platformListener; _gameObject = WorldFactory.WorldInstance.GetGameObject(settings); _logger.Log("End"); }
public void Commit() { if (logger != null) { logger.Log(context.ChangeTracker.Entries()); } context.SaveChanges(); if (logger != null) { logger.Save(); } }
public void Run() { _logger.Log("Begin"); var context = TstEngineContextHelper.CreateAndInitContext().EngineContext; //var dictionary = context.Dictionary; var inheritanceStorage = context.Storage.GlobalStorage.InheritanceStorage; var subName = NameHelper.CreateName("SubClass"); var superName = NameHelper.CreateName("SuperClass"); var inheritanceItem = new InheritanceItem(); inheritanceItem.SubName = subName; inheritanceItem.SuperName = superName; inheritanceItem.Rank = new LogicalValue(1); _logger.Log($"inheritanceItem = {inheritanceItem}"); inheritanceStorage.SetInheritance(inheritanceItem); inheritanceItem = new InheritanceItem(); inheritanceItem.SubName = subName; inheritanceItem.SuperName = superName; inheritanceItem.Rank = new LogicalValue(0.5F); _logger.Log($"inheritanceItem = {inheritanceItem}"); inheritanceStorage.SetInheritance(inheritanceItem); inheritanceItem = new InheritanceItem(); inheritanceItem.SubName = subName; inheritanceItem.SuperName = superName; inheritanceItem.Rank = new LogicalValue(0); _logger.Log($"inheritanceItem = {inheritanceItem}"); inheritanceStorage.SetInheritance(inheritanceItem); var list = inheritanceStorage.GetItemsDirectly(subName); _logger.Log($"list.Count = {list.Count}"); _logger.Log($"inheritanceItem = {list.WriteListToString()}"); _logger.Log("End"); }
public void Run() { _logger.Log("Begin"); var complexContext = TstEngineContextHelper.CreateAndInitContext(); var context = complexContext.EngineContext; var worldContext = complexContext.WorldContext; //var dictionary = context.Dictionary; 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 = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Apps\PeaceKeeper\PeaceKeeper.sobj"); npcSettings.HostListener = platformListener; npcSettings.PlatformSupport = new PlatformSupportCLIStub(); _logger.Log($"npcSettings = {npcSettings}"); var tstBaseManualControllingGameComponent = new TstBaseManualControllingGameComponent(npcSettings, worldContext); var methodName = NameHelper.CreateName("go"); 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"); command.ParamsDict[param2Name] = param2Value; _logger.Log($"command = {command}"); //ExecuteCommand(tstBaseManualControllingGameComponent, command); methodName = NameHelper.CreateName("shoot"); command = new Command(); command.Name = methodName; ExecuteCommand(tstBaseManualControllingGameComponent, command); var gameObjectSettings = new GameObjectSettings(); gameObjectSettings.Id = "#120ED339-6313-459A-900D-92F809CEBDC5"; var gunPlatformHostListener = new TstGunPlatformHostListener(); gameObjectSettings.HostListener = gunPlatformHostListener; _logger.Log($"gameObjectSettings = {gameObjectSettings}"); var gameObject = new GameObjectImplementation(gameObjectSettings, worldContext); tstBaseManualControllingGameComponent.AddToManualControl(gameObject, 12); methodName = NameHelper.CreateName("shoot"); command = new Command(); command.Name = methodName; ExecuteCommand(tstBaseManualControllingGameComponent, command); var manualControlledObjectsList = tstBaseManualControllingGameComponent.GetManualControlledObjects(); //_logger.Log($"manualControlledObjectsList = {manualControlledObjectsList.WriteListToString()}"); _logger.Log($"manualControlledObjectsList.Count = {manualControlledObjectsList.Count}"); tstBaseManualControllingGameComponent.RemoveFromManualControl(gameObject); manualControlledObjectsList = tstBaseManualControllingGameComponent.GetManualControlledObjects(); _logger.Log($"manualControlledObjectsList.Count = {manualControlledObjectsList.Count}"); _logger.Log("End"); }
public void Run() { _logger.Log("Begin"); var context = TstEngineContextHelper.CreateAndInitContext().EngineContext; var applicationInheritanceItem = new InheritanceItem() { IsSystemDefined = true }; applicationInheritanceItem.SubName = NameHelper.CreateName("PeaseKeeper"); applicationInheritanceItem.SuperName = context.CommonNamesStorage.AppName; applicationInheritanceItem.Rank = new LogicalValue(1.0F); context.Storage.GlobalStorage.InheritanceStorage.SetInheritance(applicationInheritanceItem); var compiledFunctionBody = new CompiledFunctionBody(); var strVal = new StringValue("The beatles!"); var command = new ScriptCommand(); command.OperationCode = OperationCode.PushVal; command.Value = strVal; _logger.Log($"command = {command}"); compiledFunctionBody.Commands[0] = command; var identifier = NameHelper.CreateName("@>log"); command = new ScriptCommand(); command.OperationCode = OperationCode.PushVal; command.Value = identifier; command.Position = 1; _logger.Log($"command = {command}"); compiledFunctionBody.Commands[1] = command; command = new ScriptCommand(); command.OperationCode = OperationCode.CallBinOp; command.KindOfOperator = KindOfOperator.LeftRightStream; command.Position = 2; _logger.Log($"command = {command}"); compiledFunctionBody.Commands[2] = command; command = new ScriptCommand(); command.OperationCode = OperationCode.Return; command.Position = 3; _logger.Log($"command = {command}"); compiledFunctionBody.Commands[3] = command; _logger.Log($"compiledFunctionBody = {compiledFunctionBody}"); _logger.Log($"compiledFunctionBody = {compiledFunctionBody.ToDbgString()}"); var codeFrame = new CodeFrame(); codeFrame.CompiledFunctionBody = compiledFunctionBody; codeFrame.LocalContext = new LocalCodeExecutionContext(); codeFrame.LocalContext.Storage = context.Storage.GlobalStorage; codeFrame.LocalContext.Holder = NameHelper.CreateName("PixKeeper"); //codeFrame.LocalContext.Holder = new Name(); _logger.Log($"codeFrame = {codeFrame}"); _logger.Log($"codeFrame = {codeFrame.ToDbgString()}"); var threadExecutor = new SyncThreadExecutor(context); threadExecutor.SetCodeFrame(codeFrame); threadExecutor.Start(); _logger.Log("End"); }
public void Run() { _logger.Log("Begin"); var context = TstEngineContextHelper.CreateAndInitContext().EngineContext; var globalStorage = context.Storage.GlobalStorage; var filesList = FileHelper.GetParsedFilesInfo(context.AppFile, context.Id); #if DEBUG _logger.Log($"filesList.Count = {filesList.Count}"); _logger.Log($"filesList = {filesList.WriteListToString()}"); #endif var parsedFilesList = context.Parser.Parse(filesList, globalStorage.DefaultSettingsOfCodeEntity); #if DEBUG _logger.Log($"parsedFilesList.Count = {parsedFilesList.Count}"); _logger.Log($"parsedFilesList = {parsedFilesList.WriteListToString()}"); #endif var parsedCodeEntitiesList = LinearizeSubItems(parsedFilesList); #if DEBUG _logger.Log($"parsedCodeEntitiesList.Count = {parsedCodeEntitiesList.Count}"); _logger.Log($"parsedCodeEntitiesList = {parsedCodeEntitiesList.WriteListToString()}"); #endif var metadataStorage = globalStorage.MetadataStorage; foreach (var codeEntity in parsedCodeEntitiesList) { metadataStorage.Append(codeEntity); } var inlineTrigger = parsedCodeEntitiesList.FirstOrDefault(p => p.Kind == KindOfCodeEntity.InlineTrigger); _logger.Log($"inlineTrigger = {inlineTrigger}"); var triggersStorage = globalStorage.TriggersStorage; triggersStorage.Append(inlineTrigger.InlineTrigger); var mainEntity = metadataStorage.MainCodeEntity; #if DEBUG _logger.Log($"mainEntity = {mainEntity}"); #endif var triggersResolver = context.DataResolversFactory.GetTriggersResolver(); var localCodeExecutionContext = new LocalCodeExecutionContext(); localCodeExecutionContext.Storage = globalStorage; var targetTriggersList = triggersResolver.ResolveSystemEventsTriggersList(KindOfSystemEventOfInlineTrigger.Init, mainEntity.Name, localCodeExecutionContext, ResolverOptions.GetDefaultOptions()); #if DEBUG _logger.Log($"targetTriggersList = {targetTriggersList.WriteListToString()}"); #endif _logger.Log("End"); }
public void Run() { _logger.Log("Begin"); var commonActiveContext = new ActivePeriodicObjectCommonContext(); var activeContext = new ActivePeriodicObjectContext(commonActiveContext); var activeObject = new AsyncActivePeriodicObject(activeContext) { PeriodicMethod = NRun }; var activeObject2 = new AsyncActivePeriodicObject(activeContext) { PeriodicMethod = NRun_2 }; _logger.Log($"activeObject.IsWaited (0) = {activeObject.IsWaited}"); _logger.Log($"activeObject.IsActive (0) = {activeObject.IsActive}"); var taskValue = activeObject.Start(); _logger.Log($"taskValue = {taskValue}"); activeObject2.Start(); Thread.Sleep(10000); _logger.Log($"activeObject.IsWaited = {activeObject.IsWaited}"); _logger.Log($"activeObject.IsActive = {activeObject.IsActive}"); commonActiveContext.Lock(); activeContext.WaitWhenAllIsNotWaited(); Thread.Sleep(1000); _logger.Log($"activeObject.IsWaited (2) = {activeObject.IsWaited}"); _logger.Log($"activeObject.IsActive (2) = {activeObject.IsActive}"); Thread.Sleep(1000); commonActiveContext.UnLock(); Thread.Sleep(1000); _logger.Log($"activeObject.IsWaited (3) = {activeObject.IsWaited}"); _logger.Log($"activeObject.IsActive (3) = {activeObject.IsActive}"); //Thread.Sleep(1000); //activeObject.Stop(); //_logger.Log($"activeObject.IsWaited (4) = {activeObject.IsWaited}"); //_logger.Log($"activeObject.IsActive (4) = {activeObject.IsActive}"); //Thread.Sleep(10000); //taskValue = activeObject.Start(); //_logger.Log($"taskValue = {taskValue}"); //Thread.Sleep(1000); //activeObject.Stop(); //Thread.Sleep(1000); //_logger.Log($"activeObject.TaskValue = {activeObject.TaskValue}"); //activeObject.Dispose(); //Thread.Sleep(1000); //taskValue = activeObject.Start(); //_logger.Log($"taskValue = {taskValue}"); Thread.Sleep(1000); _logger.Log("End"); }
protected void Log(string message) { _logger.Log(message); }
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 void Run() { _logger.Log("Begin"); var text = @"app PeaceKeeper { fun a() => { '`a` has been called!' >> @>log; } on Init => { 'Begin' >> @>log; a(); 'End' >> @>log; } }"; Example("FuncExample_1", text); text = @"app PeaceKeeper { fun a() { '`a` has been called!' >> @>log; } on Init => { 'Begin' >> @>log; a(); 'End' >> @>log; } }"; Example("FuncExample_1_a", text); text = @"app PeaceKeeper { fun a(@param_1) { '`a` has been called!' >> @>log; @param_1 >> @>log; } on Init => { 'Begin' >> @>log; a(1); 'End' >> @>log; } }"; Example("FuncExample_2", text); text = @"fun a(@param_1) { '`a` (any) has been called!' >> @>log; @param_1 >> @>log; } app PeaceKeeper { on Init => { 'Begin' >> @>log; a(param_1: 1); 'End' >> @>log; } }"; Example("FuncExample_2_a", text); text = @"app PeaceKeeper { fun a(@param_1) { '`a` has been called!' >> @>log; @param_1 >> @>log; } on Init => { 'Begin' >> @>log; a(@param_1: 1); 'End' >> @>log; } }"; Example("FuncExample_3", text); text = @"app PeaceKeeper { fun a(@param_1) { '`a` has been called!' >> @>log; @param_1 >> @>log; } on Init => { 'Begin' >> @>log; a(param_1: 1); 'End' >> @>log; } }"; Example("FuncExample_4", text); text = @"app PeaceKeeper { fun a(@param_1) { '`a` has been called!' >> @>log; @param_1 >> @>log; } on Init => { 'Begin' >> @>log; @param_1 = 12; a(@param_1); 'End' >> @>log; } }"; Example("FuncExample_5", text); text = @"app PeaceKeeper { fun a(@param_1) { '`a` (1) has been called!' >> @>log; @param_1 >> @>log; } fun a(@param_1, @param_2) { '`a` (2) has been called!' >> @>log; @param_1 >> @>log; @param_2 >> @>log; } on Init => { 'Begin' >> @>log; @param_1 = 12; a(@param_1); 'End' >> @>log; } }"; Example("FuncExample_6", text); text = @"app PeaceKeeper { fun a(@param_1) { '`a` (1) has been called!' >> @>log; @param_1 >> @>log; } fun a(@param_1, @param_2) { '`a` (2) has been called!' >> @>log; @param_1 >> @>log; @param_2 >> @>log; } on Init => { 'Begin' >> @>log; @param_1 = 12; a(@param_1); a(3, 'Hi'); 'End' >> @>log; } }"; Example("FuncExample_7", text); text = @"app PeaceKeeper { fun a(@param_1, @param_2 = 15) { '`a` (2) has been called!' >> @>log; @param_1 >> @>log; @param_2 >> @>log; } on Init => { 'Begin' >> @>log; @param_1 = 12; a(@param_1); 'End' >> @>log; } }"; Example("FuncExample_8", text); text = @"app PeaceKeeper { fun a(@param_1) { '`a` (any) has been called!' >> @>log; } fun a(@param_1: string) { '`a` (string) has been called!' >> @>log; } fun a(@param_1: number) { '`a` has been called!' >> @>log; @param_1 >> @>log; } on Init => { 'Begin' >> @>log; a(param_1: 1); 'End' >> @>log; } }"; Example("FuncExample_9", text); text = @"app PeaceKeeper { fun a(@param_1) { '`a` (any) has been called!' >> @>log; @param_1 >> @>log; } fun a(@param_1: (number | string)) { '`a` (number | string) has been called!' >> @>log; @param_1 >> @>log; } on Init => { 'Begin' >> @>log; a(param_1: 1); a(param_1: 'Hi'); 'End' >> @>log; } }"; Example("FuncExample_10_a", text); text = @"app PeaceKeeper { fun a(@param_1) { '`a` (any) has been called!' >> @>log; @param_1 >> @>log; } fun a(@param_1: number | string) { '`a` (number | string) has been called!' >> @>log; @param_1 >> @>log; } on Init => { 'Begin' >> @>log; a(param_1: 1); a(param_1: 'Hi'); 'End' >> @>log; } }"; Example("FuncExample_10_b", text); _logger.Log("End"); }
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); }
protected BaseCreatorExamples(BaseCreatorExamplesOptions options) { _logger.Log($"options = {options}"); if (string.IsNullOrWhiteSpace(options?.DestDir)) { _destDir = Path.Combine(Directory.GetCurrentDirectory(), "DestDirOfCreatorExamples"); } _logger.Log($"_destDir = {_destDir}"); if (Directory.Exists(_destDir)) { Directory.Delete(_destDir, true); } Directory.CreateDirectory(_destDir); _rootDir = Path.Combine(Environment.GetEnvironmentVariable("TMP"), $"TstTempProjects_{Guid.NewGuid().ToString("D").Replace("-", string.Empty)}"); if (!Directory.Exists(_rootDir)) { Directory.CreateDirectory(_rootDir); } _reportFileName = Path.Combine(_destDir, "report.txt"); _logger.Log($"_reportFileName = {_reportFileName}"); if (File.Exists(_reportFileName)) { File.Delete(_reportFileName); } WriteLineToReport(DateTime.Now.ToString()); }
public void Run() { _logger.Log("Begin"); RunCase5(); //RunCase4(); //RunCase3(); //RunGettingLongHashCode(); //RunGettingInheritanceInformation(); //RunCase2(); //RunCase1(); //ParseFacts(); _logger.Log("End"); }
public void Run() { _logger.Log("Begin"); var text = @"app PeaceKeeper { fun a(@param_1) => { '`a` has been called!' >> @>log; @param_1 >> @>log; error {: see(I, #a) :}; 'End of `a`' >> @>log; } on Init => { try { 'Begin' >> @>log; a(param_1: 1); 'End' >> @>log; } catch { 'catch' >> @>log; } catch(@e) { 'catch(@e)' >> @>log; @e >> @>log; } catch(@e) where {: hit(enemy, I) :} { 'catch(@e) where {: hit(enemy, I) :}' >> @>log; } catch(@e) where {: see(I, $x) :} { 'catch(@e) where {: see(I, $x) :}' >> @>log; @e >> @>log; } else { 'else' >> @>log; } ensure { 'ensure' >> @>log; } 'End of `Init`' >> @>log; } }"; Example("ErrorProcessingExample_1", text); text = @"app PeaceKeeper { fun a(@param_1) => { '`a` has been called!' >> @>log; @param_1 >> @>log; error {: see(I, #a) :}; 'End of `a`' >> @>log; } on Init => { try { 'Begin' >> @>log; a(param_1: 1); 'End' >> @>log; } catch { 'catch' >> @>log; } catch(@e) { 'catch(@e)' >> @>log; @e >> @>log; } catch(@e) where {: hit(enemy, I) :} { 'catch(@e) where {: hit(enemy, I) :}' >> @>log; } catch(@e) where {: see(I, $x) :} { 'catch(@e) where {: see(I, $x) :}' >> @>log; @e >> @>log; } else { 'else' >> @>log; } ensure { 'ensure' >> @>log; } 'End of `Init`' >> @>log; } on {: see(I, $x) :} ($x >> @x) => { 'on Fired' >> @>log; @x >> @>log; } }"; Example("ErrorProcessingExample_2", text); text = @"app PeaceKeeper { fun a(@param_1) => { '`a` has been called!' >> @>log; @param_1 >> @>log; error {: see(I, #a) :}; 'End of `a`' >> @>log; } on Init => { try { 'Begin' >> @>log; a(param_1: 1); 'End' >> @>log; } catch { 'catch' >> @>log; } 'End of `Init`' >> @>log; } }"; Example("ErrorProcessingExample_3", text); text = @"app PeaceKeeper { fun a(@param_1) => { '`a` has been called!' >> @>log; @param_1 >> @>log; error {: see(I, #a) :}; 'End of `a`' >> @>log; } on Init => { try { 'Begin' >> @>log; a(param_1: 1); 'End' >> @>log; } catch { 'catch' >> @>log; } else { 'else' >> @>log; } 'End of `Init`' >> @>log; } }"; Example("ErrorProcessingExample_4", text); text = @"app PeaceKeeper { fun a(@param_1) => { '`a` has been called!' >> @>log; @param_1 >> @>log; error {: see(I, #a) :}; 'End of `a`' >> @>log; } on Init => { try { 'Begin' >> @>log; a(param_1: 1); 'End' >> @>log; } catch { 'catch' >> @>log; } else { 'else' >> @>log; } ensure { 'ensure' >> @>log; } 'End of `Init`' >> @>log; } }"; Example("ErrorProcessingExample_5", text); text = @"app PeaceKeeper { fun a(@param_1) => { '`a` has been called!' >> @>log; @param_1 >> @>log; error {: see(I, #a) :}; 'End of `a`' >> @>log; } on Init => { try { 'Begin' >> @>log; a(param_1: 1); 'End' >> @>log; } 'End of `Init`' >> @>log; } }"; Example("ErrorProcessingExample_6", text); text = @"app PeaceKeeper { on Init => { try { 'Begin' >> @>log; error {: see(I, #a) :}; 'End' >> @>log; } else { 'else' >> @>log; } 'End of `Init`' >> @>log; } }"; Example("ErrorProcessingExample_7", text); text = @"app PeaceKeeper { on Init => { try { 'Begin' >> @>log; error {: see(I, #a) :}; 'End' >> @>log; } ensure { 'ensure' >> @>log; } 'End of `Init`' >> @>log; } }"; Example("ErrorProcessingExample_8", text); text = @"app PeaceKeeper { on Init => { try { 'Begin' >> @>log; error {: see(I, #a) :}; 'End' >> @>log; } else { 'else' >> @>log; } ensure { 'ensure' >> @>log; } 'End of `Init`' >> @>log; } }"; Example("ErrorProcessingExample_9", text); _logger.Log("End"); }
public void Shoot(CancellationToken cancellationToken) { _logger.Log("Begin"); _logger.Log("End"); }
private static void TstCreatorExamples() { _logger.Log("Begin"); //using var handler = new CreatorExamples_Fun_01_06_2021(); using var handler = new CreatorExamples_Error_Processing_07_06_2021(); handler.Run(); _logger.Log("End"); }
public IProcessCreatingResult CreateProcess(ICommand command) { _logger.Log($"command = {command}"); throw new NotImplementedException(); }