예제 #1
0
        public string getSynTime(String teamName, String musicName)
        {
            //return "::"+ teamName+"++"+musicName;
            string result = "ss";

            try
            {
                DbProcess msd = new DbProcess(teamName);
                // 验证是否已存在某条舞团播放信息
                if (msd.getTeam())
                {// true为已存在
                 // 获取音乐播放状态
                    msd.setSyncIdFromTeamName(teamName);
                    if (msd.getMusicState() == 1)
                    {                                         // 1-播放中;0-暂停;-1-默认状态
                     // 获取音乐开始播放日期时间
                        DateTime ts = msd.getStartDateTime(); // 开始播放的日期时间
                        long     s  = StringProcess.ConvertDataTimeLong(DateTime.Now) - StringProcess.ConvertDataTimeLong(ts);

                        return("" + s);//播放进度
                    }
                    else if (msd.getMusicState() == 0)
                    {
                        long s = msd.getPauseTime();
                        return("" + -1);//"已在"+s+"毫秒处暂停";
                    }
                    else
                    {
                        return("" + -2);//"播放状态错误";
                    }
                }
                else
                {
                    // 添加
                    System.Diagnostics.Debug.Write(msd.getTeam());
                    if (msd.addNewMusic(musicName))
                    {
                        return("" + 0); //"已添加成功";
                    }
                    return("" + -3);    //"添加失败";
                }
            }
            catch (Exception e)
            {
                result = 2017 + e.ToString();
            }
            return(result);
        }