当前位置: 首页>>代码示例>>C#>>正文


C# SortedSet.ToString方法代码示例

本文整理汇总了C#中System.Collections.SortedSet.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SortedSet.ToString方法的具体用法?C# SortedSet.ToString怎么用?C# SortedSet.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.SortedSet的用法示例。


在下文中一共展示了SortedSet.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 static void Main(string[] args)
 {
     var stackOfValues = new Stack<string>();
     GetInitialValuesFromArgs(args, ref stackOfValues);
     var demoSet1 = new Set<string>(stackOfValues.ToArray());
     Console.WriteLine(demoSet1.ToString());
     var demoSet3 = new SortedSet(stackOfValues.ToArray());
     Console.WriteLine(demoSet3.ToString());
     Console.ReadKey();
 }
开发者ID:RavingRabbit,项目名称:Labs,代码行数:10,代码来源:Program.cs

示例2: IntegrateGamesFromVdf

        /// <summary>
        /// Loads in games from a VDF node containing a list of games.
        /// Any games in the node not found in the game list will be added to the gamelist.
        /// If a game in the node has a tags subnode, the "favorite" field will be overwritten.
        /// If a game in the node has a category set, it will overwrite any categories in the gamelist.
        /// If a game in the node does NOT have a category set, the category in the gamelist will NOT be cleared.
        /// </summary>
        /// <param name="appsNode">Node containing the game nodes</param>
        /// <param name="ignore">Set of games to ignore</param>
        /// <returns>Number of games loaded</returns>
        private int IntegrateGamesFromVdf( VdfFileNode appsNode, SortedSet<int> ignore, bool ignoreDlc )
        {
            int loadedGames = 0;

            Dictionary<string, VdfFileNode> gameNodeArray = appsNode.NodeArray;
            if( gameNodeArray != null ) {
                foreach( KeyValuePair<string, VdfFileNode> gameNodePair in gameNodeArray ) {
                    int gameId;
                    if( int.TryParse( gameNodePair.Key, out gameId ) ) {
                        if( ( ignore != null && ignore.Contains( gameId ) ) || ( ignoreDlc && Program.GameDB.IsDlc( gameId ) ) ) {
                            Program.Logger.Write( LoggerLevel.Verbose, GlobalStrings.GameData_SkippedProcessingGame, gameId );
                            continue;
                        }
                        if( gameNodePair.Value != null && gameNodePair.Value.ContainsKey( "tags" ) ) {
                            SortedSet<Category> cats = new SortedSet<Category>();

                            loadedGames++;

                            VdfFileNode tagsNode = gameNodePair.Value["tags"];
                            Dictionary<string, VdfFileNode> tagArray = tagsNode.NodeArray;
                            if( tagArray != null ) {
                                foreach( VdfFileNode tag in tagArray.Values ) {
                                    string tagName = tag.NodeString;
                                    if( tagName != null ) {
                                        Category c = GetCategory( tagName );
                                        if( c != null ) cats.Add( c );
                                    }
                                }
                            }

                            bool hidden = false;
                            if( gameNodePair.Value.ContainsKey( "hidden" ) ) {
                                VdfFileNode hiddenNode = gameNodePair.Value["hidden"];
                                hidden = ( hiddenNode.NodeString == "1" || hiddenNode.NodeInt == 1 );
                            }

                            // Add the game to the list if it doesn't exist already
                            if( !Games.ContainsKey( gameId ) ) {
                                GameInfo newGame = new GameInfo( gameId, string.Empty );
                                Games.Add( gameId, newGame );
                                newGame.Name = Program.GameDB.GetName( gameId );
                                Program.Logger.Write( LoggerLevel.Verbose, GlobalStrings.GameData_AddedNewGame, gameId, newGame.Name );
                            }

                            if( cats.Count > 0 ) {
                                this.SetGameCategories( gameId, cats, false );
                            }
                            Games[gameId].Hidden = hidden;

                            //TODO: Don't think SortedSet.ToString() does what I hope
                            Program.Logger.Write( LoggerLevel.Verbose, GlobalStrings.GameData_ProcessedGame, gameId, ( cats.Count == 0 ) ? "~" : cats.ToString() );
                        }
                    }
                }
            }

            return loadedGames;
        }
开发者ID:newzealandpaul,项目名称:depressurizer,代码行数:68,代码来源:GameData.cs


注:本文中的System.Collections.SortedSet.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。