示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            String version = FileVersionInfo.GetVersionInfo(System.Windows.Forms.Application.ExecutablePath).FileVersion;

            Text = String.Format("特效查看器 v{0}", version);

            path = @"../../DataResource\Effect";
            items.Clear();
            DirectoryInfo directoryInfo = new DirectoryInfo(path);

            foreach (FileInfo file in directoryInfo.GetFiles())
            {
                if (file.Extension == ".eff")
                {
                    var itm = new SelectItem();
                    itm.Path = file.Name;
                    StreamReader sr = new StreamReader(path + "/" + itm.Path);
                    sr.ReadLine();
                    sr.ReadLine();
                    sr.ReadLine();
                    itm.Image = sr.ReadLine().Split('\t')[0];
                    sr.Close();
                    items.Add(itm);
                }
            }
        }
示例#2
0
        /// <summary>
        /// is this selection item a structural or navigation property selection item.
        /// </summary>
        /// <param name="selectItem">the selection item to check</param>
        /// <returns>true if this selection item is a structural property selection item.</returns>
        internal static bool IsStructuralOrNavigationPropertySelectionItem(SelectItem selectItem)
        {
            DebugUtils.CheckNoExternalCallers();
            PathSelectItem pathSelectItem = selectItem as PathSelectItem;

            return(pathSelectItem != null && (pathSelectItem.SelectedPath.LastSegment is NavigationPropertySegment || pathSelectItem.SelectedPath.LastSegment is PropertySegment));
        }
        // @Override
        public Row getSubSelection(DataSetHeader header)
        {
            int size = header.size();

            Object[] values = new Object[size];
            Style[]  styles = new Style[size];
            for (int i = 0; i < size; i++)
            {
                SelectItem selectItem = header.getSelectItem(i);

                if (selectItem.getSubQuerySelectItem() != null)
                {
                    values[i] = getValue(selectItem.getSubQuerySelectItem());
                    styles[i] = getStyle(selectItem.getSubQuerySelectItem());
                    if (values[i] == null)
                    {
                        values[i] = getValue(selectItem);
                        styles[i] = getStyle(selectItem);
                    }
                }
                else
                {
                    values[i] = getValue(selectItem);
                    styles[i] = getStyle(selectItem);
                }
            }
            return(new DefaultRow(header, values, styles));
        }
    void Start()
    {
        dialogueWithGroundskeeperScript = Groundskeeper.GetComponent <DialogueWithGroundskeeper>();
        dialogueWithVanessaScript       = Vanessa.GetComponent <DialogueWithVanessa>();

        lockedWithNPC           = false;
        UhhhhMaybeYouShouldWait = FMODUnity.RuntimeManager.CreateInstance("event:/Dialogue/Player/UhhhhMaybeYouShouldWait");
        turulSFXScript          = turul.GetComponent <PlayTurulSFX>();
        TurulSingleSquawk       = FMODUnity.RuntimeManager.CreateInstance("event:/SFX/TurulSquawk");
        LockComment             = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/LockComment");
        StillMausoleumComment   = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/StillMausoleumComment");
        StillClockComment       = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/StillClockComment");
        BlankGraveComment       = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/GraveWithoutWordsComment");
        TreeOfLifeComment       = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/TreeOfLife");
        BangingMausoleumComment = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/BangingMausoleumComment");
        CreepyClockComment      = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/CreepyClockComment");
        FilledInGravesComment   = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/FilledInGravesComment");
        IgnoreTheGhostComment   = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/IgnoreTheGhostComment");

        obtainLighterFromCharlieComment = FMODUnity.RuntimeManager.CreateInstance("event:/Dialogue/Player/ObtainLighterComment");
        obtainFanFromVanessaComment     = FMODUnity.RuntimeManager.CreateInstance("event:/Dialogue/Player/ObtainFanComment");


        IHaveAShovel = FMODUnity.RuntimeManager.CreateInstance("event:/ItemInteractions/IHaveAShovel");

        lightScript     = lights.GetComponent <ProgressiveLights>();
        gateCloseScript = bathroomCutsceneHolder.GetComponent <TriggerGateClose>();

        waterBottleSlotSelectItemScript = waterBottleSlot.GetComponent <SelectItem>();
        inventoryScript = GetComponent <Inventory>();

        inventoryItemManagerScript = InventoryCanvas.GetComponent <InventoryItemManager>();

        LeaveForintOnTheGround = FMODUnity.RuntimeManager.CreateInstance("event:/Monologue/LeaveForintOnTheGround");
    }
示例#5
0
        /// <summary>
        /// 获取预付类清单
        /// </summary>
        /// <returns></returns>
        public JsonResult PreSelectNameList()
        {
            List <SelectItem>  items  = new List <SelectItem>();
            List <PreCharging> preLst = new CWTariff().FindPreChargeList(pr => true);

            foreach (PreCharging pre in preLst)
            {
                SelectItem it = new SelectItem();
                it.OptionValue = pre.ID.ToString();
                string cycle = "";
                switch (pre.CycleUnit)
                {
                case EnmCycleUnit.Day:
                    cycle = "天";
                    break;

                case EnmCycleUnit.Hour:
                    cycle = "小时";
                    break;

                case EnmCycleUnit.Month:
                    cycle = "月";
                    break;

                case EnmCycleUnit.Season:
                    cycle = "季度";
                    break;
                }
                it.OptionText = pre.CycleNum + " " + cycle + " " + pre.Fee + "元";

                items.Add(it);
            }
            return(Json(items, JsonRequestBehavior.AllowGet));
        }
示例#6
0
文件: Poller.cs 项目: xuzhe35/netmq
        private void RebuildPollset()
        {
            m_pollset = null;
            m_pollact = null;

            m_pollSize = m_sockets.Count + m_pollinSockets.Count;
            m_pollset  = new SelectItem[m_pollSize];

            m_pollact = new NetMQSocket[m_sockets.Count];

            uint itemNbr = 0;

            foreach (var socket in m_sockets)
            {
                m_pollset[itemNbr] = new PollerSelectItem(socket, socket.GetPollEvents());
                m_pollact[itemNbr] = socket;
                itemNbr++;
            }

            foreach (var socket in m_pollinSockets)
            {
                m_pollset[itemNbr] = new SelectItem(socket.Key, PollEvents.PollError | PollEvents.PollIn);
                itemNbr++;
            }

            m_isDirty = false;
        }
示例#7
0
文件: SelectItem.cs 项目: vebin/IQMap
        public void CreateParse()
        {
            var item = new SelectItem("colname as aliasname");

            Assert.AreEqual("colname", item.Field);
            Assert.AreEqual("aliasname", item.Alias);

            item = new SelectItem("colname");
            Assert.AreEqual("colname", item.Field);
            Assert.AreEqual(null, item.Alias);


            Assert.Throws <ArgumentException>(() =>
            {
                item = new SelectItem("colname aliasname");
            });

            Assert.Throws <ArgumentException>(() =>
            {
                item = new SelectItem("colname as an aliasname");
            });

            Assert.Throws <ArgumentException>(() =>
            {
                item = new SelectItem("colname = aliasname");
            });
        }
示例#8
0
文件: SelectItem.cs 项目: vebin/IQMap
        public void Create()
        {
            var item = new SelectItem("colname", "MeaningfulName");

            Assert.AreEqual("colname AS MeaningfulName", item.GetSql());
            Assert.AreEqual("colname", item.Field);
        }
示例#9
0
        /// <summary>
        /// Add a select item to the current list of selection items
        /// </summary>
        /// <param name="itemToAdd">The item to add</param>
        internal void AddToSelectedItems(SelectItem itemToAdd)
        {
            ExceptionUtils.CheckArgumentNotNull(itemToAdd, "itemToAdd");

            if (this.selectedItems.Any(x => x is WildcardSelectItem) && IsStructuralOrNavigationPropertySelectionItem(itemToAdd))
            {
                return;
            }

            bool isWildcard = itemToAdd is WildcardSelectItem;

            List<SelectItem> newSelectedItems = new List<SelectItem>();

            foreach (SelectItem selectedItem in this.selectedItems)
            {
                if (isWildcard)
                {
                    if (!IsStructuralSelectionItem(selectedItem))
                    {
                        newSelectedItems.Add(selectedItem);
                    }
                }
                else
                {
                    newSelectedItems.Add(selectedItem);
                }
            }        

            newSelectedItems.Add(itemToAdd);
            this.selectedItems = new ReadOnlyCollection<SelectItem>(newSelectedItems);
        }
示例#10
0
        public async Task <IActionResult> AddEditSelectItem(int id)
        {
            AddEditSelectItemViewModel model = new AddEditSelectItemViewModel();

            model.SelectGroupListItems = await _context.SelectGroups.Select(c => new SelectListItem()
            {
                Text  = c.Title,
                Value = c.Id.ToString()
            }).ToListAsync();

            if (id != 0)
            {
                using (_serviceProvider.GetRequiredService <ApplicationDbContext>())
                {
                    SelectItem SelectItem = await _context.SelectItems.Where(a => a.Id == id).SingleOrDefaultAsync();

                    if (SelectItem != null)
                    {
                        model.Id            = SelectItem.Id;
                        model.Title         = SelectItem.Title;
                        model.IdSelectGroup = SelectItem.IdSelectGroup;
                    }
                }
            }

            return(PartialView("AddEditSelectItem", model));
        }
示例#11
0
        private string GetOrderByValue([NotNull] SelectItem item, [NotNull] string columnName)
        {
            Debug.ArgumentNotNull(item, nameof(item));
            Debug.ArgumentNotNull(columnName, nameof(columnName));

            /*
             * switch (columnName.ToUpperInvariant())
             * {
             * case "@ID":
             * return item.ID.ToString();
             * case "@NAME":
             * return item.Name;
             * case "@TEMPLATENAME":
             * return item.TemplateName;
             * case "@TEMPLATEID":
             * return item.TemplateID.ToString();
             * case "@PATH":
             * return item.Paths.Path;
             * }
             */
            var field = item.Fields.FirstOrDefault(f => f.ColumnName == columnName);

            if (field == null)
            {
                return(null);
            }

            return(field.Value);
        }
示例#12
0
        private void RebuildPollset()
        {
#if !NET35
            Debug.Assert(m_isSchedulerThread.Value);
#endif

            // Recreate the m_pollSet and m_pollact arrays.
            m_pollSet = new SelectItem[m_sockets.Count + m_pollinSockets.Count];
            m_pollact = new NetMQSocket[m_sockets.Count];

            // For each socket in m_sockets,
            // put a corresponding SelectItem into the m_pollSet array and a reference to the socket itself into the m_pollact array.
            uint index = 0;

            foreach (var socket in m_sockets)
            {
                m_pollSet[index] = new SelectItem(socket.SocketHandle, socket.GetPollEvents());
                m_pollact[index] = socket;
                index++;
            }

            foreach (var socket in m_pollinSockets.Keys)
            {
                m_pollSet[index] = new SelectItem(socket, PollEvents.PollError | PollEvents.PollIn);
                index++;
            }

            // Mark this as NOT having any fresh events to attend to, as yet.
            m_isPollSetDirty = false;
        }
示例#13
0
        /// <summary>
        /// Handles OnUpdate event
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected override void OnUpdate(EventArgs e)
        {
            string   email;
            Label    lblEMail;
            CheckBox chkSelect;

            foreach (RepeaterItem SelectItem in repListItem.Items)
            {
                lblEMail  = (Label)SelectItem.FindControl("lblEMail");
                email     = lblEMail.Text;
                chkSelect = (CheckBox)SelectItem.FindControl("chkSelect");

                if (chkSelect.Checked)
                {
                    //BlacklistDB.AddToBlackList(this.portalSettings.PortalID, email, "Blacklisted by " +  Context.User.Identity.Name);
                    // Added EsperantusKeys for Localization
                    // Mario Endara [email protected] june-1-2004
                    BlacklistDB.AddToBlackList(this.PortalSettings.PortalID, email,
                                               General.GetString("NEWSLETTER_BLACKLISTED") +
                                               PortalSettings.CurrentUser.Identity.Email);
                }
                else
                {
                    BlacklistDB.DeleteFromBlackList(this.PortalSettings.PortalID, email);
                }
            }

            // Redirect back to the portal home page
            RedirectBackToReferringPage();
        }
        /// <summary>
        /// Build a wildcard selection item
        /// </summary>
        /// <param name="tokenIn">the token to bind to a wildcard</param>
        /// <param name="model">the model to search for this wildcard</param>
        /// <param name="item">the new wildcard selection item, if we found one</param>
        /// <returns>true if we successfully bound to a wildcard, false otherwise</returns>
        public static bool TryBindAsWildcard(PathSegmentToken tokenIn, IEdmModel model, out SelectItem item)
        {
            bool isTypeToken = tokenIn.IsNamespaceOrContainerQualified();
            bool wildcard = tokenIn.Identifier.EndsWith("*", StringComparison.Ordinal);

            if (isTypeToken && wildcard)
            {
                string namespaceName = tokenIn.Identifier.Substring(0, tokenIn.Identifier.Length - 2);

                if (model.DeclaredNamespaces.Any(declaredNamespace => declaredNamespace.Equals(namespaceName, StringComparison.Ordinal)))
                {
                    item = new NamespaceQualifiedWildcardSelectItem(namespaceName);
                    return true;
                }
            }

            if (tokenIn.Identifier == "*")
            {
                item = new WildcardSelectItem();
                return true;
            }

            item = null;
            return false;
        }
示例#15
0
    public void Init()
    {
        mCraftItem = GetComponentInChildren <CraftItemSlot>();
        mResource  = GetComponentsInChildren <CraftResourceSlot>().ToList();
        mAccept    = GetComponentInChildren <CraftStart>();
        mProcess   = transform.Find("Crafting_Cover").GetComponentInChildren <CraftProcess>();

        mCraftItem.Init();
        mCraftItem.resourceHandler += SetCurItem;
        mProcess.ResetHandler      += mCraftItem.ResetSlot;

        for (int i = 0; i < mResource.Count; i++)
        {
            mResource[i].Init(i);
            mProcess.ResetHandler += mResource[i].ResetSlot;
        }
        mAccept.Init();
        mProcess.ResetHandler += mAccept.ResetStart;
        mProcess.Init();

        SelectItem select = transform.parent.parent.Find("SelectWindow").GetComponent <SelectItem>();

        select.SetCraftHandler += mCraftItem.SetSlot;

        for (int i = 0; i < mResource.Count; i++)
        {
            select.SetCraftHandler += mResource[i].SetSlot;
        }

        mProcess.ResetHandler += select.HideWindow;
    }
示例#16
0
        public static PathSelectItem ShouldBePathSelectionItem(this SelectItem actual, ODataPath path)
        {
            PathSelectItem pathSeleteItem = actual.ShouldBeSelectedItemOfType <PathSelectItem>();

            Assert.True(pathSeleteItem.SelectedPath.Equals(path));
            return(pathSeleteItem);
        }
        // @Override
        public HavingBuilder having(String columnExpression)
        {
            SelectItemParser parser     = new SelectItemParser(_query, false);
            SelectItem       selectItem = parser.findSelectItem(columnExpression);

            return(having(selectItem));
        }
示例#18
0
        public void NestedSelectWithValidExpressionOnCollection()
        {
            // Arrange
            SelectToken select = ParseSelectToken("PreviousAddresses($select=Street)");

            // Act
            SelectExpandClause clause = BinderForPerson.Bind(expandToken: null, selectToken: select);

            // Assert
            Assert.NotNull(clause);

            // only one top level $select
            SelectItem selectItem = Assert.Single(clause.SelectedItems);

            // it should be "PathSelectItem
            PathSelectItem pathSelect = Assert.IsType <PathSelectItem>(selectItem);

            Assert.NotNull(pathSelect.SelectAndExpand);

            // Street
            selectItem = Assert.Single(pathSelect.SelectAndExpand.SelectedItems);
            PathSelectItem subPathSelect = Assert.IsType <PathSelectItem>(selectItem);

            Assert.Equal("Street", subPathSelect.SelectedPath.ToResourcePathString(ODataUrlKeyDelimiter.Parentheses));
            Assert.NotNull(subPathSelect.SelectAndExpand);
        }
示例#19
0
        public override IList <SettingItem> GetConnectionParameters()
        {
            var infoItem    = new SelectItem(CONNECTION_INFO, CONNECTION_INFO);
            var tradingItem = new SelectItem(CONNECTION_TRADING, CONNECTION_TRADING);

            var relation = new SettingItemRelationEnability(CONNECTION, tradingItem);

            var result = new List <SettingItem>
            {
                new SettingItemGroup(LOGIN_PARAMETER_GROUP, new List <SettingItem>
                {
                    new SettingItemRadioLocalized(CONNECTION, infoItem, new List <SelectItem> {
                        infoItem, tradingItem
                    }),
                    new SettingItemString(PARAMETER_API_KEY, string.Empty)
                    {
                        Text     = "API key",
                        Relation = relation
                    },
                    new SettingItemPassword(PARAMETER_SECRET_KEY, new PasswordHolder())
                    {
                        Text     = "Secret key",
                        Relation = relation
                    }
                })
            };

            return(result);
        }
示例#20
0
        public Cinecalidad(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps)
            : base(id: "cinecalidad",
                   name: "Cinecalidad",
                   description: "Películas Full HD en Castellano y Latino Dual.",
                   link: "https://www.cinecalidad.is/",
                   caps: new TorznabCapabilities(),
                   configService: configService,
                   client: wc,
                   logger: l,
                   p: ps,
                   configData: new ConfigurationData())
        {
            Encoding = Encoding.UTF8;
            Language = "es-es";
            Type     = "public";

            var language = new SelectItem(new Dictionary <string, string>
            {
                { "castellano", "Castilian Spanish" },
                { "latino", "Latin American Spanish" }
            })
            {
                Name  = "Select language",
                Value = "castellano"
            };

            configData.AddDynamic("language", language);

            AddCategoryMapping(1, TorznabCatType.MoviesHD);
        }
        } // getConverters()

        // @Override
        public DataSet intercept(DataSet dataSet)
        {
            Dictionary<Column, TypeConverter<object, object>> converters = getConverters(dataSet);
            if (converters.IsEmpty())
            {
                return dataSet;
            }

            bool             hasConverter = false;
            List<SelectItem> selectItems  = NArrays.AsList<SelectItem>(dataSet.getSelectItems());
            TypeConverter<object, object>[] converterArray = new TypeConverter<object, object>[selectItems.Count];
            for (int i = 0; i < selectItems.Count; i++)
            {
                SelectItem selectItem = selectItems[i];
                Column     column     = selectItem.getColumn();
                if (column != null && selectItem.getAggregateFunction() == null)
                {
                    TypeConverter<object, object> converter = converters[column];
                    if (converter != null)
                    {
                        hasConverter = true;
                        converterArray[i] = converter;
                    }
                }
            }

            if (! hasConverter)
            {
                return dataSet;
            }

            return new ConvertedDataSet(dataSet, converterArray);
        } // intercept()
示例#22
0
        private int Compare([NotNull] SelectItem x, [NotNull] SelectItem y)
        {
            Debug.ArgumentNotNull(x, nameof(x));
            Debug.ArgumentNotNull(y, nameof(y));

            foreach (var column in OrderBy)
            {
                var value1 = GetOrderByValue(x, column.ColumnName);
                var value2 = GetOrderByValue(y, column.ColumnName);

                if (value1 == null && value2 == null)
                {
                    return(0);
                }

                if (value1 == null)
                {
                    return(-1 * column.Direction);
                }

                if (value2 == null)
                {
                    return(column.Direction);
                }

                var result = StrCmpLogicalW(value1, value2);
                if (result != 0)
                {
                    return(result * column.Direction);
                }
            }

            return(0);
        }
示例#23
0
        public void DuplicatedSelectPathInOneDollarSelectWorksAsSingle(string select, string expect)
        {
            // Arrange
            ODataQueryOptionParser parser = new ODataQueryOptionParser(_model.Model, _model.Customer, _model.Customers,
                                                                       new Dictionary <string, string> {
                { "$select", select }
            });

            // Act
            SelectExpandClause selectAndExpand = parser.ParseSelectAndExpand();

            // Assert
            Assert.NotNull(selectAndExpand);
            Assert.False(selectAndExpand.AllSelected);
            SelectItem       selectItem     = Assert.Single(selectAndExpand.SelectedItems);
            PathSelectItem   pathSelectItem = Assert.IsType <PathSelectItem>(selectItem);
            ODataPathSegment pathSegment    = Assert.Single(pathSelectItem.SelectedPath);

            if (expect == "ID")
            {
                PropertySegment propertySegment = Assert.IsType <PropertySegment>(pathSegment);
                Assert.Equal(expect, propertySegment.Identifier);
            }
            else
            {
                OperationSegment operationSegment = Assert.IsType <OperationSegment>(pathSegment);
                Assert.Equal(expect, operationSegment.Operations.Single().FullName());
            }
        }
示例#24
0
        public void SelectIsBasedOnTheCurrentLevel()
        {
            // Arrange: $expand=MyDog($select=Color;$expand=MyPeople;)
            ExpandTermToken innerExpandTerm = new ExpandTermToken(new NonSystemToken("MyPeople", null, null));
            ExpandTermToken outerExpandTerm = new ExpandTermToken(new NonSystemToken("MyDog", null, null),
                                                                  new SelectToken(new List <PathSegmentToken>()
            {
                new NonSystemToken("Color", null, null)
            }),
                                                                  new ExpandToken(new ExpandTermToken[] { innerExpandTerm }));
            ExpandToken expandToken = new ExpandToken(new ExpandTermToken[] { outerExpandTerm });

            // Act
            SelectExpandClause clause = BinderForPerson.Bind(expandToken, null);

            // $expand=MyDog
            Assert.True(clause.AllSelected);
            SelectItem selectItem = Assert.Single(clause.SelectedItems);
            ExpandedNavigationSelectItem expandedItem = selectItem.ShouldBeExpansionFor(HardCodedTestModel.GetPersonMyDogNavProp());

            // Sub-level ($select=Color;$expand=MyPeople;)
            SelectExpandClause subSelectExpand = expandedItem.SelectAndExpand;

            Assert.False(subSelectExpand.AllSelected);
            Assert.Equal(2, subSelectExpand.SelectedItems.Count());
            selectItem   = Assert.Single(subSelectExpand.SelectedItems, x => x is ExpandedNavigationSelectItem);
            expandedItem = selectItem.ShouldBeExpansionFor(HardCodedTestModel.GetDogMyPeopleNavProp());

            Assert.NotNull(expandedItem.SelectAndExpand);
        }
示例#25
0
        public void MultiLevelExpandTermTokenWorks()
        {
            // Arrange: $expand=MyDog($expand=MyPeople)
            ExpandTermToken innerExpandTerm = new ExpandTermToken(new NonSystemToken("MyPeople", null, null));
            ExpandTermToken outerExpandTerm = new ExpandTermToken(new NonSystemToken("MyDog", null, null), null,
                                                                  new ExpandToken(new ExpandTermToken[] { innerExpandTerm }));
            ExpandToken expandToken = new ExpandToken(new ExpandTermToken[] { outerExpandTerm });

            // Act
            SelectExpandClause clause = BinderForPerson.Bind(expandToken, null);

            // Assert
            Assert.True(clause.AllSelected);
            SelectItem selectItem = Assert.Single(clause.SelectedItems);

            ExpandedNavigationSelectItem expandedItem = selectItem.ShouldBeExpansionFor(HardCodedTestModel.GetPersonMyDogNavProp());

            // sub-level
            Assert.NotNull(expandedItem.SelectAndExpand);
            Assert.True(expandedItem.SelectAndExpand.AllSelected);
            selectItem   = Assert.Single(expandedItem.SelectAndExpand.SelectedItems);
            expandedItem = selectItem.ShouldBeExpansionFor(HardCodedTestModel.GetDogMyPeopleNavProp());

            // sub-sub level
            Assert.NotNull(expandedItem.SelectAndExpand);
        }
示例#26
0
        public void EntitySetCorrectlyPopulatedAtEachLevel()
        {
            // Arrange: $expand=MyDog($expand=MyPeople;)
            ExpandTermToken innerExpandTerm = new ExpandTermToken(new NonSystemToken("MyPeople", null, null));
            ExpandTermToken outerExpandTerm = new ExpandTermToken(new NonSystemToken("MyDog", null, null),
                                                                  null,
                                                                  new ExpandToken(new ExpandTermToken[] { innerExpandTerm }));
            ExpandToken expandToken = new ExpandToken(new ExpandTermToken[] { outerExpandTerm });

            // Act
            SelectExpandClause clause = BinderForPerson.Bind(expandToken, null);

            // Assert
            SelectItem selectItem = Assert.Single(clause.SelectedItems);
            ExpandedNavigationSelectItem myDogExpandItem = selectItem.ShouldBeExpansionFor(HardCodedTestModel.GetPersonMyDogNavProp());

            Assert.Same(HardCodedTestModel.GetDogsSet(), myDogExpandItem.NavigationSource);

            // Sub-level ($expand=MyPeople)
            Assert.NotNull(myDogExpandItem.SelectAndExpand);
            selectItem = Assert.Single(myDogExpandItem.SelectAndExpand.SelectedItems);
            ExpandedNavigationSelectItem myPeopleExpandItem = selectItem.ShouldBeExpansionFor(HardCodedTestModel.GetDogMyPeopleNavProp());

            Assert.Same(HardCodedTestModel.GetPeopleSet(), myPeopleExpandItem.NavigationSource);

            // Sub-sub-level
            Assert.NotNull(myPeopleExpandItem.SelectAndExpand);
        }
示例#27
0
        public DBRefList <T> Retrieve <T>(Clause clause = null) where T : TableEntity
        {
            var script = new SQLScript(Accessor, Commons.Objects.Enums.SQLTYPE.SELECT);
            var from   = new FromItem <T>(Accessor);
            var select = new SelectItem(Accessor, from);

            script.AddItems(select, from);
            if (clause != null)
            {
                var where = new WhereItem(Accessor, clause, from);
                script.AddItems(where);
            }

            var list = new DBRefList <T>();

            var table = Accessor.Retrieve(script.ExportCommand());

            if (table != null && table.Rows.Count > 0)
            {
                foreach (var row in table.Rows)
                {
                    list.NewEntity().LoadFrom(row as DataRow, 0);
                }
            }
            return(list);
        }
示例#28
0
 protected void OnOutline(SelectItem i)
 {
     for (int l = 0; l < i.outlines.Length; l++)
     {
         i.outlines[l].eraseRenderer = false;
     }
 }
示例#29
0
        public void NestedTopAndSkipAndCountWithValidExpression()
        {
            // Arrange
            SelectToken select = ParseSelectToken("FavoriteColors($skip=4;$count=false;$top=2)");

            // Act
            SelectExpandClause clause = BinderForPerson.Bind(expandToken: null, selectToken: select);

            // Assert
            Assert.NotNull(clause);
            Assert.NotNull(clause.SelectedItems);

            // FavoriteColors
            SelectItem     selectItem    = Assert.Single(clause.SelectedItems);
            PathSelectItem subPathSelect = Assert.IsType <PathSelectItem>(selectItem);

            Assert.NotNull(subPathSelect.SkipOption);
            Assert.Equal(4, subPathSelect.SkipOption.Value);

            Assert.NotNull(subPathSelect.CountOption);
            Assert.False(subPathSelect.CountOption.Value);

            Assert.NotNull(subPathSelect.TopOption);
            Assert.Equal(2, subPathSelect.TopOption.Value);
        }
示例#30
0
        /// <summary>
        /// 选择某一项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _search_ComBox_SelectedValueChanged(object sender, EventArgs e)
        {
            //MessageBox.Show(_search_ComBox.Text);
            //MessageBox.Show(_search_ComBox.SelectedItem.ToString());
            if (_search_ComBox.SelectedItem != null)
            {
                SelectItem item = _search_ComBox.SelectedItem as SelectItem;
                ListView.ListViewItemCollection mList = new ListView.ListViewItemCollection(lvOneSelf);
                mList = lvOneSelf.Items;                         //.Find(item.Name, true);
                List <string>       tagList  = mListOneSelfPath; // lvOneSelf.Tag as List<string>;
                List <ListViewItem> listView = new List <ListViewItem>();
                int i = 0;
                foreach (ListViewItem view in mListOneSelfApp)
                {
                    if (view.Text == item.Name)
                    {
                        listView.Add(view);
                        break;
                    }
                    i++;
                }
                lvOneSelf.Items.Clear();
                lvOneSelf.Items.AddRange(listView.ToArray());
                List <string> strlist = new List <string>()
                {
                    mListOneSelfPath[i]
                };
                //ExecuteCommon execute = new ExecuteCommon();
                ///* 绑定数据 */
                //if (!(bool)execute.doMethod(Key_LogicCore.LoadLvOneSelf.ToString(), new object[] { mImgListOneSelf, XmlCore.listOneSelfPath, XmlCore.listIcon, lvOneSelf })) return;

                lvOneSelf.Tag = strlist;
                //MessageBox.Show(item.Value);
            }
        }
示例#31
0
文件: Poller.cs 项目: xzoth/netmq
        private void RebuildPollset()
        {
            m_pollSize = m_sockets.Count + m_pollinSockets.Count;

            // Recreate the m_pollset and m_pollact arrays.
            m_pollset = new SelectItem[m_pollSize];
            m_pollact = new NetMQSocket[m_sockets.Count];

            // For each socket in m_sockets,
            // put a corresponding SelectItem into the m_pollset array and a reference to the socket itself into the m_pollact array.
            uint itemNbr = 0;

            foreach (var socket in m_sockets)
            {
                m_pollset[itemNbr] = new SelectItem(socket.SocketHandle, socket.GetPollEvents());
                m_pollact[itemNbr] = socket;
                itemNbr++;
            }

            foreach (var socket in m_pollinSockets)
            {
                m_pollset[itemNbr] = new SelectItem(socket.Key, PollEvents.PollError | PollEvents.PollIn);
                itemNbr++;
            }

            // Mark this as NOT having any fresh events to attend to, as yet.
            m_isDirty = false;
        }
示例#32
0
        public static AndConstraint <PathSelectItem> ShouldBePathSelectionItem(this SelectItem actual, ODataPath path)
        {
            var andConstraint = actual.ShouldBeSelectedItemOfType <PathSelectItem>();

            andConstraint.And.SelectedPath.Equals(path).Should().BeTrue();
            return(andConstraint);
        }
 public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
 {
     var allColors = Enum.GetValues(typeof(ProductColor));
     ISelectItem[] colorItems = new ISelectItem[allColors.Length-1];
     for (int i = 1; i < allColors.Length; i++)
     {
         var value =
             EPiServer.Framework.Localization.LocalizationService.Current.GetStringByCulture("/common/product/colors/" +
                                                                                             ((ProductColor)i).ToString(), ContentLanguage.PreferredCulture);
         colorItems[i-1] = new SelectItem() { Text = value, Value = value };
     }
     return colorItems;
 }
        // Process $levels in ExpandedNavigationSelectItem.
        private static ExpandedNavigationSelectItem ProcessLevels(
            ExpandedNavigationSelectItem expandItem,
            int levelsMaxLiteralExpansionDepth,
            out bool levelsEncounteredInExpand,
            out bool isMaxLevelInExpand)
        {
            int level;
            isMaxLevelInExpand = false;

            if (expandItem.LevelsOption == null)
            {
                levelsEncounteredInExpand = false;
                level = 1;
            }
            else
            {
                levelsEncounteredInExpand = true;
                if (expandItem.LevelsOption.IsMaxLevel)
                {
                    isMaxLevelInExpand = true;
                    level = levelsMaxLiteralExpansionDepth;
                }
                else
                {
                    level = (int)expandItem.LevelsOption.Level;
                }
            }

            // Do not expand when:
            // 1. $levels is equal to or less than 0.
            // 2. $levels value is greater than current MaxExpansionDepth
            if (level <= 0 || level > levelsMaxLiteralExpansionDepth)
            {
                return null;
            }

            ExpandedNavigationSelectItem item = null;
            SelectExpandClause currentSelectExpandClause = null;
            SelectExpandClause selectExpandClause = null;
            bool levelsEncounteredInInnerExpand = false;
            bool isMaxLevelInInnerExpand = false;

            // Try diffent expansion depth until expandItem.SelectAndExpand is successfully expanded
            while (selectExpandClause == null && level > 0)
            {
                selectExpandClause = ProcessLevels(
                        expandItem.SelectAndExpand,
                        levelsMaxLiteralExpansionDepth - level,
                        out levelsEncounteredInInnerExpand,
                        out isMaxLevelInInnerExpand);
                level--;
            }

            if (selectExpandClause == null)
            {
                return null;
            }

            // Correct level value
            level++;

            while (level > 0)
            {
                if (item == null)
                {
                    currentSelectExpandClause = selectExpandClause;
                }
                else if (selectExpandClause.AllSelected)
                {
                    // Concat the processed items
                    currentSelectExpandClause = new SelectExpandClause(
                        new SelectItem[] { item }.Concat(selectExpandClause.SelectedItems),
                        selectExpandClause.AllSelected);
                }
                else
                {
                    // PathSelectItem is needed for the expanded item if AllSelected is false. 
                    PathSelectItem pathSelectItem = new PathSelectItem(
                        new ODataSelectPath(expandItem.PathToNavigationProperty));

                    // Keep default SelectItems before expanded item to keep consistent with normal SelectExpandClause 
                    SelectItem[] items = new SelectItem[] { item, pathSelectItem };
                    currentSelectExpandClause = new SelectExpandClause(
                        new SelectItem[] { }.Concat(selectExpandClause.SelectedItems).Concat(items),
                        selectExpandClause.AllSelected);
                }

                // Construct a new ExpandedNavigationSelectItem with current SelectExpandClause.
                item = new ExpandedNavigationSelectItem(
                    expandItem.PathToNavigationProperty,
                    expandItem.NavigationSource,
                    currentSelectExpandClause);

                level--;

                // Need expand and construct selectExpandClause every time if it is max level in inner expand
                if (isMaxLevelInInnerExpand) 
                {
                    selectExpandClause = ProcessLevels(
                        expandItem.SelectAndExpand,
                        levelsMaxLiteralExpansionDepth - level,
                        out levelsEncounteredInInnerExpand,
                        out isMaxLevelInInnerExpand);
                }
            }

            levelsEncounteredInExpand = levelsEncounteredInExpand || levelsEncounteredInInnerExpand;
            isMaxLevelInExpand = isMaxLevelInExpand || isMaxLevelInInnerExpand;

            return item;
        }
示例#35
0
 /// <summary>
 /// is this selection item a structural selection item.
 /// </summary>
 /// <param name="selectItem">the selection item to check</param>
 /// <returns>true if this selection item is a structural property selection item.</returns>
 private static bool IsStructuralSelectionItem(SelectItem selectItem)
 {
     PathSelectItem pathSelectItem = selectItem as PathSelectItem;
     return pathSelectItem != null && (pathSelectItem.SelectedPath.LastSegment is PropertySegment);
 }
        // Process $levels in ExpandedNavigationSelectItem.
        private ExpandedNavigationSelectItem ProcessLevels(
            ExpandedNavigationSelectItem expandItem,
            int levelsMaxLiteralExpansionDepth,
            out bool levelsEncounteredInExpand,
            out bool isMaxLevelInExpand)
        {
            int level;
            isMaxLevelInExpand = false;

            // $level=x
            if (expandItem.LevelsOption != null && !expandItem.LevelsOption.IsMaxLevel)
            {
                levelsEncounteredInExpand = true;
                level = (int)expandItem.LevelsOption.Level;
                if (LevelsMaxLiteralExpansionDepth < 0)
                {
                    levelsMaxLiteralExpansionDepth = level;
                }
            }
            else
            {
                if (levelsMaxLiteralExpansionDepth < 0)
                {
                    levelsMaxLiteralExpansionDepth = ODataValidationSettings.DefaultMaxExpansionDepth;
                }

                if (expandItem.LevelsOption == null)
                {
                    // no $level
                    levelsEncounteredInExpand = false;
                    level = 1;
                }
                else
                {
                    // $level=max
                    levelsEncounteredInExpand = true;
                    isMaxLevelInExpand = true;
                    level = levelsMaxLiteralExpansionDepth;
                }
            }

            // Do not expand when:
            // 1. $levels is equal to or less than 0.
            // 2. $levels value is greater than current MaxExpansionDepth
            if (level <= 0 || level > levelsMaxLiteralExpansionDepth)
            {
                return null;
            }

            ExpandedNavigationSelectItem item = null;
            SelectExpandClause currentSelectExpandClause = null;
            SelectExpandClause selectExpandClause = null;
            bool levelsEncounteredInInnerExpand = false;
            bool isMaxLevelInInnerExpand = false;

            // Try diffent expansion depth until expandItem.SelectAndExpand is successfully expanded
            while (selectExpandClause == null && level > 0)
            {
                selectExpandClause = ProcessLevels(
                        expandItem.SelectAndExpand,
                        levelsMaxLiteralExpansionDepth - level,
                        out levelsEncounteredInInnerExpand,
                        out isMaxLevelInInnerExpand);
                level--;
            }

            if (selectExpandClause == null)
            {
                return null;
            }

            // Correct level value
            level++;

            var entityType = expandItem.NavigationSource.EntityType();
            string alreadyExpandedNavigationSourceName =
                (expandItem.PathToNavigationProperty.LastSegment as NavigationPropertySegment).NavigationProperty.Name;
            IEnumerable<SelectItem> autoExpandNavigationSelectItems = GetAutoExpandedNavigationSelectItems(
                entityType,
                Context.Model,
                alreadyExpandedNavigationSourceName, 
                expandItem.NavigationSource, 
                selectExpandClause.AllSelected);
            bool hasAutoExpandInExpand = (autoExpandNavigationSelectItems.Count() != 0);

            while (level > 0)
            {
                if (item == null)
                {
                    if (hasAutoExpandInExpand)
                    {
                        currentSelectExpandClause = new SelectExpandClause(
                            new SelectItem[] { }.Concat(selectExpandClause.SelectedItems)
                                .Concat(autoExpandNavigationSelectItems),
                            selectExpandClause.AllSelected);
                    }
                    else
                    {
                        currentSelectExpandClause = selectExpandClause;
                    }
                }
                else if (selectExpandClause.AllSelected)
                {
                    // Concat the processed items
                    currentSelectExpandClause = new SelectExpandClause(
                        new SelectItem[] { item }.Concat(selectExpandClause.SelectedItems)
                            .Concat(autoExpandNavigationSelectItems),
                        selectExpandClause.AllSelected);
                }
                else
                {
                    // PathSelectItem is needed for the expanded item if AllSelected is false. 
                    PathSelectItem pathSelectItem = new PathSelectItem(
                        new ODataSelectPath(expandItem.PathToNavigationProperty));

                    // Keep default SelectItems before expanded item to keep consistent with normal SelectExpandClause 
                    SelectItem[] items = new SelectItem[] { item, pathSelectItem };
                    currentSelectExpandClause = new SelectExpandClause(
                        new SelectItem[] { }.Concat(selectExpandClause.SelectedItems)
                            .Concat(items)
                            .Concat(autoExpandNavigationSelectItems),
                        selectExpandClause.AllSelected);
                }

                // Construct a new ExpandedNavigationSelectItem with current SelectExpandClause.
                item = new ExpandedNavigationSelectItem(
                    expandItem.PathToNavigationProperty,
                    expandItem.NavigationSource,
                    currentSelectExpandClause);

                level--;

                // Need expand and construct selectExpandClause every time if it is max level in inner expand
                if (isMaxLevelInInnerExpand) 
                {
                    selectExpandClause = ProcessLevels(
                        expandItem.SelectAndExpand,
                        levelsMaxLiteralExpansionDepth - level,
                        out levelsEncounteredInInnerExpand,
                        out isMaxLevelInInnerExpand);
                }
            }

            levelsEncounteredInExpand = levelsEncounteredInExpand || levelsEncounteredInInnerExpand || hasAutoExpandInExpand;
            isMaxLevelInExpand = isMaxLevelInExpand || isMaxLevelInInnerExpand;

            return item;
        }
示例#37
0
		public void Visit(SelectItem item)
		{
			if (item.ColumnAlias != String.Empty)
				_Query.AppendFormat("AS {0} ", item.ColumnAlias);
		}
 private object TagList(IEnumerable<TermCount> tags)
 {
     List<SelectItem> brands = new List<SelectItem>();
     if (tags.Any())
     {
         int id = 1;
         foreach (var tag in tags)
         {
             SelectItem selectItem = new SelectItem();
             selectItem.id = id;
             selectItem.text = tag.Term;
             brands.Add(selectItem);
             id++;
         }
         return brands;
     }
     return null;
 }
        /// <summary>
        /// Writes Selection Item node to string
        /// </summary>
        /// <param name="node">Node to write to string</param>
        /// <returns>String representation of node.</returns>
        private static string ToString(SelectItem node)
        {
            if (node != null)
            {
                if (node is NamespaceQualifiedWildcardSelectItem)
                {
                    return ToString(node as NamespaceQualifiedWildcardSelectItem);
                }
                else if (node is PathSelectItem)
                {
                    return ToString(node as PathSelectItem);
                }
                else if (node is ExpandedNavigationSelectItem)
                {
                    return ToString(node as ExpandedNavigationSelectItem);
                }
                else if (node is WildcardSelectItem)
                {
                    return ToString(node as WildcardSelectItem);
                }
            }

            throw new NotSupportedException(String.Format("Node kind not yet supported: {0}", node.ToString()));
        }