Пример #1
0
        /// <summary>Parses the sound configuration file for a train</summary>
        /// <param name="TrainPath">The absolute on-disk path to the train's folder</param>
        /// <param name="Train">The train to which to apply the new sound configuration</param>
        internal static void ParseSoundConfig(string TrainPath, TrainManager.Train Train)
        {
            Train.InitializeCarSounds();
            SoundCfgParser.LoadDefaultATSSounds(Train, TrainPath);
            string FileName = OpenBveApi.Path.CombineFile(TrainPath, "sound.xml");

            if (System.IO.File.Exists(FileName))
            {
                if (SoundXmlParser.ParseTrain(FileName, Train))
                {
                    Program.FileSystem.AppendToLogFile("Loading sound.xml file: " + FileName);
                    return;
                }
            }
            FileName = OpenBveApi.Path.CombineFile(TrainPath, "sound.cfg");
            if (System.IO.File.Exists(FileName))
            {
                Program.FileSystem.AppendToLogFile("Loading sound.cfg file: " + FileName);
                BVE4SoundParser.Parse(FileName, TrainPath, Train);
            }
            else
            {
                Program.FileSystem.AppendToLogFile("Loading default BVE2 sounds.");
                BVE2SoundParser.Parse(TrainPath, Train);
            }
        }
Пример #2
0
        /// <summary>Parses the sound configuration file for a train</summary>
        /// <param name="TrainPath">The absolute on-disk path to the train's folder</param>
        /// <param name="Encoding">The train's text encoding</param>
        /// <param name="Train">The train to which to apply the new sound configuration</param>
        internal static void ParseSoundConfig(string TrainPath, System.Text.Encoding Encoding, TrainManager.Train Train)
        {
            string FileName = OpenBveApi.Path.CombineFile(TrainPath, "sound.xml");

            if (System.IO.File.Exists(FileName))
            {
                if (SoundXmlParser.ParseTrain(FileName, Train))
                {
                    return;
                }
            }
            FileName = OpenBveApi.Path.CombineFile(TrainPath, "sound.cfg");
            if (System.IO.File.Exists(FileName))
            {
                BVE4SoundParser.Parse(FileName, TrainPath, Encoding, Train);
            }
            else
            {
                BVE2SoundParser.Parse(TrainPath, Train);
            }
        }