Esempio n. 1
0
        public static void AddAudit(string companyCode, string username, ActionID actionID, string variable1, string variable2 = null)
        {
            CPDatabase database = null;

            try
            {
                database = new CPDatabase();

                Audit newAudit = new Audit();
                newAudit.CompanyCode = companyCode;
                newAudit.Username = username;
                newAudit.Date = DateTime.Now;
                newAudit.ActionID = (int)actionID;
                newAudit.Variable1 = variable1;
                newAudit.Variable2 = variable2;

                database.Audits.Add(newAudit);
                database.SaveChanges();
            }
            catch (Exception ex)
            {
                logger.Info("Failed to add audit to database: " + actionID.ToString(), ex);
            }
            finally
            {
                if (database != null)
                    database.Dispose();
            }
        }
 public CharacterAction(string ActionURL, string ActionPOST, bool inCombat = false, bool fightingBoss = false)
 {
     actionid = ActionID.UserDefined;
     this.inCombat = inCombat;
     this.fightingBoss = fightingBoss;
     actionURL = ActionURL;
     actionPOST = ActionPOST;
 }
 public CharacterAction(ActionID action = ActionID.UserDefined, bool inCombat = false, bool fightingBoss = false, int goldMove = 0)
 {
     actionid = action;
     this.inCombat = inCombat;
     this.fightingBoss = fightingBoss;
     this.goldMove = goldMove;
     actionURL = LookupActionURL(action, fightingBoss);
     actionRefererURL = LookupRefererURL(action, fightingBoss);
     actionPOST = LookupActionPOST(action, goldMove);
 }
Esempio n. 4
0
        /// <summary>
        /// Action the specified ID with the given conversation.
        /// </summary>
        /// <param name="id">An action ID</param>
        /// <param name="conversation">A selected conversation, or null</param>
        private void Action(ActionID id, InboxConversation conversation)
        {
            switch (id)
            {
            case ActionID.NewMessage:
                FoldersTree.MainForm.Address = "cixmail:";
                break;

            case ActionID.Print:
                Print(conversation);
                break;

            case ActionID.Profile:
            case ActionID.AuthorImage:
                FoldersTree.MainForm.Address = string.Format("cixuser:{0}", conversation.Author);
                break;

            case ActionID.Withdraw:
                conversation.MarkDelete();
                break;

            case ActionID.PageMessage:
            case ActionID.NextUnread:
                GoToNextUnread(conversation);
                break;

            case ActionID.NextPriorityUnread:
                GoToNextPriorityUnread(conversation);
                break;

            case ActionID.Edit:
            case ActionID.Reply:
            {
                InboxMessageEditor newMessageWnd = new InboxMessageEditor(conversation);
                newMessageWnd.Show();
                break;
            }

            case ActionID.Read:
                MarkConversationAsRead(conversation);
                break;

            case ActionID.SelectAll:
                SelectAll();
                break;
            }
        }
Esempio n. 5
0
        public override void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null, params object[] data)
        {
            if (string.IsNullOrEmpty(Level))
            {
                Log.Error("The level of Gated Access has not been set on the Save Action - "
                          + ActionID.ToString() + ". Please ensure it is set correct i.e. <Level>1</Level> in the parameters field", this);
                Level = string.Empty;
            }

            HttpCookie cookie = new HttpCookie(Utility.DefineCookieName())
            {
                Value   = Level,
                Expires = DateTime.Now.AddDays(Utility.GetCookieLifeSpan())
            };

            HttpContext.Current.Response.Cookies.Add(cookie);
        }
Esempio n. 6
0
        /// <summary>
        /// Return whether the specified action can be carried out.
        /// </summary>
        /// <param name="id">An action ID</param>
        public override bool CanAction(ActionID id)
        {
            switch (id)
            {
            case ActionID.NewMessage:
                return(true);

            case ActionID.Reply:
            case ActionID.Edit:
            case ActionID.Withdraw:
            case ActionID.Profile:
            case ActionID.Read:
            case ActionID.Print:
            case ActionID.SelectAll:
                return(SelectedMessage != null);
            }
            return(false);
        }
Esempio n. 7
0
        public void Softmax()
        {
            uint  numActions      = 10;
            float lambda          = 0.5f;
            uint  numActionsCover = 100;
            float C = 5;

            TestRecorder <TestContext> recorder = new TestRecorder <TestContext>();
            TestScorer <TestContext>   scorer   = new TestScorer <TestContext>(numActions);

            MwtExplorer <TestContext> mwtt = new MwtExplorer <TestContext>("mwt", recorder);
            var explorer = new SoftmaxExplorer <TestContext>(scorer, lambda, numActions);

            uint numDecisions = (uint)(numActions * Math.Log(numActions * 1.0) + Math.Log(numActionsCover * 1.0 / numActions) * C * numActions);

            uint[] actions = new uint[numActions];

            Random rand = new Random();

            for (uint i = 0; i < numDecisions; i++)
            {
                uint chosenAction = mwtt.ChooseAction(explorer, rand.NextDouble().ToString(), new TestContext()
                {
                    Id = (int)i
                });
                actions[ActionID.Make_ZeroBased(chosenAction)]++;
            }

            for (uint i = 0; i < numActions; i++)
            {
                Assert.IsTrue(actions[i] > 0);
            }

            var interactions = recorder.GetAllInteractions();

            Assert.AreEqual(numDecisions, (uint)interactions.Count);

            for (int i = 0; i < numDecisions; i++)
            {
                Assert.AreEqual(i, interactions[i].Context.Id);
            }
        }
Esempio n. 8
0
        public LoadAction(string ActionName, decimal Year)
        {
            _ = new ClearForm();
            _ = new ActionVerificationEnabled();

            ActionDB Action = ActionController.FindAction(ActionName, Convert.ToInt32(Year));

            ActionLoad.Load(Action);
            ANCChangeLoad.Load(Action.ID);
            CalculationMassLoad.Load(Action.ID);
            if (Action.PNC == true)
            {
                PNCLoad.Load(Action.ID);
            }
            if (Action.PNCSpec == true)
            {
                PNCSpecialLoad.Load(Action.ID);
            }

            ActionID.Delete();
            ActionID.Singleton.ID = Action.ID;
        }
Esempio n. 9
0
 void EnemyRandamAnimePlay()
 {
     if (Action == ActionID.ReMove)
     {
         FirstFpsAnime = true;
         switch (Random.Range(0, 4))
         {
             case 0:
                 Action = ActionID.Atk1;
                 print("atk1");
                 break;
             case 1:
                 Action = ActionID.Atk2;
                 print("atk2");
                 break;
             case 2:
                 Action = ActionID.Atk3;
                 print("atk3");
                 break;
             default:
                     Action = ActionID.Walk;
                 break;
         }
         Vector3 vec3;
         if (target)
         {
             //ランダムで目的地を変える
             vec3.x = Random.Range(-EnemyMoveDistance, EnemyMoveDistance);
             vec3.y = 0;
             vec3.z = Random.Range(-EnemyMoveDistance, EnemyMoveDistance);
             target.transform.localPosition = vec3;
         }
     }
     else
     {
         FirstFpsAnime = false;
     }
 }
Esempio n. 10
0
        /// <summary>
        /// Action the specified ID.
        /// </summary>
        /// <param name="id">An action ID</param>
        public override void Action(ActionID id)
        {
            switch (id)
            {
            case ActionID.Refresh:
                if (_thisForum != null)
                {
                    _thisForum.Refresh();
                }
                foreach (Folder topic in _currentFolder.Folder.Children)
                {
                    topic.Refresh();
                }
                break;

            case ActionID.Participants:
                FoldersTree.DisplayParticipants(_thisForum.Name);
                break;

            case ActionID.ManageForum:
                FoldersTree.ManageForum(_thisForum);
                break;

            case ActionID.NextUnread:
                FoldersTree.NextUnread(FolderOptions.NextUnread);
                break;

            case ActionID.NextPriorityUnread:
                FoldersTree.NextUnread(FolderOptions.NextUnread | FolderOptions.Priority);
                break;

            case ActionID.PageMessage:
                FoldersTree.NextUnread(FolderOptions.NextUnread);
                break;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 解析游戏动作条件
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public T resolve <T>(ActionID id)
            where T : class, IAction
        {
            T result = null;

            switch (id.ActionType)
            {
            case ActionID.ActionTypeCode.Condit:
                if (this.conditActionDict.TryGetValue(id, out var conditAction) == false)
                {
                    throw new ArgumentException($"动作ID{id}未注册");
                }

                result = conditAction as T;
                break;

            case ActionID.ActionTypeCode.Execute:
                if (this.executeActionDict.TryGetValue(id, out var executeAction) == false)
                {
                    throw new ArgumentException($"动作ID{id}未注册");
                }

                result = executeAction as T;
                break;

            default:
                throw new ArgumentException($"出现为处理的ActionType枚举类型{id.ActionType}");
            }

            if (result == null)
            {
                throw new ArgumentException($"泛型类型错误,类型{nameof(T)}与ID{id}不对应");
            }

            return(result);
        }
 public static string LookupActionURL(ActionID action, bool fightingBoss)
 {
     switch (action)
     {
         case ActionID.GoToTown01:
             return "https://dknight2.com/index.php?do=gotown:1";
         case ActionID.GoToTown02:
             return "https://dknight2.com/index.php?do=gotown:2";
         case ActionID.GoToTown03:
             return "https://dknight2.com/index.php?do=gotown:3";
         case ActionID.GoToTown04:
             return "https://dknight2.com/index.php?do=gotown:4";
         case ActionID.GoToTown05:
             return "https://dknight2.com/index.php?do=gotown:5";
         case ActionID.GoToTown06:
             return "https://dknight2.com/index.php?do=gotown:6";
         case ActionID.GoToTown07:
             return "https://dknight2.com/index.php?do=gotown:7";
         case ActionID.GoToTown08:
             return "https://dknight2.com/index.php?do=gotown:8";
         case ActionID.GoToTown09:
             return "https://dknight2.com/index.php?do=gotown:9";
         case ActionID.GoToTown10:
             return "https://dknight2.com/index.php?do=gotown:10";
         case ActionID.GoToTown11:
             return "https://dknight2.com/index.php?do=gotown:11";
         case ActionID.GoToTown12:
             return "https://dknight2.com/index.php?do=gotown:12";
         case ActionID.GoToTown13:
             return "https://dknight2.com/index.php?do=gotown:13";
         case ActionID.GoToTown14:
             return "https://dknight2.com/index.php?do=gotown:14";
         case ActionID.GoToTown15:
             return "https://dknight2.com/index.php?do=gotown:15";
         case ActionID.GoToTown16:
             return "https://dknight2.com/index.php?do=gotown:16";
         case ActionID.GoToTown17:
             return "https://dknight2.com/index.php?do=gotown:17";
         case ActionID.GoToTown18:
             return "https://dknight2.com/index.php?do=gotown:18";
         case ActionID.UsePotionHP:
             return "https://dknight2.com/index.php?do=potion:1";
         case ActionID.UsePotionMP:
             return "https://dknight2.com/index.php?do=potion:2";
         case ActionID.UsePotionTP:
             return "https://dknight2.com/index.php?do=potion:3";
         case ActionID.BuyPotionHP:
             return "https://dknight2.com/index.php?do=buypotions&buy=1&amount=20";
         case ActionID.BuyPotionMP:
             return "https://dknight2.com/index.php?do=buypotions&buy=2&amount=20";
         case ActionID.BuyPotionTP:
             return "https://dknight2.com/index.php?do=buypotions&buy=3&amount=20";
         case ActionID.RangerWood50:
             return "https://dknight2.com/index.php?do=woodcut";
         case ActionID.RangerFish50:
             return "https://dknight2.com/index.php?do=fish";
         case ActionID.RangerStone50:
             return "https://dknight2.com/index.php?do=stone";
         case ActionID.RangerIron50:
             return "https://dknight2.com/index.php?do=iron";
         case ActionID.WithdrawGold:
         case ActionID.DepositGold:
             return "https://dknight2.com/index.php?do=bank";
         case ActionID.DepositDragonPoints:
             return "https://dknight2.com/index.php?do=dpbank";
         case ActionID.ExploreNorth:
         case ActionID.ExploreSouth:
         case ActionID.ExploreWest:
         case ActionID.ExploreEast:
             return "https://dknight2.com/index.php?do=move";
         case ActionID.SleepAtInn:
             return "https://dknight2.com/index.php?do=inn";
         case ActionID.Run:
         case ActionID.CastSleep60:
         case ActionID.CastDamage50:
             if (fightingBoss)
             {
                 return "https://dknight2.com/index.php?do=fightboss";
             }
             return "https://dknight2.com/index.php?do=fight";
     }
     return null;
 }
Esempio n. 13
0
 public Node_Goap(WorldStateSet ws, ActionID actionID)
 {
     this.WS = ws;
     this.ID = actionID;
 }
Esempio n. 14
0
 public Node_Goap(WorldStateSet ws, WorldStateSymbol[] wsDiff, float gCost, float hCost, Node_Goap parent, ActionID actionID)
 {
     this.parent = parent;
     this.WS     = ws;
     this.ID     = actionID;
     this.hCost  = hCost;
     this.WSDiff = wsDiff;
 }
Esempio n. 15
0
 public static string Name(ActionID id)
 {
     return(ActionTable.table_.get_Item(id));
 }
Esempio n. 16
0
 public ActionKVP(ActionID actionID, ActionDelegate actionDelegate)
 {
     this.actionID       = actionID;
     this.actionDelegate = actionDelegate;
 }
        /// <summary>
        /// Starting with iOS 8.0, the NP can inform the NC of potential actions that are associated with iOS notifications. On the user’s behalf, the NC can then request the NP to perform an action associated with a specific iOS notification.
        ///
        /// The NC is informed of the existence of performable actions on an iOS notification by detecting the presence of set flags in the EventFlags field of the GATT notifications generated by the Notification Source characteristic
        /// </summary>
        /// <param name="notificationUID">A 32-bit numerical value that is the unique identifier (UID) for the iOS notification on which to perform the action.</param>
        /// <param name="actionID">The action identifier.</param>
        /// <returns></returns>
        public async Task <GattCommunicationStatus> PerformNotificationActionAsync(UInt32 notificationUID, ActionID actionID)
        {
            var stream = new MemoryStream();
            var writer = new BinaryWriter(stream);

            writer.Write((byte)CommandID.PerformNotificationAction);
            writer.Write(notificationUID);
            writer.Write((byte)actionID);

            byte[] bytes = stream.ToArray();

            try
            {
                return(await WriteValueAsync(bytes.AsBuffer()));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 public static int Int(this ActionID e)
 {
     return((int)e);
 }
Esempio n. 19
0
 public static string GetActionString(ActionID actionId)
 {
     return(ActionString[(int)actionId]);
 }
Esempio n. 20
0
 /// <summary>
 /// Return the toolbar button that corresponds to the specified Action ID or
 /// null if no such button exists.
 /// </summary>
 public CRToolbarItem ItemWithID(ActionID id)
 {
     return((from CRToolbarItem item in CRToolbarItemCollection.DefaultCollection.Buttons where item.ID == id select item).FirstOrDefault());
 }
Esempio n. 21
0
 public ActionPacket(ActionID actionID, WhichID whichID)
 {
     this.actionID = actionID;
     this.whichID  = whichID;
 }
Esempio n. 22
0
        /// <summary>
        /// Action the specified ID.
        /// </summary>
        /// <param name="id">An action ID</param>
        public override void Action(ActionID id)
        {
            switch (id)
            {
                case ActionID.Refresh:
                    if (_thisForum != null)
                    {
                        _thisForum.Refresh();
                    }
                    foreach (Folder topic in _currentFolder.Folder.Children)
                    {
                        topic.Refresh();
                    }
                    break;

                case ActionID.Participants:
                    FoldersTree.DisplayParticipants(_thisForum.Name);
                    break;

                case ActionID.ManageForum:
                    FoldersTree.ManageForum(_thisForum);
                    break;

                case ActionID.NextUnread:
                    FoldersTree.NextUnread(FolderOptions.NextUnread);
                    break;

                case ActionID.NextPriorityUnread:
                    FoldersTree.NextUnread(FolderOptions.NextUnread|FolderOptions.Priority);
                    break;

                case ActionID.PageMessage:
                    FoldersTree.NextUnread(FolderOptions.NextUnread);
                    break;
            }
        }
Esempio n. 23
0
        /// <summary>
        /// Return whether the specified action can be carried out.
        /// </summary>
        /// <param name="id">An action ID</param>
        public override bool CanAction(ActionID id)
        {
            switch (id)
            {
                case ActionID.ManageForum:
                    return _thisForum != null && _thisForum.IsModerator;

                case ActionID.Refresh:
                case ActionID.Participants:
                    return true;
            }
            return false;
        }
Esempio n. 24
0
 /// <summary>
 /// Return whether or not we can process the specified action ID.
 /// </summary>
 public override bool CanAction(ActionID id)
 {
     switch (id)
     {
         case ActionID.JoinForum:
         case ActionID.Refresh:
             return true;
     }
     return false;
 }
Esempio n. 25
0
        /// <summary>
        /// Top-level check whether the specified action ID can be carried out.
        /// </summary>
        private bool CanAction(ActionID id)
        {
            switch (id)
            {
                case ActionID.Offline:
                case ActionID.Search:
                    return true;

                case ActionID.BackTrack:
                    return CanGoBack();

                case ActionID.GoForward:
                    return CanGoForward();

                case ActionID.NextUnread:
                    return CIX.TotalUnread > 0;

                case ActionID.NextPriorityUnread:
                    return CIX.TotalUnreadPriority > 0;

                case ActionID.JoinForum:
                    return true;
            }
            return _foldersTree.CanAction(id);
        }
Esempio n. 26
0
        /// <summary>
        /// Return whether the specified action can be carried out.
        /// </summary>
        /// <param name="id">An action ID</param>
        public override bool CanAction(ActionID id)
        {
            switch (id)
            {
                case ActionID.NewMessage:
                    return true;

                case ActionID.Reply:
                case ActionID.Edit:
                case ActionID.Withdraw:
                case ActionID.Profile:
                case ActionID.Read:
                case ActionID.Print:
                case ActionID.SelectAll:
                    return SelectedMessage != null;
            }
            return false;
        }
Esempio n. 27
0
 ///<summary>Append a line into log</summary>
 public FunctionResult LogString(ActionID ActionCode, string sString)
 {
     try //Protection from file operations errors
     {
         //DateTime uNow = DateTime.Now;
         string s = Environment.TickCount.ToString("0000");
         uLogFileStream.Write(DateTime.Now.ToString("yyyyMMdd-HHmmss.") + s.Substring(s.Length-4));
         uLogFileStream.Write("; ");
         uLogFileStream.Write(((int)ActionCode).ToString());
         uLogFileStream.Write("; ");
         uLogFileStream.WriteLine(sString);
         return FunctionResult.OK;
     }
     catch
     {
         return FunctionResult.ErrorOnWritingFile;
     }
 }
Esempio n. 28
0
        /// <summary>
        /// Return the text string for the specified action.
        /// </summary>
        public override string TitleForAction(ActionID id)
        {
            if (SelectedMessage != null)
            {
                InboxConversation conversation = SelectedMessage;
                switch (id)
                {
                    case ActionID.Read:
                        return conversation.UnreadCount > 0 ? Resources.AsRead : Resources.AsUnread;

                    case ActionID.Withdraw:
                        return Resources.Delete;
                }
            }
            return null;
        }
Esempio n. 29
0
 /// <summary>
 /// Return the title for the specified action.
 /// </summary>
 public string TitleForAction(ActionID id)
 {
     return _currentView.TitleForAction(id);
 }
Esempio n. 30
0
        /// <summary>
        /// Action the specified ID with the given conversation.
        /// </summary>
        /// <param name="id">An action ID</param>
        /// <param name="conversation">A selected conversation, or null</param>
        private void Action(ActionID id, InboxConversation conversation)
        {
            switch (id)
            {
                case ActionID.NewMessage:
                    FoldersTree.MainForm.Address = "cixmail:";
                    break;

                case ActionID.Print:
                    Print(conversation);
                    break;

                case ActionID.Profile:
                case ActionID.AuthorImage:
                    FoldersTree.MainForm.Address = string.Format("cixuser:{0}", conversation.Author);
                    break;

                case ActionID.Withdraw:
                    conversation.MarkDelete();
                    break;

                case ActionID.PageMessage:
                case ActionID.NextUnread:
                    GoToNextUnread(conversation);
                    break;

                case ActionID.NextPriorityUnread:
                    GoToNextPriorityUnread(conversation);
                    break;

                case ActionID.Edit:
                case ActionID.Reply:
                    {
                        InboxMessageEditor newMessageWnd = new InboxMessageEditor(conversation);
                        newMessageWnd.Show();
                        break;
                    }

                case ActionID.Read:
                    MarkConversationAsRead(conversation);
                    break;

                case ActionID.SelectAll:
                    SelectAll();
                    break;
            }
        }
Esempio n. 31
0
        /// <summary>
        /// Return a string that represents the key used for the specified action.
        /// </summary>
        /// <param name="actionId">The action ID</param>
        /// <returns>The key string</returns>
        public static string MapActionToKeyString(ActionID actionId)
        {
            string actionEnum = actionId.ToString();

            UIConfigKeysKey ky = null;
            if (Keys.customkey != null)
            {
                ky = Keys.customkey.FirstOrDefault(key => String.Equals(key.name, actionEnum, StringComparison.CurrentCultureIgnoreCase));
            }
            if (ky == null)
            {
                ky = Keys.key.FirstOrDefault(key => String.Equals(key.name, actionEnum, StringComparison.CurrentCultureIgnoreCase));
            }
            if (ky != null)
            {
                switch (ky.code)
                {
                    case "Oemcomma":    return ",";
                    case "OemPeriod":   return ".";
                    case "Left":        return "←";
                    case "Right":       return "→";
                }
                return ky.code;
            }
            return string.Empty;
        }
Esempio n. 32
0
 public bool IsDown(ActionID id)
 {
     return(this.Player0.GetButton((int)id));
 }
Esempio n. 33
0
 public Node_Goap(WorldStateSet ws, WorldStateSymbol[] wsDiff, ActionID actionID)
 {
     this.WS     = ws;
     this.ID     = actionID;
     this.WSDiff = wsDiff;
 }
Esempio n. 34
0
 public bool IsPressedKey(ActionID id)
 {
     return(this.Player0.GetButtonDown((int)id));
 }
Esempio n. 35
0
 /// <summary>
 /// Returns the component with the given ID. If more than one component shares
 /// the same ID, the first one is returned.
 /// </summary>
 /// <param name="id">ID of the component</param>
 /// <returns>A CanvasElementBase, or null</returns>
 public CanvasElementBase this[ActionID id]
 {
     get { return _components.FirstOrDefault(cmn => cmn.ID == id); }
 }
Esempio n. 36
0
        public bool IsPressedAxis(ActionID axisID)
        {
            int num = (double)Mathf.Abs(this.Player0.GetAxisPrev((int)axisID)) <= 0.300000011920929 ? 0 : 1;

            return(((double)Mathf.Abs(this.Player0.GetAxis((int)axisID)) <= 0.300000011920929 ? 0 : 1) > num);
        }
 public static string LookupActionPOST(ActionID action, int goldMove = 0)
 {
     switch (action)
     {
         case ActionID.SleepAtInn:
             return "choice=" + goldMove + "+Gold&heal=Full+Heal";
         case ActionID.WithdrawGold:
             return "bank=Withdraw&withdraw=" + goldMove;
         case ActionID.DepositGold:
             return "bank=Deposit&deposit=" + goldMove;
         case ActionID.DepositDragonPoints:
             return "dpbank=Deposit&deposit=" + goldMove;
         case ActionID.ExploreNorth:
             return "north=North&keydir=";
         case ActionID.ExploreSouth:
             return "south=South&keydir=";
         case ActionID.ExploreWest:
             return "west=West&keydir=";
         case ActionID.ExploreEast:
             return "east=East&keydir=";
         case ActionID.CastSleep60:
             return "spell=Spell&userspell=13";
         case ActionID.CastDamage50:
             return "spell=Spell&userspell=10";
         case ActionID.RangerWood50:
             return "ac=t6&submit=Yes";
         case ActionID.RangerFish50:
         case ActionID.RangerStone50:
         case ActionID.RangerIron50:
             return "ac=t6&submit=Yes%21";
     }
     return null;
 }
Esempio n. 38
0
 public float GetAxisRaw(ActionID axisID)
 {
     return(this.Player0.GetAxisRaw((int)axisID));
 }
 public static string LookupRefererURL(ActionID action, bool fightingBoss)
 {
     switch (action)
     {
         case ActionID.SleepAtInn:
             return "https://dknight2.com/index.php";
         case ActionID.BuyPotionHP:
         case ActionID.BuyPotionMP:
         case ActionID.BuyPotionTP:
             return "https://dknight2.com/index.php?do=buypotions";
     }
     if (LookupActionPOST(action) == null)
     {
         return "https://dknight2.com/index.php";
     }
     return LookupActionURL(action, fightingBoss);
 }
Esempio n. 40
0
 /// <summary>
 /// Return the toolbar button that corresponds to the specified Action ID or
 /// null if no such button exists.
 /// </summary>
 public CRToolbarItem ItemWithID(ActionID id)
 {
     return (from CRToolbarItem item in CRToolbarItemCollection.DefaultCollection.Buttons where item.ID == id select item).FirstOrDefault();
 }
Esempio n. 41
0
        /// <summary>
        /// Process the specified Action ID.
        /// </summary>
        public override void Action(ActionID id)
        {
            switch (id)
            {
                case ActionID.JoinForum:
                    {
                        ListView.SelectedIndexCollection selectedItems = dvForumsList.SelectedIndices;
                        if (selectedItems.Count == 1)
                        {
                            DirForum selectedForum = _items[selectedItems[0]];
                            string forumName = selectedForum.Name;

                            JoinForum joinForum = new JoinForum(forumName);
                            if (joinForum.ShowDialog() == DialogResult.OK)
                            {
                                FoldersTree.MainForm.Address = string.Format("cix:{0}", forumName);
                            }
                        }
                        break;
                    }

                case ActionID.Refresh:
                    _currentCategory.Refresh();
                    break;
            }
        }
Esempio n. 42
0
 /// <summary>
 /// Action the specified ID.
 /// </summary>
 /// <param name="id">An action ID</param>
 public override void Action(ActionID id)
 {
     Action(id, SelectedMessage);
 }
 public void Set(String str, ActionID id)
 {
     ID      = id;
     message = str;
 }
Esempio n. 44
0
        /// <summary>
        /// Return whether the specified action can be carried out.
        /// </summary>
        /// <param name="id">An action ID</param>
        public override bool CanAction(ActionID id)
        {
            switch (id)
            {
                case ActionID.Profile:
                case ActionID.MarkThreadReadThenRoot:
                case ActionID.MarkThreadRead:
                case ActionID.ReadLock:
                case ActionID.Ignore:
                case ActionID.Star:
                case ActionID.Priority:
                case ActionID.Link:
                case ActionID.SelectAll:
                case ActionID.Print:
                case ActionID.ReplyByMail:
                case ActionID.Block:
                    if (SelectedMessage != null)
                    {
                        CIXMessage message = SelectedMessage;
                        return !message.IsPseudo;
                    }
                    return false;

                case ActionID.ManageForum:
                    if (_currentFolder.ID > 0)
                    {
                        TopicFolder topicFolder = (TopicFolder)_currentFolder;
                        Folder forumFolder = topicFolder.Folder.ParentFolder;
                        DirForum forum = CIX.DirectoryCollection.ForumByName(forumFolder.Name);
                        return forum != null && forum.IsModerator;
                    }
                    return false;

                case ActionID.Expand:
                    return SelectedMessage != null && IsExpandable(SelectedMessage);

                case ActionID.Copy:
                    return DisplayedItem != null && !string.IsNullOrWhiteSpace(DisplayedItem.Selection);

                case ActionID.GoTo:
                    return _currentFolder.ID > 0 && _messages.Count > 0;

                case ActionID.Original:
                    if (SelectedMessage != null)
                    {
                        CIXMessage message = SelectedMessage;
                        return message.CommentID != 0;
                    }
                    return false;

                case ActionID.Refresh:
                    return _currentFolder.ID > 0;

                case ActionID.Participants:
                    return true;

                case ActionID.Read:
                    if (SelectedMessage != null)
                    {
                        CIXMessage message = SelectedMessage;
                        return !message.IsPseudo && !message.ReadLocked;
                    }
                    return false;

                case ActionID.NextRoot:
                {
                    int selectedIndex = SelectedRow;
                    return selectedIndex < _messages.Count - 1;
                }

                case ActionID.Root:
                    return SelectedRow > 0;

                case ActionID.NewMessage:
                {
                    if (_currentFolder.ID > 0)
                    {
                        TopicFolder topicFolder = (TopicFolder)_currentFolder;
                        Folder forumFolder = topicFolder.Folder.IsRootFolder ? topicFolder.Folder : topicFolder.Folder.ParentFolder;
                        DirForum forum = CIX.DirectoryCollection.ForumByName(forumFolder.Name);
                        bool isModerator = forum != null && forum.IsModerator;
                        bool isReadOnly = topicFolder.Folder.IsReadOnly;
                        return isModerator || !isReadOnly;
                    }
                    return false;
                }

                case ActionID.Delete:
                case ActionID.Withdraw:
                    if (SelectedMessage != null)
                    {
                        CIXMessage message = SelectedMessage;
                        Folder topic = message.Topic;
                        Folder forumFolder = topic.ParentFolder;
                        DirForum forum = CIX.DirectoryCollection.ForumByName(forumFolder.Name);
                        bool isModerator = forum != null && forum.IsModerator;

                        return isModerator || message.IsPseudo || message.IsMine;
                    }
                    return false;

                case ActionID.Edit:
                    if (SelectedMessage != null)
                    {
                        CIXMessage message = SelectedMessage;
                        return message.IsDraft;
                    }
                    return false;

                case ActionID.Reply:
                case ActionID.Quote:
                    if (SelectedMessage != null)
                    {
                        CIXMessage message = SelectedMessage;
                        Folder topicFolder = message.Topic;
                        if (topicFolder != null)
                        {
                            Folder forumFolder = topicFolder.ParentFolder;
                            DirForum forum = CIX.DirectoryCollection.ForumByName(forumFolder.Name);
                            bool isModerator = forum != null && forum.IsModerator;

                            if (topicFolder.IsReadOnly && !isModerator)
                            {
                                return false;
                            }
                            return !message.IsPseudo;
                        }
                    }
                    return false;
            }
            return false;
        }
Esempio n. 45
0
 public override string ToString()
 {
     return(String.Format("[{0}] Action", ActionID.ToString().PadLeft(3)));
 }
Esempio n. 46
0
 /// <summary>
 /// Override to return the title for the specified action.
 /// </summary>
 public virtual string TitleForAction(ActionID id)
 {
     return(null);
 }
Esempio n. 47
0
 public InputPacket(InputID inputID, UpDownID upDownID, ActionID actionID)
 {
     this.inputID  = inputID;
     this.upDownID = upDownID;
     this.actionID = actionID;
 }
Esempio n. 48
0
 /// <summary>
 /// Override to return whether the subview can handle the specified action.
 /// </summary>
 /// <param name="id">The ID of the action</param>
 public virtual bool CanAction(ActionID id)
 {
     return(false);
 }
Esempio n. 49
0
        /// <summary>
        /// Actions the specified action ID.
        /// </summary>
        public void Action(ActionID id)
        {
            FolderBase folderBase = (FolderBase)(_contextMenuNode ?? _selectedNode).Tag;
            switch (id)
            {
                case ActionID.Refresh:
                {
                    if (folderBase.ID > 0)
                    {
                        TopicFolder topicFolder = (TopicFolder)folderBase;
                        Folder folder = topicFolder.Folder;
                        if (folder.IsRootFolder)
                        {
                            DirForum thisForum = CIX.DirectoryCollection.ForumByName(folder.Name);
                            thisForum.Refresh();
                        }
                    }
                    folderBase.Refresh();
                    _contextMenuNode = null;
                    return;
                }

                case ActionID.ManageForum:
                {
                    if (folderBase.ID > 0)
                    {
                        TopicFolder topicFolder = (TopicFolder) folderBase;
                        Folder folder = topicFolder.Folder;
                        if (!folder.IsRootFolder)
                        {
                            folder = folder.ParentFolder;
                        }
                        DirForum thisForum = CIX.DirectoryCollection.ForumByName(folder.Name);
                        ManageForum(thisForum);
                    }
                    _contextMenuNode = null;
                    return;
                }

                case ActionID.Participants:
                {
                    if (folderBase.ID > 0)
                    {
                        TopicFolder topicFolder = (TopicFolder) folderBase;
                        Folder folder = topicFolder.Folder;
                        if (!folder.IsRootFolder)
                        {
                            folder = folder.ParentFolder;
                        }
                        DisplayParticipants(folder.Name);
                    }
                    _contextMenuNode = null;
                    return;
                }

                case ActionID.Delete:
                {
                    if (folderBase.ID > 0)
                    {
                        TopicFolder folder = (TopicFolder)folderBase;
                        string promptString = string.Format(Resources.ConfirmDelete, folder.Name);
                        if (MessageBox.Show(promptString, Resources.Confirm, MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
                        {
                            folder.Folder.Delete(true);
                        }
                    }
                    _contextMenuNode = null;
                    return;
                }

                case ActionID.ResignForum:
                {
                    if (folderBase.ID > 0)
                    {
                        TopicFolder folder = (TopicFolder)folderBase;
                        string promptString = String.Format(Resources.ConfirmResign, folder.Name);
                        if (MessageBox.Show(promptString, Resources.Confirm, MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes)
                        {
                            folder.Folder.Resign();
                        }
                    }
                    _contextMenuNode = null;
                    return;
                }

                case ActionID.MarkTopicRead:
                {
                    if (folderBase.ID > 0)
                    {
                        TopicFolder folder = (TopicFolder)folderBase;
                        HandleMarkFolderRead(folder.Folder);
                    }
                    _contextMenuNode = null;
                    return;
                }
            }
            if (_currentView != null)
            {
                _currentView.Action(id);
            }
        }
Esempio n. 50
0
 /// <summary>
 /// Override to return whether the subview can handle the specified action.
 /// </summary>
 /// <param name="id">The ID of the action</param>
 public virtual bool CanAction(ActionID id)
 {
     return false;
 }
Esempio n. 51
0
        /// <summary>
        /// Return whether the specified action ID can be handled.
        /// </summary>
        internal bool CanAction(ActionID id)
        {
            TreeNode node = _contextMenuNode ?? _selectedNode;
            FolderBase folderBase = node != null ? (FolderBase)node.Tag : null;
            switch (id)
            {
                case ActionID.ManageForum:
                {
                    DirForum thisForum = null;
                    if (folderBase != null && folderBase.ID > 0)
                    {
                        TopicFolder topicFolder = (TopicFolder) folderBase;
                        Folder folder = topicFolder.Folder;
                        if (!folder.IsRootFolder)
                        {
                            folder = folder.ParentFolder;
                        }
                        thisForum = CIX.DirectoryCollection.ForumByName(folder.Name);
                    }
                    return thisForum != null && thisForum.IsModerator;
                }

                case ActionID.ResignForum:
                {
                    Folder folder = folderBase != null && folderBase.ID > 0 ? ((TopicFolder)folderBase).Folder : null;
                    return folder != null && folder.CanResign && !folder.IsResigned;
                }

                case ActionID.Delete:
                case ActionID.Participants:
                case ActionID.MarkTopicRead:
                {
                    return folderBase != null && folderBase.ID > 0;
                }
            }
            return (_currentView != null) && _currentView.CanAction(id);
        }
Esempio n. 52
0
        public static IActionPool GetActionPool(ActionID actionID)
        {
            switch (actionID)
            {
            case ActionID.UI_CHANGE_CROSSSIGHT_SIZE:
                return(new ChangeCrossSightSizeActionPool());

            case ActionID.PAUSE_TIMELINE_EVENT_ACTION:
                return(new PauseActionPool());

            case ActionID.SET_MAX_SPEED_EVENT_ACTION:
                return(new SetMaxSpeedActionPool());

            case ActionID.CHANGE_SPEED_EVENT_ACTION:
                return(new ChangeSpeedActionPool());

            case ActionID.PLAY_POINT_SOUND_EVENT_ACTION:
                return(new PlayPointSoundActionPool());

            case ActionID.PLAY_ENTITY_POSITION_SOUND_EVENT_ACTION:
                return(new PlayEntityPositionSoundActionPool());

            case ActionID.PLAY_ENTITY_BIND_SOUND_EVENT_ACTION:
                return(new PlayEntityBindSoundActionPool());

            case ActionID.PLAY_EMIT_SOUND_EVENT_ACTION:
                return(new PlayEmitSoundActionPool());

            case ActionID.ACCUMULATION_FORCE_RELEASE_EVENT_ACTION:
                return(new AccumulationForceReleaseActionPool());

            case ActionID.FLYER_EMIT_EVENT_ACTION:
                return(new FlyerEmitActionPool());

            case ActionID.FLYER_TRACE_PATH_DURATION_ACTION:
                return(new FlyerTracePathActionPool());

            case ActionID.FLYER_ANGULAR_TRACE_PATH_DURATION_ACTION:
                return(new FlyerAngularTracePathActionPool());

            case ActionID.TARGETNEAR_EMIT_NODE_EVENT_ACTION:
                return(new TargetNearEmitNodeActionPool());

            case ActionID.RANGE_EMIT_NODE_EVENT_ACTION:
                return(new RangeEmitNodeActionPool());

            case ActionID.NEXT_LOOP_EMIT_NODE_EVENT_ACTION:
                return(new NextLoopEmitNodeActionPool());

            case ActionID.FIXED_EMIT_NODE_EVENT_ACTION:
                return(new FixedEmitNodeActionPool());

            case ActionID.AUTO_RANGE_EMIT_NODE_EVENT_ACTION:
                return(new AutoRangeEmitNodeActionPool());

            case ActionID.AOE_TARGET_EFFECT_EVENT_ACTION:
                return(new AoeTargetEffectActionPool());

            case ActionID.ADD_ENTITY_POSITION_EFFECT_EVENT_ACTION:
                return(new AddEntityPositionEffectActionPool());

            case ActionID.ADD_ENTITY_BIND_TO_TARGET_EFFECT_EVENT_ACTION:
                return(new AddEntityBindToTargetEffectActionPool());

            case ActionID.ADD_EMIT_LINK_TARGET_EFFECT_EVENT_ACTION:
                return(new AddEmitLinkTargetEffectActionPool());

            case ActionID.ADD_EMIT_LINK_TARGET__EFFECT_DURATION_ACTION:
                return(new AddEmitLinkTargetDurationEffectActionPool());

            case ActionID.ADD_EMIT_EFFECT_EVENT_ACTION:
                return(new AddEmitEffectActionPool());

            case ActionID.ADD_EMIT_EFFECT_DURATION_ACTION:
                return(new AddEmitDurationEffectActionPool());

            case ActionID.ADD_BIND_LINK_TARGET_EFFECT_EVENT_ACTION:
                return(new AddBindLinkTargetEffectActionPool());

            case ActionID.SET_DIRECTION_EVENT_ACTION:
                return(new SetDirectionActionPool());

            case ActionID.AFFECT_CD_EVENT_ACTION:
                return(new AffectCDActionPool());

            case ActionID.CHANGE_ACCELERATE_DURATION_ACTION:
                return(new ChangeAccelerateActionPool());
            }

            return(null);
        }
Esempio n. 53
0
        /// <summary>
        /// Return the text string for the specified action.
        /// </summary>
        public override string TitleForAction(ActionID id)
        {
            if (SelectedMessage != null)
            {
                CIXMessage message = SelectedMessage;
                switch (id)
                {
                    case ActionID.ReadLock:
                        return message.ReadLocked ? Resources.ClearReadLock : Resources.SetReadLock;

                    case ActionID.Ignore:
                        return message.Ignored ? Resources.AsUnignored : Resources.AsIgnored;

                    case ActionID.Priority:
                        return message.Priority ? Resources.AsNormal : Resources.AsPriority;

                    case ActionID.Star:
                        return message.Starred ? Resources.ClearFlag : Resources.Flag;

                    case ActionID.Read:
                        return message.Unread ? Resources.AsRead : Resources.AsUnread;

                    case ActionID.Withdraw:
                        return message.IsPseudo ? Resources.DeleteOnMenu : Resources.WithdrawOnMenu;
                }
            }
            return null;
        }
Esempio n. 54
0
 private void LogSimpleLine(ActionID ActionCode, string sLine)
 {
     if (uSetting.bLogActions)
         uLog.LogString(ActionCode, sLine);
 }
Esempio n. 55
0
 /// <summary>
 /// Override to handle the specified action.
 /// </summary>
 /// <param name="id">The ID of the action</param>
 public virtual void Action(ActionID id)
 {
 }
Esempio n. 56
0
        /// <summary>
        /// Action the specified ID with the given message item.
        /// </summary>
        /// <param name="id">An action ID</param>
        /// <param name="message">A selected message, or null</param>
        private void Action(ActionID id, CIXMessage message)
        {
            switch (id)
            {
                case ActionID.Chat:
                    Chat(message);
                    break;

                case ActionID.Block:
                    if (message != null)
                    {
                        string titleString = string.Format(Resources.BlockTitle, message.Author);
                        string promptString = string.Format(Resources.BlockPrompt, message.Author);
                        if (MessageBox.Show(promptString, titleString, MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            CIX.RuleCollection.Block(message.Author);
                            OnMessageChanged(message);
                        }
                    }
                    break;

                case ActionID.Participants:
                    if (_currentFolder.ID > 0)
                    {
                        TopicFolder topic = (TopicFolder) _currentFolder;
                        Folder forum = topic.Folder.ParentFolder;
                        Participants parDialog = new Participants(FoldersTree.MainForm, forum.Name);
                        parDialog.ShowDialog();
                    }
                    break;

                case ActionID.ManageForum:
                    if (_currentFolder.ID > 0)
                    {
                        TopicFolder topicFolder = (TopicFolder) _currentFolder;
                        Folder forumFolder = topicFolder.Folder.ParentFolder;
                        DirForum forum = CIX.DirectoryCollection.ForumByName(forumFolder.Name);
                        FoldersTree.ManageForum(forum);
                    }
                    break;

                case ActionID.Email:
                    Email(message);
                    break;

                case ActionID.Profile:
                case ActionID.AuthorImage:
                    FoldersTree.MainForm.Address = string.Format("cixuser:{0}", message.Author);
                    break;

                case ActionID.Priority:
                    PriorityThread(message);
                    break;

                case ActionID.Ignore:
                    IgnoreThread(message);
                    break;

                case ActionID.ReadLock:
                    ToggleReadLock(message);
                    break;

                case ActionID.Quote:
                    if (message != null)
                    {
                        Comment(message, message.Body.Quoted());
                    }
                    break;

                case ActionID.Edit:
                case ActionID.Reply:
                    if (message != null)
                    {
                        if (message.Topic.Flags.HasFlag(FolderFlags.OwnerCommentsOnly) && !message.IsMine)
                        {
                            Action(ActionID.ReplyByMail);
                        }
                        else
                        {
                            Comment(message, null);
                        }
                    }
                    break;

                case ActionID.ReplyByMail:
                    {
                        InboxMessageEditor newMessageWnd = new InboxMessageEditor(message);
                        newMessageWnd.Show();
                    }
                    break;

                case ActionID.Print:
                    Print(message);
                    break;

                case ActionID.Read:
                    ToggleRead(message);
                    break;

                case ActionID.Star:
                    ToggleStar(message);
                    break;

                case ActionID.Withdraw:
                    WithdrawMessage(message);
                    break;

                case ActionID.Delete:
                    DeleteMessage(message);
                    break;

                case ActionID.NextUnread:
                    GoToNextUnread(message);
                    break;

                case ActionID.NextPriorityUnread:
                    GoToNextPriorityUnread(message);
                    break;

                case ActionID.GoToSource:
                    GoToSourceThread(message);
                    break;

                case ActionID.Link:
                    CopyLinkToClipboard(message);
                    break;

                case ActionID.PageMessage:
                    if (tsvMessagePane.Items.Count > 0)
                    {
                        MessageItem messageItem = tsvMessagePane.Items[0] as MessageItem;
                        if (messageItem != null)
                        {
                            if (ScrollMessageUp())
                            {
                                break;
                            }
                            if (messageItem.Message.Unread)
                            {
                                MarkAsRead(messageItem.Message);
                            }
                            FoldersTree.NextUnread(FolderOptions.NextUnread);

                            // Put focus back on thread
                            ActiveControl = tsvMessages;
                        }
                    }
                    break;

                case ActionID.GoTo:
                    if (CanAction(ActionID.GoTo))
                    {
                        GoToMessageDialog();
                    }
                    break;

                case ActionID.MarkThreadRead:
                    MarkThreadRead(message);
                    FoldersTree.NextUnread(FolderOptions.NextUnread);
                    break;

                case ActionID.MarkThreadReadThenRoot:
                    MarkThreadRead(message);
                    FoldersTree.NextUnread(FolderOptions.NextUnread | FolderOptions.Root);
                    break;

                case ActionID.MarkTopicRead:
                    MarkTopicRead();
                    FoldersTree.NextUnread(FolderOptions.NextUnread);
                    break;

                case ActionID.NextRoot:
                    SelectRoot(message, RootToSelect.NextRoot);
                    break;

                case ActionID.Root:
                    SelectRoot(message, RootToSelect.PreviousRoot);
                    break;

                case ActionID.Original:
                    SelectOriginal(message);
                    break;

                case ActionID.NewMessage:
                    NewMessage(string.Empty);
                    break;

                case ActionID.SelectAll:
                    SelectAll();
                    break;

                case ActionID.Expand:
                    ExpandCollapseThread(message);
                    break;

                case ActionID.Copy:
                    CopySelection();
                    break;
            }
        }
Esempio n. 57
0
 /// <summary>
 /// Override to handle the specified action.
 /// </summary>
 /// <param name="id">The ID of the action</param>
 public virtual void Action(ActionID id)
 {
 }
Esempio n. 58
0
 public override string ToString()
 {
     return(ActionID.ToString());
 }
Esempio n. 59
0
 /// <summary>
 /// Override to return the title for the specified action.
 /// </summary>
 public virtual string TitleForAction(ActionID id)
 {
     return null;
 }
Esempio n. 60
0
                    // Subkey returns an action ID corresponding to mixing a parent
                    // action ID with a string description of the subkey.
                    public static ActionID Subkey(ActionID parent, @string desc)
                    {
                        var h = sha256.New();

                        h.Write((slice <byte>) "subkey:");
                        h.Write(parent[..]);