Пример #1
0
    private bool InShowTime(int round, List <CTaiguShowTime> showTimeList)
    {
        bool           inShowTime = false;
        CTaiguShowTime showTime   = null;

        for (int i = 0; i < showTimeList.Count; ++i)
        {
            showTime = showTimeList[i];
            if (showTime != null)
            {
                if (round >= showTime.BeginTime && round <= showTime.EndTime)
                {
                    inShowTime = true;
                    break;
                }
            }
        }

        return(inShowTime);
    }
Пример #2
0
    public override void LoadStageInfo(byte[] stageInfo)
    {
        //SetMatchValue();

        //return;

        using (MemoryStream memStream = new MemoryStream(stageInfo))
        {
            using (StreamReader sr = new StreamReader(memStream, CommonFunc.GetCharsetEncoding()))
            {
                char[]        trimStart = { ' ', '\t' };
                char[]        trimEnd   = { ' ', '\r', '\n', '\t' };
                List <string> roundNote = new List <string>();

                string stringLine = null;
                while ((stringLine = sr.ReadLine()) != null)
                {
                    if (stringLine != "")
                    {
                        stringLine.TrimEnd(trimEnd);
                        stringLine.TrimStart(trimStart);

                        if (BeginWithFlag(stringLine, '#'))
                        {
                            StageTag tag = AnalyseTag(ref stringLine, '#');
                            if (tag == StageTag.Round)
                            {
                                stringLine = stringLine.Replace(" ", "");
                                string strHead = "";
                                string strNote = "";
                                SeparateString(stringLine, ':', ref strHead, ref strNote);
                                roundNote.Add(strNote);
                            }
                            else if (tag == StageTag.PatEnd)
                            {
                                AnalysisRoundNote(roundNote);
                                roundNote.Clear();
                            }
                        }
                        else if (BeginWithFlag(stringLine, '@'))
                        {
                            //Show time
                            stringLine = stringLine.Replace(" ", "");
                            string strHead  = "";
                            string strBegin = "";
                            string strEnd   = "";
                            SeparateString(stringLine, ':', ref strHead, ref strBegin, ref strEnd);

                            int nBegin = Convert.ToInt32(strBegin);
                            int nEnd   = Convert.ToInt32(strEnd);
                            if (nBegin > 0 && nBegin < nEnd)
                            {
                                CTaiguShowTime showTime = new CTaiguShowTime();
                                showTime.BeginTime = nBegin;
                                showTime.EndTime   = nEnd;
                                ShowTimeList.Add(showTime);
                            }
                        }
                        else
                        {
                            string key   = "";
                            string value = "";
                            SeparateString(stringLine, ':', ref key, ref value);

                            key = key.ToUpper();
                            SetMatchValue(key, value);
                        }
                    }
                }
                sr.Close();
            }
            memStream.Close();
        }
    }