/// <summary> /// Exports the supplied query /// </summary> /// <param name="q">The <see cref="StoredQuery"/> to export</param> /// <param name="filename">The name of the file to export it to.</param> /// <returns>True if the query was exported, false otherwise.</returns> private bool ExportQuery(StoredQuery q, string filename) { //overwrite file? if (File.Exists(filename)) { if (!Parameters.AskYesNo("The filename " + filename + " already exists, do you want to overwrite it?")) { return(false); } } if (q.QueryScope != QueryScope.Private) { return(true); } //Create item and serialize var wiq = new WorkItemQuery { Query = q.QueryText }; XmlSerializerUtil.SerializeToXmlFile(wiq, filename, new UTF8Encoding(false)); Console.WriteLine("Exported query " + q.Name + " to file " + filename); return(true); }
/* ******************************************************************* * Methods * *******************************************************************/ #region public void Save() /// <summary> /// Saves the current settings /// </summary> public void Save() { XmlSerializerUtil.SerializeToXmlFile(this, _filename); }