Example #1
0
 internal void ChangeUserVolume(SongInformation songInfo, int userVolume)
 {
     ExecuteDataTable("update ScoreTable set uservolume = @uservolume where scoreid = @scoreid;", new SQLiteParameter[] {
         new SQLiteParameter("@scoreid", songInfo.ID),
         new SQLiteParameter("@uservolume", userVolume)
     });
 }
Example #2
0
 internal void ChangeLatency(SongInformation songInfo, float latency)
 {
     ExecuteDataTable("update ScoreTable set latency = @latency where scoreid = @scoreid;", new SQLiteParameter[] {
         new SQLiteParameter("@scoreid", songInfo.ID),
         new SQLiteParameter("@latency", latency)
     });
 }
Example #3
0
 /// <summary>
 /// SongInformationからリザルトを取得します
 /// </summary>
 /// <param name="songInfo"></param>
 /// <returns></returns>
 public static ResultInfo[] GetInfoFromSongInformation(SongInformation songInfo)
 {
     if (songInfo == null || !songInfo.IsPPDSong)
     {
         return(new ResultInfo[0]);
     }
     return(PPDDatabase.DB.GetResults(songInfo.ID));
 }
Example #4
0
 /// <summary>
 /// 更新します。
 /// </summary>
 public static void Update(SongInformation[] songInformations)
 {
     root = null;
     PPDDatabase.DB.Update(false, songInformations);
     if (Updated != null)
     {
         Updated.Invoke(null, EventArgs.Empty);
     }
 }
Example #5
0
        private static SongInformation AnalyzeEVD(string path, SongInformation si, Difficulty difficulty)
        {
            try
            {
                IEVDData[] data = null;
                if (si.IsOld)
                {
                    data = EVDReader.Read(path);
                }
                else
                {
                    var pr    = new PackReader(path);
                    var pppsr = pr.Read("evd");
                    data = EVDReader.Read(pppsr);
                    pr.Close();
                }
                foreach (ChangeVolumeEvent evddata in Array.FindAll(data, (evd) => (evd is ChangeVolumeEvent)))
                {
                    if (evddata.Channel == 0 && evddata.Time == 0)
                    {
                        si.MovieVolume = -100 * (100 - evddata.Volume);
                        break;
                    }
                }
                foreach (ChangeNoteTypeEvent evddata in Array.FindAll(data, (evd) => (evd is ChangeNoteTypeEvent)))
                {
                    if (evddata.NoteType == NoteType.AC || evddata.NoteType == NoteType.ACFT)
                    {
                        switch (difficulty)
                        {
                        case PPDFrameworkCore.Difficulty.Easy:
                            si.EasyNoteType = evddata.NoteType;
                            break;

                        case PPDFrameworkCore.Difficulty.Normal:
                            si.NormalNoteType = evddata.NoteType;
                            break;

                        case PPDFrameworkCore.Difficulty.Hard:
                            si.HardNoteType = evddata.NoteType;
                            break;

                        case PPDFrameworkCore.Difficulty.Extreme:
                            si.ExtremeNoteType = evddata.NoteType;
                            break;
                        }
                        break;
                    }
                }
            }
            catch
            {
            }
            return(si);
        }
Example #6
0
 internal void RemoveUnconnectedLinks()
 {
     foreach (LogicFolderInfomation info in LogicFolderInfomation.All)
     {
         var songInfo = SongInformation.FindSongInformationByID(info.ScoreID);
         if (songInfo == null)
         {
             info.Remove();
         }
     }
 }
Example #7
0
        private static LogicFolderInfomation AddScore(LogicFolderInfomation parent, SongInformation si, string linkName)
        {
            if (parent == null || si == null || !parent.IsFolder || !si.IsPPDSong)
            {
                return(null);
            }
            PPDDatabase.DB.ExecuteDataTable("insert into LogicFolder(scoreid,isfolder,name,date) values(@scoreid,@isfolder,@name,@date);", new SQLiteParameter[] {
                new SQLiteParameter("@scoreid", si.ID), new SQLiteParameter("@isfolder", "0"), new SQLiteParameter("@name", linkName), new SQLiteParameter("@date", DateTime.Now.ToString(CultureInfo.InvariantCulture))
            });
            var newscore = new LogicFolderInfomation();

            using (var reader = PPDDatabase.DB.ExecuteReader("select * from LogicFolder where ROWID = last_insert_rowid();", null))
            {
                while (reader.Reader.Read())
                {
                    newscore.ID       = reader.Reader.GetInt32(0);
                    newscore.IsFolder = reader.Reader.GetInt32(2) == 1;
                    newscore.Name     = reader.Reader.GetString(3);
                    newscore.ScoreID  = reader.Reader.GetInt32(1);
                    newscore.DateTime = DateTime.Parse(reader.Reader.GetString(5), CultureInfo.InvariantCulture);
                    newscore.parent   = parent;
                    newscore.Depth    = parent.Depth + 1;
                    parent.ChildrenList.Add(newscore);
                    break;
                }
            }
            if (newscore != null)
            {
                var ids = PPDDatabase.ParseStringToList(parent.ChildIDs);
                ids.Add(newscore.ID);
                parent.ChildIDs = PPDDatabase.ConverListToString(ids);
                UpdateChildIDs(parent.ChildIDs, parent.ID);
            }
            StaticAfterAdd?.Invoke(newscore, EventArgs.Empty);
            return(newscore);
        }
Example #8
0
 /// <summary>
 /// 譜面のリンクを追加します
 /// </summary>
 /// <param name="si"></param>
 /// <param name="linkName"></param>
 /// <returns></returns>
 public LogicFolderInfomation AddScore(SongInformation si, string linkName)
 {
     return(AddScore(this, si, linkName));
 }
Example #9
0
 /// <summary>
 /// 譜面のリンクを追加します
 /// </summary>
 /// <param name="si"></param>
 public LogicFolderInfomation AddScore(SongInformation si)
 {
     return(AddScore(si, si.DirectoryName));
 }
Example #10
0
 private static LogicFolderInfomation AddScore(LogicFolderInfomation parent, SongInformation si)
 {
     return(AddScore(parent, si, si.DirectoryName));
 }
Example #11
0
        /// <summary>
        /// 指定したフォルダの譜面情報を取得します。(使わないでください)
        /// </summary>
        /// <param name="directory"></param>
        /// <returns></returns>
        public static SongInformation ReadData(string directory)
        {
            var ret = new SongInformation
            {
                loadFromDir   = true,
                ID            = -1,
                DirectoryPath = directory,
                MoviePath     = FindMovieFile(directory)
            };

            if (File.Exists(Path.Combine(directory, "easy.ppd")))
            {
                ret.Difficulty |= AvailableDifficulty.Easy;
            }
            if (File.Exists(Path.Combine(directory, "normal.ppd")))
            {
                ret.Difficulty |= AvailableDifficulty.Normal;
            }
            if (File.Exists(Path.Combine(directory, "hard.ppd")))
            {
                ret.Difficulty |= AvailableDifficulty.Hard;
            }
            if (File.Exists(Path.Combine(directory, "extreme.ppd")))
            {
                ret.Difficulty |= AvailableDifficulty.Extreme;
            }
            if (File.Exists(Path.Combine(directory, "data.ini")))
            {
                using (StreamReader sr = new StreamReader(Path.Combine(directory, "data.ini")))
                {
                    var ss      = sr.ReadToEnd();
                    var setting = new SettingReader(ss);
                    ret.IsOld = !setting.IsIniFormat;
                    if (!float.TryParse(setting.ReadString("bpm"), NumberStyles.Float, CultureInfo.InvariantCulture, out ret.bpm))
                    {
                        ret.bpm = 100;
                    }
                    ret.BPMString           = setting.ReadString("bpmstring");
                    ret.difficultystring[0] = setting.ReadString("difficulty easy");
                    ret.difficultystring[1] = setting.ReadString("difficulty normal");
                    ret.difficultystring[2] = setting.ReadString("difficulty hard");
                    ret.difficultystring[3] = setting.ReadString("difficulty extreme");
                    ret.AuthorName          = setting.ReadString("authorname");
                    float.TryParse(setting.ReadString("moviecutleft"), NumberStyles.Float, CultureInfo.InvariantCulture, out float left);
                    float.TryParse(setting.ReadString("moviecutright"), NumberStyles.Float, CultureInfo.InvariantCulture, out float right);
                    float.TryParse(setting.ReadString("moviecuttop"), NumberStyles.Float, CultureInfo.InvariantCulture, out float top);
                    float.TryParse(setting.ReadString("moviecutbottom"), NumberStyles.Float, CultureInfo.InvariantCulture, out float bottom);
                    ret.TrimmingData = new MovieTrimmingData(top, left, right, bottom);
                    float.TryParse(setting.ReadString("thumbtimestart"), NumberStyles.Float, CultureInfo.InvariantCulture, out ret.thumbstarttime);
                    float.TryParse(setting.ReadString("thumbtimeend"), NumberStyles.Float, CultureInfo.InvariantCulture, out ret.thumbendtime);
                    float.TryParse(setting.ReadString("start"), NumberStyles.Float, CultureInfo.InvariantCulture, out ret.starttime);
                    float.TryParse(setting.ReadString("end"), NumberStyles.Float, CultureInfo.InvariantCulture, out ret.endtime);
                    // float.TryParse(setting["latency"], NumberStyles.Float, CultureInfo.InvariantCulture, out ret.latency);
                    ret.GUID  = setting.ReadString("guid");
                    ret.IsOld = !setting.IsIniFormat;
                }
            }
            else
            {
                MessageBox.Show("there is no data.ini in " + directory);
            }

            ret.EasyHash    = GetHash(Path.Combine(directory, "easy.ppd"));
            ret.NormalHash  = GetHash(Path.Combine(directory, "normal.ppd"));
            ret.HardHash    = GetHash(Path.Combine(directory, "hard.ppd"));
            ret.ExtremeHash = GetHash(Path.Combine(directory, "extreme.ppd"));


            ret.MovieVolume = -1000;
            //read .evd
            foreach (AvailableDifficulty difficulty in DifficultyArray)
            {
                if (difficulty != AvailableDifficulty.None)
                {
                    string filePath = ret.IsOld ? Path.Combine(directory, difficulty + ".evd") : Path.Combine(directory, difficulty + ".ppd");
                    if (File.Exists(filePath) && (ret.Difficulty & difficulty) == difficulty)
                    {
                        ret = AnalyzeEVD(filePath, ret, ConvertAvailable(difficulty));
                    }
                }
            }
            return(ret);
        }
Example #12
0
        private static SongInformation[] GetFromDirectory(string directory)
        {
            if (!Directory.Exists(directory))
            {
                return(new SongInformation[0]);
            }

            var list = new List <SongInformation>(10);

            using (var reader = PPDDatabase.DB.ExecuteReader("select * from ScoreTable where parentpath = @parentpath", new SQLiteParameter[] { new SQLiteParameter("@parentpath", directory) }))
            {
                while (reader.Reader.Read())
                {
                    try
                    {
                        var si = new SongInformation
                        {
                            IsPPDSong     = DatabaseUtility.GetInt32(reader.Reader, 26) == 1,
                            ID            = DatabaseUtility.GetInt32(reader.Reader, 0),
                            DirectoryPath = reader.Reader.GetString(1)
                        };
                        if (si.IsPPDSong)
                        {
                            si.ThumbStartTime   = DatabaseUtility.GetFloat(reader.Reader, 2);
                            si.ThumbEndTime     = DatabaseUtility.GetFloat(reader.Reader, 3);
                            si.StartTime        = DatabaseUtility.GetFloat(reader.Reader, 4);
                            si.EndTime          = DatabaseUtility.GetFloat(reader.Reader, 5);
                            si.BPM              = DatabaseUtility.GetFloat(reader.Reader, 6);
                            si.difficultystring = new string[] {
                                reader.Reader.GetString(7),
                                reader.Reader.GetString(8),
                                reader.Reader.GetString(9),
                                reader.Reader.GetString(10)
                            };
                            si.Difficulty |= DatabaseUtility.GetInt32(reader.Reader, 11) == 1 ? AvailableDifficulty.Easy : AvailableDifficulty.None;
                            si.Difficulty |= DatabaseUtility.GetInt32(reader.Reader, 12) == 1 ? AvailableDifficulty.Normal : AvailableDifficulty.None;
                            si.Difficulty |= DatabaseUtility.GetInt32(reader.Reader, 13) == 1 ? AvailableDifficulty.Hard : AvailableDifficulty.None;
                            si.Difficulty |= DatabaseUtility.GetInt32(reader.Reader, 14) == 1 ? AvailableDifficulty.Extreme : AvailableDifficulty.None;
                            si.resultIDs   = new int[] {
                                DatabaseUtility.GetInt32(reader.Reader, 15),
                                DatabaseUtility.GetInt32(reader.Reader, 16),
                                DatabaseUtility.GetInt32(reader.Reader, 17),
                                DatabaseUtility.GetInt32(reader.Reader, 18)
                            };
                            si.TrimmingData = new MovieTrimmingData(
                                DatabaseUtility.GetFloat(reader.Reader, 21),
                                DatabaseUtility.GetFloat(reader.Reader, 19),
                                DatabaseUtility.GetFloat(reader.Reader, 20),
                                DatabaseUtility.GetFloat(reader.Reader, 22)
                                );
                            si.GUID            = reader.Reader.GetString(23);
                            si.AuthorName      = reader.Reader.GetString(24);
                            si.UpdateDate      = reader.Reader.GetString(25);
                            si.MovieVolume     = DatabaseUtility.GetInt32(reader.Reader, 27);
                            si.moviepath       = reader.Reader.GetString(28);
                            si.ParentDirectory = reader.Reader.GetString(29);
                            si.IsOld           = DatabaseUtility.GetInt32(reader.Reader, 30) == 1;
                            si.Latency         = DatabaseUtility.GetFloat(reader.Reader, 31);

                            if ((si.Difficulty & AvailableDifficulty.Easy) == AvailableDifficulty.Easy)
                            {
                                si.EasyHash = new byte[32];
                                reader.Reader.GetBytes(32, 0, si.EasyHash, 0, 32);
                            }
                            if ((si.Difficulty & AvailableDifficulty.Normal) == AvailableDifficulty.Normal)
                            {
                                si.NormalHash = new byte[32];
                                reader.Reader.GetBytes(33, 0, si.NormalHash, 0, 32);
                            }
                            if ((si.Difficulty & AvailableDifficulty.Hard) == AvailableDifficulty.Hard)
                            {
                                si.HardHash = new byte[32];
                                reader.Reader.GetBytes(34, 0, si.HardHash, 0, 32);
                            }
                            if ((si.Difficulty & AvailableDifficulty.Extreme) == AvailableDifficulty.Extreme)
                            {
                                si.ExtremeHash = new byte[32];
                                reader.Reader.GetBytes(35, 0, si.ExtremeHash, 0, 32);
                            }
                            si.EasyNoteType    = (NoteType)DatabaseUtility.GetInt32(reader.Reader, 36);
                            si.NormalNoteType  = (NoteType)DatabaseUtility.GetInt32(reader.Reader, 37);
                            si.HardNoteType    = (NoteType)DatabaseUtility.GetInt32(reader.Reader, 38);
                            si.ExtremeNoteType = (NoteType)DatabaseUtility.GetInt32(reader.Reader, 39);
                            si.BPMString       = reader.Reader.GetString(40);
                            si.UserVolume      = DatabaseUtility.GetInt32(reader.Reader, 41);
                        }
                        list.Add(si);
                    }
                    catch
                    {
                    }
                }
            }
            foreach (SongInformation si in list)
            {
                si.UpdateScore();
            }
            list.Sort(new SongInformationComparer());
            return(list.ToArray());
        }
Example #13
0
 /// <summary>
 /// 譜面からストレージを取得します。
 /// </summary>
 /// <param name="songInfo"></param>
 /// <returns></returns>
 public static ScoreStorage GetStorageFromSongInformation(SongInformation songInfo)
 {
     return(PPDDatabase.DB.GetScoreStorage(songInfo.ID));
 }
Example #14
0
        internal bool WriteScore(int scoreID, Difficulty difficulty, int[] counts, int maxcombo, int score, ResultEvaluateType resulttype, float finishtime, SongInformation songInfo)
        {
            bool highscore   = false;
            int  bestscoreid = -1;

            using (var reader = ExecuteReader("select * from ScoreTable where scoreid = @scoreid;", new SQLiteParameter[] { new SQLiteParameter("@scoreid", scoreID) }))
            {
                while (reader.Reader.Read())
                {
                    switch (difficulty)
                    {
                    case Difficulty.Easy:
                        bestscoreid = reader.Reader.GetInt32(15);
                        break;

                    case Difficulty.Normal:
                        bestscoreid = reader.Reader.GetInt32(16);
                        break;

                    case Difficulty.Hard:
                        bestscoreid = reader.Reader.GetInt32(17);
                        break;

                    case Difficulty.Extreme:
                        bestscoreid = reader.Reader.GetInt32(18);
                        break;
                    }
                    break;
                }
            }
            if (bestscoreid != -1)
            {
                using (var reader = ExecuteReader("select * from ResultTable where resultid = @resultid;", new SQLiteParameter[] { new SQLiteParameter("@resultid", bestscoreid) }))
                {
                    while (reader.Reader.Read())
                    {
                        var bestscore  = reader.Reader.GetInt32(4);
                        var bestcounts = new int[] {
                            reader.Reader.GetInt32(5),
                            reader.Reader.GetInt32(6),
                            reader.Reader.GetInt32(7),
                            reader.Reader.GetInt32(8),
                            reader.Reader.GetInt32(9)
                        };
                        var bestmaxcombo = reader.Reader.GetInt32(10);
                        highscore = IsHighScore(score, counts, maxcombo, bestscore, bestcounts, bestmaxcombo);
                    }
                }
            }
            else
            {
                highscore = true;
            }
            highscore = highscore && resulttype != ResultEvaluateType.Mistake;
            var resultId = (int)ExecuteDataTable(@"insert into ResultTable(
                                   scoreid,
                                   difficulty,
                                   evaluate,
                                   score,
                                   coolcount,
                                   goodcount,
                                   safecount,
                                   sadcount,
                                   worstcount,
                                   maxcombo,
                                   finishtime,
                                   date
                                ) values(
                                   @scoreid,
                                   @difficulty,
                                   @evaluate,
                                   @score,
                                   @coolcount,
                                   @goodcount,
                                   @safecount,
                                   @sadcount,
                                   @worstcount,
                                   @maxcombo,
                                   @finishtime,
                                   @date
                                );", new SQLiteParameter[] {
                new SQLiteParameter("@scoreid", scoreID),
                new SQLiteParameter("@difficulty", (int)difficulty),
                new SQLiteParameter("@evaluate", (int)resulttype),
                new SQLiteParameter("@score", score),
                new SQLiteParameter("@coolcount", counts[0]),
                new SQLiteParameter("@goodcount", counts[1]),
                new SQLiteParameter("@safecount", counts[2]),
                new SQLiteParameter("@sadcount", counts[3]),
                new SQLiteParameter("@worstcount", counts[4]),
                new SQLiteParameter("@maxcombo", maxcombo),
                new SQLiteParameter("@finishtime", finishtime),
                new SQLiteParameter("@date", DateTime.Now.ToString(CultureInfo.InvariantCulture))
            });

            if (highscore)
            {
                ExecuteDataTable("update ScoreTable set " + GetSQLColumn(difficulty) + " = @resultid where scoreid = @scoreid;", new SQLiteParameter[] {
                    new SQLiteParameter("@scoreid", scoreID),
                    new SQLiteParameter("@resultid", resultId)
                });
                songInfo.resultIDs[(int)difficulty] = resultId;
                songInfo.UpdateScore();
            }
            return(highscore);
        }
Example #15
0
        private void UpdatePPDSongInformation(string dir, string parentdir, bool forceUpdate, out bool hasppd, List <ModifiedPPDScoreInfo> addedScoreInfo, SongInformation[] songInfos)
        {
            hasppd = false;
            var time = Directory.GetLastWriteTime(dir);

            // check files
            if (!CheckPPDDirectory(dir))
            {
                foreach (string childdir in Directory.GetDirectories(dir))
                {
                    UpdatePPDSongInformation(childdir, dir, forceUpdate, out bool temp, addedScoreInfo, songInfos);
                    hasppd |= temp;
                }
                if (hasppd)
                {
                    IsUpdatedDirectory(dir, time.ToString(CultureInfo.InvariantCulture), out bool IsExistDir);
                    if (!IsExistDir)
                    {
                        ExecuteDataTable("insert into ScoreTable(directorypath,isppd,parentpath,updatedate) values(@dir,@isppd,@parentdir,@updatedate);", new SQLiteParameter[] {
                            new SQLiteParameter("@dir", dir),
                            new SQLiteParameter("@isppd", "0"),
                            new SQLiteParameter("@parentdir", parentdir),
                            new SQLiteParameter("@updatedate", time.ToString(CultureInfo.InvariantCulture))
                        });
                    }
                }
                else
                {
                    // PPDの譜面がないフォルダ
                    // DBにフォルダがある場合はそのデータを削除
                    ExecuteDataTable("delete from ScoreTable where directorypath == @dir", new SQLiteParameter[] {
                        new SQLiteParameter("@dir", dir)
                    });
                }
            }
            else
            {
                hasppd = true;
                if (File.Exists(Path.Combine(dir, "data.ini")))
                {
                    time = GetLastFileTime(Path.Combine(dir, "data.ini"));
                }
                bool shouldUpdate = (IsUpdatedDirectory(dir, time.ToString(CultureInfo.InvariantCulture), out bool IsExistDir) || forceUpdate) || (songInfos != null && songInfos.FirstOrDefault(s => s.DirectoryPath.ToLower() == dir.ToLower()) != null);
                if (!shouldUpdate)
                {
                    return;
                }
                var info = SongInformation.ReadData(dir);
                if (!IsExistDir)
                {
                    ExecuteDataTable(@"insert into ScoreTable(
                                directorypath,
                                thumbtimestart,
                                thumbtimeend,
                                start,
                                end,
                                bpm,
                                difficultyeasy,
                                difficultynormal,
                                difficultyhard,
                                difficultyextreme,
                                availableeasy,
                                availablenormal,
                                availablehard,
                                availableextreme,
                                moviecutleft,
                                moviecutright,
                                moviecuttop,
                                moviecutbottom,
                                guid,
                                authorname,
                                updatedate,
                                isppd,
                                movievolume,
                                moviepath,
                                parentpath,
                                isold,
                                latency,
                                easyhash,
                                normalhash,
                                hardhash,
                                extremehash,
                                isaceasy,
                                isacnormal,
                                isachard,
                                isacextreme,
                                bpmstring
                        ) values(
                                @directorypath,
                                @thumbtimestart,
                                @thumbtimeend,
                                @start,
                                @end,
                                @bpm,
                                @difficultyeasy,
                                @difficultynormal,
                                @difficultyhard,
                                @difficultyextreme,
                                @availableeasy,
                                @availablenormal,
                                @availablehard,
                                @availableextreme,
                                @moviecutleft,
                                @moviecutright,
                                @moviecuttop,
                                @moviecutbottom,
                                @guid,
                                @authorname,
                                @updatedate,
                                @isppd,
                                @movievolume,
                                @moviepath,
                                @parentpath,
                                @isold,
                                @latency,
                                @easyhash,
                                @normalhash,
                                @hardhash,
                                @extremehash,
                                @isaceasy,
                                @isacnormal,
                                @isachard,
                                @isacextreme,
                                @bpmstring
                            );", new SQLiteParameter[] {
                        new SQLiteParameter("@directorypath", dir),
                        new SQLiteParameter("@thumbtimestart", info.ThumbStartTime),
                        new SQLiteParameter("@thumbtimeend", info.ThumbEndTime),
                        new SQLiteParameter("@start", info.StartTime),
                        new SQLiteParameter("@end", info.EndTime),
                        new SQLiteParameter("@bpm", info.BPM),
                        new SQLiteParameter("@difficultyeasy", info.GetDifficultyString(Difficulty.Easy)),
                        new SQLiteParameter("@difficultynormal", info.GetDifficultyString(Difficulty.Normal)),
                        new SQLiteParameter("@difficultyhard", info.GetDifficultyString(Difficulty.Hard)),
                        new SQLiteParameter("@difficultyextreme", info.GetDifficultyString(Difficulty.Extreme)),
                        new SQLiteParameter("@availableeasy", (info.Difficulty & SongInformation.AvailableDifficulty.Easy) == SongInformation.AvailableDifficulty.Easy?1:0),
                        new SQLiteParameter("@availablenormal", (info.Difficulty & SongInformation.AvailableDifficulty.Normal) == SongInformation.AvailableDifficulty.Normal?1:0),
                        new SQLiteParameter("@availablehard", (info.Difficulty & SongInformation.AvailableDifficulty.Hard) == SongInformation.AvailableDifficulty.Hard?1:0),
                        new SQLiteParameter("@availableextreme", (info.Difficulty & SongInformation.AvailableDifficulty.Extreme) == SongInformation.AvailableDifficulty.Extreme?1:0),
                        new SQLiteParameter("@moviecutleft", info.TrimmingData.Left),
                        new SQLiteParameter("@moviecutright", info.TrimmingData.Right),
                        new SQLiteParameter("@moviecuttop", info.TrimmingData.Top),
                        new SQLiteParameter("@moviecutbottom", info.TrimmingData.Bottom),
                        new SQLiteParameter("@guid", info.GUID),
                        new SQLiteParameter("@authorname", info.AuthorName),
                        new SQLiteParameter("@updatedate", time.ToString(CultureInfo.InvariantCulture)),
                        new SQLiteParameter("@isppd", 1),
                        new SQLiteParameter("@movievolume", info.MovieVolume),
                        new SQLiteParameter("@moviepath", info.MoviePath),
                        new SQLiteParameter("@parentpath", parentdir),
                        new SQLiteParameter("@isold", info.IsOld?1:0),
                        new SQLiteParameter("@latency", info.Latency),
                        new SQLiteParameter("@easyhash", info.EasyHash),
                        new SQLiteParameter("@normalhash", info.NormalHash),
                        new SQLiteParameter("@hardhash", info.HardHash),
                        new SQLiteParameter("@extremehash", info.ExtremeHash),
                        new SQLiteParameter("@isaceasy", (int)info.EasyNoteType),
                        new SQLiteParameter("@isacnormal", (int)info.NormalNoteType),
                        new SQLiteParameter("@isachard", (int)info.HardNoteType),
                        new SQLiteParameter("@isacextreme", (int)info.ExtremeNoteType),
                        new SQLiteParameter("@bpmstring", info.BPMString)
                    });
                }
                else
                {
                    ExecuteDataTable(@"update ScoreTable set
                                thumbtimestart     =@thumbtimestart,
                                thumbtimeend       =@thumbtimeend,
                                start              =@start,
                                end                =@end,
                                bpm                =@bpm,
                                difficultyeasy     =@difficultyeasy,
                                difficultynormal   =@difficultynormal,
                                difficultyhard     =@difficultyhard,
                                difficultyextreme  =@difficultyextreme,
                                availableeasy      =@availableeasy,
                                availablenormal    =@availablenormal,
                                availablehard      =@availablehard,
                                availableextreme   =@availableextreme,
                                moviecutleft       =@moviecutleft,
                                moviecutright      =@moviecutright,
                                moviecuttop        =@moviecuttop ,
                                moviecutbottom     =@moviecutbottom,
                                guid               =@guid,
                                authorname         =@authorname,
                                updatedate         =@updatedate,
                                isppd              =@isppd,
                                movievolume        =@movievolume,
                                moviepath          =@moviepath,
                                parentpath         =@parentpath,
                                isold              =@isold,
                                easyhash           =@easyhash,
                                normalhash         =@normalhash,
                                hardhash           =@hardhash,
                                extremehash        =@extremehash,
                                isaceasy           =@isaceasy,
                                isacnormal         =@isacnormal,
                                isachard           =@isachard,
                                isacextreme        =@isacextreme,
                                bpmstring          =@bpmstring
                        where directorypath = @directorypath;", new SQLiteParameter[] {
                        new SQLiteParameter("@directorypath", dir),
                        new SQLiteParameter("@thumbtimestart", info.ThumbStartTime),
                        new SQLiteParameter("@thumbtimeend", info.ThumbEndTime),
                        new SQLiteParameter("@start", info.StartTime),
                        new SQLiteParameter("@end", info.EndTime),
                        new SQLiteParameter("@bpm", info.BPM),
                        new SQLiteParameter("@difficultyeasy", info.GetDifficultyString(Difficulty.Easy)),
                        new SQLiteParameter("@difficultynormal", info.GetDifficultyString(Difficulty.Normal)),
                        new SQLiteParameter("@difficultyhard", info.GetDifficultyString(Difficulty.Hard)),
                        new SQLiteParameter("@difficultyextreme", info.GetDifficultyString(Difficulty.Extreme)),
                        new SQLiteParameter("@availableeasy", (info.Difficulty & SongInformation.AvailableDifficulty.Easy) == SongInformation.AvailableDifficulty.Easy?1:0),
                        new SQLiteParameter("@availablenormal", (info.Difficulty & SongInformation.AvailableDifficulty.Normal) == SongInformation.AvailableDifficulty.Normal?1:0),
                        new SQLiteParameter("@availablehard", (info.Difficulty & SongInformation.AvailableDifficulty.Hard) == SongInformation.AvailableDifficulty.Hard?1:0),
                        new SQLiteParameter("@availableextreme", (info.Difficulty & SongInformation.AvailableDifficulty.Extreme) == SongInformation.AvailableDifficulty.Extreme?1:0),
                        new SQLiteParameter("@moviecutleft", info.TrimmingData.Left),
                        new SQLiteParameter("@moviecutright", info.TrimmingData.Right),
                        new SQLiteParameter("@moviecuttop", info.TrimmingData.Top),
                        new SQLiteParameter("@moviecutbottom", info.TrimmingData.Bottom),
                        new SQLiteParameter("@guid", info.GUID),
                        new SQLiteParameter("@authorname", info.AuthorName),
                        new SQLiteParameter("@updatedate", time.ToString(CultureInfo.InvariantCulture)),
                        new SQLiteParameter("@isppd", 1),
                        new SQLiteParameter("@movievolume", info.MovieVolume),
                        new SQLiteParameter("@moviepath", info.MoviePath),
                        new SQLiteParameter("@parentpath", parentdir),
                        new SQLiteParameter("@isold", info.IsOld?1:0),
                        new SQLiteParameter("@easyhash", info.EasyHash),
                        new SQLiteParameter("@normalhash", info.NormalHash),
                        new SQLiteParameter("@hardhash", info.HardHash),
                        new SQLiteParameter("@extremehash", info.ExtremeHash),
                        new SQLiteParameter("@isaceasy", (int)info.EasyNoteType),
                        new SQLiteParameter("@isacnormal", (int)info.NormalNoteType),
                        new SQLiteParameter("@isachard", (int)info.HardNoteType),
                        new SQLiteParameter("@isacextreme", (int)info.ExtremeNoteType),
                        new SQLiteParameter("@bpmstring", info.BPMString)
                    });
                }
                using (var reader = ExecuteReader("select * from ScoreTable where directorypath = @directorypath;",
                                                  new SQLiteParameter[] { new SQLiteParameter("@directorypath", dir) }))
                {
                    while (reader.Reader.Read())
                    {
                        var index = reader.Reader.GetInt32(0);
                        var guid  = reader.Reader.GetString(23);
                        if (!IsExistDir)
                        {
                            var mppdsi = new ModifiedPPDScoreInfo(index, guid)
                            {
                                EasyHash    = info.EasyHash,
                                NormalHash  = info.NormalHash,
                                HardHash    = info.HardHash,
                                ExtremeHash = info.ExtremeHash
                            };
                            addedScoreInfo.Add(mppdsi);
                        }
                        break;
                    }
                }
            }
        }
Example #16
0
 /// <summary>
 /// 書き込みます
 /// </summary>
 /// <param name="scoreID"></param>
 /// <param name="difficulty"></param>
 /// <param name="counts"></param>
 /// <param name="maxcombo"></param>
 /// <param name="score"></param>
 /// <param name="resulttype"></param>
 /// <param name="finishtime"></param>
 /// <param name="songInfo"></param>
 /// <returns></returns>
 public static bool WriteScore(int scoreID, Difficulty difficulty, int[] counts, int maxcombo, int score, ResultEvaluateType resulttype, float finishtime, SongInformation songInfo)
 {
     return(PPDDatabase.DB.WriteScore(scoreID, difficulty, counts, maxcombo, score, resulttype, finishtime, songInfo));
 }