Ejemplo n.º 1
0
        private void GetUserSetting()
        {
            string settingPath = BaseDir + @"Resources\setting.cfg";

            try
            {
                MasterVolumeValue = int.Parse(FileOperation.GetSettingValueFromFile(settingPath, "MasterVolume"));
                EffectVolumeValue = int.Parse(FileOperation.GetSettingValueFromFile(settingPath, "EffectVolume"));
                MusicVolumeValue  = int.Parse(FileOperation.GetSettingValueFromFile(settingPath, "MusicVolume"));
            }
            catch (Exception e)
            {
                MessageBoxResult result = MessageBox.Show("Unable to load setting! Would U like to restore default Setting? Detail Problem: \n" + e.ToString(), "Opps Error X.X", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    string output = FileOperation.FileToString(BaseDir + @"Resources\defaultSetting.cfg", EncodingType.UTF8);
                    if (output == "Fail to Gain Access, Pls Close program that use this resources!")
                    {
                        MessageBox.Show("Backup Setting not found or corrupted! Please re-install the game!", "Game Failure (X . X)");
                        Environment.Exit(-1);
                    }
                    byte[] recover = Encoding.Default.GetBytes(output);
                    FileOperation.ByteArraytoFile(BaseDir + @"Resources\setting.cfg", recover, recover.Length);
                    GetUserSetting();
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        private void GetData()
        {
            string s = FileOperation.FileToString(GroupPath + @"\beatmapInfo.bmi", EncodingType.UTF8);

            string[] spString = s.Split('#')[1].Split('\n');
            SongName = spString[1].Substring(6);
            SongName = SongName.Substring(0, SongName.Length - 1);
            Artist   = spString[2].Substring(8);
            Artist   = Artist.Substring(0, Artist.Length - 1);
            Author   = spString[3].Substring(8);
            Author   = Author.Substring(0, Author.Length - 1);
            BPM      = int.Parse(spString[4].Substring(5));
        }
Ejemplo n.º 3
0
 private void SetProperty()
 {
     Logo = BaseDir + @"Resources\Logo.png";
     NewUpdateandBuildDir = BaseDir + @"Resources\BuildNotes.txt";
     NewUpdateContent     = FileOperation.FileToString(NewUpdateandBuildDir, EncodingType.UTF8);
     SongPath             = BaseDir + @"Resources\Songs\";
     SkinsParentpath      = BaseDir + @"Resources\Skins\";
     settingIcon          = new List <BitmapImage>();
     IsSettingPanelOpen   = false;
     GetTextureInformation();
     GetAccountInformation();
     ScreenX               = int.Parse(SystemParameters.PrimaryScreenWidth.ToString());
     ScreenY               = int.Parse(SystemParameters.PrimaryScreenHeight.ToString());
     IsBGMPause            = false;
     NowplayingLength      = 366;
     isShowPernamentlyInfo = true;
     GetUserSetting();
     SongProgress = 50;
 }