Beispiel #1
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();
        }
Beispiel #2
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);
     }
 }
Beispiel #3
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() + ')');
 }
Beispiel #4
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());
 }