'Replace strings in txt file by others strings

foreach (var line in File.ReadLines(@"C:\temp\Licence.txt"))
                {
                    if (line.Contains(Produit.ToUpper()))
                    {
                        string text = File.ReadAllText(@"C:\temp\Licence.txt");
                        text = text.Replace("PDF", "STATUS");
                        File.WriteAllText(@"C:\temp\Licence.txt", text);
                        //Search in line ';' and copy it in ID that comes after
                        //Name = Label corresponding to ID
                        string visu = "Label" + " - " + "ID";
                        LicenseItems.Add(new License() { ID = Produit, Name = line, Visu=visu }); 
                    }
                }

Here I have a txt file including several product codes (ex: STARVIEW;138 (138 = ID) STARVIEW;139 WEBSERVICE;144 etc) which are already linked in my code by other products. My goal is to automatically change these "labels" by another txt file including other product codes ( like theses OPIUM - 138 OPIUM - 139 DECADEY - 144) I would like to try to interchange them and replace the ";" by "-" but I can't find a solution for that, my request is rather vague but I can't explain really better due to my lack of experience in programmation :/ thanks a lot in advance !



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source