/// <summary> /// Экспорт базы каналов, поток. /// </summary> /// <param name="param">Параметр потока</param> private void SaveAsXMLThread(object param) { var data = param as DataForSaveAsXML; Logs.Show(); Logs.DisableButtons(); Logs.Clear(); Logs.SetProgress(0); try { Logs.SetProgress(1); XMLReporter.SaveAsXML(data.pathToFile, data.rewrite, data.cdbxTagView, data.cdbxNewNames); Logs.SetProgress(50); Logs.AddMessage("Done."); } catch (System.Exception ex) { Logs.AddMessage("Exception - " + ex); } finally { if (Logs.IsNull() == false) { Logs.EnableButtons(); Logs.SetProgress(100); } } }
/// <summary> /// Сохранить количество тэгов в SVG. /// </summary> /// <param name="folderPath">Путь к каталогу</param> private static void SaveTagsCount(string folderPath) { const int maxTagsCount = 5000; folderPath += CountOfTagsFileName; int tagsCount = XMLReporter.GetTagsCount(); string displayingText = $"{tagsCount} тэг(ов)"; string result = MakeStringForWriting(tagsCount, maxTagsCount, displayingText); WriteFile(result, folderPath); }
/// <summary> /// Сохранить количество тэгов в SVG. /// </summary> /// <param name="folderPath">Путь к каталогу</param> private void SaveTagsCount(string folderPath) { const int maxTagsCount = 5000; folderPath += CountOfTagsFileName; int tagsCount = XMLReporter.GetTagsCount(); string labelName = GenerateNounAfterNumber("тэг", tagsCount, string.Empty, "а", "ов"); string displayingText = $"{tagsCount} {labelName}"; string result = MakeStringForWriting(tagsCount, maxTagsCount, displayingText); WriteFile(result, folderPath); }
/// <summary> /// Сохранить количество тэгов в SVG. /// </summary> /// <param name="folderPath">Путь к каталогу</param> private static void SaveTagsCount(string folderPath) { const int maxTagsCount = 5000; folderPath += countOfTagsFileName; int tagsCount = XMLReporter.GetTagsCount(); string strForWriting = $"{tagsCount.ToString()} тэг(ов)"; int currentValue = ValueAsPercentage(tagsCount, maxTagsCount); string result = string.Format(svgFilePattern, percents, currentValue, strForWriting); var tagsWriter = new StreamWriter(folderPath, false, Encoding.UTF8); tagsWriter.WriteLine(result); tagsWriter.Flush(); tagsWriter.Close(); }