예제 #1
0
        public static void readFromFile()
        {
            if (!File.Exists(Addendums.File.appPath + "\\settings.tdv"))
            {
                return;
            }

            BinaryReader s = null;

            try
            {
                s = new BinaryReader(new FileStream(Addendums.File.appPath + "\\settings.tdv", FileMode.Open));
                //dump file data into dummy vars so if there's an error, the game options won't contain strange data
                //caused by the stream erroring out unexpectedly.
                //if player is running outdated config, don't error out, just ignore the rest
                float musicVol       = s.ReadSingle();
                bool  announceCourse = s.ReadBoolean();
                bool  rp             = s.ReadBoolean();
                int   announceV      = s.ReadInt32();
                int   bufferS        = s.ReadInt32();
                byte  en             = s.ReadByte();
                int   launchC        = s.ReadInt32();
                int   port           = s.ReadInt32();
                float menuVol        = s.ReadSingle();
                float onlineVol      = s.ReadSingle();
                int   speechSource   = s.ReadInt32();
                int   ho             = s.ReadInt32();
                int   da             = s.ReadInt32();
                int   ye             = s.ReadInt32();

                Common.currentMusicVol    = musicVol;
                announceCourseChange      = announceCourse;
                RPAutoTrigger             = rp;
                verticalRangeAnnounceTime = announceV;
                bufferSize            = (DSound.BufferSize)bufferS;
                enabled               = (Device)en;
                launchCount           = launchC;
                Client.port           = port;
                Common.menuMusicVol   = menuVol;
                Common.onlineMusicVol = onlineVol;
                if (speechSource > 2)
                {
                    speechSource = (int)SapiSpeech.SpeechSource.auto;
                }
                SapiSpeech.setSource((SapiSpeech.SpeechSource)speechSource);
                hour = ho;
                day  = da;
                year = ye;
            }
            catch (Exception e)
            {
                //Ignore the error
                System.Diagnostics.Trace.WriteLine("Error while reading options: " + e.GetBaseException());
                return;
            }
            finally
            {
                s.Close();
            }
        }
예제 #2
0
        public static void readFromFile()
        {
            if (!File.Exists(Addendums.File.appPath + "\\settings.tdv"))
            {
                return;
            }

            BinaryReader s = null;

            try
            {
                s = new BinaryReader(new FileStream(Addendums.File.appPath + "\\settings.tdv", FileMode.Open));
                //dump file data into dummy vars so if there's an error, the game options won't contain strange data
                //caused by the stream erroring out unexpectedly.
                //if player is running outdated config, don't error out, just ignore the rest
                float musicVol = s.ReadSingle();
                Common.musicVolume    = musicVol;
                musicVol              = s.ReadSingle();
                Common.cutSceneVolume = musicVol;
                bool   announceCourse = s.ReadBoolean();
                bool   rp             = s.ReadBoolean();
                int    announceV      = s.ReadInt32();
                byte   en             = s.ReadByte();
                int    launchC        = s.ReadInt32();
                int    port           = s.ReadInt32();
                int    speechSource   = s.ReadInt32();
                int    ho             = s.ReadInt32();
                int    da             = s.ReadInt32();
                int    ye             = s.ReadInt32();
                String ip             = s.ReadString();
                String callSign       = s.ReadString();
                announceCourseChange      = announceCourse;
                RPAutoTrigger             = rp;
                verticalRangeAnnounceTime = announceV;
                enabled     = (Device)en;
                launchCount = launchC;
                Client.port = port;
                if (speechSource > 2)
                {
                    speechSource = (int)SapiSpeech.SpeechSource.auto;
                }
                SapiSpeech.setSource((SapiSpeech.SpeechSource)speechSource);
                hour = ho;
                day  = da;
                year = ye;
                Options.ipOrDomain = ip;
                Options.callSign   = callSign;
                bool pr = s.ReadBoolean();
                playRIO = pr;
                byte sv = s.ReadByte();
                menuVoiceMode   = (VoiceModes)sv;
                sv              = s.ReadByte();
                statusVoiceMode = (VoiceModes)sv;
                float readerRate = s.ReadSingle();
                SapiSpeech.screenReaderRate = readerRate;
            }
            catch (Exception e)
            {
                //Ignore the error
            }
            finally
            {
                s.Close();
            }
        }