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


C# Player.MessageUnsafePath方法代码示例

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


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

示例1: DumpStatsHandler

        static void DumpStatsHandler( Player player, Command cmd )
        {
            string fileName = cmd.Next();
            if( fileName == null ) {
                CdDumpStats.PrintUsage( player );
                return;
            }

            if( !Paths.Contains( Paths.WorkingPath, fileName ) ) {
                player.MessageUnsafePath();
                return;
            }

            // ReSharper disable AssignNullToNotNullAttribute
            if( Paths.IsProtectedFileName( Path.GetFileName( fileName ) ) ) {
                // ReSharper restore AssignNullToNotNullAttribute
                player.Message( "You may not use this file." );
                return;
            }

            string extension = Path.GetExtension( fileName );
            if( extension == null || !extension.Equals( ".txt", StringComparison.OrdinalIgnoreCase ) ) {
                player.Message( "Stats filename must end with .txt" );
                return;
            }

            if( File.Exists( fileName ) && !cmd.IsConfirmed ) {
                player.Confirm( cmd, "File \"{0}\" already exists. Overwrite?", Path.GetFileName( fileName ) );
                return;
            }

            if( !Paths.TestFile( "DumpStats file", fileName, false, FileAccess.Write ) ) {
                player.Message( "Cannot create specified file. See log for details." );
                return;
            }

            PlayerInfo[] infos;
            using( FileStream fs = File.Create( fileName ) ) {
                using( StreamWriter writer = new StreamWriter( fs ) ) {
                    infos = PlayerDB.PlayerInfoList;
                    if( infos.Length == 0 ) {
                        writer.WriteLine( "(TOTAL) (0 players)" );
                        writer.WriteLine();
                    } else {
                        DumpPlayerGroupStats( writer, infos, "(TOTAL)" );
                    }

                    List<PlayerInfo> rankPlayers = new List<PlayerInfo>();
                    foreach( Rank rank in RankManager.Ranks ) {
                        // ReSharper disable LoopCanBeConvertedToQuery
                        for( int i = 0; i < infos.Length; i++ ) {
                            // ReSharper restore LoopCanBeConvertedToQuery
                            if( infos[i].Rank == rank ) rankPlayers.Add( infos[i] );
                        }
                        if( rankPlayers.Count == 0 ) {
                            writer.WriteLine( "{0}: 0 players, 0 banned, 0 inactive", rank.Name );
                            writer.WriteLine();
                        } else {
                            DumpPlayerGroupStats( writer, rankPlayers, rank.Name );
                        }
                        rankPlayers.Clear();
                    }
                }
            }

            player.Message( "Stats saved to \"{0}\"", fileName );
        }
开发者ID:Blingpancakeman,项目名称:800craft,代码行数:67,代码来源:MaintenanceCommands.cs

示例2: GenHandler


//.........这里部分代码省略.........
                {
                    player.Message("When used from console, /Gen requires FileName.");
                    CdGenerate.PrintUsage(player);
                    return;
                }
                if (!cmd.IsConfirmed)
                {
                    player.Confirm(cmd, "Replace THIS MAP with a generated one ({0})?", templateFullName);
                    return;
                }

            }
            else
            {
                if (cmd.HasNext)
                {
                    CdGenerate.PrintUsage(player);
                    return;
                }
                // saving to file
                fileName = fileName.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
                if (!fileName.EndsWith(".fcm", StringComparison.OrdinalIgnoreCase))
                {
                    fileName += ".fcm";
                }
                if (!Paths.IsValidPath(fileName))
                {
                    player.Message("Invalid filename.");
                    return;
                }
                fullFileName = Path.Combine(Paths.MapPath, fileName);
                if (!Paths.Contains(Paths.MapPath, fullFileName))
                {
                    player.MessageUnsafePath();
                    return;
                }
                string dirName = fullFileName.Substring(0, fullFileName.LastIndexOf(Path.DirectorySeparatorChar));
                if (!Directory.Exists(dirName))
                {
                    Directory.CreateDirectory(dirName);
                }
                if (!cmd.IsConfirmed && File.Exists(fullFileName))
                {
                    player.Confirm(cmd, "The mapfile \"{0}\" already exists. Overwrite?", fileName);
                    return;
                }
            }

            // generate the map
            Map map;
            player.MessageNow("Generating {0}...", templateFullName);

            if (genEmpty)
            {
                map = MapGenerator.GenerateEmpty(mapWidth, mapLength, mapHeight);

            }
            else if (genOcean)
            {
                map = MapGenerator.GenerateOcean(mapWidth, mapLength, mapHeight);

            }
            else if (genFlatgrass)
            {
                map = MapGenerator.GenerateFlatgrass(mapWidth, mapLength, mapHeight);
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:66,代码来源:WorldCommands.cs

示例3: WorldSaveHandler

        static void WorldSaveHandler(Player player, Command cmd)
        {
            string p1 = cmd.Next(), p2 = cmd.Next();
            if (p1 == null)
            {
                CdWorldSave.PrintUsage(player);
                return;
            }

            World world = player.World;
            string fileName;
            if (p2 == null)
            {
                fileName = p1;
                if (world == null)
                {
                    player.Message("When called from console, /wsave requires WorldName. See \"/Help save\" for details.");
                    return;
                }
            }
            else
            {
                world = WorldManager.FindWorldOrPrintMatches(player, p1);
                if (world == null) return;
                fileName = p2;
            }

            // normalize the path
            fileName = fileName.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
            if (fileName.EndsWith("/") && fileName.EndsWith(@"\"))
            {
                fileName += world.Name + ".fcm";
            }
            else if (!fileName.ToLower().EndsWith(".fcm", StringComparison.OrdinalIgnoreCase))
            {
                fileName += ".fcm";
            }
            if (!Paths.IsValidPath(fileName))
            {
                player.Message("Invalid filename.");
                return;
            }
            string fullFileName = Path.Combine(Paths.MapPath, fileName);
            if (!Paths.Contains(Paths.MapPath, fullFileName))
            {
                player.MessageUnsafePath();
                return;
            }

            // Ask for confirmation if overwriting
            if (File.Exists(fullFileName))
            {
                FileInfo targetFile = new FileInfo(fullFileName);
                FileInfo sourceFile = new FileInfo(world.MapFileName);
                if (!targetFile.FullName.Equals(sourceFile.FullName, StringComparison.OrdinalIgnoreCase))
                {
                    if (!cmd.IsConfirmed)
                    {
                        player.Confirm(cmd, "Target file \"{0}\" already exists, and will be overwritten.", targetFile.Name);
                        return;
                    }
                }
            }

            // Create the target directory if it does not exist
            string dirName = fullFileName.Substring(0, fullFileName.LastIndexOf(Path.DirectorySeparatorChar));
            if (!Directory.Exists(dirName))
            {
                Directory.CreateDirectory(dirName);
            }

            player.MessageNow("Saving map to {0}", fileName);

            const string mapSavingErrorMessage = "Map saving failed. See server logs for details.";
            Map map = world.Map;
            if (map == null)
            {
                if (File.Exists(world.MapFileName))
                {
                    try
                    {
                        File.Copy(world.MapFileName, fullFileName, true);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogType.Error,
                                    "WorldCommands.WorldSave: Error occured while trying to copy an unloaded map: {0}", ex);
                        player.Message(mapSavingErrorMessage);
                    }
                }
                else
                {
                    Logger.Log(LogType.Error,
                                "WorldCommands.WorldSave: Map for world \"{0}\" is unloaded, and file does not exist.",
                                world.Name);
                    player.Message(mapSavingErrorMessage);
                }
            }
            else if (map.Save(fullFileName))
            {
//.........这里部分代码省略.........
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:101,代码来源:WorldCommands.cs

示例4: RealmCreate

        public static void RealmCreate(Player player, Command cmd, string themeName, string templateName)
        {
            MapGenTemplate template;
            MapGenTheme theme;

            int wx, wy, height = 128;
            if (!(cmd.NextInt(out wx) && cmd.NextInt(out wy) && cmd.NextInt(out height)))
            {
                if (player.World != null)
                {
                    wx = 128;
                    wy = 128;
                    height = 128;
                }
                else
                {
                    player.Message("When used from console, /gen requires map dimensions.");

                    return;
                }
                cmd.Rewind();
                cmd.Next();
                cmd.Next();
            }

            if (!Map.IsValidDimension(wx))
            {
                player.Message("Cannot make map with width {0}: dimensions must be multiples of 16.", wx);
                return;
            }
            else if (!Map.IsValidDimension(wy))
            {
                player.Message("Cannot make map with length {0}: dimensions must be multiples of 16.", wy);
                return;
            }
            else if (!Map.IsValidDimension(height))
            {
                player.Message("Cannot make map with height {0}: dimensions must be multiples of 16.", height);
                return;
            }

            string fileName = player.Name;
            string fullFileName = null;

            if (fileName == null)
            {
                if (player.World == null)
                {
                    player.Message("When used from console, /gen requires FileName.");

                    return;
                }
                if (!cmd.IsConfirmed)
                {
                    player.Confirm(cmd, "Replace this realm's map with a generated one?");
                    return;
                }
            }
            else
            {
                fileName = fileName.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
                if (!fileName.EndsWith(".fcm", StringComparison.OrdinalIgnoreCase))
                {
                    fileName += ".fcm";
                }
                fullFileName = Path.Combine(Paths.MapPath, fileName);
                if (!Paths.IsValidPath(fullFileName))
                {
                    player.Message("Invalid filename.");
                    return;
                }
                if (!Paths.Contains(Paths.MapPath, fullFileName))
                {
                    player.MessageUnsafePath();
                    return;
                }
                string dirName = fullFileName.Substring(0, fullFileName.LastIndexOf(Path.DirectorySeparatorChar));
                if (!Directory.Exists(dirName))
                {
                    Directory.CreateDirectory(dirName);
                }
                if (!cmd.IsConfirmed && File.Exists(fullFileName))
                {
                    player.Confirm(cmd, "The mapfile \"{0}\" already exists. Overwrite?", fileName);
                    return;
                }
            }

            bool noTrees;
            if (themeName.Equals("grass", StringComparison.OrdinalIgnoreCase))
            {
                theme = MapGenTheme.Forest;
                noTrees = true;
            }
            else
            {
                try
                {
                    theme = (MapGenTheme)Enum.Parse(typeof(MapGenTheme), themeName, true);
                    noTrees = (theme != MapGenTheme.Forest);
//.........这里部分代码省略.........
开发者ID:727021,项目名称:800craft,代码行数:101,代码来源:RealmHandler.cs

示例5: GenHandler


//.........这里部分代码省略.........
            if( !cmd.IsConfirmed && // Only print once -- before confirmation is given.
                (!Map.IsRecommendedDimension( mapWidth ) || !Map.IsRecommendedDimension( mapLength ) ||
                 mapHeight%16 != 0) ) {
                player.Message( "&WThe map will have non-standard dimensions. " +
                                "You may see glitched blocks or visual artifacts. " +
                                "The only recommended map dimensions are: 16, 32, 64, 128, 256, 512, and 1024." );
            }

            // See what else the player has given us...
            string givenName = cmd.Next();
            if( givenName == null ) {
                // No name given. Assume that we're replacing the current world.
                if( playerWorld != null ) {
                    world = playerWorld;
                    if( !cmd.IsConfirmed ) {
                        Logger.Log( LogType.UserActivity,
                                    "Gen: Asked {0} to confirm replacing the map of world {1} (\"this map\")",
                                    player.Name,
                                    playerWorld.Name );
                        player.Confirm( cmd, "Gen: Replace THIS MAP with a generated one ({0})?", genParams );
                        return;
                    }

                } else {
                    player.Message( "When used from console, /Gen requires a world name or map file name." );
                    CdGen.PrintUsage( player );
                    return;
                }

            } else {
                // Either a world name or a filename was given. Check worlds first.
                World existingWorld = WorldManager.FindWorldExact( givenName );

                if( existingWorld != null ) {
                    // A matching world name found. Assume that we're replacing it.
                    if( !cmd.IsConfirmed ) {
                        Logger.Log( LogType.UserActivity,
                                    "Gen: Asked {0} to confirm replacing the map of world {1}",
                                    player.Name,
                                    existingWorld.Name );
                        player.Confirm( cmd,
                                        "Gen: Replace the map of world {0}&S with a generated one ({1})?",
                                        existingWorld.ClassyName,
                                        genParams );
                        return;
                    }
                    world = existingWorld;

                } else {
                    // No world with this name found. Assume that we were given a filename.
                    givenName = givenName.Replace( Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar );
                    if( !givenName.EndsWith( ".fcm", StringComparison.OrdinalIgnoreCase ) ) {
                        givenName += ".fcm";
                    }
                    if( !Paths.IsValidPath( givenName ) ) {
                        player.Message( "Gen: Invalid file name given." );
                        return;
                    }
                    fileName = Path.Combine( Paths.MapPath, givenName );
                    if( !Paths.Contains( Paths.MapPath, fileName ) ) {
                        player.MessageUnsafePath();
                        return;
                    }
                    if( File.Exists( fileName ) ) {
                        if( !cmd.IsConfirmed ) {
                            Logger.Log( LogType.UserActivity,
                                        "Gen: Asked {0} to confirm overwriting map file \"{1}\"",
                                        player.Name,
                                        givenName );
                            player.Confirm( cmd, "Gen: The map file \"{0}\" already exists. Overwrite?", givenName );
                            return;
                        }
                    }
                }
            }

            // Warn players on the affected world, if applicable
            if( world != null ) {
                world.Players
                     .Except( player )
                     .Message( "&SIncoming map change!" );
            }

            // Prepare to generate
            genParams.MapWidth = mapWidth;
            genParams.MapLength = mapLength;
            genParams.MapHeight = mapHeight;
            GenTaskParams genTaskParams = new GenTaskParams {
                Player = player,
                World = world,
                FileName = givenName,
                FullFileName = fileName,
                GenState = genParams.CreateGenerator()
            };
            player.MessageNow( "Generating (please wait): {0}", genParams );

            // Do the rest in a background thread
            Scheduler.NewBackgroundTask( GenTaskCallback, genTaskParams )
                     .RunOnce();
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:101,代码来源:WorldCommands.cs

示例6: DumpStatsHandler

        static void DumpStatsHandler( Player player, CommandReader cmd ) {
            string fileName = cmd.Next();
            if( fileName == null ) {
                CdDumpStats.PrintUsage( player );
                return;
            }

            if( !Paths.Contains( Paths.WorkingPath, fileName ) ) {
                player.MessageUnsafePath();
                return;
            }

            if( Paths.IsProtectedFileName( Path.GetFileName( fileName ) ) ) {
                player.Message( "You may not use this file." );
                return;
            }

            string extension = Path.GetExtension( fileName );
            if( extension == null || !extension.Equals( ".txt", StringComparison.OrdinalIgnoreCase ) ) {
                player.Message( "Stats file name must end with .txt" );
                return;
            }

            if( File.Exists( fileName ) && !cmd.IsConfirmed ) {
                Logger.Log( LogType.UserActivity,
                            "DumpStats: Asked {0} for confirmation to overwrite \"{1}\"",
                            player.Name, fileName );
                player.Confirm( cmd, "File \"{0}\" already exists. Overwrite?", Path.GetFileName( fileName ) );
                return;
            }

            if( !Paths.TestFile( "DumpStats file", fileName, false, FileAccess.Write ) ) {
                player.Message( "Cannot create specified file. See log for details." );
                return;
            }

            using( FileStream fs = File.Create( fileName ) ) {
                using( StreamWriter writer = new StreamWriter( fs ) ) {
                    PlayerInfo[] infos = PlayerDB.PlayerInfoList;
                    if( infos.Length == 0 ) {
                        writer.WriteLine( "(TOTAL) (0 players)" );
                        writer.WriteLine();
                    } else {
                        DumpPlayerGroupStats( writer, infos, "(TOTAL)" );
                    }

                    List<PlayerInfo> rankPlayers = new List<PlayerInfo>();
                    foreach( Rank rank in RankManager.Ranks ) {
                        rankPlayers.AddRange( infos.Where( t => t.Rank == rank ) );
                        if( rankPlayers.Count == 0 ) {
                            writer.WriteLine( "{0}: 0 players, 0 banned, 0 inactive", rank.Name );
                            writer.WriteLine();
                        } else {
                            DumpPlayerGroupStats( writer, rankPlayers, rank.Name );
                        }
                        rankPlayers.Clear();
                    }
                }
            }

            player.Message( "Stats saved to \"{0}\"", fileName );
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:62,代码来源:MaintenanceCommands.cs

示例7: WorldClearSaveHandler

        static void WorldClearSaveHandler(Player player, CommandReader cmd)
        {
            string WorldCSave = player.World.Name;
            if (player.World.Name == null)
            {
                CdWorldSave.PrintUsage(player);
                return;
            }

            World world = player.World;
            string fileName;
            fileName = WorldCSave;
            {
                world = WorldManager.FindWorldOrPrintMatches(player, WorldCSave);
                if (world == null) return;
                fileName = WorldCSave;
            }

            // normalize the path
            fileName = fileName.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
            fileName = "World(" + WorldCSave + ")clear.fcm";
            if (!Paths.IsValidPath(fileName))
            {
                player.Message("Invalid file name.");
                return;
            }
            string fullFileName = Path.Combine(Paths.WClearPath, fileName);
            if (!Paths.Contains(Paths.WClearPath, fullFileName))
            {
                player.MessageUnsafePath();
                return;
            }

            // Ask for confirmation if overwriting
            if (File.Exists(fullFileName))
            {
                FileInfo targetFile = new FileInfo(fullFileName);
                FileInfo sourceFile = new FileInfo(world.MapFileName);
                if (!targetFile.FullName.Equals(sourceFile.FullName, StringComparison.OrdinalIgnoreCase))
                {
                    if (!cmd.IsConfirmed)
                    {
                        Logger.Log(LogType.UserActivity,
                                    "WCSave: Asked {0} to confirm overwriting map file \"{1}\"",
                                    player.Name, targetFile.FullName);
                        player.Confirm(cmd, "Target file \"{0}\" already exists, and will be overwritten.", targetFile.Name);
                        return;
                    }
                }
            }

            // Create the target directory if it does not exist
            string dirName = fullFileName.Substring(0, fullFileName.LastIndexOf(Path.DirectorySeparatorChar));
            if (!Directory.Exists(dirName))
            {
                Directory.CreateDirectory(dirName);
            }

            player.Message("Saving map to {0}", fileName);

            const string mapSavingErrorMessage = "Map saving failed. See server logs for details.";
            Map map = world.Map;
            if (map == null)
            {
                if (File.Exists(world.MapFileName))
                {
                    try
                    {
                        File.Copy(world.MapFileName, fullFileName, true);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogType.Error,
                                    "WorldCommands.WorldCSave: Error occurred while trying to copy an unloaded map: {0}", ex);
                        player.Message(mapSavingErrorMessage);
                    }
                }
                else
                {
                    Logger.Log(LogType.Error,
                                "WorldCommands.WorldCSave: Map for world \"{0}\" is unloaded, and file does not exist.",
                                world.Name);
                    player.Message(mapSavingErrorMessage);
                }
            }
            else if (map.Save(fullFileName))
            {
                player.Message("Map saved succesfully.");
            }
            else
            {
                Logger.Log(LogType.Error,
                            "WorldCommands.WorldCSave: Saving world \"{0}\" failed.", world.Name);
                player.Message(mapSavingErrorMessage);
            }
        }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:96,代码来源:WorldCommands.cs

示例8: ImportRankListHandler

        // TODO: document the fact that this only promotes (unlike "/Import Ranks")
        static void ImportRankListHandler( Player player, CommandReader cmd ) {
            string fileName = cmd.Next();
            string rankName = cmd.Next();
            string reason = cmd.NextAll();

            if( fileName == null || rankName == null ) {
                CdImportRankList.PrintUsage( player );
                return;
            }

            // parse rank name
            Rank rank = RankManager.FindRank( rankName );
            if( rank == null ) {
                player.MessageNoRank( rankName );
                return;
            }
            
            // Make sure that the target file is legit
            if( !Paths.Contains( Paths.WorkingPath, fileName ) ) {
                Logger.Log( LogType.SuspiciousActivity,
                            "ImportRankList: Player {0} tried to import from \"{1}\"",
                            player.Name,
                            fileName );
                player.MessageUnsafePath();
                return;
            }

            // Make sure file exists
            if( !File.Exists( fileName ) ) {
                player.Message( "Rank list file not found: " + fileName );
                return;
            }

            // Read list of names from file.
            // Using List list to preserve capitalization and a HashSet to avoid duplicates.
            List<string> nameList = new List<string>();
            using( StreamReader reader = new StreamReader( fileName ) ) {
                HashSet<string> lowerNameSet = new HashSet<string>();
                while( true ) {
                    string nextName = reader.ReadLine();
                    if( nextName == null ) break;
                    if( !Player.IsValidPlayerName( nextName ) ) {
                        player.Message( "ImportRankList: Invalid player name skipped: {0}", nextName );
                        continue;
                    }
                    string nameToLower = nextName.ToLowerInvariant();
                    if( lowerNameSet.Contains( nameToLower ) ) {
                        player.Message( "ImportRankList: Skipping a duplicate name: {0}", nextName );
                        continue;
                    }
                    nameList.Add( nextName );
                    lowerNameSet.Add( nameToLower );
                }
            }

            // Ask player to confirm before continuing
            if( !cmd.IsConfirmed ) {
                Logger.Log( LogType.UserActivity,
                            "Import: Asked {0} to confirm importing {1} ranks from {2}",
                            player.Name,
                            nameList.Count,
                            fileName );
                player.Confirm( cmd,
                                "ImportRankList: Are you sure you want to rank {0} players to {1}&S?",
                                nameList.Count,
                                rank.ClassyName );
                return;
            }

            // Carry out the promotions
            int newPlayers = 0,
                promotedPlayers = 0,
                skippedPlayers = 0;
            foreach( string name in nameList ) {
                PlayerInfo info = PlayerDB.FindPlayerInfoExact( name );
                if( info == null ) {
                    // Create and promote a new record
                    newPlayers++;
                    PlayerInfo newInfo = PlayerDB.CreateNewPlayerInfo( name, RankChangeType.Promoted );
                    newInfo.ChangeRank( player, rank, reason, true, true, false );
                    Logger.Log( LogType.UserActivity, "ImportRankList: Created a new player record for {0}", name );

                } else {
                    // Check if an existing record needs updating
                    if( info.Rank < rank && // don't demote anyone
                        !info.IsBanned && // don't promote banned players
                        info.RankChangeType != RankChangeType.Demoted && // don't re-promote demoted players
                        info.RankChangeType != RankChangeType.AutoDemoted ) {
                        // Promote!
                        info.ChangeRank( player, rank, reason, true, true, false );
                        promotedPlayers++;

                    } else {
                        skippedPlayers++;
                    }
                }
            }
            string successMsg = String.Format(
                "ImportRankList: Created {0} new records, promoted {1} players, " +
//.........这里部分代码省略.........
开发者ID:fragmer,项目名称:fCraft,代码行数:101,代码来源:MaintenanceCommands.cs


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