Exemple #1
0
 protected override void DoWrite(IDataQueue queue)
 {
     using (FileStream fw = new FileStream(GetWorkingFileName(), FileMode.Create))
     {
         XmlDataTool.WriteQueueToXml(queue, fw, "DataSet", "DataRow");
     }
     FinalizeBulkCopy();
 }
Exemple #2
0
 protected override void DoRead(IDataQueue queue)
 {
     using (XmlReader xr = XmlReader.Create(GetWorkingFileName(), new XmlReaderSettings {
         CheckCharacters = false
     }))
     {
         m_loadedData = XmlDataTool.ReadXmlToQueue(xr, queue, "DataRow");
     }
     FinalizeBulkCopy();
 }
Exemple #3
0
 private void DoReadTable(NameWithSchema table, IDataQueue queue)
 {
     try
     {
         string   fnbase = XmlTool.NormalizeIdentifier(table.ToString());
         ZipEntry xmlEntry;
         try { xmlEntry = m_zip[fnbase + ".xml"]; }
         catch { xmlEntry = null; }
         ZipEntry drsEntry;
         try { drsEntry = m_zip[fnbase + ".drs"]; }
         catch { drsEntry = null; }
         if (drsEntry == null && xmlEntry == null)
         {
             var dbs = GetStructure();
             if (dbs.Tables.GetIndex(table) < 0)
             {
                 throw new InternalError("DAE-00019 Table not found in data archive:" + table.ToString());
             }
             // table is empty, only has no drs nor xml file
             queue.PutEof();
             return;
         }
         using (Stream fr = (drsEntry ?? xmlEntry).OpenReader())
         {
             if (drsEntry != null)
             {
                 BedTool.LoadQueue(fr, queue);
             }
             else if (xmlEntry != null)
             {
                 using (XmlReader reader = XmlReader.Create(fr, new XmlReaderSettings {
                     CheckCharacters = false
                 }))
                 {
                     XmlDataTool.ReadXmlToQueue(reader, queue, "DataRow");
                 }
             }
         }
     }
     finally
     {
         queue.CloseWriting();
     }
 }
Exemple #4
0
 public override bool ValueToString(Type type, object val, out string res)
 {
     return(XmlDataTool.CustomValueToStringOverride(type, val, out res));
 }
Exemple #5
0
        //private static void SetupFrameworkHooks()
        //{
        //    HFramework.ValueToString = XmlDataTool.CustomValueToStringOverride;
        //    HFramework.ValueFromString = XmlDataTool.CustomValueFromStringOverride;

        //    HFramework.FindAddonType = AddonTool.CustomFindAddonType;
        //    HFramework.AllowSendErrorReports = () => GlobalSettings.Pages.General().AllowSendErrorReports;

        //    Framework.NautralProgramName = "DatAdmin";
        //}

        public override bool ValueFromString(Type type, string sval, out object res)
        {
            return(XmlDataTool.CustomValueFromStringOverride(type, sval, out res));
        }