Пример #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>Loads the default plugin for the specified train.</summary>
        /// <param name="train">The train to attach the plugin to.</param>
        /// <param name="trainFolder">The train folder.</param>
        /// <returns>Whether the plugin was loaded successfully.</returns>
        internal static bool LoadDefaultPlugin(TrainManager.Train train, string trainFolder)
        {
            string file    = OpenBveApi.Path.CombineFile(Program.FileSystem.GetDataFolder("Plugins"), "OpenBveAts.dll");
            bool   success = LoadPlugin(train, file, trainFolder);

            if (success)
            {
                train.Plugin.IsDefault = true;
                SoundCfgParser.LoadDefaultATSSounds(train, trainFolder);
            }
            return(success);
        }
Пример #3
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)
        {
            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))
                {
                    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);
            }
        }