コード例 #1
0
        public static void Import(User user, string fileName = null)
        {
            try
            {
                WorldEditCommand command;

                if (!string.IsNullOrEmpty(fileName))
                {
                    command = new ImportCommand(user, fileName);
                    if (command.Invoke())
                    {
                        user.Player.MsgLoc($"Import done in {command.ElapsedMilliseconds}ms. Use /paste");
                    }
                    else
                    {
                        new PrintBlueprintListCommand(user).Invoke();
                    }
                }
                else
                {
                    new PrintBlueprintListCommand(user).Invoke();
                }
            }
            catch (WorldEditCommandException e)
            {
                user.Player.ErrorLocStr(e.Message);
            }
            catch (Exception e) { Log.WriteException(e); }
        }