Aurora.Services.WebAPIHandler.AddGroupNotice C# (CSharp) 메소드

AddGroupNotice() 개인적인 메소드

private AddGroupNotice ( OSDMap map ) : OSDMap
map OSDMap
리턴 OSDMap
        private OSDMap AddGroupNotice(OSDMap map)
        {
            OSDMap resp = new OSDMap();

            if (!map.ContainsKey("GroupID") || !map.ContainsKey("AuthorID") || !map.ContainsKey("Subject") || !map.ContainsKey("Message"))
            {
                resp["Failed"] = new OSDString("Missing required arguments one or more of GroupID, AuthorID, Subject, Message");
            }
            else
            {
                UUID GroupID = UUID.Zero;
                UUID.TryParse(map["GroupID"].ToString(), out GroupID);

                UUID AuthorID = UUID.Zero;
                UUID.TryParse(map["AuthorID"].ToString(), out AuthorID);

                string subject = map["Subject"].ToString().Trim();
                string message = map["Message"].ToString().Trim();

                IGroupsServiceConnector groups = Aurora.DataManager.DataManager.RequestPlugin<IGroupsServiceConnector>();
                IUserAccountService users = m_registry.RequestModuleInterface<IUserAccountService>();
                UserAccount Author = AuthorID != UUID.Zero && users != null ? users.GetUserAccount(null, AuthorID) : null;

                if (GroupID == UUID.Zero)
                {
                    resp["Failed"] = new OSDString("GroupID was UUID.Zero");
                }
                else if (AuthorID == UUID.Zero)
                {
                    resp["Failed"] = new OSDString("AuthorID was UUID.Zero");
                }
                else if (subject == string.Empty)
                {
                    resp["Failed"] = new OSDString("Subject was empty");
                }
                else if (message == string.Empty)
                {
                    resp["Failed"] = new OSDString("Message was empty");
                }
                else if (groups == null)
                {
                    resp["Failed"] = new OSDString("Could not findIGroupsServiceConnector");
                }
                else if (users == null)
                {
                    resp["Failed"] = new OSDString("Could not find IUserAccountService");
                }
                else if (Author == null)
                {
                    resp["Failed"] = new OSDString(string.Format("Could not find author with ID {0}", AuthorID));
                }
                else
                {
                    UUID noticeID = UUID.Random();
                    try
                    {
                        groups.AddGroupNotice(AuthorID, GroupID, noticeID, Author.Name, subject, message, UUID.Zero, 0, "");
                        resp["NoticeID"] = noticeID;
                    }
                    catch
                    {
                        resp["Failed"] = new OSDString("An exception was thrown.");
                    }
                }
            }

            return resp;
        }