/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; hashCode = hashCode * 59 + Type.GetHashCode(); hashCode = hashCode * 59 + Barcode1DSymbology.GetHashCode(); if (Data != null) { hashCode = hashCode * 59 + Data.GetHashCode(); } hashCode = hashCode * 59 + X1.GetHashCode(); hashCode = hashCode * 59 + X2.GetHashCode(); hashCode = hashCode * 59 + X3.GetHashCode(); hashCode = hashCode * 59 + X4.GetHashCode(); hashCode = hashCode * 59 + Y1.GetHashCode(); hashCode = hashCode * 59 + Y2.GetHashCode(); hashCode = hashCode * 59 + Y3.GetHashCode(); hashCode = hashCode * 59 + Y4.GetHashCode(); hashCode = hashCode * 59 + BboxLeftInches.GetHashCode(); hashCode = hashCode * 59 + BboxTopInches.GetHashCode(); hashCode = hashCode * 59 + BboxWidthInches.GetHashCode(); hashCode = hashCode * 59 + BboxHeightInches.GetHashCode(); hashCode = hashCode * 59 + PageNumber.GetHashCode(); hashCode = hashCode * 59 + PagePixelWidth.GetHashCode(); hashCode = hashCode * 59 + PagePixelHeight.GetHashCode(); hashCode = hashCode * 59 + PageHorizontalResolution.GetHashCode(); hashCode = hashCode * 59 + PageVerticalResolution.GetHashCode(); return(hashCode); } }
public static void MainTest() { var x1 = new X1(); var x2 = new X2(); var x3 = new X3(); var x4 = new X4(); x4.Display2(); x1 = x4; x1.Display1(); System.Console.WriteLine(x1.y); //x1.Display2(); System.Console.WriteLine(); var tt = new Y <int, Double>(); tt.Set(3); tt.Set(.3); x1 = new X1(); var x11 = new X1(); x2 = new X2(); var x22 = new X2(); x1 = T1.V1(x22); //x2 = T1.V2(x1); }
public static void SaveLog() { //创建文件夹 var dir = AppDomain.CurrentDomain.BaseDirectory + "Log"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } //新文件则添加表头 var fileName = dir + "\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".csv"; if (!File.Exists(fileName)) { var sw = new StreamWriter(fileName, true); var title = "时间,Y1,X4,X3,X2,X1,结果"; sw.WriteLine(title); sw.Flush(); sw.Close(); } var item = DateTime.Now.ToString("HH:mm:ss:fff") + "," + Y.ToString("f3") + "," + X1.ToString("f3") + "," + X2.ToString("f3") + "," + X3.ToString("f3") + "," + X4.ToString("f3"); //+ "," + WZ1.ToString("f3") //+ "," + WZ2.ToString("f3") //+ "," + WZ3.ToString("f3") //+ "," + WZ11.ToString("f3") //+ "," + WZ31.ToString("f3") var sw2 = new StreamWriter(fileName, true); sw2.WriteLine(item); sw2.Flush(); sw2.Close(); //删除过期文件 var files = Directory.GetFiles(dir); for (var i = 0; i < files.Length; i++) { var dt = File.GetCreationTime(files[i]); var ts = DateTime.Now - dt; if (ts.Days > 30) { File.Delete(files[i]); } } }
public static void DifferentObjectsHavSameHashesIfOnlyIrrelevantFieldsDiffer() { var x = new X4 { F1 = "some string", F2 = 17, F3 = new X1(), Irrelevant = 999 }; var y = new X4 { F1 = "some string", F2 = 17, F3 = new X1(), Irrelevant = 1000 }; Assert.Equal(x.GetHashCode(), y.GetHashCode()); }
private void Update() { if (Input.GetMouseButtonDown(1) && !tookPicture && phoneEquipped) { // Raycast based on player's camera Ray ray = cam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0)); Vector3 forward = this.transform.TransformDirection(Vector3.forward) * 100; RaycastHit hit; if (Physics.Raycast(ray, out hit, interactDistance, layer)) { if (hit.transform.tag == "X_Event") { X1 event1 = hit.transform.GetComponent <X1>(); X2 event2 = hit.transform.GetComponent <X2>(); X3 event3 = hit.transform.GetComponent <X3>(); X4 event4 = hit.transform.GetComponent <X4>(); XBlank eventBlank = hit.transform.GetComponent <XBlank>(); if (event1) { StartCoroutine(DelayEvent1(event1)); // Play shatter vfx hit.transform.GetComponent <MeshRenderer>().enabled = false; hit.transform.GetComponent <BoxCollider>().enabled = false; Destroy(hit.transform.gameObject, 5.0f); } else if (event2) { StartCoroutine(DelayEvent2(event2)); hit.transform.GetComponent <MeshRenderer>().enabled = false; hit.transform.GetComponent <BoxCollider>().enabled = false; } else if (event3) { StartCoroutine(DelayEvent3(event3)); hit.transform.GetComponent <MeshRenderer>().enabled = false; hit.transform.GetComponent <BoxCollider>().enabled = false; } else if (event4) { StartCoroutine(DelayEvent4(event4)); hit.transform.GetComponent <MeshRenderer>().enabled = false; hit.transform.GetComponent <BoxCollider>().enabled = false; } else if (eventBlank) { StartCoroutine(DelayEventBlank(eventBlank)); } } else if (hit.transform.tag == "Door") { if (hit.transform.GetComponent <Door>().TargetKeyID == 1337) // hallway puzzle door { StartCoroutine(FlashDoorColor(hit.transform.gameObject, new Color(0, 1, 0.792f, 1))); } } } // Picture effect on phone TakePicture(); } if (Input.GetKeyDown(KeyCode.C)) { EquipPhone(); } }
private IEnumerator DelayEvent4(X4 event4) { yield return(new WaitForSeconds(0.1f)); event4.enabled = true; }
/// <summary> /// Returns true if BarcodeInfo instances are equal /// </summary> /// <param name="input">Instance of BarcodeInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(BarcodeInfo input) { if (input == null) { return(false); } return (( Type == input.Type || Type.Equals(input.Type) ) && ( Barcode1DSymbology == input.Barcode1DSymbology || Barcode1DSymbology.Equals(input.Barcode1DSymbology) ) && ( Data == input.Data || (Data != null && Data.Equals(input.Data)) ) && ( X1 == input.X1 || X1.Equals(input.X1) ) && ( X2 == input.X2 || X2.Equals(input.X2) ) && ( X3 == input.X3 || X3.Equals(input.X3) ) && ( X4 == input.X4 || X4.Equals(input.X4) ) && ( Y1 == input.Y1 || Y1.Equals(input.Y1) ) && ( Y2 == input.Y2 || Y2.Equals(input.Y2) ) && ( Y3 == input.Y3 || Y3.Equals(input.Y3) ) && ( Y4 == input.Y4 || Y4.Equals(input.Y4) ) && ( BboxLeftInches == input.BboxLeftInches || BboxLeftInches.Equals(input.BboxLeftInches) ) && ( BboxTopInches == input.BboxTopInches || BboxTopInches.Equals(input.BboxTopInches) ) && ( BboxWidthInches == input.BboxWidthInches || BboxWidthInches.Equals(input.BboxWidthInches) ) && ( BboxHeightInches == input.BboxHeightInches || BboxHeightInches.Equals(input.BboxHeightInches) ) && ( PageNumber == input.PageNumber || PageNumber.Equals(input.PageNumber) ) && ( PagePixelWidth == input.PagePixelWidth || PagePixelWidth.Equals(input.PagePixelWidth) ) && ( PagePixelHeight == input.PagePixelHeight || PagePixelHeight.Equals(input.PagePixelHeight) ) && ( PageHorizontalResolution == input.PageHorizontalResolution || PageHorizontalResolution.Equals(input.PageHorizontalResolution) ) && ( PageVerticalResolution == input.PageVerticalResolution || PageVerticalResolution.Equals(input.PageVerticalResolution) )); }