void Save(string language, string addOn)
        {
            string captionFile =
                System.IO.Path.Combine(Steam.SteamData.GetHLAInstallFolder(), Steam.SteamData.HLAWIPAddonGamePath,
                                       addOn, Steam.SteamData.CaptionFolder, string.Format(Steam.SteamData.CaptionFormat, language + "_custom"));

            ClosedCaptions captionsList  = new ClosedCaptions();
            ClosedCaptions workingCCList = new ClosedCaptions();
            //First load in all the game captions for the selected language.


            string gameCaptionFile = System.IO.Path.Combine(Steam.SteamData.GetHLAInstallFolder(), @"game\hlvr",
                                                            Steam.SteamData.CaptionFolder, string.Format(Steam.SteamData.CaptionFormat, language));

            using (var stream = new FileStream(gameCaptionFile, FileMode.Open, FileAccess.Read))
            {
                captionsList.Read(stream);
            }

            foreach (var caption in Captions)
            {
                workingCCList.Add(caption.Caption);
                captionsList.Add(caption.Caption);
            }
            captionsList.Write(captionFile);
            string workingCaptionFile = System.IO.Path.Combine(Steam.SteamData.GetHLAInstallFolder(), Steam.SteamData.HLAWIPAddonGamePath,
                                                               addOn, Steam.SteamData.CaptionFolder, string.Format(workingCCFileFormat, language + "_custom"));

            workingCCList.Write(workingCaptionFile);

            MessageBox.Show("Captions saved as: " + captionFile + "\r\nWorking caption file: " + workingCaptionFile);
        }
예제 #2
0
        public static void WriteCaptionFile(ClosedCaptions captions, string filename)
        {
            // Need a better way to clear the file
            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            captions.Write(filename);
            Console.WriteLine("Wrote new caption file:");
            Console.WriteLine(Path.GetFullPath(filename));
        }