From 44d910e81c34a07923671b98a2dc512016569439 Mon Sep 17 00:00:00 2001 From: Zefanja Jobse Date: Sun, 22 Sep 2024 17:46:26 +0200 Subject: [PATCH] fix application width after dpi scaling fix and use skip_list instead of a static list. --- PlanningCenter to OPS/Actions/LyricsToFile.cs | 35 +++++++------------ PlanningCenter to OPS/SelectSongs.Designer.cs | 10 +++--- PlanningCenter to OPS/SelectSongs.resx | 4 +-- 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/PlanningCenter to OPS/Actions/LyricsToFile.cs b/PlanningCenter to OPS/Actions/LyricsToFile.cs index a8329dd..2e7bffa 100644 --- a/PlanningCenter to OPS/Actions/LyricsToFile.cs +++ b/PlanningCenter to OPS/Actions/LyricsToFile.cs @@ -11,11 +11,13 @@ namespace PlanningCenter_to_OPS.Actions internal class LyricsToFile { private static readonly string[] removed_if_in_line = { + "Vers", "Vers 1", "Vers 2", "Vers 3", "Vers 4", "Vers 5", + "Verse", "Verse 1", "Verse 2", "Verse 3", @@ -98,38 +100,25 @@ internal static string Lyrics(string lyrics, List skip_list) string previous_line = ""; foreach (string line in current_lyrics) { + string mut_line = line; + foreach (var item in remove_text) + { + mut_line = Regex.Replace(mut_line, item, ""); + } // if value not in RemovedText or if added to skip_list - if (!removed_if_in_line.Any(s => line.ToLower().Contains(s.ToLower())) || skip_list.Any(s => s == line)) + if (!removed_if_in_line.Any(s => mut_line.ToLower().Contains(s.ToLower())) || skip_list.Any(s => s == mut_line)) { - // replace chorus with ops eqivelant - Dictionary translate_to_ops = new Dictionary() { - { "chorus", "Chorus:" }, - { "chorus 1", "Chorus 1:"}, - { "chorus 2", "Chorus 2:"}, - { "chorus 3", "Chorus 3:"}, - { "bridge", "Bridge:" }, - { "bridge 2x", "Bridge 2x:" }, - { "refrein", "Refrein:" }, - { "refrein 1", "Refrein 1:"}, - { "refrein 2", "Refrein 2:"}, - { "refrein 3", "Refrein 3:"}, - }; - - string translated_ops; - if (translate_to_ops.TryGetValue(line.ToLower().Replace(":", ""), out translated_ops)) + // Use skiplist to make it a header item when needed + if (skip_list.Contains(mut_line.Trim().ToLower().Replace(":", "") + ":")) { - cleaned_lyrics += translated_ops + "\r\n"; + cleaned_lyrics += mut_line.Trim() + ":\r\n"; } else { - byte[] bytes = Encoding.ASCII.GetBytes(ReplaceWordChars(line)); + byte[] bytes = Encoding.ASCII.GetBytes(ReplaceWordChars(mut_line)); char[] chars = Encoding.ASCII.GetChars(bytes); string result = new(chars); result = result.Replace("?", ""); - foreach (var item in remove_text) - { - result = Regex.Replace(result, item, ""); - } // skip the line if current and previous result are both empty if (!(previous_line == "" && result == "")) diff --git a/PlanningCenter to OPS/SelectSongs.Designer.cs b/PlanningCenter to OPS/SelectSongs.Designer.cs index 2322436..d6874cd 100644 --- a/PlanningCenter to OPS/SelectSongs.Designer.cs +++ b/PlanningCenter to OPS/SelectSongs.Designer.cs @@ -35,21 +35,19 @@ private void InitializeComponent() // label1 // label1.AutoSize = true; - label1.Location = new System.Drawing.Point(37, 21); - label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + label1.Location = new System.Drawing.Point(18, 10); label1.Name = "label1"; - label1.Size = new System.Drawing.Size(493, 32); + label1.Size = new System.Drawing.Size(241, 15); label1.TabIndex = 0; label1.Text = "Selecteer waar elk lied vandaan moet komen"; // // SelectSongs // - AutoScaleDimensions = new System.Drawing.SizeF(192F, 192F); + AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - ClientSize = new System.Drawing.Size(992, 759); + ClientSize = new System.Drawing.Size(531, 380); Controls.Add(label1); Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); - Margin = new System.Windows.Forms.Padding(6); Name = "SelectSongs"; Text = "Liederen selecteren"; Load += SelectSongs_Load; diff --git a/PlanningCenter to OPS/SelectSongs.resx b/PlanningCenter to OPS/SelectSongs.resx index 3fcc115..645ed82 100644 --- a/PlanningCenter to OPS/SelectSongs.resx +++ b/PlanningCenter to OPS/SelectSongs.resx @@ -1,7 +1,7 @@