private static string AddObjectInstance(CodeMemberMethod method, object instance, InstanceManager instanceManager) { Type type = instance.GetType(); if (instanceManager.ConstainsInstance(instance)) return instanceManager.GetInstanceName(instance); string variableName = instanceManager.GetInstanceName(instance); CodeVariableDeclarationStatement objectVariable = new CodeVariableDeclarationStatement( type.Name, variableName, new CodeObjectCreateExpression(type.Name, new CodeVariableReferenceExpression("session"))); method.Statements.Add(objectVariable); var ti = XafTypesInfo.Instance.FindTypeInfo(type); foreach (var member in ti.Members.Where(m => ((m.MemberType.IsPrimitive || m.MemberType == typeof(string)) && m.IsPersistent && m.IsPublic))) { object value = member.GetValue(instance); if (value != null) { method.Statements.Add(new CodeAssignStatement( new CodePropertyReferenceExpression(new CodeVariableReferenceExpression(variableName), member.Name), new CodePrimitiveExpression(value))); } } foreach (var member in ti.Members.Where(m => m.MemberTypeInfo.IsPersistent && m.IsPublic && !m.IsReferenceToOwner)) { object value = member.GetValue(instance); if (value != null) { string valueName = AddObjectInstance(method, value, instanceManager); method.Statements.Add(new CodeAssignStatement( new CodePropertyReferenceExpression(new CodeVariableReferenceExpression(variableName), member.Name), new CodeVariableReferenceExpression(valueName))); } } foreach (var member in ti.Members.Where(m => m.IsAssociation && m.IsList && m.IsPublic)) { IList list = member.GetValue(instance) as IList; if (list != null && list.Count > 0) { foreach (object value in list) { string valueName = AddObjectInstance(method, value, instanceManager); method.Statements.Add(new CodeMethodInvokeExpression( new CodeMethodReferenceExpression( new CodePropertyReferenceExpression(new CodeVariableReferenceExpression(variableName), member.Name), "Add"), new CodeVariableReferenceExpression(valueName))); } } } return variableName; }
private static void CheckInstance() { if (instance == null) { instance = Globals.instance.gameObject.GetComponentInChildren<InstanceManager>(); if (instance == null) { instance = Globals.instance.gameObject.AddComponent<InstanceManager>(); } } }
private void ThumbStickTimer_Tick(object sender, EventArgs e) { if (InstanceManager.getGamepad().isConnected()) { if (InstanceManager.getGamepad().leftThumb.X < -50 || InstanceManager.getGamepad().gamepad.Buttons == GamepadButtonFlags.DPadLeft) { InstanceManager.getMove().moveLeft(); gameBoard.Invalidate(); } if (InstanceManager.getGamepad().leftThumb.X > 50 || InstanceManager.getGamepad().gamepad.Buttons == GamepadButtonFlags.DPadRight) { InstanceManager.getMove().moveRight(); gameBoard.Invalidate(); } if (InstanceManager.getGamepad().leftThumb.Y < -80 || InstanceManager.getGamepad().gamepad.Buttons == GamepadButtonFlags.DPadDown) { if (paused) { return; } //TODO: remove ref InstanceManager.getMove().joystickDown(ref movingDown); InstanceManager.getSound().playMove(); gameBoard.Invalidate(); } else { movingDown = false; } } else {//if no controller is gamepad.isConnected(), we stop the timer from updating because its pointless. thumbStickTimer.Stop(); controllerButtonTimer.Stop(); } }
static void Main(string[] args) { Directory.SetCurrentDirectory(AppContext.BaseDirectory); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Task.Run(() => { InternalSettings.EnableWebPIfPossible(); SettingsLoader.Load(); }); bool singleInstance = true; // -n means run as new instance if (args.Contains("-n")) { singleInstance = false; } else if (args.Length < 1) { singleInstance = false; } using (InstanceManager instanceManager = new InstanceManager(singleInstance, args, SingleInstanceCallback)) { mainForm = new MainForm(args); Application.Run(mainForm); } Directory.SetCurrentDirectory(AppContext.BaseDirectory); if (InternalSettings.Delete_Temp_Directory && Directory.Exists(InternalSettings.Temp_Image_Folder)) { Directory.Delete(InternalSettings.Temp_Image_Folder, true); } SettingsLoader.Save(); }
/// <inheritdoc /> public TorchServer(TorchConfig config = null) { DedicatedInstance = new InstanceManager(this); AddManager(DedicatedInstance); AddManager(new EntityControlManager(this)); AddManager(new RemoteAPIManager(this)); AddManager(new ElasticManager(this)); AddManager(new FirebaseManager(this)); Config = config ?? new TorchConfig(); var sessionManager = Managers.GetManager <ITorchSessionManager>(); sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this)); // Needs to be done at some point after MyVRageWindows.Init // where the debug listeners are registered if (!((TorchConfig)Config).EnableAsserts) { MyDebug.Listeners.Clear(); } _simUpdateTimer.Elapsed += SimUpdateElapsed; _simUpdateTimer.Start(); }
public override void GetInstanceResult(ResultProtectFightNty result) { if (InstanceManager.CurrentInstanceType != base.Type) { return; } BattleUI battleUI = UIManagerControl.Instance.GetUIIfExist("BattleUI") as BattleUI; battleUI.BtnQuitAction = null; this.instanceResult = result; InstanceManager.StopAllClientAI(true); if (EntityWorld.Instance.EntSelf.IsInBattle) { if (result.isWin) { InstanceManager.InstanceWin(); } else { InstanceManager.InstanceLose(); } } }
protected void ChangeCareerInstanceFinish(bool isWin) { if (InstanceManager.CurrentInstanceType != ChangeCareerInstance.Instance.Type) { return; } if (isWin) { InstanceManager.InstanceWin(); } else { this.IsWinWithChange = false; if (this.IsQuit) { ChangeCareerInstance.Instance.ShowLoseUI(); } else { InstanceManager.InstanceLose(); } } }
/// <summary> /// Adds button to access building details from building info panels. /// </summary> internal static void AddInfoPanelButton() { // Get parent panel and apply button. ZonedBuildingWorldInfoPanel infoPanel = UIView.library.Get <ZonedBuildingWorldInfoPanel>(typeof(ZonedBuildingWorldInfoPanel).Name); UIButton panelButton = UIUtils.CreateButton(infoPanel.component, 133); // Basic setup. panelButton.height = 19.5f; panelButton.textScale = 0.65f; panelButton.textVerticalAlignment = UIVerticalAlignment.Bottom; panelButton.relativePosition = new UnityEngine.Vector3(infoPanel.component.width - panelButton.width - 10, 120); panelButton.text = Translations.Translate("RPR_REALPOP"); // Just in case other mods are interfering. panelButton.Enable(); // Event handler. panelButton.eventClick += (control, clickEvent) => { // Select current building in the building details panel and show. BuildingDetailsPanel.Open(InstanceManager.GetPrefabInfo(WorldInfoPanel.GetCurrentInstanceID()) as BuildingInfo); }; }
public void DeleteInstance(string instanceName) { lock (_syncHandle) { // Verify instance exists var serverConfig = InstanceManager.Instances[instanceName]; if (serverConfig == null) { throw new InvalidOperationException(String.Format("An instance named {0} does not exist on this node.", instanceName)); } // Delete instance directory var instanceDirectory = Path.Combine(InstanceDirectory, instanceName); if (Directory.Exists(instanceDirectory)) { Directory.Delete(instanceDirectory, true); } // Remove instance configuration InstanceManager.Instances.Remove(instanceName); InstanceManager.Save(); } }
public bool Execute(DeleteArgs args) { try { System.Console.WriteLine("SIM: Starting Delete"); InstanceManager.Initialize(args.InstanceDirectory); var instance = InstanceManager.GetInstance(args.InstanceName); if (instance == null) { System.Console.WriteLine("SIM: Warning! Can't detect installed instance {0}", args.InstanceName); return(true); } SIM.Pipelines.Delete.DeleteArgs deleteArgs = new SIM.Pipelines.Delete.DeleteArgs(instance, new SqlConnectionStringBuilder(args.ConnectionString)); IPipelineController controller = new ConsoleController(); PipelineManager.Initialize(); PipelineManager.StartPipeline( "delete", deleteArgs, controller, false); System.Console.WriteLine("SIM: Finished Delete"); return(true); } catch (Exception ex) { System.Console.WriteLine("Sitecore SIM install failed", ex); return(false); } }
private void Dispose(bool disposing) { if (!IsDisposed) { IsDisposed = true; if (disposing) { // Dispose all clients. foreach (var client in _ClientTable.Values) client.Dispose(); // Dispose all servers. foreach (var server in _ServerTable2.Values) server.Dispose(); // Raise the StateChange event. foreach (EventHandler handler in StateChange.GetInvocationList()) try { handler(this, EventArgs.Empty); } catch { // Swallow any exception that occurs. } } if (IsInitialized) { // Uninitialize this DDEML instance. InstanceManager.Uninitialize(InstanceId); // Indicate that this object is no longer initialized. InstanceId = 0; } } }
static void Main() { DownloadManager.CheckForInternetConnection(); PathData.InitDirectories(); CheckForUpdates(); NewsStorage.InitDirectories(); SettingsManager.Load(); MinecraftUserData.loadUsers(); ScheduleMinecraftVersionJsonDownload(); MinecraftAssetManager.LoadAssets(); PluginManager.LoadPlugins(); PluginManager.EnablePlugins(); SettingsManager.AddDefault("javapath", "java", "java.exe", Setting._Type._string); SettingsManager.AddDefault("MinecraftRAM", "java", "2G", Setting._Type._string); SettingsManager.AddDefault("Sync options", "sync", true, Setting._Type._bool); SettingsManager.AddDefault("Sync serverlists", "sync", true, Setting._Type._bool); App app = new App(); App.sysTray = new SystemTray(); App.logFile = (PathData.LogPath + "\\" + DateTime.Now.ToString("s").Replace(':', '-') + ".log"); mainWindow = new MainWindow(); SettingsManager.LoadList(); app.Run(mainWindow); App.sysTray.destroy(); PluginManager.DisablePlugins(); InstanceManager.SaveInstances(); MinecraftUserData.saveUsers(); SettingsManager.Save(); AppendLogFile(); }
private static Base.Profiles.Profile DetectProfile() { try { InstanceManager.Initialize(); var instances = InstanceManager.Instances; if (!instances.Any()) { return(null); } var database = instances.Select(x => Safe(() => x.AttachedDatabases.FirstOrDefault(y => y.Name.EqualsIgnoreCase("core")), x.ToString())).FirstOrDefault(x => x != null); var cstr = SqlServerManager.Instance.GetManagementConnectionString(database.ConnectionString).ToString(); var instance = instances.FirstOrDefault(); var root = instance.RootPath.EmptyToNull().With(x => Path.GetDirectoryName(x)) ?? "C:\\inetpub\\wwwroot"; var rep = GetRepositoryPath(); var lic = GetLicensePath(); if (!FileSystem.FileSystem.Local.File.Exists(lic)) { FileSystem.FileSystem.Local.File.Copy(instance.LicencePath, lic); } return(new Base.Profiles.Profile { ConnectionString = cstr, InstancesFolder = root, LocalRepository = rep, License = lic }); } catch (Exception ex) { Log.Error(ex, "Error during detecting profile defaults"); return(new Base.Profiles.Profile()); } }
public WorldGeneratorDialog(InstanceManager instanceManager) { _instanceManager = instanceManager; InitializeComponent(); _loadLocalization(); var scenarios = MyLocalCache.GetAvailableWorldInfos(new List <string> { Path.Combine(MyFileSystem.ContentPath, "CustomWorlds") }); foreach (var tup in scenarios) { string directory = tup.Item1; MyWorldInfo info = tup.Item2; string localizedName = MyTexts.GetString(MyStringId.GetOrCompute(info.SessionName)); var checkpoint = MyLocalCache.LoadCheckpoint(directory, out _); checkpoint.OnlineMode = MyOnlineModeEnum.PUBLIC; _checkpoints.Add(new PremadeCheckpointItem { Name = localizedName, Icon = Path.Combine(directory, "thumb.jpg"), Path = directory, Checkpoint = checkpoint }); } /* * var premadeCheckpoints = Directory.EnumerateDirectories(Path.Combine("Content", "CustomWorlds")); * foreach (var path in premadeCheckpoints) * { * var thumbPath = Path.GetFullPath(Directory.EnumerateFiles(path).First(x => x.Contains("thumb"))); * * _checkpoints.Add(new PremadeCheckpointItem * { * Path = path, * Icon = thumbPath, * Name = Path.GetFileName(path) * }); * }*/ PremadeCheckpoints.ItemsSource = _checkpoints; }
public static int Initialize(Ddeml.DdeCallback pfnCallback, int afCmd) { lock (_Table) { // Initialize a DDEML instance. var instanceId = 0; Ddeml.DdeInitialize(ref instanceId, pfnCallback, afCmd, 0); if (instanceId == 0) return instanceId; // Make sure this thread has an IMessageFilter on it. var slot = Thread.GetNamedDataSlot(DataSlot); if (Thread.GetData(slot) == null) { var filter = new InstanceManager(); Application.AddMessageFilter(filter); Thread.SetData(slot, filter); } // Add an entry to the table that maps the instance identifier to the current thread. _Table.Add(instanceId, Ddeml.GetCurrentThreadId()); return instanceId; } }
private void Continue(NativeActivityContext context, Bookmark bookmark, object obj) { var eventArgs = obj as WorkflowNotificationEventArgs; if (eventArgs == null) { return; } // Check two things: // 1. if the wf author wanted to monitor this event type (create, etc.) // 2. if the current action has that event type var childCreated = GetOptionalBoolArgument(context, WaitForChildCreated, true) && string.CompareOrdinal(eventArgs.NotificationType, WorkflowNotificationObserver.NotificationType.ChildCreated) == 0; var childEdited = GetOptionalBoolArgument(context, WaitForChildEdited, true) && string.CompareOrdinal(eventArgs.NotificationType, WorkflowNotificationObserver.NotificationType.ChildEdited) == 0; var childDeleted = GetOptionalBoolArgument(context, WaitForChildDeleted, true) && string.CompareOrdinal(eventArgs.NotificationType, WorkflowNotificationObserver.NotificationType.ChildDeleted) == 0; // do not do anything, continue waiting if (!childCreated && !childEdited && !childDeleted) { return; } // remove the notification from the SN db InstanceManager.ReleaseWait(notificationId.Get(context)); // this lets the workflow move on to the next activity context.RemoveBookmark(bookmark); // set result values: the child in question and the operation name Result.Set(context, new WfContent(eventArgs.Info as string)); NotificationType.Set(context, eventArgs.NotificationType); }
public void Show(ushort stopId) { InstanceID instanceId = InstanceID.Empty; instanceId.NetNode = stopId; if (!InstanceManager.IsValid(instanceId)) { Debug.LogWarning("Invalid instance ID for StopDestinationInfoPanel"); this.Hide(); return; } this.AttemptToShowIPT2Panel(instanceId); this.stopId = stopId; var node = Singleton <NetManager> .instance.m_nodes.m_buffer[this.stopId]; this.transportLineId = node.m_transportLine; Debug.Log("Valid instance ID for StopDestinationInfoPanel"); WorldInfoPanel.HideAllWorldInfoPanels(); this.m_LineNameLabel.text = Singleton <TransportManager> .instance.GetLineName(this.transportLineId) + " destinations"; this.m_StopNameLabel.text = "Stop #" + this.GetStopIndex(); int passengerCount = Singleton <TransportManager> .instance.m_lines.m_buffer[this.transportLineId].CalculatePassengerCount(this.stopId); this.m_PassengerCountLabel.text = "Waiting passengers: " + passengerCount; this.m_BuildingPopularities = this.GetPositionPopularities(); ToolsModifierControl.cameraController.SetTarget(instanceId, node.m_position, false); this.Show(); }
public Player() { sfx = InstanceManager.getSound(); checkRow = InstanceManager.getRowCheck(); confirmTimer = InstanceManager.getMainForm().confimTimer; gravityTimer = InstanceManager.getMainForm().gravityTimer; nextShapeBox = InstanceManager.getMainForm().nextShapeBox; predict = InstanceManager.getPredict(); rand = InstanceManager.getRandom(); debugFont = new Font("Arial", 12.0F); //setup rows, placedrectangles, etc placedrect = new Rectangle[2]; storedColor = new Brush[0]; rows = new Rectangle[2]; rand = new Random(); List <Brush> addcolor = storedColor.ToList(); addcolor.Add(currentColor); addcolor.Add(currentColor); storedColor = addcolor.ToArray(); for (int y = 0; y < 20; y++) // makes a 10x20 grid { for (int x = 0; x < 10; x++) { List <Rectangle> addtile = rows.ToList(); addtile.Add(new Rectangle(x * 32, y * 32, 32, 32)); rows = addtile.ToArray(); } } InstanceManager.getNextShape().generateNextShape(); }
/// <summary> /// Spawns a unit based on the level set. /// </summary> private void SpawnUnit() { if (unitList.Length > 0 && unitList [(int)unitLevel] != null) { Transform unit = InstanceManager.Spawn(unitList [(int)unitLevel].transform, spawnLocation.position, Quaternion.identity); unit.GetComponent <SpawnAI> ().SetOwner(this); // Increase the total number of enemies spawned and the number of spawned enemies numberOfUnits++; totalSpawnedUnits++; } else if (ObjectsToSpawn.Count > 0) { Transform unit = InstanceManager.Spawn(ObjectsToSpawn [Random.Range(0, ObjectsToSpawn.Count - 1)].transform, spawnLocation.position, Quaternion.identity); unit.GetComponent <SpawnAI> ().SetOwner(this); // Increase the total number of enemies spawned and the number of spawned enemies numberOfUnits++; totalSpawnedUnits++; } else { Debug.LogError("Error trying to spawn unit of level " + unitLevel.ToString() + " on spawner " + spawnID + " - No unit set"); spawn = false; } }
public override void ShowWinUI() { base.ShowWinUI(); InstanceManager.StopAllClientAI(true); UIManagerControl.Instance.HideUI("BattleUI"); TimerHeap.AddTimer(1000u, 0, delegate { UIManagerControl.Instance.HideUI("BattleUI"); CommonBattlePassUI commonBattlePassUI = LinkNavigationManager.OpenCommonBattlePassUI(); if (commonBattlePassUI != null) { commonBattlePassUI.PlayAnimation(InstanceResultType.Win); commonBattlePassUI.UpdateEliteUI(base.InstanceResult.item); commonBattlePassUI.BtnStatictisVisibity = false; commonBattlePassUI.BtnAgainVisibility = false; commonBattlePassUI.BtnMultipleVisibility = false; commonBattlePassUI.BtnTipTextVisibility = false; commonBattlePassUI.ExitCallback = delegate { TramcarManager.Instance.SendExitProtectFightReq(); }; } }); }
/// <summary> /// Moves tetris block down a tile. /// </summary> /// <returns></returns> public bool moveDown() { updateLoc(); for (int i = placedrect.Length - 1; i > 0; i--) { if (bOne.Y == placedrect[i].Y - 32 && bOne.X == placedrect[i].X || bTwo.Y == placedrect[i].Y - 32 && bTwo.X == placedrect[i].X || bThree.Y == placedrect[i].Y - 32 && bThree.X == placedrect[i].X || bFour.Y == placedrect[i].Y - 32 && bFour.X == placedrect[i].X) { return(false); } } if (bOne.Y != 608 && bTwo.Y != 608 && bThree.Y != 608 && bFour.Y != 608) { plyY += 32; InstanceManager.getSound().playMove(); InstanceManager.getPlayer().setPlayerCoords(plyX, plyY); return(true); } return(true); }
public override void InitActorState() { base.InitActorState(); if (this.IsClientDominate) { if (InstanceManager.IsDebut) { this.DebutBattle(); } } else { this.DebutBattle(); } this.ExteriorUnit.IsAutoUpdateExterior = true; if (!base.IsPlayerMate) { EventDispatcher.Broadcast <int, Transform>(CameraEvent.PlayerBorn, this.TypeID, base.Actor.FixTransform); } if (!this.IsEntitySelfType) { InstanceManager.PlayerInitEnd(this); } }
protected new void Update() { base.Update(); var self = this as FsBulletML.Processable.IBulletmlObject; if (!this.Root && self.BulletRoot && !self.Used) { InstanceManager.Destroy(gameObject); } if (this.transform.position.x < 0 || this.transform.position.x > 4.8) { self.Used = false; InstanceManager.Destroy(gameObject); } if (this.transform.position.y < -6.4 || this.transform.position.y > 0) { self.Used = false; InstanceManager.Destroy(gameObject); } }
public override void ShowLoseUI() { base.ShowLoseUI(); InstanceManager.StopAllClientAI(true); BattleLoseUI battleLoseUI = LinkNavigationManager.OpenBattleLoseUI(); battleLoseUI.BtnExitAction = delegate { ElementInstanceManager.Instance.SendExitElementCopyReq(delegate { }); BallElement.Instance.shouldChangePosImmediately = false; }; battleLoseUI.BtnAgainAction = null; battleLoseUI.BtnPetLvAction = delegate { ElementInstanceManager.Instance.SendExitElementCopyReq(delegate { EventDispatcher.Broadcast("SHOW_PETLEVEL"); }); }; battleLoseUI.ShowBtnAgainBtn(false); battleLoseUI.ShowBtnDamageCal(false); }
protected override void Process(ReinstallArgs args) { InstanceManager.Initialize(); var instance = InstanceManager.GetInstance(args.InstanceName); Assert.IsNotNull(instance, nameof(instance)); if (this.ProcessorDefinition.Param == "nowait") { try { InstanceHelper.StartInstance(instance, 500); } catch { // ignore error } } else { InstanceHelper.StartInstance(instance); } }
public async Task StartAssignment_AppliesAssignmentContext() { var loggerFactory = MockNullLogerFactory.CreateLoggerFactory(); var settingsManager = new ScriptSettingsManager(); var instanceManager = new InstanceManager(settingsManager, null, loggerFactory, null); var envValue = new { Name = Path.GetTempFileName().Replace(".", string.Empty), Value = Guid.NewGuid().ToString() }; settingsManager.SetSetting(EnvironmentSettingNames.AzureWebsitePlaceholderMode, "1"); WebScriptHostManager.ResetStandbyMode(); var context = new HostAssignmentContext { Environment = new Dictionary <string, string> { { envValue.Name, envValue.Value } } }; bool result = instanceManager.StartAssignment(context); Assert.True(result); // specialization is done in the background await Task.Delay(500); var value = Environment.GetEnvironmentVariable(envValue.Name); Assert.Equal(value, envValue.Value); // calling again should return false, since we're no longer // in placeholder mode result = instanceManager.StartAssignment(context); Assert.False(result); }
private object DoRouting(dynamic _) { this.EnableCors(); // get instance and check if active. string instanceName = _.instance; IInstance instance; if (!InstanceManager.TryGet(instanceName, out instance)) { // oeps, instance not active! return(Negotiate.WithStatusCode(HttpStatusCode.NotFound)); } if (string.IsNullOrWhiteSpace(this.Request.Query.loc.ToString())) { // no loc parameters. return(Negotiate.WithStatusCode(HttpStatusCode.NotAcceptable).WithModel("loc parameter not found or request invalid.")); } var locs = this.Request.Query.loc.ToString().Split(','); if (locs.Length < 4) { // less than two loc parameters. return(Negotiate.WithStatusCode(HttpStatusCode.NotAcceptable).WithModel("only one loc parameter found or request invalid.")); } var coordinates = new Coordinate[locs.Length / 2]; for (int idx = 0; idx < coordinates.Length; idx++) { float lat, lon = 0f; if (float.TryParse(locs[idx * 2], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out lat) && float.TryParse(locs[idx * 2 + 1], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out lon)) { // parsing was successful. coordinates[idx] = new Coordinate(lat, lon); } else { // invalid formatting. return(Negotiate.WithStatusCode(HttpStatusCode.NotAcceptable).WithModel("location coordinates are invalid.")); } } // get profile. string profileName = "car"; // assume car is the default. if (!string.IsNullOrWhiteSpace(this.Request.Query.profile)) { // a vehicle was defined. profileName = this.Request.Query.profile; } if (!instance.Supports(profileName)) {// vehicle not found or not registered. return(Negotiate.WithStatusCode(HttpStatusCode.NotAcceptable).WithModel( string.Format("Profile with name '{0}' not found.", profileName))); } // tries to calculate the given route. var result = instance.Calculate(profileName, coordinates); if (result.IsError) { return(Negotiate.WithStatusCode(HttpStatusCode.NotFound)); } return(result.Value); }
/// <summary> /// Creates a bunch of stuff (such as the biome library, primitive library etc.) which won't change /// from game to game. /// </summary> public void InitializeStaticData(string companyName, string companyMotto, NamedImageFrame companyLogo, Color companyColor) { CompositeLibrary.Initialize(); CraftLibrary = new CraftLibrary(); if (SoundManager.Content == null) { SoundManager.Content = Content; SoundManager.LoadDefaultSounds(); SoundManager.SetActiveSongs(ContentPaths.Music.dwarfcorp, ContentPaths.Music.dwarfcorp_2, ContentPaths.Music.dwarfcorp_3, ContentPaths.Music.dwarfcorp_4); } new PrimitiveLibrary(GraphicsDevice, Content); InstanceManager = new InstanceManager(); EntityFactory.InstanceManager = InstanceManager; InstanceManager.CreateStatics(Content); Color[] white = new Color[1]; white[0] = Color.White; pixel = new Texture2D(GraphicsDevice, 1, 1); pixel.SetData(white); Tilesheet = TextureManager.GetTexture(ContentPaths.Terrain.terrain_tiles); AspectRatio = GraphicsDevice.Viewport.AspectRatio; DefaultShader = Content.Load<Effect>(ContentPaths.Shaders.TexturedShaders); DefaultShader.Parameters["xFogStart"].SetValue(40.0f); DefaultShader.Parameters["xFogEnd"].SetValue(80.0f); VoxelLibrary = new VoxelLibrary(); VoxelLibrary.InitializeDefaultLibrary(GraphicsDevice, Tilesheet); bloom = new BloomComponent(Game) { Settings = BloomSettings.PresetSettings[5] }; bloom.Initialize(); fxaa = new FXAA(); fxaa.Initialize(); SoundManager.Content = Content; PlanService.Restart(); ComponentManager = new ComponentManager(this, companyName, companyMotto, companyLogo, companyColor); ComponentManager.RootComponent = new Body("root", null, Matrix.Identity, Vector3.Zero, Vector3.Zero, false); Vector3 origin = new Vector3(WorldOrigin.X, 0, WorldOrigin.Y); Vector3 extents = new Vector3(1500, 1500, 1500); ComponentManager.CollisionManager = new CollisionManager(new BoundingBox(origin - extents, origin + extents)); Alliance.Relationships = Alliance.InitializeRelationships(); JobLibrary.Initialize(); MonsterSpawner = new MonsterSpawner(); EntityFactory.Initialize(); }
public void LcyPaymentWithOtherDocTestSteps() { // // Precondition steps // Logger.Info("Precondition steps: Write LCY payment To Payment Db"); _expectedLcyPayment.WriteToPaymentDb(); Logger.Info("Precondition steps: Write BCASS payment To Dwh database"); _expectedBccasPayment.WriteToDwhDb(); Logger.Info("Precondition steps: Export Payment To BCCAS"); PaymentExporter.ExportPaymentToBccas(_expectedBccasPayment.PostingDate); Logger.Info("Precondition steps: Add CoverXml to App1"); Services.Documents.AddDocumentToApp1WithSignature(_expectedCoverXml.GetXml()); Logger.Debug($"Precondition steps: CoverXml {_expectedCoverXml.GetXmlString()}"); Payment expectedPayment = new Payment(_expectedBccasPayment, _expectedCoverXml); OtherContract expectedContract = new OtherContract(_expectedOtherXml); Logger.Info("Precondition steps: Add OtherDocument to APP"); DownloadDocumentGreenTrade.AddDocumentToGreenTrade(_expectedCoverXml.TokenNumber); Services.Documents.AddDocumentToApp1WithSignature(_expectedOtherXml.GetXml()); // // Steps // Logger.Info("Step: Compliance Check and Approve the contract to send it to All contract queue"); OtherProcessingPage otherProcessingPage = new App1MainPage(InstanceManager.GetInstance(InstanceType.Maker)) .OpenOtherProcessingPage(); string barCodeOtherDoc = otherProcessingPage.GetBarCodeValue(_expectedOtherXml.TokenNumber); otherProcessingPage .OpenOtherContractByTokenValue(_expectedOtherXml.TokenNumber) .ComplianceCheckWithRadioButtonValue() .Close(); Logger.Info("Step: Attach Cover , Validate, Approve payment and sent it to XXX queue"); BccasValidationErrors actualBccasValidationErrors; new App1MainPage(InstanceManager.GetInstance(InstanceType.Maker)).OpenCcuProcessingLcyPage() .OpenLcyPayment(_expectedLcyPayment.TokenNumber) .VerificationCover(_expectedCoverXml.TokenNumber) .AssingDossiers() .OpenFindBccasPage() .AttachDossier(_expectedContractDossiers.ContractNumber) .OpenOtherTab() .AttachOtherDoc(barCodeOtherDoc) .CloseAssignLcyWindow() .ValidateLcy(out actualBccasValidationErrors) .VerificationCover(_expectedLcyPayment.TokenNumber) .CheckCriticalSeverity() .ApproveLcy(); Logger.Info("Step: Open Ccu-Ift -> Reporting -> LCY -> LCY payment by CDToken"); new App1MainPage(InstanceManager.GetInstance(InstanceType.Checker)).OpenCcuReportingLcyPage() .ValidateAndUploadToBccas(_expectedLcyPayment.TokenNumber); string barCodeCover = Services.Documents.GetBarCodeValueByToken(_expectedCoverXml.TokenNumber); Logger.Info("Step: Open unique contract queue by Bar code value -> Open document in UC tab"); LcyPaymentPage lcyInUniqueContract = new App1MainPage(InstanceManager.GetInstance(InstanceType.Checker)) .OpenContractPage() .FindDocAndOpenIt(barCodeCover) .OpenOther(_expectedContractDossiers.ContractNumber) .OpenLcy(_expectedCoverXml.TokenNumber); Logger.Info("Step: Read Fcy Payment from UI"); Payment actualUiPayment = lcyInUniqueContract.ReadFromUi(ContractTypes.Contract.ToString()); Logger.Info("Step: Read actual Database payment"); Payment actualDbPayment = Service.Database.Oplata.ReadFromDb(_expectedBccasPayment.TflexRefNo, _expectedLcyPayment.Branch); Assert.Multiple(() => { Assert.IsTrue(DataTableUtils.TablesAreTheSame(actualBccasValidationErrors, _expectedBccasValidationErrors), "Actual BCCAS Validation error list is not equal to Expected list"); Assert.AreEqual(expectedPayment, actualUiPayment, "Actual UI Payment is not equal to Expected payment"); Assert.AreEqual(expectedPayment, actualDbPayment, "Actual Db Payment is not equal to Expected payment"); }); }
public async Task Mounts_Valid_BYOS_Accounts() { _environment.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebsitePlaceholderMode, "1"); const string account1 = "storageaccount1"; const string share1 = "share1"; const string accessKey1 = "key1key1key1=="; const string targetPath1 = "/data"; const string account2 = "storageaccount2"; const string share2 = "share2"; const string accessKey2 = "key2key2key2=="; const string targetPath2 = "/data/store2"; const string account3 = "storageaccount3"; const string share3 = "share3"; const string accessKey3 = "key3key3key3=="; const string targetPath3 = "/somepath"; var hostAssignmentContext = new HostAssignmentContext() { Environment = new Dictionary <string, string> { [EnvironmentSettingNames.MsiSecret] = "secret", ["AZUREFILESSTORAGE_storage1"] = $"{account1}|{share1}|{accessKey1}|{targetPath1}", ["AZUREFILESSTORAGE_storage2"] = $"{account2}|{share2}|{accessKey2}|{targetPath2}", ["AZUREBLOBSTORAGE_blob1"] = $"{account3}|{share3}|{accessKey3}|{targetPath3}", [EnvironmentSettingNames.MsiEndpoint] = "endpoint", }, SiteId = 1234, SiteName = "TestSite", IsWarmupRequest = false }; var meshInitServiceClient = new Mock <IMeshServiceClient>(MockBehavior.Strict); meshInitServiceClient.Setup(client => client.MountCifs(Utility.BuildStorageConnectionString(account1, accessKey1, CloudConstants.AzureStorageSuffix), share1, targetPath1)) .Throws(new Exception("Mount failure")); meshInitServiceClient.Setup(client => client.MountCifs(Utility.BuildStorageConnectionString(account2, accessKey2, CloudConstants.AzureStorageSuffix), share2, targetPath2)).Returns(Task.FromResult(true)); meshInitServiceClient.Setup(client => client.MountBlob(Utility.BuildStorageConnectionString(account3, accessKey3, CloudConstants.AzureStorageSuffix), share3, targetPath3)).Returns(Task.FromResult(true)); var instanceManager = new InstanceManager(_optionsFactory, _httpClient, _scriptWebEnvironment, _environment, _loggerFactory.CreateLogger <InstanceManager>(), new TestMetricsLogger(), meshInitServiceClient.Object); instanceManager.StartAssignment(hostAssignmentContext); await TestHelpers.Await(() => !_scriptWebEnvironment.InStandbyMode, timeout : 5000); meshInitServiceClient.Verify( client => client.MountCifs(Utility.BuildStorageConnectionString(account1, accessKey1, CloudConstants.AzureStorageSuffix), share1, targetPath1), Times.Exactly(2)); meshInitServiceClient.Verify( client => client.MountCifs(Utility.BuildStorageConnectionString(account2, accessKey2, CloudConstants.AzureStorageSuffix), share2, targetPath2), Times.Once); meshInitServiceClient.Verify( client => client.MountBlob(Utility.BuildStorageConnectionString(account3, accessKey3, CloudConstants.AzureStorageSuffix), share3, targetPath3), Times.Once); }
public override GameObject GetBulletPrefubInstance() { return(InstanceManager.InstantiatePrefab(this.bulletObject, this.transform.position, this.transform.rotation)); }
void Start() { screenManager = FindObjectOfType<ScreenManager>(); instanceManager = FindObjectOfType<InstanceManager>(); //timer = spawnRate / 2; }
public CatchDataSummery(InstanceManager im) { this.im = im; }
void Awake() { instance = this; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); // gameObject refers to game object this component is attached to // NOTE IS THERE A BUG? NO RETURN? } DontDestroyOnLoad(gameObject); // To preserve game data such as score between stages mapManagerScript = GetComponent<MapManager>(); instanceManagerScript = GetComponent<InstanceManager>(); playerManagerScript = GetComponent<PlayerManager>(); maskScript = GetComponent<Mask>(); shadowScript = GetComponent<Shadow>(); fadeScript = GetComponent<FadeAlphaCutoff>(); mapMovingObjectScript = GetComponent<MapMovingObject>(); }
public static int Initialize(Ddeml.DdeCallback pfnCallback, int afCmd) { lock (_Table) { // Initialize a DDEML instance. int instanceId = 0; Ddeml.DdeInitialize(ref instanceId, pfnCallback, afCmd, 0); if (instanceId != 0) { // Make sure this thread has an IMessageFilter on it. LocalDataStoreSlot slot = Thread.GetNamedDataSlot(DataSlot); if (Thread.GetData(slot) == null) { InstanceManager filter = new InstanceManager(); Application.AddMessageFilter(filter); Thread.SetData(slot, filter); } // Add an entry to the table that maps the instance identifier to the current thread. _Table.Add(instanceId, Ddeml.GetCurrentThreadId()); } return instanceId; } }
// Use this for initialization void Awake() { manager = this; //generate the name-prefab dictionary from the prefab list prefabDict = new Dictionary<string, GameObject>(); for (int i = 0; i < prefabs.Count; i++){ prefabDict.Add(prefabs[i].name, prefabs[i]); } }