public void StartGame() { rLogic = new ResourceLogic(); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); rLogic.Resetvalues(); Debug.Log("Game Started" + SceneManager.GetActiveScene().buildIndex); }
private void OnTriggerEnter2D(Collider2D other) { ResourceLogic rl = other.gameObject.GetComponent <ResourceLogic>(); if (rl != null) { dr.AddResource(rl.drillResources); Destroy(other.gameObject); } }
/// <summary> /// handle the zombie creation event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void HandleZombieEvent(object sender, EventArrivedEventArgs e) { try { LogHelper.WriteInfo(ResourceLogic.GetString(ResourceKeyName.EventArrived)); ZombieManagement.ReplayZombieMessage(Guid.Parse(e.NewEvent.Properties[WmiProperties.InstanceId].Value.ToString())); } catch (Exception ex) { LogHelper.WriteError(ex); } }
private void SpawnResourceOffscreen() { GameObject resource = Instantiate(resourcePrefab); resource.transform.position = GetRandomPosition(); ResourceLogic resourceLogic = resource.GetComponent <ResourceLogic>(); resourceLogic.SetResourceType(GetRandomType()); GameObject oldObj = GetNextPoolObject(); Destroy(oldObj); objectPool[iterator] = resource; }
/// <summary> /// save all message in the selected dump layer /// </summary> /// <param name="ServiceInstanceID"></param> /// <param name="MessagesID"></param> /// <param name="btArtifact"></param> private static void SaveMessages(Guid ServiceInstanceID, IEnumerable <Guid> MessagesID, BTArtifactLogic btArtifact) { LogHelper.WriteInfo(ResourceLogic.GetString(ResourceKeyName.MessageSaving)); //retrieve the right layer ITransportLayer accessLayer = ConfigParameter.GettingTheRightLayer(); foreach (Guid gu in MessagesID) { //retrieving the message String sMessage = btArtifact.GetMessageBodyByMessageId(gu, ServiceInstanceID); //save the message accessLayer.SendMessage(sMessage, gu); //updatecounter PerfCounterAsync.UpdateStatistic(); } LogHelper.WriteInfo(ResourceLogic.GetString(ResourceKeyName.MessageSaved)); }
static void Main() { try { //check configuration before starting if (ConfigParameter.IsConfigurationOk()) { #if DEBUG LogHelper.WriteInfo(ResourceLogic.GetString(ResourceKeyName.DebugMode)); //init counter PerfCounterAsync.InitPerformanceCounter(); InitializeWatcher(); Console.ReadLine(); PerfCounterAsync.Close(); #else System.ServiceProcess.ServiceBase[] ServicesToRun; // More than one user service may run in the same process. To add // another service to this process, change the following line to // create a second service object. For example, // // ServicesToRun = New System.ServiceProcess.ServiceBase[] {new Service1(), new MySecondUserService()}; // ServicesToRun = new System.ServiceProcess.ServiceBase[] { new ZombieManagementService() }; System.ServiceProcess.ServiceBase.Run(ServicesToRun); #endif } else { LogHelper.WriteError(ResourceLogic.GetString(ResourceKeyName.ErrorValidation)); } } catch (Exception ex) { LogHelper.WriteError(ResourceLogic.GetString(ResourceKeyName.StopService)); LogHelper.WriteError(ex); } }
/// <summary> /// Start or stop the service windows /// </summary> private void ManageService() { //check if the config has changed without save if (ConfigChange) { DialogResult result = MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ConfigChange), ResourceLogic.GetString(ResourceKeyName.ConfigChangeTitle), MessageBoxButtons.YesNoCancel); switch (result) { case DialogResult.Yes: //let's save saveConfiguration(); break; case DialogResult.Cancel: //stop service management return; break; case DialogResult.No: //reinit FillControls(); break; default: //so continue with the old values break; } ConfigChange = false; } Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; _ServiceWindowsLogic.StartOrStopService(); Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; }
/// <summary> /// get back the zombie message, replay it and delete the zombie orchestration /// </summary> /// <param name="serviceInstanceId"></param> public static void ReplayZombieMessage(Guid serviceInstanceId) { Boolean deleteOrchestrationAction = false; //initialize WMI WmiLogic wmiAccess = new WmiLogic(); //Initialize artifact list BTArtifactLogic btArtifact = new BTArtifactLogic(); //retrieve all zombie message id wmiAccess.GetZombieMessage(serviceInstanceId); // Loop over the returned messages from the query if (wmiAccess.MessageFound) { //need to destroy the orchestration after deleteOrchestrationAction = true; LogHelper.WriteInfo(String.Format(ResourceLogic.GetString(ResourceKeyName.ZombieFound), serviceInstanceId)); //saving all messages SaveMessages(serviceInstanceId, wmiAccess.ListMessageId, btArtifact); } else { LogHelper.WriteInfo(String.Format(ResourceLogic.GetString(ResourceKeyName.NoZombieFound), serviceInstanceId)); } //Now terminate the current orchestration if (deleteOrchestrationAction) { LogHelper.WriteInfo(String.Format(ResourceLogic.GetString(ResourceKeyName.DeleteZombieOrchestration))); WmiLogic.TerminateOrchestration(serviceInstanceId); } }
public override void Commit(IDictionary savedState) { MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.EndInstallation)); base.Commit(savedState); }
/// <summary> /// Saving the new configuration /// </summary> private void saveConfiguration() { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; DumpType dtype = DumpType.File; //default value String svalue = String.Empty; //define the way where the xml will be dropped WcfType binding = WcfType.NamedPipe; //default value if (!FileSelected && !MsmqSelected && !WcfSelected) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.SelectType)); return; } //retrieve the current dump layer if (FileSelected) { dtype = DumpType.File; svalue = FolderPath; //test if the folder exist if (!FileLogic.IsValidPathFolder(svalue)) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ValidFolderPath)); return; } } if (MsmqSelected) { dtype = DumpType.Msmq; svalue = MsmqPath; if (!MsmqLayer.IsExist(svalue)) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ValidMsmqPath)); return; } } if (WcfSelected) { dtype = DumpType.Wcf; svalue = WcfUri; if (!Enum.TryParse <WcfType>(SelectedBindingType, out binding)) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ValidWcfBinding)); return; } if (String.IsNullOrEmpty(svalue)) { Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ValidWcfUri)); return; } } _editor.updateConfigurationFile(dtype, svalue, binding); Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; if (dtype == DumpType.Wcf) { MessageBox.Show(String.Format(ResourceLogic.GetString(ResourceKeyName.WcfPortCreation), binding.ToString())); } //confguration is applied so just apply show mode ConfigChange = false; MessageBox.Show(ResourceLogic.GetString(ResourceKeyName.ConfigurationSaved)); }