Esempio n. 1
0
 public void Save(XmlElement xml)
 {
     SaveBase(xml);
     this.SavePropertiesCore(xml);
     XmlTool.SaveParameters(xml, SpecificData);
     if (ObjectName != null)
     {
         ObjectName.SaveToXml(xml);
     }
     if (RelatedTable != null)
     {
         RelatedTable.SaveToXml(xml, "relschema", "reltable");
     }
     //XmlTool.SaveNameWithSchema(xml, RelatedTable, "relschema", "reltable");
     if (DependsOn != null)
     {
         XmlElement deps = xml.AddChild("DependsOn");
         foreach (var item in DependsOn)
         {
             var        repr = SpecificRepresentationAddonType.Instance.FindRepresentation(item.ObjectType);
             XmlElement it   = deps.AddChild(repr.XmlElementName);
             if (item.Name != null)
             {
                 item.Name.SaveToXml(it);
             }
         }
     }
 }
Esempio n. 2
0
 public void Save(XmlElement xml)
 {
     xml.AddChild("Type").InnerXml     = EventType;
     xml.AddChild("Used").InnerXml     = UsedAt.ToString("s");
     xml.AddChild("Duration").InnerXml = Math.Round(Duration.TotalSeconds).ToString();
     XmlTool.SaveParameters(xml, Params);
     foreach (var sub in SubEvents)
     {
         sub.SaveProperties(xml.AddChild("Sub"));
     }
 }
Esempio n. 3
0
 public void Save(XmlElement xml)
 {
     SaveBase(xml);
     //this.SaveProperties(xml);
     XmlTool.SaveParameters(xml, SpecificData);
     if (FullName != null)
     {
         FullName.SaveToXml(xml);
     }
     //XmlTool.SaveNameWithSchema(xml, FullName);
     DataType.SaveToXml(xml);
     if (DefaultValue != null)
     {
         DefaultValue.SaveToXml(xml.AddChild("Default"));
     }
 }
Esempio n. 4
0
 private void SaveToXml(XmlElement xml, bool oldStyle)
 {
     SaveBase(xml);
     if (FullName != null)
     {
         FullName.SaveToXml(xml);
     }
     foreach (ColumnStructure col in Columns)
     {
         XmlElement cx = XmlTool.AddChild(xml, "Column");
         col.Save(cx);
     }
     if (oldStyle)
     {
         foreach (DatAdmin.Constraint cnt in Constraints)
         {
             cnt.Save(xml);
         }
     }
     else
     {
         foreach (DatAdmin.Constraint cnt in Constraints)
         {
             XmlElement cx = XmlTool.AddChild(xml, "Constraint");
             cnt.SaveToXml(cx);
         }
     }
     XmlTool.SaveParameters(xml, SpecificData);
     if (!String.IsNullOrEmpty(Comment))
     {
         xml.AddChild("Comment").InnerText = Comment;
     }
     if (FixedData != null)
     {
         FixedData.SaveToXml(xml.AddChild("FixedData"));
     }
 }
Esempio n. 5
0
        private static void DoSendError(Exception error, List <LogMessageRecord> logHistory, Bitmap screenshot)
        {
            try
            {
                var            desc = ApiDescriptor.GetInstance();
                HttpWebRequest req  = (HttpWebRequest)WebRequest.Create(desc.SendError);
                req.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
                req.Method      = "POST";

                XmlDocument doc = XmlTool.CreateDocument("Error");
                XmlElement  xml = doc.DocumentElement;

                xml.SetAttribute("version", VersionInfo.VERSION);
                xml.AddChild("Message").InnerText    = error.Message;
                xml.AddChild("Type").InnerText       = error.GetType().FullName;
                xml.AddChild("StackTrace").InnerText = error.StackTrace;
                //xml.AddChild("DataTree").InnerText = GetDataTree();
                Exception se = error;
                while (se != null)
                {
                    XmlTool.SaveParameters(xml, se.Data);
                    se = se.InnerException;
                }

                xml.AddChild("Text").InnerText = error.ToString();

                //if (logHistory != null && CheckAutoUpdate.SendErrorLogs) Logging.SaveLogs(logHistory, xml.AddChild("LogHistory"));

                Dictionary <string, string> pars = new Dictionary <string, string>();
                StringWriter sw = new StringWriter();
                doc.Save(sw);
                pars["DATA"] = sw.ToString();
                //if (screenshot != null && CheckAutoUpdate.SendErrorScreenshots) pars["SCREENSHOT"] = SerializeScreenshot(screenshot);
                //if (CheckAutoUpdate.UpdateID != null) pars["PROGRAMUPDATE"] = CheckAutoUpdate.UpdateID.ToString();
                FeedbackTool.FillStdParams(pars, true);

                string pars_enc = StringTool.UrlEncode(pars, Encoding.UTF8);
                byte[] data     = Encoding.UTF8.GetBytes(pars_enc);
                req.ContentLength = data.Length;

                using (Stream fw = req.GetRequestStream())
                {
                    fw.Write(data, 0, data.Length);
                }
                using (var resp = req.GetResponse())
                {
                    using (Stream fr = resp.GetResponseStream())
                    {
                        using (StreamReader reader = new StreamReader(fr))
                        {
                            string line = reader.ReadToEnd();
                            Logging.Debug("Read result from datadmin feedback:" + line);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                Errors.ReportSilent(err, false);
            }
        }
Esempio n. 6
0
 public void Save(XmlElement xml)
 {
     this.SavePropertiesCore(xml);
     XmlTool.SaveParameters(xml, SpecificData);
 }