public DiffItemVersionedFile(Item item, VersionSpec versionSpec)
 {
     this.versionControlServer = item.VersionControlServer;
         this.item = item;
         this.versionSpec = versionSpec;
         this.label = item.ServerItem;
 }
示例#2
0
 public DiffFile(string name) {
     Name = name;
     LeftItem = new Item();
     LeftItem.LoadInfo += LoadInfo;
     RightItem = new Item();
     RightItem.LoadInfo += LoadInfo;
 }
示例#3
0
        public void UpdateItem(Item item)
        {
            item.SellIn -= 1;
            item.Quality += item.GetQualityChange();

            item.Quality = Math.Min(ItemConstants.MaximumQuality, item.Quality);
        }
示例#4
0
        public static void Loading_OnLoadingComplete(EventArgs args)
        {
            if (Variables._Player.Hero != Champion.Draven)
            {
                return;
            }

            Q = new Spell.Active(SpellSlot.Q, (uint) Variables._Player.GetAutoAttackRange());
            W = new Spell.Active(SpellSlot.W);
            E = new Spell.Skillshot(SpellSlot.E, 1050, SkillShotType.Linear);
            R = new Spell.Skillshot(SpellSlot.R, 2000, SkillShotType.Linear);

            var slot = Variables._Player.GetSpellSlotFromName("summonerdot");
            if (slot != SpellSlot.Unknown)
            {
                Ignite = new Spell.Targeted(slot, 600);
            }

            Variables.QReticles = new List<Variables.QRecticle>();

            Qss = new Item((int) ItemId.Quicksilver_Sash);
            Mercurial = new Item((int) ItemId.Mercurial_Scimitar);

            Variables.abilitySequence = new[] { 1, 3, 2, 1, 1, 4, 1, 3, 1, 3, 4, 3, 3, 2, 2, 4, 2, 2 };

            EventManager.load();
            MenuManager.Load();
        }
示例#5
0
 protected override void AddSpecialFields(Document document, Item item)
 {
     Assert.ArgumentNotNull(document, "document");
     Assert.ArgumentNotNull(item, "item");
     document.Add(this.CreateTextField(BuiltinFields.Name, item.Name));
     document.Add(this.CreateDataField(BuiltinFields.Name, item.Name));
     this.DetectRemovalFilterAndProcess(document, item, "DisplayName", BuiltinFields.Name, (itm) => item.Appearance.DisplayName);
     this.DetectRemovalFilterValueField(document, item, "Icon", BuiltinFields.Icon, itm => itm.Appearance.Icon);
     this.DetectRemovalFilterAndProcess(document, item, "Creator", BuiltinFields.Creator, itm => itm.Statistics.CreatedBy);
     this.DetectRemovalFilterAndProcess(document, item, "Editor", BuiltinFields.Editor, itm => itm.Statistics.UpdatedBy);
     this.DetectRemovalFilterAndProcess(document, item, "AllTemplates", BuiltinFields.AllTemplates, this.GetAllTemplates);
     this.DetectRemovalFilterAndProcess(document, item, "TemplateName", BuiltinFields.TemplateName, itm => itm.TemplateName);
     if (this.DetectRemoval("Hidden"))
     {
         if (this.IsHidden(item))
         {
             this.DetectRemovalFilterValueField(document, item, "Hidden", BuiltinFields.Hidden, itm => "1");
         }
     }
     this.DetectRemovalFilterValueField(document, item, "Created", BuiltinFields.Created, itm => item[FieldIDs.Created]);
     this.DetectRemovalFilterValueField(document, item, "Updated", BuiltinFields.Updated, itm => item[FieldIDs.Updated]);
     this.DetectRemovalFilterAndProcess(document, item, "Path", BuiltinFields.Path, this.GetItemPath);
     this.DetectRemovalFilterAndProcess(document, item, "Links", BuiltinFields.Links, this.GetItemLinks);
     var tags = this.Tags;
     if (tags.Length > 0)
     {
         document.Add(this.CreateTextField(BuiltinFields.Tags, tags));
         document.Add(this.CreateDataField(BuiltinFields.Tags, tags));
     }
 }
 public int CountItemPathDuplicates(Item item)
 {
     return item.Parent.Children.Where<Item>(delegate(Item x)
     {
         return (x.Name == item.Name);
     }).Count<Item>();
 }
示例#7
0
 public static Batch CreateOrders2()
 {
     var b = new Batch();
     var o = new PurchaseOrder();
     o.CustId = "0815";
     var i = new Item();
     i.ProdId = "1234";
     i.Price = 37;
     i.Quantity = 2;
     o.Item.Add(i);
     i = new Item();
     i.ProdId = "5678";
     i.Price = 1.5;
     i.Quantity = 3;
     o.Item.Add(i);
     b.PurchaseOrder.Add(o);
     o = new PurchaseOrder();
     o.CustId = "1324";
     i = new Item();
     i.ProdId = "7788";
     i.Price = 42;
     i.Quantity = 1;
     b.PurchaseOrder.Add(o);
     return b;
 }
        public FeedDetailsViewModel()
        {
            RootChannel = new Channel();
            RootChannel.Title = "Titre du channel";
            RootChannel.Description =   "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet eleifend ante." +
                                        "In vel mauris metus, ac viverra lectus. Aenean dui sapien, pretium eu gravida ut, sollicitudin" +
                                        "et nisi. In hac habitasse platea dictumst. Quisque egestas ligula in lorem sodales sed" +
                                        " congue turpis varius. Maecenas vel quam at tortor viverra tristique vitae at lorem. Maecenas" +
                                        " augue augue, convallis tristique congue ut, porta sed felis. Nam nisi libero, vehicula" +
                                        " ac ultricies quis, imperdiet lobortis tellus.";
            RootChannel.Link = "http://www.google.com";

            Items = new List<Item>();
            for (int i = 0; i < 20; ++i)
            {
                Item item = new Item();
                item.Title = "Titre de l'item " + i.ToString();
                item.Description =  "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet eleifend ante." +
                                    "In vel mauris metus, ac viverra lectus. Aenean dui sapien, pretium eu gravida ut, sollicitudin" +
                                    "et nisi. In hac habitasse platea dictumst. Quisque egestas ligula in lorem sodales sed" +
                                    " congue turpis varius. Maecenas vel quam at tortor viverra tristique vitae at lorem. Maecenas" +
                                    " augue augue, convallis tristique congue ut, porta sed felis. Nam nisi libero, vehicula" +
                                    " ac ultricies quis, imperdiet lobortis tellus.";
                item.PubDate = DateTime.Now;
                Items.Add(item);

            }

            ReadItem = new RelayCommand((param) => ReadItemBody(param as Item));
            //feedDetailsDataModel = new FeedDetailsDataModel();
        }
 public override IEnumerable<Item> GetMatchingChildItem(BaseDataMap map, Item listParent, string importValue)
 {
     IEnumerable<Item> t = (from Item c in listParent.GetChildren()
                            where c[MatchOnFieldName].ToLower().Equals(importValue.ToLower())
                            select c).ToList();
     return t;
 }
 public ConstantAttribute(Item owner, int attributeID, string attributeName, double value)
 {
     Owner = owner;
     AttributeID = attributeID;
     AttributeName = attributeName;
     Value = value;
 }
        public override string ResolveValue(Item item)
        {
            var result = new StringBuilder();

            // Get all renderings
            foreach (var reference in item.Visualization.GetRenderings(Sitecore.Data.Items.DeviceItem.ResolveDevice(item.Database), false))
            {
                // Get the source item
                if (reference.RenderingItem != null && !string.IsNullOrEmpty(reference.Settings.DataSource))
                {
                    var source = item.Database.GetItem(reference.Settings.DataSource);
                    if (source != null)
                    {
                        // Go through all fields
                        foreach (Field field in source.Fields)
                        {
                            result.Append(GetFieldValue(field));
                            result.Append(" ");
                        }
                    }
                }
            }

            return result.ToString();
        }
 private Item[] CreateBasicUnsortedList()
 {
     var b = new Item("B", new Item("A", null));
     var d = new Item("E", new Item("C", new Item("D", null)));
     var f = new Item("F", new Item("A"));
     return new[] { b, d, f };
 }
示例#13
0
        public bool IsMatch()
        {
            if (conditionFunc == null)
            {
                conditionFunc = ScriptManager.GetCondition(Condition);
            }

            if (BaitItem == null)
            {
                if (Id > 0)
                {
                    BaitItem = DataManager.ItemCache[Id];
                }
                else if (!string.IsNullOrWhiteSpace(Name))
                {
                    BaitItem =
                        DataManager.ItemCache.Values.Find(
                            i => string.Equals(i.EnglishName, Name, StringComparison.InvariantCultureIgnoreCase)
                                || string.Equals(i.CurrentLocaleName, Name, StringComparison.InvariantCultureIgnoreCase));
                }
            }

            if (BaitItem == null || BaitItem.ItemCount() == 0)
            {
                return false;
            }

            return conditionFunc();
        }
示例#14
0
        public DiffItemVersionedFile(VersionControlServer versionControl,
																 int itemId, int changeset, string displayPath)
        {
            this.versionControlServer = versionControl;
                this.item = versionControl.GetItem(itemId, changeset);
                this.label = displayPath;
        }
        protected override void Init(MyObjectBuilder_DefinitionBase ob)
        {
            base.Init(ob);

            MyObjectBuilder_BlueprintDefinition builder = (MyObjectBuilder_BlueprintDefinition)ob;

            Prerequisites = new Item[builder.Prerequisites.Length];
            for (int i = 0; i < Prerequisites.Length; ++i)
            {
                Prerequisites[i] = Item.FromObjectBuilder(builder.Prerequisites[i]);
            }
            if (builder.Result != null)
            {
                Results = new Item[1];
                Results[0] = Item.FromObjectBuilder(builder.Result);
            }
            else
            {
                Results = new Item[builder.Results.Length];
                for (int i = 0; i < Results.Length; ++i)
                {
                    Results[i] = Item.FromObjectBuilder(builder.Results[i]);
                }
            }
            BaseProductionTimeInSeconds = builder.BaseProductionTimeInSeconds;
            PostprocessNeeded = true;
            ProgressBarSoundCue = builder.ProgressBarSoundCue;
        }
示例#16
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Debug.Logger = this;
            //bool useNamespace = false;
            env = new CSLE.CLS_Environment(this);//如果要启用命名空间,第二个参数要打开
            TestReg.Reg(env);
         
            //查找所有脚本文件
            string[] dirs = System.IO.Directory.GetDirectories("script");

            foreach (var d in dirs)
            {
                try
                {
                    Item i = new Item();
                    i.path = d;
                    i.test = System.IO.File.ReadAllText(d + "/test.txt");

                    listItem.Items.Add(i);
                }
                catch (Exception err)
                {

                }
            }


        }
示例#17
0
 static PermaActive()
 {
     HealthPotion = new Item(2003, 0);
     TotalBiscuit = new Item(2010, 0);
     CorruptingPotion = new Item(2033, 0);
     RefillablePotion = new Item(2031, 0);
 }
示例#18
0
 public bool build(Item item)
 {
     StringTheory theory = new StringTheory();
     StringTheory theory2 = new StringTheory();
     Field field = null;
     Hashtable hashtable = item.getBoxView();
     ArrayList coll = new ArrayList();
     ArrayList list2 = new ArrayList();
     foreach (string str in hashtable.Keys)
     {
         field = (Field)hashtable[str];
         if ((field != null) && field.Touched())
         {
             coll.Add(str);
             list2.Add(field.toSql());
         }
     }
     theory.Join(coll, ", ");
     theory2.Join(list2, ", ");
     if (coll.Count > 0)
     {
         StringTheory val = new StringTheory("INSERT INTO %tableName% (%fields%) VALUES (%values%)");
         val.Replace("%tableName%", item.getStreamName());
         val.Replace("%fields%", theory);
         val.Replace("%values%", theory2);
         base.Append(val);
     }
     return false;
 }
      public static string GetWorkflowStateName(Item item)
      {
         Assert.ArgumentNotNull(item, "item");

         if (!TemplateManager.IsFieldPartOfTemplate(FieldIDs.Workflow, item))
         {
            return String.Empty;
         }

         var workflowProvider = item.Database.WorkflowProvider;
         if ((workflowProvider == null) || (workflowProvider.GetWorkflows().Length <= 0))
         {
            return String.Empty;
         }

         var workflow = workflowProvider.GetWorkflow(item);
         if (workflow == null)
         {
            return String.Empty;
         }

         var state = workflow.GetState(item);
         if (state != null)
         {
            return state.DisplayName;
         }

         return String.Empty;
      }
        /// <summary>
        /// Composes and sends an email according to user-defined preferences.
        /// </summary>
        /// <param name="report">Report to append to email body.</param>
        /// <param name="item">Item to send information on.</param>
        /// <param name="sendTo">Receiver's email address.</param>
        public static void SendEmail(string report, Item item, string sendTo)
        {
            MailMessage message = ComposeEmail(report, item, sendTo);

            if (message == null)
            {
                Log.Info("Scheduled Publish: No receiver for publishing email. " + DateTime.Now, new object());
                return;
            }

            if (NotificationEmailSettings.UseWebConfig)
            {
                try
                {
                    MainUtil.SendMail(message);
                }
                catch (Exception ex)
                {
                    Log.Error(string.Format("{0} {1}", "Scheduled Publish: Sending publish email through web.config settings failed.", ex), message);
                }
            }
            else
            {
                SendMailMessage(message);
            }
        }
		private object ConvertIdentifier(
			object value,
			Item item,
			Direction direction,
			Guid providerId,
			string itemType)
		{
			if (value != null && !string.IsNullOrWhiteSpace(value.ToString()))
			{
				if (direction == Direction.Packaging)
				{
					var guid = Dependencies.ConvertIdentifier(value.ToString(), IdentifierReplaceDirection.FromNodeIdToGuid);

					// add dependency for the item
					var name = string.Concat(itemType, " from picker");
					var dependency = new Dependency(name, guid, providerId);
					item.Dependencies.Add(dependency);

					return guid;
				}
				else if (direction == Direction.Extracting)
				{
					return Dependencies.ConvertIdentifier(value.ToString(), IdentifierReplaceDirection.FromGuidToNodeId);
				}
			}

			return value;
		}
        public override Warning EvaluateEditorWarning(Item item)
        {
            bool transparentSync = item.Statistics.UpdatedBy == UnicornDataProvider.TransparentSyncUpdatedByValue;
            string title = transparentSync ? "This item is included by Unicorn Transparent Sync" : "This item is controlled by Unicorn";

            string message = "You should not change this item because your changes will be overwritten by the next code deployment. Ask a developer for help if you need to change this item.";

            if (Settings.GetBoolSetting("Unicorn.DevMode", true))
            {
                message = "Changes to this item will be written to disk as part of the '{0}' configuration so they can be shared with others.".FormatWith(_parentConfiguration.Name);
            }

            if (transparentSync)
            {
                using (new TransparentSyncDisabler())
                {
                    using (new DatabaseCacheDisabler())
                    {
                        var dbItem = Database.GetItem(item.Uri);
                        if (dbItem != null) message += " Item exists in the Sitecore database as well as Transparent Sync.";
                        else
                            message += " Item does not exist in the Sitecore database.";
                    }
                }
            }

            return new Warning(title, message);
        }
示例#23
0
文件: IO.cs 项目: jayvin/Courier
        public static string ItemFilePath(Item item, string providerDirectory, string revisionAlias)
        {
            string root = RevisionsFolder(revisionAlias);

            var courierFileName = Umbraco.Courier.Core.Helpers.IO.SanitizeFileName(item.CourierFileName);
            return Path.Combine(root, providerDirectory, courierFileName + "." + Core.Settings.fileExt);
        }
        private static List<Item> GetItemsRecursively(Item item, int attributeId)
        {
            var itemStack = new Stack<Item>();
            itemStack.Push(item);

            var selectedItems = new List<Item>();

            while (itemStack.Any())
            {
                var curItem = itemStack.Pop();
                if (curItem is Skill)
                {
                    continue; //TODO das ist haesslich evtl. anders loesen
                }
                foreach (var subItem in curItem.InstalledItems)
                {
                    if (subItem is Skill)
                    {
                        continue;
                    }
                    //TODO index attributes by id -> faster lookup
                    foreach (var curSkillRequirementId  in SKILL_REQUIREMENT_ATTRIBUTE_IDS)
                    {
                        IAttribute attribute;
                        if (subItem.TryGetAttributeById(curSkillRequirementId, out attribute) && (int) attribute.Value == attributeId)
                        {
                            selectedItems.Add(subItem);
                            break;
                        }
                    }
                    itemStack.Push(subItem);
                }
            }
            return selectedItems;
        }
示例#25
0
        public void SetUp()
        {
            Location location = new Location (null, new Point (5, 5));

            actor = new MockActor (location);
            item = new MockItem (location);
        }
示例#26
0
		public override int GetTextLength (Item item)
		{
			//
			// There are about 22 chars (eg https://t.co/UoGgfjFd) per attachment
			//
			return item.Text.Length + 22*(item.Links.Count + item.Images.Count + item.Files.Count);
		}
        /// <summary>
        /// Updates the sell in and quality of the specified item.
        /// </summary>
        /// <param name="item">The item to update.</param>
        public void UpdateItem(Item item)
        {
            item.SellIn--;

            // "Backstage passes", like aged brie, increases in Quality as it's SellIn value approaches
            if (item.SellIn > 10)
            {
                item.Quality++;
            }

            // Quality increases by 2 when there are 10 days or less..
            if (item.SellIn <= 10)
            {
                item.Quality += 2;
            }

            // .. and by 3 when there are 5 days or less
            if (item.SellIn <= 5)
            {
                item.Quality++;
            }

            // .. but Quality drops to 0 after the concert
            if (item.SellIn < 0)
            {
                item.Quality = 0;
            }
        }
        public async void WhenItemIsPostedResponseShouldBe201AndLocationHeaderShouldBeSet()
        {
            var item = new Item
            {
                Id = 1,
                Name = "Filip"
            };
            var service = new Mock<IItemService>().Object;
            var controller = new ItemsController(service)
            {
                Configuration = new HttpConfiguration(),
                Request = new HttpRequestMessage
                {
                    Method = HttpMethod.Post,
                    RequestUri = new Uri("http://localhost/items")
                }
            };
            controller.Configuration.MapHttpAttributeRoutes();
            controller.Configuration.EnsureInitialized();
            controller.RequestContext.RouteData = new HttpRouteData(
                new HttpRoute(), new HttpRouteValueDictionary { { "controller", "Items" } });

            var result = await controller.Post(item);

            Assert.Equal(HttpStatusCode.Created, result.StatusCode);
            Assert.Equal("http://localhost/items/1", result.Headers.Location.AbsoluteUri);
        }
示例#29
0
        public static bool IsInRange(Player p, Item i, int range, out int distance)
        {
            int fromX = (int)(p.X * 32.0);
            int fromZ = (int)(p.Z * 32.0);

            return IsInRange(fromX, fromZ, i.X, i.Z, range, out distance);
        }
示例#30
0
        public void CopyFields(Item sourceItem, Item targetItem, bool itemWasCreated)
        {
            try
            {
                if (sourceItem.Versions.Count > 0)
                {
                    if (targetItem.Versions.Count == 0 || IfExist == ActionIfExists.Append)
                    {
                        targetItem = targetItem.Versions.AddVersion();
                    }

                    if (!DoNotCopyFields)
                    {
                        targetItem.Editing.BeginEdit();
                        sourceItem.Fields.ReadAll();
                        foreach (Field field in sourceItem.Fields)
                        {
                            if (ShouldProcessField(field, itemWasCreated))
                            {
                                targetItem.Fields[field.Name].SetValue(field.Value, true);
                            }
                        }
                        targetItem.Editing.EndEdit();
                        targetItem.Editing.AcceptChanges();
                    }
                    WriteItem(targetItem);
                }
            }
            catch (Exception exception)
            {
                targetItem.Editing.CancelEdit();
                WriteError(new ErrorRecord(exception, "sitecore_item_translation_field_copy_error",
                    ErrorCategory.NotSpecified, null));
            }
        }