コード例 #1
0
ファイル: ShellSchemeEditor.cs プロジェクト: FNKGino/poderosa
        public ShellSchemeEditor(IShellScheme current)
        {
            InitializeComponent();
            InitializeText();

            _deleteCharBox.Items.AddRange(new string[] { "BackSpace", "Delete" });

            _schemeCollection = TerminalUIPlugin.Instance.TerminalEmulatorPlugin.ShellSchemeCollection;
            _tags = new List<ItemTag>();
            _removing = new List<ItemTag>();

            _current = null;
            int index = 0;
            int current_index = 0;
            _blockUIEvent = true;
            foreach (IShellScheme ss in _schemeCollection.Items) {
                ItemTag tag = new ItemTag(ss.Clone(), ss);
                _tags.Add(tag);
                _schemeComboBox.Items.Add(ss.Name);
                if (current == ss)
                    current_index = index;
                index++;
            }
            _blockUIEvent = false;

            //これで初期化
            _schemeComboBox.SelectedIndex = current_index;
        }
コード例 #2
0
 public bool EditItem(string feedId, string itemId, ItemTag addTag, ItemTag removeTag, ItemAction action)
 {
     Uri requestUrl = _urlBuilder.BuildUri(UrlType.ItemEdit);
     string token = GetToken();
     Dictionary<string, string> postData = _urlBuilder.GetItemEditData(token, feedId, itemId, addTag, removeTag, action);
     var result = _httpService.PerformPost(requestUrl, postData);
     if(result.Equals("OK"))
         return true;
     return false;
 }
コード例 #3
0
        public void EditItem(string feedId, string itemId, ItemTag addTag, ItemTag removeTag, ItemAction action, Action<bool> onSuccess = null, Action<Exception> onError = null, Action onFinally = null)
        {
            GetToken(
                token =>
                    {
                        Uri requestUrl = _urlBuilder.BuildUri(UrlType.ItemEdit);
                        Dictionary<string, string> postData = _urlBuilder.GetItemEditData(token, feedId, itemId, addTag, removeTag, action);
                        _httpService.PerformPostAsync(requestUrl, postData,
                            result =>
                                {
                                    if (onSuccess != null)
                                    {
                                        if (result.Equals("OK"))
                                            onSuccess(true);
                                        else
                                            onSuccess(false);
                                    }
                                },
                                onError, onFinally);

                    }
                , onError, onFinally
                );
        }
コード例 #4
0
 public void CreateTag(ItemTag Tag)
 {
     TagsRepository.Add(Tag);
 }
コード例 #5
0
ファイル: HexGrid.cs プロジェクト: TJRyan/Exile-Island
    void CreateCell(int x, int z, int i)
    {
        Vector3 position;//中心坐标

        position.x = (x + z * 0.5f - z / 2) * (HexMetrics.innerRadius * 2f);
        position.y = 0f;
        position.z = z * (HexMetrics.outerRadius * 1.5f);

        HexCell cell = cells[i] = Instantiate <HexCell>(cellPrefab);

        cell.transform.SetParent(transform, false);
        cell.transform.localPosition = position;
        cell.coordinates             = HexCoordinates.FromOffsetCoordinates(x, z);
        //cell.color = defaultColor;

        for (int id = 0; id < Setting.GetRoleNumber(); ++id)
        {
            if (i == Setting.RIP[id])
            {
                cell.roleID = id;
            }
        }

        if (x > 0)
        {
            cell.SetNeighbor(HexDirection.W, cells[i - 1]);
        }
        if (z > 0)
        {
            if ((z & 1) == 0)
            {
                cell.SetNeighbor(HexDirection.SE, cells[i - width]);
                if (x > 0)
                {
                    cell.SetNeighbor(HexDirection.SW, cells[i - width - 1]);
                }
            }
            else
            {
                cell.SetNeighbor(HexDirection.SW, cells[i - width]);
                if (x < width - 1)
                {
                    cell.SetNeighbor(HexDirection.SE, cells[i - width + 1]);
                }
            }
        }

        //生成宝箱
        if (Random.value < Setting.GetChestPro() && cell.roleID == -1)
        {
            cell.item = GameObject.Instantiate(chestPrefab);
            cell.item.transform.SetParent(transform, false);
            cell.item.transform.localPosition = position + Vector3.down * 3;
            cell.item.transform.Rotate(new Vector3(0, Random.value * 360, 0));


            ItemTag maxTag  = ItemTag.maxTag;
            ItemTag itemTag = (ItemTag)(Random.value * (float)maxTag);
            cell.item.GetComponent <Chest>().itemTag = (itemTag != maxTag) ? itemTag : ItemTag.bow;
        }
        else
        {
            cell.item    = null;
            cell.itemTag = ItemTag.noItem;
        }

        /*显示格子坐标
         * Text label = Instantiate<Text>(cellLabelPrefab);
         * label.rectTransform.SetParent(gridCanvas.transform, false);
         * label.rectTransform.anchoredPosition =
         *  new Vector3(position.x, position.z);
         * label.text = cell.coordinates.ToStringOnSeparateLines();*/
    }
コード例 #6
0
ファイル: Consumer.cs プロジェクト: Emil760/Game
 public Food(ItemTag tag, string name, float weight, string path, short hp, short hunger, short thirst, short stamina, short poison, short rad, int time)
     : base(tag, ItemType.Food, name, weight, path, hp, hunger, thirst, stamina, poison, rad)
 {
     this.time = time;
 }
コード例 #7
0
ファイル: FileBrowserScanner.cs プロジェクト: nbsrujan/acat
        /// <summary>
        /// Prompt the user to make a selection on what to do with the
        /// selected file.  Open it or delete it.
        /// </summary>
        /// <param name="itemTag">file info</param>
        /// <returns>selected operation</returns>
        private FileOperation getFileOperationFromUser(ItemTag itemTag)
        {
            var retVal = FileOperation.None;
            Form form = Context.AppPanelManager.CreatePanel("FileOperationConfirmScanner", itemTag.FInfo.Name);
            if (form is FileOperationConfirmScanner)
            {
                var fileOpScanner = form as FileOperationConfirmScanner;
                fileOpScanner.FInfo = itemTag.FInfo;
                Context.AppPanelManager.ShowDialog(Context.AppPanelManager.GetCurrentPanel(), form as IPanel);

                if (fileOpScanner.OpenFile)
                {
                    retVal = FileOperation.Open;
                }
                else if (fileOpScanner.DeleteFile)
                {
                    retVal = FileOperation.Delete;
                }
            }

            return retVal;
        }
コード例 #8
0
ファイル: Recyclable.cs プロジェクト: Emil760/Game
 public RecycleableComplex(ItemTag tag, ItemType type, string name, float weight, string path, int time, ItemTag[] inputs, LootRandom[] outputs)
     : base(tag, type, name, weight, path, time, outputs)
 {
     this.inputs = inputs;
 }
コード例 #9
0
    private void LoadPlugins()
    {
      foreach (string pluginFile in availablePlugins)
      {
        Assembly pluginAssembly = null;
        try
        {
          Log.Debug("PluginsNew: loadPlugins {0}", pluginFile);
          pluginAssembly = Assembly.LoadFrom(pluginFile);
        }
        catch (BadImageFormatException)
        {
          Log.Warn("PluginsNew: {0} has a bad image format", pluginFile);
        }

        if (pluginAssembly != null)
        {
          try
          {
            Type[] exportedTypes = pluginAssembly.GetExportedTypes();
            List<object> NonSetupWindows = new List<object>();

            foreach (Type type in exportedTypes)
            {
              bool isPlugin = (type.GetInterface("MediaPortal.GUI.Library.ISetupForm") != null);
              bool isGuiWindow = ((type.IsClass) && (type.IsSubclassOf(typeof (GUIWindow))));

              // an abstract class cannot be instanciated
              if (type.IsAbstract)
              {
                continue;
              }

              bool isIncompatible = !CompatibilityManager.IsPluginCompatible(type);
              if (isIncompatible)
              {
                Log.Warn(
                  "Plugin Manager: Plugin {0} is incompatible with the current MediaPortal version! (File: {1})",
                  type.FullName, pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1));
              }

              // Try to locate the interface we're interested in
              if (isPlugin || isGuiWindow)
              {
                // Create instance of the current type
                object pluginObject;
                try
                {
                  pluginObject = Activator.CreateInstance(type);
                }
                catch (TargetInvocationException)
                {
                  MessageBox.Show(
                    string.Format(
                      "An error occured while loading the plugin {0}.\n\nIt's incompatible with the current MediaPortal version and won't be loaded.",
                      type.FullName
                      ), "Plugin Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
                  Log.Warn(
                    "Plugin Manager: Plugin {0} is incompatible with the current MediaPortal version! (File: {1})",
                    type.FullName, pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1));
                  continue;
                }

                if (isPlugin)
                {
                  ISetupForm pluginForm = pluginObject as ISetupForm;
                  IExternalPlayer extPlayer = pluginObject as IExternalPlayer;
                  IShowPlugin showPlugin = pluginObject as IShowPlugin;

                  if (pluginForm != null)
                  {
                    ItemTag tag = new ItemTag();
                    tag.SetupForm = pluginForm;
                    tag.DllName = pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1);
                    tag.WindowId = pluginForm.GetWindowId();

                    if (isGuiWindow)
                    {
                      GUIWindow win = (GUIWindow)pluginObject;
                      if (tag.WindowId == win.GetID)
                      {
                        tag.Type = win.GetType().ToString();
                        tag.IsProcess = false;
                        tag.IsWindow = true;
                      }
                    }
                    else if (extPlayer != null)
                    {
                      tag.IsExternalPlayer = true;
                    }
                    else
                    {
                      tag.IsProcess = true;
                    }

                    if (showPlugin != null)
                    {
                      tag.ShowDefaultHome = showPlugin.ShowDefaultHome();
                    }

                    tag.IsIncompatible = isIncompatible;

                    LoadPluginImages(type, tag);
                    loadedPlugins.Add(tag);
                  }
                }
                else
                {
                  NonSetupWindows.Add(pluginObject);
                }
              }
            }
            // Filter plugins from e.g. dialogs or other windows.
            foreach (GUIWindow win in NonSetupWindows)
            {
              foreach (ItemTag tag in loadedPlugins)
              {
                if (tag.WindowId == win.GetID)
                {
                  tag.Type = win.GetType().ToString();
                  tag.IsProcess = false;
                  tag.IsWindow = true;
                  Log.Debug(
                    "PluginsNew: {0}, window plugin, does not implement \"ISetupForm\" and \"GUIWindow\" in the same class",
                    tag.Type);
                  break;
                }
              }
            }
          }
          catch (Exception ex)
          {
            MessageBox.Show(
              string.Format(
                "An error occured while loading the plugin file {0}.\n\nIt's broken or incompatible with the current MediaPortal version and won't be loaded.",
                pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1)), "Plugin Manager", MessageBoxButtons.OK,
              MessageBoxIcon.Error);
            Log.Warn(
              "PluginManager: Plugin file {0} is broken or incompatible with the current MediaPortal version and won't be loaded!",
              pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1));
            Log.Error("PluginManager: Exception: {0}", ex);
          }
        }
      }
    }
コード例 #10
0
ファイル: FileBrowserScanner.cs プロジェクト: nbsrujan/acat
        /// <summary>
        /// User selected a file from the list.  If reqd,
        /// ask the user if she wants to open or delete the file
        /// </summary>
        /// <param name="itemTag">Tag of the file item selected</param>
        /// <returns>true on success</returns>
        private bool onFileSelected(ItemTag itemTag)
        {
            bool doHighlightOff = true;

            if (itemTag != null && itemTag.FInfo != null && File.Exists(itemTag.FInfo.FullName))
            {
                FileOperation operation = FileOperation.None;
                if (SelectActionOpen)
                {
                    if (DialogUtils.ConfirmScanner(ActionVerb + " " + itemTag.FInfo.Name + "?"))
                    {
                        operation = FileOperation.Open;
                    }
                }
                else
                {
                    operation = getFileOperationFromUser(itemTag);
                }

                if (operation != FileOperation.None)
                {
                    handleFileOperation(operation, itemTag);
                    if (operation == FileOperation.Open)
                    {
                        doHighlightOff = false;
                    }
                }
                else
                {
                    SelectedFile = String.Empty;
                }
            }

            return doHighlightOff;
        }
コード例 #11
0
ファイル: Item.cs プロジェクト: shurunxuan/JAM-7
 public void setType(ItemTag tag)
 {
     type = tag;
 }
コード例 #12
0
            public bool EnterNode(LibraryNode node, CancellationToken ct)
            {
                if (ct.IsCancellationRequested)
                {
                    _navCallback.Invalidate();
                    return(false);
                }

                IVsHierarchy hierarchy;
                uint         itemId, itemsCount;
                Guid         projectType;

                node.SourceItems(out hierarchy, out itemId, out itemsCount);
                if (hierarchy != null)
                {
                    ErrorHandler.ThrowOnFailure(hierarchy.GetGuidProperty(
                                                    (uint)VSConstants.VSITEMID.Root,
                                                    (int)__VSHPROPID.VSHPROPID_TypeGuid,
                                                    out projectType
                                                    ));
                    if (projectType != _projectType)
                    {
                        return(false);
                    }
                }

                var parentNode = _path.Peek();

                _path.Push(node);

                // We don't want to report modules, since they map 1-to-1 to files, and those are already reported by the standard item provider
                if (node.NodeType.HasFlag(LibraryNodeType.Package))
                {
                    return(true);
                }

                // Match name against search string.
                string    name = node.Name ?? "";
                MatchKind matchKind;

                if (_searchValue.Length > 2 && _searchValue.StartsWith("/") && _searchValue.EndsWith("/"))
                {
                    if (!_regexComparer.IsCandidateMatch(name, _searchValue.Substring(1, _searchValue.Length - 2)))
                    {
                        return(true);
                    }
                    matchKind = MatchKind.Regular;
                }
                else if (name.Equals(_searchValue, StringComparison.Ordinal))
                {
                    matchKind = MatchKind.Exact;
                }
                else if (_comparer.IsCandidateMatch(name, _searchValue))
                {
                    matchKind = MatchKind.Regular;
                }
                else
                {
                    return(true);
                }

                string kind;

                if (!_sggToNavItemKind.TryGetValue(node.GlyphType, out kind))
                {
                    kind = "";
                }

                var text = node.GetTextRepresentation(VSTREETEXTOPTIONS.TTO_DISPLAYTEXT);

                if (parentNode != null)
                {
                    switch (parentNode.GlyphType)
                    {
                    case StandardGlyphGroup.GlyphGroupModule:
                        text += string.Format(" [of module {0}]", parentNode.Name);
                        break;

                    case StandardGlyphGroup.GlyphGroupClass:
                        text += string.Format(" [of class {0}]", parentNode.Name);
                        break;

                    case StandardGlyphGroup.GlyphGroupMethod:
                        text += string.Format(" [nested in function {0}]", parentNode.Name);
                        break;
                    }
                }

                var tag = new ItemTag {
                    Node = node, GlyphService = _itemProvider._glyphService
                };

                _navCallback.AddItem(new NavigateToItem(text, kind, "Python", "", tag, matchKind, PythonNavigateToItemDisplayFactory.Instance));
                return(true);
            }
コード例 #13
0
 public void AddTagToItem(string feedId, string itemId, ItemTag tag, Action<bool> onSuccess = null, Action<Exception> onError = null, Action onFinally = null)
 {
     EditItem(feedId, itemId, tag, ItemTag.None, ItemAction.Add, onSuccess, onError, onFinally);
 }
コード例 #14
0
ファイル: ShellSchemeEditor.cs プロジェクト: FNKGino/poderosa
        private void OnNewScheme(object sender, EventArgs args)
        {
            int count = 0;
            string name;
            do {
                name = count == 0 ? "New Shell" : String.Format("New Shell ({0})", count);
                count++;
            } while (FindTag(name) != null);

            ItemTag tag = new ItemTag(_schemeCollection.CreateEmptyScheme(name), null);
            _tags.Add(tag);
            _schemeComboBox.Items.Add(name);
            Debug.Assert(_tags.Count == _schemeComboBox.Items.Count);
            _schemeComboBox.SelectedIndex = _tags.Count - 1; //これで選択
        }
コード例 #15
0
 public void RemoveTagFromItem(string feedId, string itemId, ItemTag tag, Action<bool> onSuccess = null, Action<Exception> onError = null, Action onFinally = null)
 {
     EditItem(feedId, itemId, ItemTag.None, tag, ItemAction.Remove, onSuccess, onError, onFinally);
 }
コード例 #16
0
 public void GetTag(ItemTag tag, ReaderFeedParameters parameters,
     Action<IEnumerable<FeedItem>> onSuccess = null, Action<Exception> onError = null, Action onFinally = null)
 {
     Uri requestUrl = _urlBuilder.BuildUri(UrlType.Tag, tag, parameters);
     ExecGetFeedAsync(requestUrl, onSuccess, onError, onFinally);
 }
コード例 #17
0
ファイル: FileBrowserScanner.cs プロジェクト: nbsrujan/acat
        /// <summary>
        /// Handle actuation of a widget - navigate, select file
        /// etc depending on what the widget represents
        /// </summary>
        /// <param name="itemTag"></param>
        private void handleSelect(ItemTag itemTag)
        {
            bool doHighlightOff = true;

            switch (itemTag.DataType)
            {
                case ItemTag.ItemType.NextPage:
                    gotoNextPage();
                    break;

                case ItemTag.ItemType.PreviousPage:
                    gotoPreviousPage();
                    break;

                case ItemTag.ItemType.OrderBy:
                    switchSortOrder();
                    break;

                case ItemTag.ItemType.File:
                    doHighlightOff = onFileSelected(itemTag);
                    break;
            }

            if (doHighlightOff)
            {
                highlightOff();
            }
        }
コード例 #18
0
ファイル: FileBrowserScanner.cs プロジェクト: nbsrujan/acat
        /// <summary>
        /// Perform action on the file
        /// </summary>
        /// <param name="operation">what to do?</param>
        /// <param name="itemTag">File info</param>
        private void handleFileOperation(FileOperation operation, ItemTag itemTag)
        {
            switch (operation)
            {
                case FileOperation.Open:
                    SelectedFile = itemTag.FInfo.FullName;
                    if (EvtFileOpen != null)
                    {
                        EvtFileOpen.BeginInvoke(this, new EventArgs(), null, null);
                    }

                    break;

                case FileOperation.Delete:
                    handleDeleteFile(itemTag);
                    break;
            }
        }
コード例 #19
0
ファイル: FileBrowserScanner.cs プロジェクト: nbsrujan/acat
 /// <summary>
 /// Delete the file
 /// </summary>
 /// <param name="itemTag">info about the file</param>
 private void handleDeleteFile(ItemTag itemTag)
 {
     Windows.SetText(SearchFilter, String.Empty);
     File.Delete(itemTag.FInfo.FullName);
     loadFiles();
 }
コード例 #20
0
        public ActionResult CreateItem(Product product)
        {
            if (ModelState.IsValid)
            {
                product.ReleaseDate     = DateTime.Now;
                product.PriceLV         = product.PriceEU * 2;
                product.OriginalPriceEU = product.PriceEU;
                product.Tags            = new List <ItemTag>();
                product.Images          = new List <Image>();
                var productTags = product.TagsText
                                  .Trim()
                                  .Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
                                  .ToList();
                foreach (var p in productTags)
                {
                    var checkIfTagExists = TagService.CheckIfTagExists(p);
                    if (checkIfTagExists != null)
                    {
                        product.Tags.Add(checkIfTagExists);
                    }
                    else
                    {
                        var itemTag = new ItemTag();
                        itemTag.TagName = p;
                        product.Tags.Add(itemTag);
                    }
                }
                foreach (HttpPostedFileBase file in product.Files)
                {
                    if (file != null)
                    {
                        var InputFileName = Path.GetFileName(file.FileName);
                        var timeNow       = DateTime.Now;
                        InputFileName = timeNow.Year + "-" +
                                        timeNow.Month + "-" +
                                        timeNow.Day + "-" +
                                        timeNow.Hour + "-" +
                                        timeNow.Minute + "-" +
                                        timeNow.Second + "-" +
                                        timeNow.Millisecond + "-" +
                                        InputFileName;
                        var ServerSavePath = Path.Combine(Server.MapPath("~/Content/Images/ProductImages/") + InputFileName);
                        product.Images.Add(new Image(InputFileName));

                        file.SaveAs(ServerSavePath);

                        ViewBag.UploadStatus = product.Files.Count().ToString() + " files uploaded successfully.";
                    }
                }

                ProductService.CreateProduct(product);
                var category = CategoryService.GetProductCategory(product.CategoryId);
                ProductService.SaveProduct();
                return(RedirectToAction("Items", new { Category = category.Name }));
            }
            else
            {
                var category      = CategoryService.GetProductCategory(product.CategoryId);
                var errorMessage2 = "";
                var errors        = ModelState.Select(x => x.Value.Errors)
                                    .Where(y => y.Count > 0)
                                    .ToList();
                foreach (var error in errors)
                {
                    foreach (var e in error)
                    {
                        errorMessage2 += e.ErrorMessage;
                    }
                }
                return(RedirectToAction("Items", "Admin", new { Category = category.Name, errorMessage = errorMessage2 }));
            }
        }
コード例 #21
0
        public ActionResult EditItem(ProductViewModel realProduct)
        {
            var product         = Mapper.Map <ProductViewModel, Product>(realProduct);
            var updatingProduct = ProductService.GetProduct(realProduct.Id);

            updatingProduct.TagsText    = "tagstext";
            updatingProduct.Name        = product.Name;
            updatingProduct.Description = product.Description;
            updatingProduct.CategoryId  = product.CategoryId;
            if (updatingProduct.PriceEU == updatingProduct.OriginalPriceEU)
            {
                updatingProduct.PriceEU = product.PriceEU;
            }
            updatingProduct.OriginalPriceEU = product.PriceEU;
            updatingProduct.PriceLV         = Decimal.Multiply(product.PriceEU, 2);
            updatingProduct.Quantity        = product.Quantity;
            updatingProduct.Size            = product.Size;

            product.Tags = new List <ItemTag>();
            var productTags = product.TagsText
                              .Trim()
                              .Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
                              .ToList();


            foreach (var p in productTags)
            {
                var checkIfTagExists = TagService.CheckIfTagExists(p);

                if (checkIfTagExists != null)
                {
                    product.Tags.Add(checkIfTagExists);
                }
                else
                {
                    var itemTag = new ItemTag();
                    itemTag.TagName = p;
                    product.Tags.Add(itemTag);
                }
            }
            updatingProduct.Tags = product.Tags;

            foreach (HttpPostedFileBase file in product.Files)
            {
                if (file != null)
                {
                    var InputFileName = Path.GetFileName(file.FileName);
                    var timeNow       = DateTime.Now;
                    InputFileName = timeNow.Year + "-" +
                                    timeNow.Month + "-" +
                                    timeNow.Day + "-" +
                                    timeNow.Hour + "-" +
                                    timeNow.Minute + "-" +
                                    timeNow.Second + "-" +
                                    timeNow.Millisecond + "-" +
                                    InputFileName;
                    var ServerSavePath = Path.Combine(Server.MapPath("~/Content/Images/ProductImages/") + InputFileName);
                    updatingProduct.Images.Add(new Image(InputFileName));

                    file.SaveAs(ServerSavePath);

                    ViewBag.UploadStatus = product.Files.Count().ToString() + " files uploaded successfully.";
                }
            }

            try
            {
                ProductService.UpdateProduct(updatingProduct);
                ProductService.SaveProduct();
            }
            catch (DbEntityValidationException e)
            {
                string error = "";
                foreach (var eve in e.EntityValidationErrors)
                {
                    error += "Entity of type " + eve.Entry.Entity.GetType().Name + " in state " + eve.Entry.State + " has the following validation errors:\n";
                    foreach (var ve in eve.ValidationErrors)
                    {
                        error += "- Property: " + ve.PropertyName + ", Error: " + ve.ErrorMessage;
                    }
                }
                throw new Exception(error);
            }

            return(RedirectToAction("Index", new { Category = updatingProduct.Category.Name }));
        }
コード例 #22
0
        private void updateListViewItem(ListViewItem item)
        {
            ItemTag tag = (ItemTag)item.Tag;

            int incompatibleImageOfs = tag.IsIncompatible ? 10 : 0;

            if (tag.IsWindow)
            {
                item.Font = new Font(item.Font.FontFamily, 8.5f);
                if (tag.IsEnabled)
                {
                    if (tag.IsHome)
                    {
                        item.ImageIndex = 8 + incompatibleImageOfs;
                        item.ForeColor  = Color.Green;
                    }
                    else if (tag.IsPlugins)
                    {
                        item.ImageIndex = 9 + incompatibleImageOfs;
                        item.ForeColor  = Color.RoyalBlue;
                    }
                    else
                    {
                        item.ImageIndex = 2 + incompatibleImageOfs;
                        item.ForeColor  = Color.DarkSlateGray;
                    }
                }
                else
                {
                    item.ImageIndex = 3 + incompatibleImageOfs;
                    item.ForeColor  = Color.DimGray;
                }
            }
            else
            {
                if (tag.IsEnabled)
                {
                    item.Font      = new Font(item.Font.FontFamily, 8.5f);
                    item.ForeColor = Color.DarkSlateGray;
                }
                else
                {
                    item.Font      = new Font(item.Font.FontFamily, 8.0f);
                    item.ForeColor = Color.DimGray;
                }

                if (tag.IsProcess)
                {
                    item.ImageIndex = (tag.IsEnabled ? 4 : 5) + incompatibleImageOfs;
                }
                else if (tag.IsExternalPlayer)
                {
                    item.ImageIndex = (tag.IsEnabled ? 6 : 7) + incompatibleImageOfs;
                }
                else
                {
                    item.ImageIndex = (tag.IsEnabled ? 0 : 1) + incompatibleImageOfs;
                }
            }

            // If the plugin has its own icon we will be using this one.
            // Check the imagelist for enabled / disabled variants.
            if (tag.IsEnabled && tag.ActiveImage != null)
            {
                string enabledKey = item.Text + "_enabled";
                if (!item.ImageList.Images.ContainsKey(enabledKey))
                {
                    item.ImageList.Images.Add(enabledKey, tag.ActiveImage);
                }
                item.ImageKey = enabledKey;
            }
            if (!tag.IsEnabled && tag.InactiveImage != null)
            {
                string disabledKey = item.Text + "_disabled";
                if (!item.ImageList.Images.ContainsKey(disabledKey))
                {
                    item.ImageList.Images.Add(disabledKey, tag.InactiveImage);
                }
                item.ImageKey = disabledKey;
            }

            listViewPlugins.Refresh();
            //this.Refresh();
        }
コード例 #23
0
        public static bool ItemTagAvailable(ItemTier[] itemTiers, ItemTag itemTag)
        {
            bool check(PickupIndex pickupIndex)
            {
                var itemDef = ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(pickupIndex).itemIndex);

                if (itemDef.ContainsTag(itemTag))
                {
                    //Debug.Log($"{itemTag} found for {itemDef.tier} {itemDef.nameToken}");
                    return(itemDef.ContainsTag(itemTag));
                }
                return(false);
            }

            bool isAvailable = false;


            if (!isAvailable && itemTiers.Contains(ItemTier.Tier1))
            {
                foreach (PickupIndex pickupIndex in Run.instance.availableTier1DropList)
                {
                    if (check(pickupIndex))
                    {
                        isAvailable = true; break;
                    }
                }
            }
            if (!isAvailable && itemTiers.Contains(ItemTier.Tier2))
            {
                foreach (PickupIndex pickupIndex in Run.instance.availableTier2DropList)
                {
                    if (check(pickupIndex))
                    {
                        isAvailable = true; break;
                    }
                }
            }
            if (!isAvailable && itemTiers.Contains(ItemTier.Tier3))
            {
                foreach (PickupIndex pickupIndex in Run.instance.availableTier3DropList)
                {
                    if (check(pickupIndex))
                    {
                        isAvailable = true; break;
                    }
                }
            }
            if (!isAvailable && itemTiers.Contains(ItemTier.Lunar))
            {
                foreach (PickupIndex pickupIndex in Run.instance.availableLunarDropList)
                {
                    if (check(pickupIndex))
                    {
                        isAvailable = true; break;
                    }
                }
            }
            if (!isAvailable && itemTiers.Contains(ItemTier.Boss))
            {
                foreach (PickupIndex pickupIndex in Run.instance.availableBossDropList)
                {
                    if (check(pickupIndex))
                    {
                        isAvailable = true; break;
                    }
                }
            }

            return(isAvailable);
        }
コード例 #24
0
ファイル: FileBrowserScanner.cs プロジェクト: angellcq/src
 /// <summary>
 /// Delete the file
 /// </summary>
 /// <param name="itemTag">info about the file</param>
 private void handleDeleteFile(ItemTag itemTag)
 {
     Windows.SetText(SearchFilter, String.Empty);
     File.Delete(itemTag.FInfo.FullName);
     loadFiles();
 }
コード例 #25
0
 public bool AddItem(ItemTag itemTag)
 {
     return(itemList.AddItem(itemTag));
 }
コード例 #26
0
ファイル: AbbreviationsScanner.cs プロジェクト: nbsrujan/acat
 /// <summary>
 /// User wants to edit or delete an abbr
 /// </summary>
 /// <param name="itemTag">Tag associated with the list item selected</param>
 private void handleEditAbbreviation(ItemTag itemTag)
 {
     if (itemTag.Abbr != null)
     {
         if (EvtEditAbbreviation != null)
         {
             Invoke(new MethodInvoker(() => EvtEditAbbreviation(itemTag.Abbr)));
         }
     }
 }
コード例 #27
0
ファイル: ItemTagDB.cs プロジェクト: davidkoo7/RentHereAdmin
 // method to read the column values in the database (through the referenced reader) and assign it to the correct properties of the referenced ItemTags object
 // allows for easier editing of column names if needed, used only for methods with select statments regarding ItemTags
 private static void readAItemTag(ref ItemTag itemTag, ref SqlDataReader reader)
 {
     itemTag.TagName = reader["tagName"].ToString();
     itemTag.Item    = ItemDB.getItembyID(reader["itemID"].ToString());
 }
コード例 #28
0
 public bool AddTagToItem(string feedId, string itemId, ItemTag tag)
 {
     return EditItem(feedId, itemId, tag, ItemTag.None, ItemAction.Add);
 }
コード例 #29
0
ファイル: ItemTagDB.cs プロジェクト: davidkoo7/RentHereAdmin
    // gets itemtags from the database based on user input - search input for tags may not be exact same as tag in database
    public static List <ItemTag> getItemsWithTagsLike(List <string> tagName, string location, string categoryName)
    {
        List <ItemTag> itemTagList = new List <ItemTag>();

        try
        {
            string sqlcommand = "SELECT * FROM ItemTag IT, Item I WHERE I.itemID=IT.itemID AND ( I.pricePerDay IS NOT NULL OR I.pricePerWeek IS NOT  NULL OR I.pricePerMonth IS NOT  NULL ) ";

            if (location != null)
            {
                sqlcommand += "AND I.locationName = @locationName ";
            }

            if (categoryName != null)
            {
                sqlcommand += "AND I.categoryName = @categoryName ";
            }

            sqlcommand += " and (";

            int iTagCounter = 0;
            foreach (string tag in tagName)
            {
                sqlcommand += "IT.tagName LIKE ";
                if (iTagCounter < tagName.Count - 1)
                {
                    sqlcommand += "@tagName" + iTagCounter + " OR ";
                }
                else
                {
                    sqlcommand += "@tagName" + iTagCounter + ")";
                }
                iTagCounter++;
            }

            SqlCommand command = new SqlCommand(sqlcommand);

            if (location != null)
            {
                command.Parameters.AddWithValue("@locationName", location);
            }

            if (categoryName != null)
            {
                command.Parameters.AddWithValue("@categoryName", categoryName);
            }

            iTagCounter = 0;
            foreach (string tag in tagName)
            {
                command.Parameters.AddWithValue("@tagName" + iTagCounter, "%" + tag + "%");
                iTagCounter++;
            }

            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                ItemTag itemTag = new ItemTag();

                readAItemTag(ref itemTag, ref reader);
                itemTagList.Add(itemTag);
            }

            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(itemTagList);
    }
コード例 #30
0
 public IEnumerable<FeedItem> GetTag(ItemTag tag, ReaderFeedParameters parameters)
 {
     Uri requestUrl = _urlBuilder.BuildUri(UrlType.Tag, tag, parameters);
     return ExecGetFeed(requestUrl);
 }
コード例 #31
0
            public bool EnterNode(LibraryNode node, CancellationToken ct)
            {
                if (ct.IsCancellationRequested) {
                    _navCallback.Invalidate();
                    return false;
                }

                var parentNode = _path.Peek();
                _path.Push(node);

                // We don't want to report modules, since they map 1-to-1 to files, and those are already reported by the standard item provider
                if (node.NodeType == LibraryNodeType.Package) {
                    return true;
                }

                // Match name against search string.
                string name = node.Name ?? "";
                MatchKind matchKind;
                if (_searchValue.Length > 2 && _searchValue.StartsWith("/") && _searchValue.EndsWith("/")) {
                    if (!_regexComparer.IsCandidateMatch(name, _searchValue.Substring(1, _searchValue.Length - 2))) {
                        return true;
                    }
                    matchKind = MatchKind.Regular;
                } else if (name.Equals(_searchValue, StringComparison.Ordinal)) {
                    matchKind = MatchKind.Exact;
                } else if (_comparer.IsCandidateMatch(name, _searchValue)) {
                    matchKind = MatchKind.Regular;
                } else {
                    return true;
                }

                string kind;
                _sggToNavItemKind.TryGetValue(node.GlyphType, out kind);

                var text = node.GetTextRepresentation(VSTREETEXTOPTIONS.TTO_DISPLAYTEXT);
                if (parentNode != null) {
                    switch (parentNode.GlyphType) {
                        case StandardGlyphGroup.GlyphGroupModule:
                            text += string.Format(" [of module {0}]", parentNode.Name);
                            break;
                        case StandardGlyphGroup.GlyphGroupClass:
                            text += string.Format(" [of class {0}]", parentNode.Name);
                            break;
                        case StandardGlyphGroup.GlyphGroupMethod:
                            text += string.Format(" [nested in function {0}]", parentNode.Name);
                            break;
                    }
                }

                var tag = new ItemTag { Node = node, GlyphService = _itemProvider._glyphService };
                _navCallback.AddItem(new NavigateToItem(text, kind, "J", "", tag, matchKind, JNavigateToItemDisplayFactory.Instance));
                return true;
            }
コード例 #32
0
ファイル: Recyclable.cs プロジェクト: Emil760/Game
 public Recycleable(ItemTag tag, ItemType type, string name, float weight, string path, int time, LootRandom[] outputs)
     : base(tag, type, name, weight, path)
 {
     this.time    = time;
     this.outputs = outputs;
 }
コード例 #33
0
 public void Add(ItemTag itemTag)
 {
     itemTagRepository.Add(itemTag);
 }
コード例 #34
0
ファイル: DBItemMst.cs プロジェクト: tarik1603/MonlineBrowser
 /// <summary>
 /// アイテムのタグに対応したマスターIDを取得する
 /// </summary>
 /// <param name="itemKind">アイテムの種類</param>
 /// <returns>アイテムのマスターID</returns>
 public static Int32 GetItemMstId(ItemTag itemTag)
 {
     return(ItemMstIds[(Int32)itemTag]);
 }
コード例 #35
0
 public void Update(ItemTag itemTag)
 {
     itemTagRepository.Update(itemTag);
 }
コード例 #36
0
ファイル: PreferenceEditor.cs プロジェクト: yueker/poderosa
 private void UpdateItemStatus(ListViewItem item, ItemTag tag)
 {
     item.SubItems[2].Text = tag.ValueString;
     item.Font             = tag.IsChanged ? _boldFont : _listView.Font;
 }
コード例 #37
0
ファイル: ItemFactory.cs プロジェクト: Emil760/Game
 public static Item GetItem(ItemTag tag)
 {
     return(items[tag]);
 }
コード例 #38
0
ファイル: SwitchWindowsScanner.cs プロジェクト: nbsrujan/acat
        /// <summary>
        /// Perform the operation - page through the list,
        /// activate a window etc
        /// </summary>
        /// <param name="itemTag">Meta data about seleted item</param>
        private void handleSelect(ItemTag itemTag)
        {
            switch (itemTag.DataType)
            {
                case ItemTag.ItemType.NextPage:
                    gotoNextPage();
                    break;

                case ItemTag.ItemType.PreviousPage:
                    gotoPreviousPage();
                    break;

                case ItemTag.ItemType.OrderBy:
                    switchSortOrder();
                    break;

                case ItemTag.ItemType.Window:
                    if (itemTag.WInfo != null)
                    {
                        if (!User32Interop.IsWindow(itemTag.WInfo.Handle) || !User32Interop.IsWindowVisible(itemTag.WInfo.Handle))
                        {
                            DialogUtils.ShowTimedDialog(this, "Window does not exist");
                        }
                        else if (DialogUtils.ConfirmScanner("Switch to " + itemTag.WInfo.Title + "?"))
                        {
                            if (EvtActivateWindow != null)
                            {
                                EvtActivateWindow.BeginInvoke(this, itemTag.WInfo, null, null);
                            }
                        }
                    }

                    break;
            }
        }
コード例 #39
0
 public Item GetItem(ItemTag tag)
 {
     return(items.FirstOrDefault(x => x.tag == tag));
 }
コード例 #40
0
ファイル: ShellSchemeEditor.cs プロジェクト: FNKGino/poderosa
        //UIの調整
        private void SelectScheme(ItemTag tag)
        {
            _current = tag;
            IShellScheme ss = tag.ShellScheme;
            _blockUIEvent = true;
            StringResource sr = TerminalUIPlugin.Instance.Strings;
            _deleteSchemeButton.Enabled = !ss.IsGeneric;
            _currentSchemeGroup.Text = String.Format(sr.GetString("Form.ShellSchemeEditor._currentSchemeGroup"), ss.Name);
            _nameBox.Enabled = !ss.IsGeneric;
            _nameBox.Text = ss.Name;
            _promptBox.Text = ss.PromptExpression;
            _deleteCharBox.SelectedIndex = ss.BackSpaceChar == (char)0x7F ? 1 : 0;
            _alphabeticalSort.Checked = false;
            InitCommandListBox();

            _blockUIEvent = false;
            _deleteCommandsButton.Enabled = false;
        }
コード例 #41
0
 public Person GetPerson(ItemTag tag)
 {
     return(people.FirstOrDefault(x => x.tag == tag));
 }
コード例 #42
0
        /// <summary>
        /// Load available window plugins in a list
        ///
        /// Copied and modified from MediaPortal config: PluginsNew.cs
        /// </summary>
        private void LoadPlugins()
        {
            try
            {
                foreach (string pluginFile in availablePlugins)
                {
                    Assembly pluginAssembly = null;
                    try
                    {
                        pluginAssembly = Assembly.LoadFrom(pluginFile);
                    }
                    catch (BadImageFormatException)
                    {
                        Log.Warn("[WifiRemote Setup] {0} has a bad image format", pluginFile);
                    }

                    if (pluginAssembly != null)
                    {
                        try
                        {
                            Type[] exportedTypes = pluginAssembly.GetExportedTypes();

                            foreach (Type type in exportedTypes)
                            {
                                bool isPlugin    = (type.GetInterface("MediaPortal.GUI.Library.ISetupForm") != null);
                                bool isGuiWindow = ((type.IsClass) && (type.IsSubclassOf(typeof(GUIWindow))));

                                // an abstract class cannot be instanciated
                                if (type.IsAbstract)
                                {
                                    continue;
                                }

                                // Try to locate the interface we're interested in
                                if (isPlugin || isGuiWindow)
                                {
                                    // Create instance of the current type
                                    object pluginObject;
                                    try
                                    {
                                        pluginObject = Activator.CreateInstance(type);
                                    }
                                    catch (TargetInvocationException)
                                    {
                                        // Plugin is incompatible with current MediaPortal
                                        Log.Error("[WifiRemote Setup] Plugin " + pluginFile + " incompatible");
                                        continue;
                                    }

                                    if (isPlugin)
                                    {
                                        ISetupForm pluginForm = pluginObject as ISetupForm;

                                        if (pluginForm != null)
                                        {
                                            ItemTag tag = new ItemTag();
                                            tag.SetupForm = pluginForm;
                                            tag.DllName   = pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1);
                                            tag.WindowId  = pluginForm.GetWindowId();

                                            if (isGuiWindow)
                                            {
                                                GUIWindow win = (GUIWindow)pluginObject;
                                                if (tag.WindowId == win.GetID)
                                                {
                                                    tag.Type = win.GetType().ToString();
                                                }
                                            }

                                            LoadPluginImages(type, tag);
                                            plugins.Add(tag);
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            // plugin broken or incompatible
                            Log.Error("[WifiRemote Setup] Exception: {0}", ex);
                        }
                    }
                }
            }
            catch (Exception excep)
            {
                Log.Error("[WifiRemote Setup] Error loading plugins: " + excep.Message);
            }
        }
コード例 #43
0
 public static IEnumerable <Vendor> GetVendors(ItemTag catalogTags)
 {
     return(Assets.Vendors.Where(x => (x.PreferredTag & catalogTags) != 0));
 }
コード例 #44
0
        private void LoadPlugins()
        {
            foreach (string pluginFile in availablePlugins)
            {
                Assembly pluginAssembly = null;
                try
                {
                    Log.Debug("PluginsNew: loadPlugins {0}", pluginFile);
                    pluginAssembly = Assembly.LoadFrom(pluginFile);
                }
                catch (BadImageFormatException)
                {
                    Log.Warn("PluginsNew: {0} has a bad image format", pluginFile);
                }

                if (pluginAssembly != null)
                {
                    try
                    {
                        Type[]        exportedTypes   = pluginAssembly.GetExportedTypes();
                        List <object> NonSetupWindows = new List <object>();

                        foreach (Type type in exportedTypes)
                        {
                            bool isPlugin    = (type.GetInterface("MediaPortal.GUI.Library.ISetupForm") != null);
                            bool isGuiWindow = ((type.IsClass) && (type.IsSubclassOf(typeof(GUIWindow))));

                            // an abstract class cannot be instanciated
                            if (type.IsAbstract)
                            {
                                continue;
                            }

                            bool isIncompatible = !CompatibilityManager.IsPluginCompatible(type);
                            if (isIncompatible)
                            {
                                Log.Warn(
                                    "Plugin Manager: Plugin {0} is incompatible with the current MediaPortal version! (File: {1})",
                                    type.FullName, pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1));
                            }

                            // Try to locate the interface we're interested in
                            if (isPlugin || isGuiWindow)
                            {
                                // Create instance of the current type
                                object pluginObject;
                                try
                                {
                                    pluginObject = Activator.CreateInstance(type);
                                }
                                catch (TargetInvocationException)
                                {
                                    MessageBox.Show(
                                        string.Format(
                                            "An error occured while loading the plugin {0}.\n\nIt's incompatible with the current MediaPortal version and won't be loaded.",
                                            type.FullName
                                            ), "Plugin Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    Log.Warn(
                                        "Plugin Manager: Plugin {0} is incompatible with the current MediaPortal version! (File: {1})",
                                        type.FullName, pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1));
                                    continue;
                                }

                                if (isPlugin)
                                {
                                    ISetupForm      pluginForm = pluginObject as ISetupForm;
                                    IExternalPlayer extPlayer  = pluginObject as IExternalPlayer;
                                    IShowPlugin     showPlugin = pluginObject as IShowPlugin;

                                    if (pluginForm != null)
                                    {
                                        ItemTag tag = new ItemTag();
                                        tag.SetupForm = pluginForm;
                                        tag.DllName   = pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1);
                                        tag.WindowId  = pluginForm.GetWindowId();

                                        if (isGuiWindow)
                                        {
                                            GUIWindow win = (GUIWindow)pluginObject;
                                            if (tag.WindowId == win.GetID)
                                            {
                                                tag.Type      = win.GetType().ToString();
                                                tag.IsProcess = false;
                                                tag.IsWindow  = true;
                                            }
                                        }
                                        else if (extPlayer != null)
                                        {
                                            tag.IsExternalPlayer = true;
                                        }
                                        else
                                        {
                                            tag.IsProcess = true;
                                        }

                                        if (showPlugin != null)
                                        {
                                            tag.ShowDefaultHome = showPlugin.ShowDefaultHome();
                                        }

                                        tag.IsIncompatible = isIncompatible;

                                        LoadPluginImages(type, tag);
                                        loadedPlugins.Add(tag);
                                    }
                                }
                                else
                                {
                                    NonSetupWindows.Add(pluginObject);
                                }
                            }
                        }
                        // Filter plugins from e.g. dialogs or other windows.
                        foreach (GUIWindow win in NonSetupWindows)
                        {
                            foreach (ItemTag tag in loadedPlugins)
                            {
                                if (tag.WindowId == win.GetID)
                                {
                                    tag.Type      = win.GetType().ToString();
                                    tag.IsProcess = false;
                                    tag.IsWindow  = true;
                                    Log.Debug(
                                        "PluginsNew: {0}, window plugin, does not implement \"ISetupForm\" and \"GUIWindow\" in the same class",
                                        tag.Type);
                                    break;
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(
                            string.Format(
                                "An error occured while loading the plugin file {0}.\n\nIt's broken or incompatible with the current MediaPortal version and won't be loaded.",
                                pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1)), "Plugin Manager", MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                        Log.Warn(
                            "PluginManager: Plugin file {0} is broken or incompatible with the current MediaPortal version and won't be loaded!",
                            pluginFile.Substring(pluginFile.LastIndexOf(@"\") + 1));
                        Log.Error("PluginManager: Exception: {0}", ex);
                    }
                }
            }
        }
コード例 #45
0
ファイル: Item.cs プロジェクト: Emil760/Game
 public Item(ItemTag tag, ItemType type, string name, float weight, string path)
     : this(tag, name, weight, path)
 {
     this.type = type;
 }
コード例 #46
0
        private void OnItemSelected()
        {
            contextMenuStrip.Items.Clear();

            mpButtonHome.Enabled   = false;
            mpButtonEnable.Enabled = false;
            mpButtonPlugin.Enabled = false;
            mpButtonConfig.Enabled = false;

            if (listViewPlugins.FocusedItem != null)
            {
                ItemTag itemTag = (ItemTag)listViewPlugins.FocusedItem.Tag;

                addContextMenuItem("Name", itemTag.SetupForm.PluginName(), null, false);
                addContextMenuItem("Author", string.Format("Author: {0}", itemTag.SetupForm.Author()), null, false);
                if (itemTag.IsIncompatible)
                {
                    return;
                }

                addContextMenuSeparator();
                mpButtonEnable.Enabled = true;

                if (!itemTag.IsEnabled)
                {
                    addContextMenuItem("Enabled", "Disabled", imageListContextMenu.Images[1], true);
                    mpButtonEnable.Text = "Enable";
                }
                else
                {
                    addContextMenuItem("Enabled", "Enabled", imageListContextMenu.Images[0], true);
                    string dummy;
                    mpButtonEnable.Text = "Disable";
                    if (itemTag.SetupForm.CanEnable() && itemTag.IsWindow &&
                        itemTag.SetupForm.GetHome(out dummy, out dummy, out dummy, out dummy))
                    {
                        if (!itemTag.IsHome)
                        {
                            addContextMenuItem("My Home", "Listed in Home", imageListContextMenu.Images[1], true);
                            mpButtonHome.Enabled = true;
                        }
                        else
                        {
                            addContextMenuItem("My Home", "Listed in Home", imageListContextMenu.Images[0], true);
                        }

                        if (!itemTag.IsPlugins)
                        {
                            addContextMenuItem("My Plugins", "Listed in My Plugins", imageListContextMenu.Images[1], true);
                            mpButtonPlugin.Enabled = true;
                        }
                        else
                        {
                            addContextMenuItem("My Plugins", "Listed in My Plugins", imageListContextMenu.Images[0], true);
                        }
                    }

                    if (itemTag.SetupForm.HasSetup())
                    {
                        addContextMenuSeparator();
                        addContextMenuItem("Config", "Configuration", null, true);
                        mpButtonConfig.Enabled = true;
                    }
                }
            }
        }
コード例 #47
0
 /// <summary>
 /// When an item tag button is clicked, we
 /// find the ItemTag relating to the button and set it as the
 /// currently visible item tag
 /// </summary>
 /// <param name="button"></param>
 public void OnButtonClick(int button)
 {
     CurrentInventoryItemTag = (ItemTag)button;
     MainInventory.SetItemTag(CurrentInventoryItemTag);
     SecondInventory.SetItemTag(CurrentInventoryItemTag);
 }
コード例 #48
0
ファイル: DBItemMst.cs プロジェクト: Blasthal/MonlineBrowser
 /// <summary>
 /// アイテムのタグに対応したマスターIDを取得する
 /// </summary>
 /// <param name="itemKind">アイテムの種類</param>
 /// <returns>アイテムのマスターID</returns>
 public static Int32 GetItemMstId(ItemTag itemTag)
 {
     return ItemMstIds[(Int32)itemTag];
 }
コード例 #49
0
        public override TemplateObject Handle(TagData data)
        {
            data.Shrink();
            if (data.Remaining == 0)
            {
                return(new TextTag(ToString()));
            }
            switch (data[0])
            {
            // <--[tagbase]
            // @Name ServerTag.online_players
            // @Group Entities
            // @ReturnType ListTag
            // @Returns a list of all online players.
            // @Example .online_players could return "Fortifier|mcmonkey".
            // -->
            case "online_players":
            {
                ListTag players = new ListTag();
                foreach (PlayerEntity p in TheServer.Players)
                {
                    players.ListEntries.Add(new PlayerTag(p));
                }
                return(players.Handle(data.Shrink()));
            }

            // <--[tagbase]
            // @Name ServerTag.loaded_worlds
            // @Group World
            // @ReturnType ListTag
            // @Returns a list of all loaded worlds.
            // @Example .loaded_worlds could return "default|bob".
            // -->
            case "loaded_worlds":
            {
                ListTag worlds = new ListTag();
                foreach (World w in TheServer.LoadedWorlds)
                {
                    worlds.ListEntries.Add(new WorldTag(w));
                }
                return(worlds.Handle(data.Shrink()));
            }

            // <--[tagbase]
            // @Name ServerTag.loaded_recipes
            // @Group Items
            // @ReturnType ListTag
            // @Returns a list of all loaded recipes.
            // -->
            case "loaded_recipes":
            {
                ListTag recipes = new ListTag();
                foreach (ItemRecipe r in TheServer.Recipes.Recipes)
                {
                    recipes.ListEntries.Add(new RecipeTag(r));
                }
                return(recipes.Handle(data.Shrink()));
            }

            // <--[tagbase]
            // @Name ServerTag.can_craft_from[<ListTag>]
            // @Group Items
            // @ReturnType ListTag
            // @Returns a list of all loaded recipes that can be crafted from the given input.
            // @Example .can_craft_from[blocks/grass_forest] could return "1&pipeblocks/grass_forest|".
            // -->
            case "can_craft_from":
            {
                // TODO: Handle errors neatly!
                List <ItemStack> items = new List <ItemStack>();
                ListTag          list  = ListTag.For(data.GetModifierObject(0));
                foreach (TemplateObject obj in list.ListEntries)
                {
                    items.Add(ItemTag.For(TheServer, obj).Internal);
                }
                ListTag recipes = new ListTag();
                foreach (RecipeResult r in TheServer.Recipes.CanCraftFrom(items.ToArray()))
                {
                    recipes.ListEntries.Add(new RecipeResultTag(r));
                }
                return(recipes.Handle(data.Shrink()));
            }

            // <--[tagbase]
            // @Name ServerTag.match_player[<TextTag>]
            // @Group Entities
            // @ReturnType PlayerTag
            // @Returns the player whose name best matches the input.
            // @Example .match_player[Fort] out of a group of "Fortifier", "Fort", and "Forty" would return "Fort".
            // @Example .match_player[monk] out of a group of "mcmonkey", "morph", and "Fort" would return "mcmonkey".
            // -->
            case "match_player":
            {
                string       pname  = data.GetModifier(0);
                PlayerEntity player = TheServer.GetPlayerFor(pname);
                if (player == null)
                {
                    data.Error("Invalid player '" + TagParser.Escape(pname) + "'!");
                    return(new NullTag());
                }
                return(new PlayerTag(player).Handle(data.Shrink()));
            }

            default:
                return(new TextTag(ToString()).Handle(data));
            }
        }
コード例 #50
0
            public bool EnterNode(LibraryNode node, CancellationToken ct) {
                if (ct.IsCancellationRequested) {
                    _navCallback.Invalidate();
                    return false;
                }

                IVsHierarchy hierarchy;
                uint itemId, itemsCount;
                Guid projectType;
                node.SourceItems(out hierarchy, out itemId, out itemsCount);
                if (hierarchy != null) {
                    ErrorHandler.ThrowOnFailure(hierarchy.GetGuidProperty(
                        (uint)VSConstants.VSITEMID.Root,
                        (int)__VSHPROPID.VSHPROPID_TypeGuid,
                        out projectType
                    ));
                    if (projectType != _projectType) {
                        return false;
                    }
                }

                var parentNode = _path.Peek();
                _path.Push(node);

                // We don't want to report modules, since they map 1-to-1 to files, and those are already reported by the standard item provider
                if (node.NodeType.HasFlag(LibraryNodeType.Package)) {
                    return true;
                }

                // Match name against search string.
                string name = node.Name ?? "";
                MatchKind matchKind;
                if (_searchValue.Length > 2 && _searchValue.StartsWith("/") && _searchValue.EndsWith("/")) {
                    if (!_regexComparer.IsCandidateMatch(name, _searchValue.Substring(1, _searchValue.Length - 2))) {
                        return true;
                    }
                    matchKind = MatchKind.Regular;
                } else if (name.Equals(_searchValue, StringComparison.Ordinal)) {
                    matchKind = MatchKind.Exact;
                } else if (_comparer.IsCandidateMatch(name, _searchValue)) {
                    matchKind = MatchKind.Regular;
                } else {
                    return true;
                }

                string kind;
                if (!_sggToNavItemKind.TryGetValue(node.GlyphType, out kind)) {
                    kind = "";
                }
                
                var text = node.GetTextRepresentation(VSTREETEXTOPTIONS.TTO_DISPLAYTEXT);
                if (parentNode != null) {
                    switch (parentNode.GlyphType) {
                        case StandardGlyphGroup.GlyphGroupModule:
                            text += string.Format(" [of module {0}]", parentNode.Name);
                            break;
                        case StandardGlyphGroup.GlyphGroupClass:
                            text += string.Format(" [of class {0}]", parentNode.Name);
                            break;
                        case StandardGlyphGroup.GlyphGroupMethod:
                            text += string.Format(" [nested in function {0}]", parentNode.Name);
                            break;
                    }
                }

                var tag = new ItemTag { Node = node, GlyphService = _itemProvider._glyphService };
                _navCallback.AddItem(new NavigateToItem(text, kind, "Python", "", tag, matchKind, PythonNavigateToItemDisplayFactory.Instance));
                return true;
            }
コード例 #51
0
 // Checks if this item contains a given tag
 public bool ContainsTag(ItemTag tag)
 {
     return(this.tags.Contains(tag));
 }
コード例 #52
0
 /// <summary>
 /// Checks whether the a plugin has a <see cref="PluginIconsAttribute"/> defined.  If it has, the images that are indicated
 /// in the attribute are loaded
 /// </summary>
 /// <param name="type">The <see cref="Type"/> to examine.</param>
 /// <param name="tag">The <see cref="ItemTag"/> to store the images in.</param>
 private void LoadPluginImages(Type type, ItemTag tag)
 {
   PluginIconsAttribute[] icons =
     (PluginIconsAttribute[])type.GetCustomAttributes(typeof (PluginIconsAttribute), false);
   if (icons == null || icons.Length == 0)
   {
     //Log.Debug("PluginsNew: no icons");
     return;
   }
   string resourceName = icons[0].ActivatedResourceName;
   if (!string.IsNullOrEmpty(resourceName))
   {
     Log.Debug("PluginsNew: load active image from resource - {0}", resourceName);
     tag.ActiveImage = LoadImageFromResource(type, resourceName);
     if (tag.IsIncompatible)
     {
       tag.ActiveImage = OverlayImage(tag.ActiveImage, imageListLargePlugins.Images[20]);
     }
   }
   resourceName = icons[0].DeactivatedResourceName;
   if (!string.IsNullOrEmpty(resourceName))
   {
     Log.Debug("PluginsNew: load deactivated image from resource - {0}", resourceName);
     tag.InactiveImage = LoadImageFromResource(type, resourceName);
     if (tag.IsIncompatible)
     {
       tag.InactiveImage = OverlayImage(tag.InactiveImage, imageListLargePlugins.Images[20]);
     }
   }
 }
コード例 #53
0
 public bool RemoveTagFromItem(string feedId, string itemId, ItemTag tag)
 {
     return EditItem(feedId, itemId, ItemTag.None, tag, ItemAction.Remove);
 }
コード例 #54
0
ファイル: AbbreviationsScanner.cs プロジェクト: nbsrujan/acat
        /// <summary>
        /// Depending on the type of the button, handle appropriately
        /// </summary>
        /// <param name="itemTag"></param>
        private void handleSelect(ItemTag itemTag)
        {
            switch (itemTag.DataType)
            {
                case ItemTag.ItemType.NextPage:
                    gotoNextPage();
                    break;

                case ItemTag.ItemType.PreviousPage:
                    gotoPreviousPage();
                    break;

                case ItemTag.ItemType.OrderBy:
                    switchSortOrder();
                    break;

                case ItemTag.ItemType.Abbreviation:
                    handleEditAbbreviation(itemTag);
                    break;

                case ItemTag.ItemType.AddNew:
                    handleAddNewAbbreviation();
                    break;
            }
        }
コード例 #55
0
ファイル: LaunchAppScanner.cs プロジェクト: nbsrujan/acat
        /// <summary>
        /// Handle the selection - navigate, launch app etc
        /// </summary>
        /// <param name="itemTag">item tag of selected item</param>
        private void handleSelect(ItemTag itemTag)
        {
            switch (itemTag.DataType)
            {
                case ItemTag.ItemType.NextPage:
                    gotoNextPage();
                    break;

                case ItemTag.ItemType.PreviousPage:
                    gotoPreviousPage();
                    break;

                case ItemTag.ItemType.OrderBy:
                    switchSortOrder();
                    break;

                case ItemTag.ItemType.App:
                    if (itemTag.ApplicationInfo != null)
                    {
                        if (DialogUtils.ConfirmScanner("Launch " + itemTag.ApplicationInfo.Name + "?"))
                        {
                            if (EvtLaunchApp != null)
                            {
                                EvtLaunchApp.BeginInvoke(this, itemTag.ApplicationInfo, null, null);
                                return;
                            }
                        }
                    }

                    break;
            }
        }