コード例 #1
0
        private string MakeGameFilterString(GameInfoCollection i_Games, EdlInfoCollection i_EdlInfos, FilterInfoCollection i_Filters, bool i_MultiLine)
        {
            StringBuilder m_SBGameFilter = new StringBuilder();

            string m_StrGames = MakeGameInfoString(i_Games, i_EdlInfos, i_MultiLine);

            string m_StrFilters = MakeFilterInfoString(i_Filters, i_MultiLine);

            m_SBGameFilter.AppendFormat("{0} \n\n{1}", m_StrGames, m_StrFilters);

            return(m_SBGameFilter.ToString());
        }
コード例 #2
0
        //        private string MakeGameInfoString(GameInfoCollection i_Games, bool i_MultiLine)
//        {
//            string m_RetStr = "<No Game>";

//            if(i_Games == null || i_Games.Count == 0) return m_RetStr;

//            StringBuilder m_SBGames = new StringBuilder();

//            if(this._Title)
//            {
//                m_SBGames.AppendFormat("{0}","Games:\n");
//            }

//            int times = 0;

//            int scouttypetimes=0 , maxtime=i_Games.Count-1;  //added at 2008-10-22 14:24:25@Simon

//            foreach(GameInfo i_Game in i_Games)
//            {
//                if((i_Game.Object == null || i_Game.Object == string.Empty)
//                    &&(i_Game.Opponent == null || i_Game.Opponent == string.Empty))
//                {
//                    //if obj and opponent is null , add game name
//                    if(i_Game.GameName == null || i_Game.GameName == string.Empty)
//                    {
//                        m_SBGames.Append("<None>");
//                    }
//                    else
//                    {
//                        m_SBGames.AppendFormat("{0}",i_Game.GameName);
//                    }
//                }
//                else
//                {
//                    //format game name
//                    if(!this.FirstObjectOnly || times == 0)
//                    {
//                        if(this._Object)
//                        {
//                            m_SBGames.AppendFormat("{0} ",i_Game.Object);
//                        }

//                        m_SBGames.Append("VS");

//                        times++;
//                    }

//                    if(this._Opponent)
//                    {
//                        m_SBGames.AppendFormat(" {0} ",i_Game.Opponent);
//                    }

//                    if(this._Location)
//                    {
//                        m_SBGames.AppendFormat("AT {0} ",i_Game.Location);
//                    }

//                    if(this._Date)
//                    {
//                        m_SBGames.AppendFormat("ON {0} ",i_Game.GameDate);
//                    }

//                    if(this._ScoutType)
//                    {
////						m_SBGames.AppendFormat("- {0} ",i_Game.ScoutType);
//                        #region Modified Area  at 2008-10-22 14:32:22@Simon
//                        //add his code for show Scout Type once
//                        if(!this.OnceScoutType||scouttypetimes==maxtime)
//                        {
//                            m_SBGames.AppendFormat("- {0} ",i_Game.ScoutType);
//                        }
//                        scouttypetimes++;

//                        #endregion        //End Modify
//                    }
//                }

//                if(i_MultiLine)
//                {
//                    m_SBGames.AppendFormat("\n");
//                }
//                else
//                {
//                    #region Modified Area 2008-10-27 9:19:25@Simon
////					m_SBGames.AppendFormat(",");
//                    if(!this.FirstObjectOnly)
//                    {
//                        m_SBGames.AppendFormat(",");
//                    }
//                    #endregion        //End Modify
//                }
//            }
//            m_SBGames.Length--;


//            return m_SBGames.ToString();
//        }

//        private string MakeGameFilterString(GameInfoCollection i_Games, FilterInfoCollection i_Filters, bool i_MultiLine)
//        {
//            StringBuilder m_SBGameFilter = new StringBuilder();

//            string m_StrGames = MakeGameInfoString(i_Games, i_MultiLine);

//            string m_StrFilters = MakeFilterInfoString(i_Filters, i_MultiLine);

//            m_SBGameFilter.AppendFormat("{0} \n\n{1}", m_StrGames, m_StrFilters);

//            return m_SBGameFilter.ToString();
//        }

        #endregion

        #region New
        private string MakeGameInfoString(GameInfoCollection i_Games, EdlInfoCollection i_EdlInfos, bool i_MultiLine)
        {
            string m_RetStr = "<No Game>";

            if ((i_Games == null || i_Games.Count == 0) && (i_EdlInfos == null || i_EdlInfos.Count == 0))
            {
                return(m_RetStr);
            }

            if (i_Games == null)
            {
                i_Games = new GameInfoCollection();
            }

            if (i_EdlInfos == null)
            {
                i_EdlInfos = new EdlInfoCollection();
            }

            StringBuilder m_SBGames = new StringBuilder();

            if (this._Title)
            {
                m_SBGames.AppendFormat("{0}", "Games :\n");
            }

            int times = 0;

            int scouttypetimes = 0, maxtime = i_Games.Count - 1;  //added at 2008-10-22 14:24:25@Simon

            foreach (GameInfo i_Game in i_Games)
            {
                if ((i_Game.Object == null || i_Game.Object == string.Empty) &&
                    (i_Game.Opponent == null || i_Game.Opponent == string.Empty))
                {
                    //if obj and opponent is null , add game name
                    if (i_Game.GameName == null || i_Game.GameName == string.Empty)
                    {
                        m_SBGames.Append("<None>");
                    }
                    else
                    {
                        m_SBGames.AppendFormat("{0}", i_Game.GameName);
                    }
                }
                else
                {
                    #region Format Game Display only some parts of game Name
                    //format game name
                    if (!this.FirstObjectOnly || times == 0)
                    {
                        if (this._Object)
                        {
                            m_SBGames.AppendFormat("{0} ", i_Game.Object);
                        }

                        m_SBGames.Append("VS");

                        times++;
                    }

                    if (this._Opponent)
                    {
                        m_SBGames.AppendFormat(" {0} ", i_Game.Opponent);
                    }

                    if (this._Location)
                    {
                        m_SBGames.AppendFormat("AT {0} ", i_Game.Location);
                    }

                    if (this._Date)
                    {
                        m_SBGames.AppendFormat("ON {0} ", i_Game.GameDate);
                    }

                    if (this._ScoutType)
                    {
                        //						m_SBGames.AppendFormat("- {0} ",i_Game.ScoutType);
                        #region Modified Area  at 2008-10-22 14:32:22@Simon
                        //add his code for show Scout Type once
                        if (!this.OnceScoutType || scouttypetimes == maxtime)
                        {
                            m_SBGames.AppendFormat("- {0} ", i_Game.ScoutType);
                        }
                        scouttypetimes++;

                        #endregion        //End Modify
                    }
                    #endregion
                }

                if (i_MultiLine)
                {
                    m_SBGames.AppendFormat("\n");
                }
                else
                {
                    #region Modified Area 2008-10-27 9:19:25@Simon
                    //					m_SBGames.AppendFormat(",");
                    if (!this.FirstObjectOnly)
                    {
                        m_SBGames.AppendFormat(",");
                    }
                    #endregion        //End Modify
                }
            }
            if (!i_MultiLine && this.FirstObjectOnly && maxtime > 0)
            {
                m_SBGames.AppendFormat(",");
            }
            foreach (EdlInfo edlInfo in i_EdlInfos)
            {
                m_SBGames.AppendFormat("{0} ", edlInfo.EDLName);

                if (i_MultiLine)
                {
                    m_SBGames.AppendFormat("\n");
                }
                else
                {
                    m_SBGames.AppendFormat(",");
                }
            }

            m_SBGames.Length--;

            return(m_SBGames.ToString());
        }