예제 #1
0
 internal bool Save()
 {
     try
     {
         if (!Directory.Exists(Path.Combine(AppDataRoamingPath, "Scanner Tool")))
         {
             Directory.CreateDirectory(Path.Combine(AppDataRoamingPath, "Scanner Tool"));
         }
         else if (File.Exists(Path.Combine(AppDataRoamingPath, "Scanner Tool", "Settings.cfg")))
         {
             File.Delete(Path.Combine(AppDataRoamingPath, "Scanner Tool", "Settings.cfg"));
         }
         var CurSB = new StringBuilder();
         CurSB.AppendLine("ScannerProductName=" + ScannerProductName);
         CurSB.AppendLine("UseInsertion=" + UseInsertion.ToString());
         CurSB.AppendLine("UseDoubleSided=" + UseDoubleSided.ToString());
         CurSB.AppendLine("UseGrey=" + UseGrey.ToString());
         CurSB.AppendLine("CheckIfEmpty=" + CheckIfEmpty.ToString());
         CurSB.AppendLine("UseEdgeDetection=" + UseEdgeDetection.ToString());
         CurSB.AppendLine("UseRotationCorrection=" + UseRotationCorrection.ToString());
         CurSB.AppendLine("UseVendorTool=" + UseVendorTool.ToString());
         CurSB.AppendLine("SizeX=" + SizeX.ToString());
         CurSB.AppendLine("SizeY=" + SizeY.ToString());
         CurSB.AppendLine("SavePath=" + SavePath);
         File.WriteAllText(Path.Combine(AppDataRoamingPath, "Scanner Tool", "Settings.cfg"), CurSB.ToString());
         return(true);
     }
     catch (Exception ex)
     {
         Program.MeldeFehler(ex.Message + "\n" + ex.StackTrace);
         Environment.Exit(1);
         return(false);
     }
 }
예제 #2
0
        public void Save(string path)
        {
            XmlWriterSettings set = new XmlWriterSettings();

            set.Indent = true;
            XmlWriter w = XmlWriter.Create(path, set);

            w.WriteStartDocument();
            w.WriteStartElement("heightmap");
            w.WriteAttributeString("MinX", Min.X.ToString());
            w.WriteAttributeString("MinY", Min.Y.ToString());
            w.WriteAttributeString("MaxX", Max.X.ToString());
            w.WriteAttributeString("MaxY", Max.Y.ToString());
            w.WriteAttributeString("SizeX", SizeX.ToString());
            w.WriteAttributeString("SizeY", SizeY.ToString());

            for (int x = 0; x < SizeX; x++)
            {
                for (int y = 0; y < SizeY; y++)
                {
                    if (!Points[x, y].HasValue)
                    {
                        continue;
                    }

                    w.WriteStartElement("point");
                    w.WriteAttributeString("X", x.ToString());
                    w.WriteAttributeString("Y", y.ToString());
                    w.WriteString(Points[x, y].Value.ToString());
                    w.WriteEndElement();
                }
            }
            w.WriteEndElement();
            w.Close();
        }
예제 #3
0
        public bool Equals([AllowNull] Image other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (Source == other.Source && Source != null && other.Source != null && Source.Equals(other.Source)) &&
                   (Layer == other.Layer && Layer != null && other.Layer != null && Layer.Equals(other.Layer)) &&
                   (SizeX == other.SizeX && SizeX != null && other.SizeX != null && SizeX.Equals(other.SizeX)) &&
                   (SizeY == other.SizeY && SizeY != null && other.SizeY != null && SizeY.Equals(other.SizeY)) &&
                   (Sizing == other.Sizing && Sizing != null && other.Sizing != null && Sizing.Equals(other.Sizing)) &&
                   (Opacity == other.Opacity && Opacity != null && other.Opacity != null && Opacity.Equals(other.Opacity)) &&
                   (X == other.X && X != null && other.X != null && X.Equals(other.X)) &&
                   (Y == other.Y && Y != null && other.Y != null && Y.Equals(other.Y)) &&
                   (XAnchor == other.XAnchor && XAnchor != null && other.XAnchor != null && XAnchor.Equals(other.XAnchor)) &&
                   (YAnchor == other.YAnchor && YAnchor != null && other.YAnchor != null && YAnchor.Equals(other.YAnchor)) &&
                   (XRef == other.XRef && XRef != null && other.XRef != null && XRef.Equals(other.XRef)) &&
                   (YRef == other.YRef && YRef != null && other.YRef != null && YRef.Equals(other.YRef)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (TemplateItemName == other.TemplateItemName && TemplateItemName != null && other.TemplateItemName != null && TemplateItemName.Equals(other.TemplateItemName)));
        }
예제 #4
0
    public void Initialize()
    {
        RaycastHit hit;

        Physics.Raycast(FirstPersonInteraction.Ray(), out hit, Settings.ReachDistance, Wire.IgnoreWiresLayermask);
        if (hit.collider == null || (hit.collider.tag != "CircuitBoard" && hit.collider.tag != "World" && hit.collider.tag != "PlaceOnlyBoard")) // all valid tags of things to place on
        {
            SoundPlayer.PlaySoundGlobal(References.Sounds.FailDoSomething);
            GameplayUIManager.UIState = UIState.None;
            return;
        }

        GameplayUIManager.UIState = UIState.NewBoardMenu;

        // to make sure there's no disconnect between the UI and the what it represents
        SizeXSlider.value = SizeX;
        SizeYSlider.value = SizeY;
        SizeXInput.text   = SizeX.ToString();
        SizeYInput.text   = SizeY.ToString();

        NewBoardCanvas.enabled = true;

        // select the size x input field so that the user can immediately begin typing
        SizeXInput.ActivateInputField();
    }
예제 #5
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Col != null)
         {
             hashCode = hashCode * 59 + Col.GetHashCode();
         }
         if (Row != null)
         {
             hashCode = hashCode * 59 + Row.GetHashCode();
         }
         if (SizeX != null)
         {
             hashCode = hashCode * 59 + SizeX.GetHashCode();
         }
         if (SizeY != null)
         {
             hashCode = hashCode * 59 + SizeY.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Options != null)
         {
             hashCode = hashCode * 59 + Options.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #6
0
 /// <summary>
 /// A hash code produced out of hash codes of <see cref="MinX"/>, <see cref="MinY"/>, <see cref="SizeX"/>, <see cref="SizeY"/>.
 /// </summary>
 /// <returns>A hash code produced out of hash codes of <see cref="MinX"/>, <see cref="MinY"/>, <see cref="SizeX"/>, <see cref="SizeY"/>.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MinX.GetHashCode();
         hashCode = (hashCode * 397) ^ MinY.GetHashCode();
         hashCode = (hashCode * 397) ^ SizeX.GetHashCode();
         hashCode = (hashCode * 397) ^ SizeY.GetHashCode();
         return(hashCode);
     }
 }
예제 #7
0
 public override int GetHashCode()
 {
     if (IsEmpty)
     {
         return(0);
     }
     else
     {
         // Perform field-by-field XOR of HashCodes
         return(X.GetHashCode() ^
                Y.GetHashCode() ^
                Z.GetHashCode() ^
                SizeX.GetHashCode() ^
                SizeY.GetHashCode() ^
                SizeZ.GetHashCode());
     }
 }
예제 #8
0
        /// <summary>
        /// Returns true if DashboardWidgetBean instances are equal
        /// </summary>
        /// <param name="input">Instance of DashboardWidgetBean to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(DashboardWidgetBean input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Col == input.Col ||
                     (Col != null &&
                      Col.Equals(input.Col))
                     ) &&
                 (
                     Row == input.Row ||
                     (Row != null &&
                      Row.Equals(input.Row))
                 ) &&
                 (
                     SizeX == input.SizeX ||
                     (SizeX != null &&
                      SizeX.Equals(input.SizeX))
                 ) &&
                 (
                     SizeY == input.SizeY ||
                     (SizeY != null &&
                      SizeY.Equals(input.SizeY))
                 ) &&
                 (
                     Type == input.Type ||
                     (Type != null &&
                      Type.Equals(input.Type))
                 ) &&
                 (
                     Options == input.Options ||
                     (Options != null &&
                      Options.Equals(input.Options))
                 ));
        }
예제 #9
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Visible != null)
                {
                    hashCode = hashCode * 59 + Visible.GetHashCode();
                }

                if (Source != null)
                {
                    hashCode = hashCode * 59 + Source.GetHashCode();
                }

                if (Layer != null)
                {
                    hashCode = hashCode * 59 + Layer.GetHashCode();
                }

                if (SizeX != null)
                {
                    hashCode = hashCode * 59 + SizeX.GetHashCode();
                }

                if (SizeY != null)
                {
                    hashCode = hashCode * 59 + SizeY.GetHashCode();
                }

                if (Sizing != null)
                {
                    hashCode = hashCode * 59 + Sizing.GetHashCode();
                }

                if (Opacity != null)
                {
                    hashCode = hashCode * 59 + Opacity.GetHashCode();
                }

                if (X != null)
                {
                    hashCode = hashCode * 59 + X.GetHashCode();
                }

                if (Y != null)
                {
                    hashCode = hashCode * 59 + Y.GetHashCode();
                }

                if (XAnchor != null)
                {
                    hashCode = hashCode * 59 + XAnchor.GetHashCode();
                }

                if (YAnchor != null)
                {
                    hashCode = hashCode * 59 + YAnchor.GetHashCode();
                }

                if (XRef != null)
                {
                    hashCode = hashCode * 59 + XRef.GetHashCode();
                }

                if (YRef != null)
                {
                    hashCode = hashCode * 59 + YRef.GetHashCode();
                }

                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }

                if (TemplateItemName != null)
                {
                    hashCode = hashCode * 59 + TemplateItemName.GetHashCode();
                }

                return(hashCode);
            }
        }
예제 #10
0
 get => new Point(SizeX, SizeY);
 public override int GetHashCode() => X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode() ^ SizeX.GetHashCode() ^ SizeY.GetHashCode() ^ SizeZ.GetHashCode();
예제 #12
0
 /// <summary>
 /// Returns a <see cref="System.String" /> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String" /> that represents this instance.
 /// </returns>
 public override string ToString()
 {
     return('(' + X.ToString() + ';' + Y.ToString() + ';' + Z.ToString() + ';' + SizeX.ToString() + ';' + SizeY.ToString() + ';' + SizeZ.ToString() + ')');
 }
예제 #13
0
 public override string ToString()
 {
     return(CenterX.ToString() + ", " + CenterY.ToString() + ", " + SizeX.ToString() + ", " + SizeY.ToString() + ", " +
            NodeIndex.ToString() + ", " + NodeCount.ToString() + ", " + Short7.ToString() + ", " + Short8.ToString() + ", " +
            FloatUtil.ToString(Float1) + ", " + Byte1.ToString() + ", " + Byte2.ToString() + ", " + Byte3.ToString() + ", " + Byte4.ToString());
 }