public FillterOption() { try { this.FillingLineID = 0; this.LowerFillterDate = DateTime.Today.AddDays(-1); this.UpperFillterDate = DateTime.Today.AddDays(365); string savedDownLoadInterval = GlobalRegistry.Read("DownLoadInterval"); this.DownLoadInterval = savedDownLoadInterval == null ? "8:00" : savedDownLoadInterval; string savedUpLoadInterval = GlobalRegistry.Read("UpLoadInterval"); int lastUpLoadInterval; if (int.TryParse(savedUpLoadInterval, out lastUpLoadInterval)) { this.UpLoadInterval = lastUpLoadInterval; } else { this.UpLoadInterval = 60; } } catch (Exception exception) { throw exception; } }
public FillingLineData() { DataTable defaultFillingLineData = ADODatabase.GetDataTable("SELECT FillingLineData.ProductID, ListProductName.ProductCode, ListProductName.ProductCodeOriginal, ListProductName.NoItemPerCarton, FillingLineData.BatchNo, FillingLineData.SettingDate, FillingLineData.SettingMonthID, FillingLineData.BatchSerialNumber, FillingLineData.MonthSerialNumber, FillingLineData.BatchCartonNumber, FillingLineData.MonthCartonNumber FROM FillingLineData INNER JOIN ListProductName ON FillingLineData.ProductID = ListProductName.ProductID WHERE FillingLineData.FillingLineID = " + (int)this.FillingLineID + " AND FillingLineData.IsDefault = 1"); if (defaultFillingLineData.Rows.Count > 0) { this.StartTracking(); this.ProductID = int.Parse(defaultFillingLineData.Rows[0]["ProductID"].ToString()); this.ProductCode = defaultFillingLineData.Rows[0]["ProductCode"].ToString(); this.ProductCodeOriginal = defaultFillingLineData.Rows[0]["ProductCodeOriginal"].ToString(); GlobalVariables.noItemPerCartonSetByProductID = int.Parse(defaultFillingLineData.Rows[0]["NoItemPerCarton"].ToString()); int noItem = 0; GlobalVariables.noItemPerCartonSetByProductID = int.TryParse(GlobalRegistry.Read("NoItemPerCartonSetByProductID"), out noItem) ? noItem : 0; this.BatchNo = defaultFillingLineData.Rows[0]["BatchNo"].ToString(); this.SettingDate = DateTime.Parse(defaultFillingLineData.Rows[0]["SettingDate"].ToString()); this.SettingMonthID = int.Parse(defaultFillingLineData.Rows[0]["SettingMonthID"].ToString()); this.BatchSerialNumber = defaultFillingLineData.Rows[0]["BatchSerialNumber"].ToString(); this.MonthSerialNumber = defaultFillingLineData.Rows[0]["MonthSerialNumber"].ToString(); this.BatchCartonNumber = defaultFillingLineData.Rows[0]["BatchCartonNumber"].ToString(); this.MonthCartonNumber = defaultFillingLineData.Rows[0]["MonthCartonNumber"].ToString(); this.StartTracking(); } }
private void CommitHooks() { try { RegistryKey voodooRoot = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\VoodooShader", RegistryKeyPermissionCheck.ReadWriteSubTree); if (voodooRoot != null) { if (voodooRoot.OpenSubKey("Hooks") != null) { voodooRoot.DeleteSubKeyTree("Hooks"); } } else { voodooRoot = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\VoodooShader"); } GlobalRegistry.Write(m_Hooks, voodooRoot); voodooRoot.Close(); } catch (System.Exception exc) { System.Windows.Forms.MessageBox.Show(exc.Message, "Error Writing Hooks", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public int GetRank() { if (wallRank == 0) { wallRank = GlobalRegistry.GetWallRank(); } return(wallRank); }
private void comboBoxEmptyCarton_SelectedIndexChanged(object sender, EventArgs e) { try { GlobalVariables.IgnoreEmptyCarton = this.comboBoxEmptyCarton.ComboBox.SelectedIndex == 0; GlobalRegistry.Write("IgnoreEmptyCarton", GlobalVariables.IgnoreEmptyCarton ? "1" : "0"); } catch { } }
private void Update() { if (animator.GetBool("IsOpen")) { if (GlobalRegistry.CheckKey("Next")) { DisplayNextSentence(); } } }
private void activePower(int index) { if (GlobalRegistry.CheckKey("Mechanic" + index)) { keyMechanics[index].Activate(); } if (GlobalRegistry.CheckKeyUp("Mechanic" + index)) { keyMechanics[index].Release(); } }
private void PublicGetServerName_Load(object sender, EventArgs e) { try { this.textBoxServerName.Text = GlobalRegistry.Read("ServerName"); this.textBoxDatabaseName.Text = GlobalRegistry.Read("DatabaseName"); } catch (Exception ex) { GlobalExceptionHandler.ShowExceptionMessageBox(this, ex); } }
void Awake() { //Make GameManager a Singleton if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Start() { myRenderer.sortingOrder = (int)((transform.position.y - myRenderer.bounds.extents.y) * GlobalRegistry.SORTING_Y_MULTIPLIER()); //Populate Polygon Mesh //Call GlobalRegistry for rank of this wall //It's possible rank 1 has already called getEntries on this wall, so make sure walLRank hasn't been set yet if (wallRank == 0) { wallRank = GlobalRegistry.GetWallRank(); } if (wallRank == 1) { rankOne = this; } }
void Update() { if (GlobalRegistry.CheckKey("ToggleL")) { toggleHand(-1); } if (GlobalRegistry.CheckKey("ToggleR")) { toggleHand(1); } if (GlobalRegistry.CheckKey("Use")) { useHeldItem(); } }
//Throw this object from x starting position to y target //This method is a coroutine public virtual IEnumerator <float> Throw(Vector2 target, int arcDegrees) { if (GameManager.activePlay) { beingThrown = true; //Ignore collisions between this object and the thrower for a short amount of time holderData.SetCollisionFlag(this, true); //Run-time variables float zRate = Mathf.Sqrt(9.8f * Vector2.Distance(GetPosition(), target)); float arcRadians = arcDegrees * Mathf.PI / 180; float factor = Mathf.Sin(arcRadians) / Mathf.Sin(Mathf.PI / 4); //Set object to be in front or behind player depending on direction thrown Vector2 distance = target - (Vector2)GetPosition(); //Possessed Objects have no "holder", and so the throw object could be called without holder being defined myRenderer.sortingOrder = holderData.GetSortingOrder() + (int)(-distance.y / Mathf.Abs(distance.y)); Drop(); Debug.Log("factor is " + factor + ". deltaTime is " + Time.deltaTime); shadow.addVelocity((zRate + (4.9f * AVERAGE_DELTA_TIME)) * AVERAGE_DELTA_TIME * factor); //Arc is increased by a factor of 1/factor, multiplying distance by 1/factor distance = distance * (1f / factor); //By increasing distance by a multiple of inverse factor, the speed (and so distance) will be multiplied by factor //These two together cause distance to be the same; the distance to target, but it makes the speed and arc different shadow.PushDist(distance.normalized * distance.magnitude / (shadow.GetRigidbody().drag *(26f / 15)), ForceMode2D.Impulse); //Wait for the object to hit the ground again while (shadow.GetHeight() != 0 || shadow.GetHeightVelocity() > 0) { UpdatePosition(shadow.GetHeight()); //When object has come to half its distance and started falling back down, continuously change sortingOrder if (shadow.GetHeightVelocity() < 0) { myRenderer.sortingOrder = (int)(GetPosition().y *GlobalRegistry.SORTING_Y_MULTIPLIER()); } yield return(Timing.WaitForOneFrame); } //Object has reached target, so make vibration Vibration.Vibrator().MakeVibration((int)((zRate) * FALL_VIBRATION_SIZE), (Vector2)GetPosition(), this); //Object may have crashed into other objects and hurt them, so empty the damagedList as well EmptyDamagedList(); //Object is no longer attached to thrower, so let it be able to collide with thrower again holderData.SetCollisionFlag(this, false); beingThrown = false; } }
public void populateFirstRank() { //If this wall's rank is the first one: if (wallRank == 1) { //Make EdgeCollider for this wall List <int> usedRanks = MakeEdgeCollider(); List <int> wallsInt = Enumerable.Range(1, GlobalRegistry.GetWallNum()).ToList(); GameObject[] wallsInScene = GameObject.FindGameObjectsWithTag("Wall"); WallScript makingWall = this; //do { //Find if there are wall ranks that weren't used foreach (GameObject wall in wallsInScene) { WallScript checkingWall = wall.GetComponent <WallScript>(); if (usedRanks.Contains(checkingWall.GetRank())) { wallsInt.Remove(checkingWall.GetRank()); //Tell each wall that they are in this wall if (makingWall.GetEdgeCollider()) { checkingWall.SetEdgeCollider(makingWall.GetEdgeCollider()); } } } /* * if(wallsInt.Count > 0) { * //Get all ranks and call MakeEdgeCollider on the first one remaining in wallsInt * foreach(GameObject wall in wallsInScene) { * makingWall = wall.GetComponent<WallScript>(); * if(wallsInt.Contains(makingWall.GetRank())) { * usedRanks = makingWall.MakeEdgeCollider(); * break; * } * } * } * numLoops++; * } while(wallsInt.Count > 0 && numLoops < GlobalRegistry.GetWallNum());*/ foreach (int rank in wallsInt) { Debug.LogException(new Exception("Unused rank " + rank), this); } } }
private void PublicApplicationLogon_Load(object sender, EventArgs e) { try { this.comboBoxImageS8PortName.DataSource = System.IO.Ports.SerialPort.GetPortNames(); this.comboBoxAutonicsPortName.DataSource = System.IO.Ports.SerialPort.GetPortNames(); if (this.comboBoxImageS8PortName.Items.Count == 0) { this.comboBoxImageS8PortName.DataSource = null; this.comboBoxImageS8PortName.Items.Add("COM 0"); this.comboBoxAutonicsPortName.DataSource = null; this.comboBoxAutonicsPortName.Items.Add("COM 0"); } DataTable dataTablePublicPrinterProperties = SQLDatabase.GetDataTable("SELECT TOP 1 * FROM PublicPrinterProperties"); if (dataTablePublicPrinterProperties.Rows.Count > 0) { this.comboBoxImageS8PortName.Text = (string)dataTablePublicPrinterProperties.Rows[0]["ImageS8PortName"]; this.comboBoxAutonicsPortName.Text = (string)dataTablePublicPrinterProperties.Rows[0]["AutonicsPortName"]; } string stringEmployeeID = GlobalRegistry.Read("EmployeeID"); int employeeID = -1; if (stringEmployeeID == null || stringEmployeeID.Length <= "string".Length || !int.TryParse(stringEmployeeID.Substring("string".Length), out employeeID)) { employeeID = 1; } this.EmployeeID = employeeID; this.buttonListEmployee.Visible = this.EmployeeID == 1; this.commonMetaList = new CommonMetaList(); ListMaintenance.ListEmployeeDataTable listEmployeeDataTable = this.commonMetaList.GetListEmployee(); this.comboBoxEmployeeID.DataSource = listEmployeeDataTable; this.comboBoxEmployeeID.DisplayMember = listEmployeeDataTable.DescriptionColumn.ColumnName; this.comboBoxEmployeeID.ValueMember = listEmployeeDataTable.EmployeeIDColumn.ColumnName; this.employeeIDBinding = this.comboBoxEmployeeID.DataBindings.Add("SelectedValue", this, "EmployeeID", true, DataSourceUpdateMode.OnPropertyChanged); this.employeeIDBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete); } catch (Exception exception) { GlobalExceptionHandler.ShowExceptionMessageBox(this, exception); } }
// Update is called once per frame void Update() { //Check the STATIC OBJECT ARRAY, which is an array of PowerSlot Objects, and if either 0, 1 or 2 has a keycode that is being //pressed, get its power attached and do it. for (int i = 0; i < MECHANIC_SLOTS; i++) { //Open a Power-choosing menu if (GlobalRegistry.CheckKey("PowerMenu" + i)) { mechanicMenu[i] = true; //If the Image is currently shrinking, stop it from doing that! Timing.KillCoroutines("PowerUI" + i); //Start new routine Timing.RunCoroutine(resizeUIImage(UISlots[i], 75), "PowerUI" + i); Player.GetPlayer().SetMobility(false); } if (GlobalRegistry.CheckKeyUp("PowerMenu" + i)) { mechanicMenu[i] = false; //If the Image is currently growing, stop it from doing that! Timing.KillCoroutines("PowerUI" + i); //Start new routine Timing.RunCoroutine(resizeUIImage(UISlots[i], 50), "PowerUI" + i); //If all other mechanicMenu variables are false as well, reactivate mobility //Start by reactivating mobility... Player.GetPlayer().SetMobility(true); for (int j = 0; j < MECHANIC_SLOTS; j++) { //...But if any other mechanicMenu variables ARE true, reset it to false! if (mechanicMenu[j] == true) { Player.GetPlayer().SetMobility(false); } } } //Activating a Power if (mechanicMenu[i] == false) { activePower(i); } else { activeMenu(i); } } }
private void buttonOK_Click(object sender, EventArgs e) { try { GlobalRegistry.Write("ServerName", this.textBoxServerName.Text); GlobalRegistry.Write("DatabaseName", this.textBoxDatabaseName.Text); GlobalMsADO.ServerName = this.textBoxServerName.Text; GlobalMsADO.DatabaseName = this.textBoxDatabaseName.Text; return; //http://www.codeproject.com/Articles/11967/Adding-custom-dialogs-to-your-applications } catch (Exception ex) { GlobalExceptionHandler.ShowExceptionMessageBox(this, ex); } }
public override bool Use() { //Find all torches GameObject[] torches = GameObject.FindGameObjectsWithTag("Lightable"); foreach (GameObject lightable in torches) { float distance = Vector3.Distance(lightable.transform.position, transform.position); if (distance < GlobalRegistry.PLAYER_REACH() * 3f) { // Light up that object LightableTorch lightScript = lightable.GetComponent <LightableTorch>(); if (lightScript) { lightScript.Light(); } } } //Torches are not destroyed upon use return(false); }
//Object's images become more broken as they go through the imageSet array until being officially broken at the last frame public override void Damage(float damageAmo) { damageAmo = damageAmo / (shadow.GetSize().x *GlobalRegistry.INVERSE_DAMAGE_MULTIPLIER()); //Objects with zero or only one image are considered unbreakable and will stay the same forever if (imageSet.Length > 1) { if (broken == false && imageNum < imageSet.Length - 1) { if (damageAmo >= durability) { imageNum++; myRenderer.sprite = imageSet[imageNum]; } } if (imageNum >= imageSet.Length - 1) { //If Sprite is last possible sprite, it is now the broken image and should be broken broken = true; } } }
// Update is called once per frame void Update() { if (GlobalRegistry.CheckKey("PickUp")) { playerCollider.enabled = false; RaycastHit2D touched = Physics2D.CircleCast( (Vector2)playerTransform.position, GlobalRegistry.PLAYER_REACH(), playerInstance.GetDirection(), GlobalRegistry.PLAYER_REACH(), layerMask); playerCollider.enabled = true; //Pick up the object if (touched.collider.gameObject.GetComponent <Material>()) { if (touched.collider != null) { playerInstance.PickUp(touched.collider.gameObject); } } } }
//public void GetEntries(ref Dictionary<Vector2, Vector2> pointDict) { public void GetEntries(ref List <Vector3> pointList) { if (wallRank == 0) { wallRank = GlobalRegistry.GetWallRank(); } float bottom = myRenderer.bounds.min.y; float top = myRenderer.bounds.max.y; float left = myRenderer.bounds.min.x; float right = myRenderer.bounds.max.x; /*pointDict.Add(new Vector2(left, top), new Vector2(right, top)); * pointDict.Add(new Vector2(right, top), new Vector2(right, bottom)); * pointDict.Add(new Vector2(right, bottom), new Vector2(left, bottom)); * pointDict.Add(new Vector2(left, bottom), new Vector2(left, top));*/ //Wall Rank is entered as z so the algorithm will know which wall this point is from pointList.Add(new Vector3(left, top, wallRank)); pointList.Add(new Vector3(right, top, wallRank)); pointList.Add(new Vector3(right, bottom, wallRank)); pointList.Add(new Vector3(left, bottom, wallRank)); }
private void LoadHooks() { m_DetailsDirty = false; try { RegistryKey hookRoot = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\VoodooShader\Hooks", RegistryKeyPermissionCheck.ReadSubTree); if (hookRoot != null) { m_Hooks = GlobalRegistry.ReadHooks(hookRoot); hookRoot.Close(); } else { m_Hooks = new List <Hook>(); } } catch (System.Exception exc) { System.Windows.Forms.MessageBox.Show(exc.Message, "Error Reading Hooks", MessageBoxButtons.OK, MessageBoxIcon.Error); m_Hooks = new List <Hook>(); } }
// Set when sneaking or slow public void Sneak() { speed = speed * GlobalRegistry.SNEAK_FRACTION(); }
private void buttonOK_Click(object sender, EventArgs e) { try { if (this.comboBoxEmployeeID.SelectedIndex < 0 || this.EmployeeID < 0) { throw new System.ArgumentException("Vui lòng chọn tên người sử dụng!"); } if (!this.commonMetaList.CheckPasswordSuccessful(this.EmployeeID, this.textBoxPassword.Text)) { throw new System.ArgumentException("Sai mật khẩu! Vui lòng kiểm tra lại trước khi tiếp tục."); } GlobalVariables.GlobalUserInformation = new UserInformation(this.EmployeeID, 1, this.comboBoxEmployeeID.Text); if (sender.Equals(this.buttonListEmployee)) { CommonMDI commonMDI = new CommonMDI(GlobalEnum.TaskID.ListEmployee); if (commonMDI.ShowDialog() == System.Windows.Forms.DialogResult.OK || true) { this.comboBoxEmployeeID.DataSource = this.commonMetaList.GetListEmployee(); } commonMDI.Dispose(); } if (sender.Equals(this.buttonOK)) { GlobalRegistry.Write("EmployeeID", "string" + this.EmployeeID); if (this.comboBoxImageS8PortName.SelectedIndex < 0 || this.comboBoxAutonicsPortName.SelectedIndex < 0) { throw new System.ArgumentException("Vui lòng chọn cổng COM!"); } if (this.comboBoxImageS8PortName.DataSource == null || this.comboBoxAutonicsPortName.DataSource == null) { GlobalVariables.ImageS8PortName = "COM 0"; GlobalVariables.AutonicsPortName = "COM 0"; } else { SQLDatabase.ExecuteNonQuery("UPDATE PublicPrinterProperties SET ImageS8PortName = N'" + (string)this.comboBoxImageS8PortName.SelectedValue + "', AutonicsPortName = N'" + (string)this.comboBoxAutonicsPortName.SelectedValue + "' "); GlobalVariables.ImageS8PortName = (string)this.comboBoxImageS8PortName.SelectedValue; GlobalVariables.AutonicsPortName = (string)this.comboBoxAutonicsPortName.SelectedValue; } } if (sender.Equals(this.labelChangePassword)) { PublicAuthenticationPassword publicAuthenticationPassword = new PublicAuthenticationPassword(); publicAuthenticationPassword.ShowDialog(); publicAuthenticationPassword.Dispose(); } } catch (Exception exception) { GlobalExceptionHandler.ShowExceptionMessageBox(this, exception); this.DialogResult = DialogResult.None; } }
public override void Damage(float damageAmo) { damageAmo = damageAmo / (shadow.GetSize().x *GlobalRegistry.INVERSE_DAMAGE_MULTIPLIER()); GameManager.instance.DamageEffect(); GameManager.instance.DrainCap((int)damageAmo * 2); }
//Method that swaps world whenever the player runs out of stamina //This method may be moved to its own class as the internals of this method might Get too complicated private void swapWorld() { //Code to be written later GlobalRegistry.Reset(); }
// Set when sneaking or slow public void WalkNormal() { speed = speed / GlobalRegistry.SNEAK_FRACTION(); }
static void Main() { bool isLoginOK = false; ////KHONG LOAD DATABASE //GlobalVariables.LocationID = 1; //isLoginOK = true; try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); GlobalRegistry.ShowError = true; //GlobalMsADO.ServerName = "SERVER\\SQLEXPRESS"; GlobalMsADO.ServerName = GlobalRegistry.Read("ServerName"); GlobalMsADO.DatabaseName = GlobalRegistry.Read("DatabaseName"); //GlobalMsADO.ServerName = "WH\\SQLEXPRESS"; //GlobalMsADO.DatabaseName = "E:\\20.02.2013\\Database\\BPFillingSystem.mdf"; //GlobalMsADO.ServerName = "HOME-PC\\SQLEXPRESS"; //GlobalMsADO.DatabaseName = "BPFillingSystem"; //GlobalMsADO.ServerName = "SONY-VIO\\SQLEXPRESS"; //GlobalMsADO.DatabaseName = "ImageS8SongThan"; GlobalMsADO.ServerName = "192.168.1.18"; while (!isLoginOK && GlobalVariables.LocationID >= -1)//Try to open startup database, Exit if user cancel to input ServerName and DatabaseName { //MessageBox.Show (GlobalStaticFunction.TextToASCII("AB")); //MessageBox.Show(GlobalStaticFunction.TextToHEX("AB")); ////byte[] a = GlobalStaticFunction.XORBytes(GlobalStaticFunction.StringToByteArrayFastest("01"), GlobalStaticFunction.StringToByteArrayFastest("02")); //////////string hex = BitConverter.ToString(data); //////////string hex = BitConverter.ToString(data).Replace("-", string.Empty); ; ////string hex = BitConverter.ToString(a); ////MessageBox.Show (hex); //////////1111111111---------MessageBox.Show(GlobalStaticFunction.TextToHEX("BOURG LES VALENCE" )); ////////////byte[] a = GlobalStaticFunction.CheckSumHEXString("0A,00,13,01,0A,02,38,49,4D,41,4A,45,20,02,54,46,52,41,4E,43,45,0D"); ////////////byte[] a = GlobalStaticFunction.CheckSumHEXString("0A,00,2A,01,0A,02,38,49,4D,41,4A,45,20,01,53,42,4F,55,52,47,20,4C,45,53,20,56,41,4C,45,4E,43,45,0A,02,54,46,52,41,4E,43,45,1E,1E,1E,0D"); //////////1111111111---------byte[] a = GlobalStaticFunction.CheckSumHEXString("0A,00,2A,01,0A,02,38,49,4D,41,4A,45,20,1C,01,53,42,4F,55,52,47,20,4C,45,53,20,56,41,4C,45,4E,43,45,0A,02,54,46,52,41,4E,43,45,1E,1E,1E,0D"); //////////1111111111---------MessageBox.Show(BitConverter.ToString(a)); if (GlobalMsADO.ServerName == null || GlobalMsADO.DatabaseName == null || GlobalMsADO.ServerName == "" || GlobalMsADO.DatabaseName == "")//Show Get Server Name Dialog { PublicGetServerName publicGetServerName = new PublicGetServerName(); if (publicGetServerName.ShowDialog() != DialogResult.OK) { GlobalVariables.LocationID = -2; } if (publicGetServerName.DialogResult == DialogResult.OK) { publicGetServerName.Dispose(); } } if (GlobalVariables.LocationID >= -1)//Do not execute if user cancel to input ServerName and DatabaseName { try { if (GlobalMsADO.MainDataAccessConnection(true).State == ConnectionState.Open)//Try to open new connection { isLoginOK = true; GlobalVariables.LocationID = 1; } else { GlobalMsADO.ServerName = ""; GlobalMsADO.DatabaseName = ""; } } catch { GlobalMsADO.ServerName = ""; GlobalMsADO.DatabaseName = ""; } } } if (GlobalVariables.LocationID > 0) { GlobalVariables.IgnoreEmptyCarton = GlobalRegistry.Read("IgnoreEmptyCarton") == "0" ? false : true; PublicApplicationLogon publicApplicationLogon = new PublicApplicationLogon(); if (publicApplicationLogon.ShowDialog() == DialogResult.OK) { Application.Run(new frmMDIMain()); } publicApplicationLogon.Dispose(); } } catch (Exception ex) { GlobalExceptionHandler.ShowExceptionMessageBox(new Form(), ex); } finally { Console.WriteLine("Executing finally block."); } }