Example #1
0
        /// <summary>
        /// 处理群消息
        /// </summary>
        /// <param name="group"></param>
        /// <param name="user"></param>
        /// <param name="question"></param>
        public void dealGroupMsg(long group, long user, string question)
        {
            tryInit();
            saveMsg(group, user, question.Trim());
            if (!askme(ref question))
            {
                return;
            }
            if (!allowuser(user))
            {
                return;
            }
            if (dealCmd(group, user, question))
            {
                return;
            }

            string msg      = "";
            string modeName = modes.getGroupMode(group);

            switch (modeName)
            {
            case "正常": msg += getAnswerNormal(user, question); break;

            case "混沌": msg += modes.getAnswerChaos(user, question); break;

            default: msg += modes.getAnswerWithMode(user, question, modeName); break;
            }
            msg = ItemParser.getHexie(msg);
            sendGroup(group, user, msg);
            saveMsg(group, myQQ, msg.Trim());
        }
        private void UpdateItemDisplay(Item i)
        {
            itemInfo.Text = $"{i.Name}{(i.Equipped ? " (Equipped)" : "")}{Environment.NewLine}------------------{Environment.NewLine}{i.Description}";

            itemImage.IsVisible = true;
            itemImage.SetImageFromFile(ItemParser.GetItemPath(i));
        }
Example #3
0
        /// <summary>
        /// 处理私聊信息
        /// </summary>
        /// <param name="user"></param>
        /// <param name="question"></param>
        public void dealPrivateMsg(long user, string question)
        {
            tryInit();
            saveMsg(0, user, question.Trim());
            if (!allowuser(user))
            {
                return;
            }
            if (user == masterQQ)
            {
                // Common.CqApi.SendPrivateMessage(user, "[CQ: rich, url = https://i.y.qq.com/v8/playsong.html?songid=201243685&amp;source=yqq#wechat_redirect,text=来自QQ音乐的分享 《Lightbreaker》]");
            }
            if (dealCmd(0, user, question))
            {
                return;
            }

            string msg      = "";
            string modeName = modes.getUserMode(user);

            switch (modeName)
            {
            case "正常": msg += getAnswerNormal(user, question); break;

            case "混沌": msg += modes.getAnswerChaos(user, question); break;

            default: msg += modes.getAnswerWithMode(user, question, modeName); break;
            }
            msg = ItemParser.getHexie(msg);
            sendPrivate(user, msg);
            saveMsg(0, user, msg.Trim());
        }
Example #4
0
    // 초기화
    private void Awake()
    {
        var itemCode = DataCache <int> .GetData(dataKeyOfEquippedWeapon);

        // 데이터 셋
        weaponItemUI.SetItem(ItemParser.GetItemByCode(itemCode));
    }
Example #5
0
        /// <summary>
        ///     Get the list of all active items with pagination.
        /// </summary>
        /// <param name="parameters">
        ///     The parameters is the Dictionary object which contains the filters in the form of key,value pair to refine the
        ///     list.<br></br>The possible filters are listed below<br></br>
        ///     <table>
        ///         <tr>
        ///             <td>name</td>
        ///             <td>Search items by name.<br></br>Variants: <i>name_startswith</i> and <i>name_contains</i></td>
        ///         </tr>
        ///         <tr>
        ///             <td>description</td>
        ///             <td>
        ///                 Search items by description.<br></br>Variants: <i>description_startswith</i> and
        ///                 <i>description_contains</i>
        ///             </td>
        ///         </tr>
        ///         <tr>
        ///             <td>rate</td>
        ///             <td>
        ///                 Search items by rate.<br></br>Variants: <i>rate_less_than, rate_less_equals, rate_greater_than</i> and
        ///                 <i>rate_greater_equals</i>
        ///             </td>
        ///         </tr>
        ///         <tr>
        ///             <td>tax_id</td><td>Search items by tax id.</td>
        ///         </tr>
        ///         <tr>
        ///             <td>account_id</td><td>Search items by account id.</td>
        ///         </tr>
        ///         <tr>
        ///             <td>filter_by</td>
        ///             <td>
        ///                 Filter items by status.<br></br>Allowed Values: <i>Status.All, Status.Active</i> and
        ///                 <i>Status.Inactive</i>
        ///             </td>
        ///         </tr>
        ///         <tr>
        ///             <td>search_text</td><td>Search items by name or description.</td>
        ///         </tr>
        ///         <tr>
        ///             <td>sort_column</td><td>Sort items.<br></br>Allowed Values: <i>name, rate</i> and <i>tax_name</i></td>
        ///         </tr>
        ///     </table>
        /// </param>
        /// <returns>ItemsList object.</returns>
        public ItemList GetItems(Dictionary <object, object> parameters)
        {
            var url      = baseAddress;
            var response = ZohoHttpClient.get(url, getQueryParameters(parameters));

            return(ItemParser.getItemList(response));
        }
        private void ItemParam_Click(object sender, EventArgs e)
        {
            TextBlock tb     = (TextBlock)sender;
            string    sortby = tb.Tag != null ? "[property] " + tb.Tag : ItemParser.ParseLine(tb.Text.Split('\n')[0]).Key;

            RepeatResults.SortBy = sortby;
        }
Example #7
0
        /// <summary>
        ///     Get the details of an item.
        /// </summary>
        /// <param name="item_id">The item_id is the identifier of the item.</param>
        /// <returns>LineItem object.</returns>
        public LineItem Get(string item_id)
        {
            var url      = baseAddress + "/" + item_id;
            var response = ZohoHttpClient.get(url, getQueryParameters());

            return(ItemParser.getItem(response));
        }
Example #8
0
        public ScriptEditDialog(string text) : base("Script edit", "cde.ico", SizeToContent.Manual, ResizeMode.CanResize)
        {
            InitializeComponent();
            Extensions.SetMinimalSize(this);

            AvalonLoader.Load(_textEditor);
            AvalonLoader.SetSyntax(_textEditor, "Script");

            string script = ItemParser.Format(text, 0);

            _textEditor.Text = script;
            _textEditor.TextArea.TextEntered  += new TextCompositionEventHandler(_textArea_TextEntered);
            _textEditor.TextArea.TextEntering += new TextCompositionEventHandler(_textArea_TextEntering);

            _completionWindow = new CompletionWindow(_textEditor.TextArea);
            _li = _completionWindow.CompletionList;
            ListView lv = _li.ListBox;

            lv.SelectionMode = SelectionMode.Single;

            //Image
            Extensions.GenerateListViewTemplate(lv, new ListViewDataTemplateHelper.GeneralColumnInfo[] {
                new ListViewDataTemplateHelper.ImageColumnInfo {
                    Header = "", DisplayExpression = "Image", TextAlignment = TextAlignment.Center, FixedWidth = 22, MaxHeight = 22, SearchGetAccessor = "Commands"
                },
                new ListViewDataTemplateHelper.GeneralColumnInfo {
                    Header = "Commands", DisplayExpression = "Text", TextAlignment = TextAlignment.Left, IsFill = true, ToolTipBinding = "Description"
                }
            }, null, new string[] { }, "generateHeader", "false");

            _completionWindow.Content = null;
            _completionWindow         = null;

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
Example #9
0
        /// <summary>
        ///     Mark an active item as inactive.
        /// </summary>
        /// <param name="item_id">The item_id is the identifier of the item.</param>
        /// <returns>System.String.<br></br>The success message is "The item has been marked as inactive."</returns>
        public string MarkAsInactive(string item_id)
        {
            var url      = baseAddress + "/" + item_id + "/inactive";
            var response = ZohoHttpClient.post(url, getQueryParameters());

            return(ItemParser.getMessage(response));
        }
Example #10
0
        public async Task GetItemInfoAsync([Summary("Item ID (in hex)")] string itemHex)
        {
            if (!Globals.Bot.Config.AllowLookup)
            {
                await ReplyAsync($"{Context.User.Mention} - Lookup commands are not accepted.");

                return;
            }

            ushort itemID = ItemParser.GetID(itemHex);

            if (itemID == Item.NONE)
            {
                await ReplyAsync("Invalid item requested.").ConfigureAwait(false);

                return;
            }

            var name   = GameInfo.Strings.GetItemName(itemID);
            var result = ItemInfo.GetItemInfo(itemID);

            if (result.Length == 0)
            {
                await ReplyAsync($"No customization data available for the requested item ({name}).").ConfigureAwait(false);
            }
            else
            {
                await ReplyAsync($"{name}:\r\n{result}").ConfigureAwait(false);
            }
        }
Example #11
0
 /// <summary>
 /// Handles the actions to do when the save button is clicked
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event args.</param>
 public void SaveButton_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < addedIngredients.Count(); i++)
     {
         addedIngredients[i].CanDelete = false;
     }
     if (editMode)
     {
         editRecipe.Name         = nameField.Text;
         editRecipe.Instructions = instructionsField.Text;
         editRecipe.Ingredients  = ItemParser.IngredientsToIdCSV(addedIngredients.ToList());
         editRecipe.Quantities   = ItemParser.FloatListToQuantityValues(quantityStore);
         RecViewModel.UpdateRecipesCommand.Execute(editRecipe);
     }
     else
     {
         Recipe recipe = new Recipe
                         (
             nameField.Text,
             instructionsField.Text,
             addedIngredients.ToList(),
             quantityStore,
             0
                         );
         RecViewModel.AddRecipesCommand.Execute(recipe);
     }
     Finish();
 }
Example #12
0
            public void ShouldParsePluralItemInput()
            {
                var parsed = new ItemParser(Fixture.PluralItemInput);

                Equal(parsed.Code, "ITEM00003");
                Equal(parsed.Quantity, 2);
            }
Example #13
0
	// 초기화
	private void Awake()
	{
		// 싱글톤 초기화
		if (instance == null)
		{
			instance = this;
		}
		else
		{
			Destroy(this);
		}

		// 아이템 설명 ui 설정
		ItemSlot.itemDescriptionPanel = itemDescriptionPanel;

		// 인벤토리 슬롯 UI 가져오기
		inventoryArray = inventoryPanel.GetComponentInChildren<UIGrid>().GetComponentsInChildren<ItemSlot>();

		// 슬롯 목록 초기화
		ItemSlot[] itemSlotArray = inventoryPanel.GetComponentsInChildren<ItemSlot>();

		foreach (var itemUI in itemSlotArray)
		{
			itemUI.Init();
		}

		// 데이터 셋
		int[] itemCodeList = DataCache<int>.GetArrayData(dataCaheInventoryItemListKey);
		
		for (int i = 0; i < itemCodeList.Length; i++)
		{
			inventoryArray[i].SetItem(ItemParser.GetItemByCode(itemCodeList[i]));
		}
	}
Example #14
0
        /// <summary>
        /// Delete the item created.items that are part of transaction cannot be deleted.
        /// </summary>
        /// <param name="item_id">The item_id is the identifier of the item.</param>
        /// <returns>System.String.<br></br>The success message is "The item has been deleted." </returns>
        public string Delete(string item_id)
        {
            string url      = baseAddress + "/" + item_id;;
            var    response = ZohoHttpClient.delete(url, getQueryParameters());

            return(ItemParser.getMessage(response));
        }
Example #15
0
        private List <LogItem> Parse(string file)
        {
            if (_cancelRequested)
            {
                return(new List <LogItem>());
            }

            Progress?.Invoke(++_current, _total);

            var content = FileReader.Read(file);

            var logBlocks = Regex
                            .Split(content, "<meta.*<pre>|</pre>.*</html>", RegexOptions.Compiled)
                            .Where(s => s?.Length > 0);

            if (!logBlocks.Any())
            {
                return(new List <LogItem>());
            }

            return(logBlocks
                   .Select(block => ItemParser.Parse(block))
                   .Where(log => log.IsValid)
                   .ToList());
        }
Example #16
0
            public void ShouldParseSingularItemInput()
            {
                var parsed = new ItemParser(Fixture.SingularItemInput);

                Equal(parsed.Code, "ITEM00001");
                Equal(parsed.Quantity, 1);
            }
Example #17
0
        public async Task StackAsync([Summary("Item ID (in hex)")] string itemHex, [Summary("Count of items in the stack")] int count)
        {
            if (!Globals.Bot.Config.AllowLookup)
            {
                await ReplyAsync($"{Context.User.Mention} - Lookup commands are not accepted.");

                return;
            }

            ushort itemID = ItemParser.GetID(itemHex);

            if (itemID == Item.NONE || count < 1 || count > 99)
            {
                await ReplyAsync("Invalid item requested.").ConfigureAwait(false);

                return;
            }

            var ct   = count - 1; // value 0 => count of 1
            var item = new Item(itemID)
            {
                Count = (ushort)ct
            };
            var msg = ItemParser.GetItemText(item);

            await ReplyAsync(msg).ConfigureAwait(false);
        }
Example #18
0
 public void 一文字消費する()
 {
     var parser = new ItemParser<char>(c => (char)c);
     var input = Reader.FromString("abc");
     var expected = Success._('a', Reader.FromString("bc"));
     Assert.That(parser.Apply(input), Is.EqualTo(expected));
 }
Example #19
0
        public async Task RequestDropAsync([Summary(DropItemSummary)][Remainder] string request)
        {
            var cfg   = Globals.Bot.Config;
            var items = ItemParser.GetItemsFromUserInput(request, cfg.DropConfig, cfg.DropConfig.UseLegacyDrop ? ItemDestination.PlayerDropped : ItemDestination.HeldItem);

            MultiItem.StackToMax(items);
            await DropItems(items).ConfigureAwait(false);
        }
 public FootwearController(IRepository <Item> itemRepo,
                           IProductService product, IStoreService store)
 {
     _itemRepo = itemRepo;
     _product  = product;
     _store    = store;
     _parser   = new ItemParser(_product);
 }
Example #21
0
	// 현재 들고있는 아이템 드랍
	public void DropItem()
	{
		if (ItemSlot.clickTarget != null)
		{
			var obj = Instantiate(droppedItemPrefab, Vector2.zero, Quaternion.identity);
			obj.GetComponent<FieldItem>().Init(ItemParser.GetItemByCode(ItemSlot.clickTarget.DropItem()));
		}
	}
Example #22
0
    void Start()
    {
        itemParser = gameObject.GetComponent <ItemParser>();

        int    level     = SaveData.Instance.LoadingStageLevel;
        string sceneName = "Game" + level;

        StartCoroutine(ChangeSceneAndDisplayLoadingScreen(sceneName));
    }
Example #23
0
        public void ItemsParseCorrectly(string input, string expectedName, int expectedSellIn, int expectedQuality)
        {
            ItemParser parser = new ItemParser();
            var        item   = parser.Parse(input);

            Assert.AreEqual(expectedName, item.Name, "Name should match expected.");
            Assert.AreEqual(expectedQuality, item.Quality, "Quality should match expected.");
            Assert.AreEqual(expectedSellIn, item.SellIn, "SellIn should match expected.");
        }
Example #24
0
 /// <summary>
 /// Instantiates a new view model
 /// </summary>
 /// <param name="recipe">The recipe to show</param>
 /// <param name="ingredientReference">A reference to the list of ingredients, to be loaded on the recipe</param>
 public RecipeDetailViewModel(Recipe recipe = null, IngredientsViewModel ingredientReference = null)
 {
     if (recipe != null)
     {
         Title          = recipe.Name;
         Recipe         = recipe;
         IngredientList = ItemParser.IdCSVToIngredientList(recipe.Ingredients, ingredientReference);
         QuantityList   = ItemParser.QuantityValuesToFloatList(recipe.Quantities);
     }
 }
Example #25
0
 public void ItemParserに空を渡すと失敗する()
 {
     var parser = new ItemParser<char>(c => (char)c);
     var input = Reader.FromString("");
     var result = parser.Apply(input).Match(
         (r, rest) => (string)Util.Fail(),
         (m, rest) => m
     );
     var expected = "input is empty.";
     Assert.That(result, Is.EqualTo(expected));
 }
        public async Task CustomizeAsync([Summary("Item ID (in hex)")] string itemHex, [Summary("Customization value sum")] int sum)
        {
            ushort itemID = ItemParser.GetID(itemHex);

            if (itemID == Item.NONE)
            {
                await ReplyAsync("Invalid item requested.").ConfigureAwait(false);

                return;
            }
            if (sum <= 0)
            {
                await ReplyAsync("No customization data specified.").ConfigureAwait(false);

                return;
            }

            var remake = ItemRemakeUtil.GetRemakeIndex(itemID);

            if (remake < 0)
            {
                await ReplyAsync("No customization data available for the requested item.").ConfigureAwait(false);

                return;
            }

            int body   = sum & 7;
            int fabric = sum >> 5;

            if (fabric > 7 || ((fabric << 5) | body) != sum)
            {
                await ReplyAsync("Invalid customization data specified.").ConfigureAwait(false);

                return;
            }

            var info = ItemRemakeInfoData.List[remake];
            // already checked out-of-range body/fabric values above
            bool hasBody   = body == 0 || body <= info.ReBodyPatternNum;
            bool hasFabric = fabric == 0 || info.GetFabricDescription(fabric) != "Invalid";

            if (!hasBody || !hasFabric)
            {
                await ReplyAsync("Requested customization for item appears to be invalid.").ConfigureAwait(false);
            }

            var item = new Item(itemID)
            {
                BodyType = body, PatternChoice = fabric
            };
            var msg = ItemParser.GetItemText(item);

            await ReplyAsync(msg).ConfigureAwait(false);
        }
Example #27
0
        /// <summary>
        /// Create a new item.
        /// </summary>
        /// <param name="item_info">The item_info is the LineItem object with name and rate as mandatory attributes.</param>
        /// <returns>LineItem object.</returns>
        public LineItem Create(LineItem item_info)
        {
            string url        = baseAddress;
            var    json       = JsonConvert.SerializeObject(item_info);
            var    jsonstring = new Dictionary <object, object>();

            jsonstring.Add("JSONString", json);
            var response = ZohoHttpClient.post(url, getQueryParameters(jsonstring));

            return(ItemParser.getItem(response));
        }
Example #28
0
        /// <summary>
        ///     Update the details of an item.
        /// </summary>
        /// <param name="item_id">The item_id is the identifier of the item.</param>
        /// <param name="update_info">The update_info is the LineItem object which contains the updation information.</param>
        /// <returns>LineItem object.</returns>
        public LineItem Update(string item_id, LineItem update_info)
        {
            var url        = baseAddress + "/" + item_id;
            var json       = JsonConvert.SerializeObject(update_info);
            var jsonstring = new Dictionary <object, object>();

            jsonstring.Add("JSONString", json);
            var response = ZohoHttpClient.put(url, getQueryParameters(jsonstring));

            return(ItemParser.getItem(response));
        }
        public void Export()
        {
            string headerFile            = VariableDefines.XML_PATH.Replace(".m2d", ".m2h");
            List <PackFileEntry> files   = FileList.ReadFile(File.OpenRead(headerFile));
            MemoryMappedFile     memFile = MemoryMappedFile.CreateFromFile(VariableDefines.XML_PATH);

            // Parse and save some item data from xml file
            List <ItemMetadata> items = ItemParser.Parse(memFile, files);

            ItemParser.Write(items);
        }
        public static async Task <ProcessingResult> ProcessAsync(Configuration configuration, CancellationToken token)
        {
            using var fileLoader = new FileLoader(token);
            var mapper    = new UriMapper(configuration);
            var parser    = new ItemParser(mapper, configuration.Mode);
            var writer    = new ItemWriter(mapper);
            var processor = new ItemProcessor(fileLoader, parser, writer, configuration, token);

            await processor.RunAsync().ConfigureAwait(false);

            return(new ProcessingResult(fileLoader.FailedUris));
        }
Example #31
0
 public XMLParser(RoomHandler roomHand, Game1 gm)
 {
     roomHandler     = roomHand;
     itemParser      = new ItemParser(gm);
     enemyParser     = new EnemyParser(gm);
     trapParser      = new TrapsParser(gm);
     npcParser       = new NPCParser(gm);
     blockParser     = new BlockParser(gm);
     doorParser      = new DoorParser(gm, roomHandler);
     conditionParser = new ConditionParser();
     spawnerParser   = new SpawnerParser(gm);
 }
Example #32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyboardLurker" /> class.
        /// </summary>
        /// <param name="processId">The process identifier.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="hotkeyService">The key code service.</param>
        /// <param name="keyboardHelper">The keyboard helper.</param>
        public KeyboardLurker(int processId, SettingsService settingsService, HotkeyService hotkeyService, PoeKeyboardHelper keyboardHelper)
        {
            this._processId       = processId;
            this._settingsService = settingsService;
            this._hotkeyService   = hotkeyService;
            this._keyboardHelper  = keyboardHelper;

            this._itemParser = new ItemParser();
            this._itemParser.CheckPledgeStatus();
            this._settingsService.OnSave += this.SettingsService_OnSave;
            this._keyboardHook            = new KeyboardHook(this._processId);
        }
Example #33
0
        public void when_the_item_is_in_the_registry_should_return_the_item_created_from_the_factory()
        {
            //Arrange
            var itemFactoryRegistry = Substitute.For<IFindItemFactories>();
            IParseItems itemParser = new ItemParser(itemFactoryRegistry);
            var item = new Item { Name = "Normal Item", Quality = 10, SellIn = 5 };

            var testItem = new TestItem();
            itemFactoryRegistry.Find(item).Returns((Func<Item, IUpdateAnItem>)(i => testItem));

            //Act
            var parsedItem = itemParser.Parse(item);

            //Assert
            Assert.That(parsedItem, Is.EqualTo(testItem));
        }