public bool GetAndSet() { sdbDesign = new SDBDesigner(); sdbDesign.SearchPrefix = ""; switch (SearchType) { case PSSearchType.Confirmed: { SDBIdentifier = "Confirmed EXO"; break; } case PSSearchType.Candidate: { SDBIdentifier = "Candidate EXO"; break; } } SDBDescription = "Exo Planet Query Listing, IPAC, CalTech"; sdbDesign.DefaultObjectIndex = 28; sdbDesign.DefaultObjectDescription = "Exoplanet"; //Import Exo VOTable query and convert to an SDB XML database sdbXResults = ServerQueryToResultsXML(); if (sdbXResults == null) { return(false); } //Parse the Exo-specific catalog data for names and widths to be used // for defining columns in the output text data to TSX SDB text file //colMap is the generic list of column names and maximum data widths sdbDesign.MakeHeaderMap(sdbXResults); //Create the TSX SDB Text header by mapping the column map to the // TSX built-in and user data fields sdbXDoc = ResultsXMLtoSDBHeader(sdbXResults); return(true); }
public static void XMLToSDBClipboard(SDBDesigner sdbDesign, XDocument sdbXhdr, XElement sdbXML) { //Open text file //Add the header //Build and add text lines according to the header //Write the XDocument to the text file string test = sdbXhdr.ToString(); Clipboard.SetText(test); test += "\n"; //Write the sdb text according to the column map foreach (XElement dRec in sdbXML.Elements(SDBEntryX)) { string line = XMLtoTextLine(dRec, sdbDesign.DataFields); test += line; } Clipboard.SetText(test); return; }
public static void XMLToSDBText(string exportFileName, SDBDesigner sdbDesign, XDocument sdbXhdr, XElement sdbXML) { //Open text file //Add the header //Build and add text lines according to the header StreamWriter tFile = File.CreateText(exportFileName); //Write the XDocument to the text file sdbXhdr.Save(tFile); tFile.Close(); File.AppendAllText(exportFileName, "\n"); //Write the sdb text according to the column map foreach (XElement dRec in sdbXML.Elements(SDBEntryX)) { string line = XMLtoTextLine(dRec, sdbDesign.DataFields); File.AppendAllText(exportFileName, line); } return; }
public bool GetAndSet() { sdbDesign = new SDBDesigner(); if (SearchSN) { sdbDesign.DefaultObjectIndex = 60; sdbDesign.DefaultObjectDescription = "Supernovae"; SDBDescription = "IAU Supernova Working Group Transient Name Server (https://www.wis-tns.org/)"; sdbDesign.SearchPrefix = ""; if (IsNGCHosted) { SDBIdentifier = "TNS - Supernovae(NGC)"; } else { SDBIdentifier = "TNS - Supernovae"; } } else { sdbDesign.DefaultObjectIndex = 20; sdbDesign.DefaultObjectDescription = "Unclassified Transient"; SDBIdentifier = "TNS - Unclassified AT"; SDBDescription = "IAU Supernova Working Group Transient Name Server"; sdbDesign.SearchPrefix = ""; } //Import TNS CSV text query and convert to an XML database sdbXResults = ServerQueryToResultsXML(); if (sdbXResults == null) { return(false); } //Parse the TNS-specific catalog data for names and widths to be used // for defining columns in the output text data to TSX SDB text file //colMap is the generic list of column names and maximum data widths sdbDesign.MakeHeaderMap(sdbXResults); //Create the TSX SDB Text header by mapping the column map to the // TSX built-in and user data fields sdbXDoc = ResultsXMLtoSDBHeader(sdbXResults); return(true); }
public bool GetAndSet() { sdbDesign = new SDBDesigner(); sdbDesign.SearchPrefix = ""; sdbDesign.DefaultObjectIndex = 37; sdbDesign.DefaultObjectDescription = "Near Earth Object"; SDBIdentifier = "MPC NEOCP"; SDBDescription = "Minor Planet Center Confirmed NEO"; //Import TNS CSV text query and convert to an XML database sdbXResults = ServerQueryToResultsXML(); if (sdbXResults == null) { return(false); } //Parse the TNS-specific catalog data for names and widths to be used // for defining columns in the output text data to TSX SDB text file //colMap is the generic list of column names and maximum data widths sdbDesign.MakeHeaderMap(sdbXResults); //Create the TSX SDB Text header by mapping the column map to the // TSX built-in and user data fields sdbXDoc = ResultsXMLtoSDBHeader(sdbXResults); return(true); }
public bool GetAndSet() { sdbDesign = new SDBDesigner(); switch (SearchType) { case NOVA_VTYPE: sdbDesign.SearchPrefix = ""; SDBIdentifier = "AAVSO VSX NOVA"; SDBDescription = VSX_DATABASE_DESCRIPTION; sdbDesign.DefaultObjectIndex = 20; //MixedDeepSpace sdbDesign.DefaultObjectDescription = "Nova"; break; case BLLAC_VTYPE: sdbDesign.SearchPrefix = ""; SDBIdentifier = "AAVSO VSX BLLAC"; SDBDescription = VSX_DATABASE_DESCRIPTION; sdbDesign.DefaultObjectIndex = 20; //MixedDeepSpace sdbDesign.DefaultObjectDescription = "BLLAC"; break; case AGN_VTYPE: sdbDesign.SearchPrefix = ""; SDBIdentifier = "AAVSO VSX AGN"; SDBDescription = VSX_DATABASE_DESCRIPTION; sdbDesign.DefaultObjectIndex = 20; //MixedDeepSpace sdbDesign.DefaultObjectDescription = "AGN"; break; case QSO_VTYPE: sdbDesign.SearchPrefix = ""; SDBIdentifier = "AAVSO VSX QSO"; SDBDescription = VSX_DATABASE_DESCRIPTION; sdbDesign.DefaultObjectIndex = 22; //Quasar sdbDesign.DefaultObjectDescription = "Quasar"; break; case SUSPECTS_VTYPE: sdbDesign.SearchPrefix = ""; SDBIdentifier = "AAVSO VSX SUSPECTS"; SDBDescription = VSX_DATABASE_DESCRIPTION; sdbDesign.DefaultObjectIndex = 2; //Suspected Variable Star sdbDesign.DefaultObjectDescription = "Suspected Variable Star"; SDBPeriodHigh = "0"; SDBPeriodLow = "1000"; break; } //Import TNS CSV text query and convert to an XML database sdbXResults = ServerQueryToResultsXML(); if (sdbXResults == null) { return(false); } //Parse the TNS-specific catalog data for names and widths to be used // for defining columns in the output text data to TSX SDB text file //colMap is the generic list of column names and maximum data widths sdbDesign.MakeHeaderMap(sdbXResults); //Create the TSX SDB Text header by mapping the column map to the // TSX built-in and user data fields sdbXDoc = ResultsXMLtoSDBHeader(sdbXResults); return(true); }