如题~分不够再给。有能力的情况下给分给到满意为止~

解决方案 »

  1.   

    用一个Timer可以了,根据当前播放的时间读取歌词文件中的每行开头的时间,时间比对一致的话就显示该行歌词就行了。 
    当然Timer的Interval要设置的间隔小一点喽
      

  2.   

    4楼的兄弟~我说的LCR并不是歌词~而是modbus协议中使用的校验码算法。
      

  3.   


         public string LRC(string str) 
            {            
                int d_lrc = 0; 
                string h_lrc = ""; 
                int l = str.Length; 
                for (int c = 0; c < l; c = c + 2) 
                { 
                    string c_data = str.Substring(c, 2); 
                    d_lrc = d_lrc +Convert.ToInt32(c_data); 
                } 
                if (d_lrc >= 16) 
                    d_lrc = d_lrc%16; 
                h_lrc = Convert.ToInt32(~d_lrc + 1).ToString("X"); 
                if (h_lrc.Length > 2) 
                    h_lrc = h_lrc.Substring (h_lrc .Length -2,2); 
                return h_lrc; 
            }读书的时候记得,现在都忘了,这是网上找的,你看看对不
      

  4.   

      static byte LRC(byte[] data)
      {
        byte lrc = 0;
        foreach (byte c in data)
        {
          lrc += c;
        }
        return (byte)-lrc;  
      }
      

  5.   


            public static string checkSum(string writeUncheck)
            {
                char[] hexArray = new char[writeUncheck.Length];
                hexArray = writeUncheck.ToCharArray();
                int decNum = 0, decNumMSB= 0, decNumLSB = 0;
                int decByte, decByteTotal = 0;            bool msb = true;
                
                for( int t = 0; t <= hexArray.GetUpperBound(0); t++)
                {
                    if((hexArray[t]>= 48) && (hexArray[t] <= 57))
                    
                        decNum = (hexArray[t] - 48);
                    
                    else if ( (hexArray[t] >= 65) & (hexArray[t] <= 70))
                        decNum = 10 + (hexArray[t] - 65);                if (msb)
                    {
                        decNumMSB = decNum * 16;
                        msb = false;
                    }
                    else 
                    {
                        decNumLSB = decNum;
                        msb = true;
                    }
                    if (msb)
                    {
                        decByte = decNumMSB + decNumLSB;
                        decByteTotal += decByte;
                    }
                }            decByteTotal = (255 - decByteTotal) + 1;
                decByteTotal = decByteTotal & 255;            int a, b = 0;
                
                string hexByte = "", hexTotal = "";
                double i;            for (i = 0; decByteTotal > 0; i++)
                {
                    b = Convert.ToInt32(System.Math.Pow(16.0, i));
                    a = decByteTotal % 16;
                    decByteTotal /= 16;
                    if (a <= 9)
                        hexByte = a.ToString();
                    else
                    {
                        switch (a)
                        {
                            case 10:
                                hexByte = "A";
                                break;
                            case 11:
                                hexByte = "B";
                                break;
                            case 12:
                                hexByte = "C";
                                break;
                            case 13:
                                hexByte = "D";
                                break;
                            case 14:
                                hexByte = "E";
                                break;
                            case 15:
                                hexByte = "F";
                                break;
                        }
                    }
                    hexTotal = String.Concat(hexByte, hexTotal);
                }
                return hexTotal;
           }问题基本上解决,但还是有点问题,这算法是在codeproject找的。还是有时会计算错,不过比我之前的少。不知道什么回来。