From 446d2c4b17c6f88e7ce2095f8b3d1d902b5dd1bd Mon Sep 17 00:00:00 2001 From: KirillGutyrchik Date: Thu, 24 Oct 2024 08:01:32 +0300 Subject: [PATCH] Disable rewrite file --- src/ProjectImportICP/ChannelBaseTransformer.cs | 7 +++---- src/ProjectImportICP/ModifyChannelsDBDialog.cs | 6 +----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/ProjectImportICP/ChannelBaseTransformer.cs b/src/ProjectImportICP/ChannelBaseTransformer.cs index 66668f37..05baf3d8 100644 --- a/src/ProjectImportICP/ChannelBaseTransformer.cs +++ b/src/ProjectImportICP/ChannelBaseTransformer.cs @@ -97,16 +97,15 @@ public static string ModifyID(string newChannelDB, string oldChannelDB, IEnumera .Where(t => t.NewID != null && t.OldID != null) .ToDictionary(j => j.NewID, j => j.Enabled); - - var replaceRegex = new Regex($@"(?<=){string.Join("|", IdToReplaced.Keys)}(?=<\/channels:id>)", - RegexOptions.None, TimeSpan.FromMilliseconds(10000)); - var replaceEnableRegex = new Regex($@"(?<=(?{string.Join("|", IdEnable.Keys)})<\/channels:id>[\d\w\s:]*)0", RegexOptions.None, TimeSpan.FromMilliseconds(10000)); // enable used tags var chbaseWithEnabled = replaceEnableRegex.Replace(newChannelDB, m => IdEnable[m.Groups["id"].Value]); + var replaceRegex = new Regex($@"(?<=){string.Join("|", IdToReplaced.Keys)}(?=<\/channels:id>)", + RegexOptions.None, TimeSpan.FromMilliseconds(10000)); + return replaceRegex.Replace(chbaseWithEnabled, m => IdToReplaced[m.Value]); } diff --git a/src/ProjectImportICP/ModifyChannelsDBDialog.cs b/src/ProjectImportICP/ModifyChannelsDBDialog.cs index e82e70b0..cff00a2c 100644 --- a/src/ProjectImportICP/ModifyChannelsDBDialog.cs +++ b/src/ProjectImportICP/ModifyChannelsDBDialog.cs @@ -137,11 +137,7 @@ private void ModifyBttn_Click(object sender, EventArgs e) // Проверка совпадения индексов ChannelBaseTransformer.CheckChbaseID(modifiedDstChbase); - // Смена названия файла для сохранения, если такой уже существует - var dstSavePath = needExport? - dstPath : Path.Combine(Path.GetDirectoryName(dstPath), Path.GetFileNameWithoutExtension(dstPath) + "_reindex.cdbx"); - - using (var writer = new StreamWriter(dstSavePath, false, Encoding.UTF8)) + using (var writer = new StreamWriter(dstPath, false, Encoding.UTF8)) writer.Write(modifiedDstChbase); Logs.SetProgress(100);