コード例 #1
0
 private void EquipBamboo()
 {
     equippedBamboo = scannedBamboo;
     scannedBamboo  = null;
     equippedBamboo.Attach(mouth);
     _playerController.speedMultiplier = equippedBamboo.GetSpeedMultiplier();
 }
コード例 #2
0
		/// <summary>
		/// Returns a list with all unnecessary files older
		/// than <see cref="MaxAge"/>.
		/// </summary>
		/// <param name="engine">the prevalence engine</param>
		/// <returns></returns>
		public override System.IO.FileInfo[] SelectFiles(Bamboo.Prevalence.PrevalenceEngine engine)
		{
			FileInfo[] unnecessary = GetUnnecessaryPrevalenceFiles(engine);
			int index = FindFirstFileOlderThanPeriod(unnecessary);
			if (index > 0)
			{
				return GetFileInfoRange(unnecessary, 0, index+1);
			}
			return NullCleanUpPolicy.EmptyFileInfoArray;
		}
コード例 #3
0
ファイル: PlanSample.cs プロジェクト: jameshruby/Bamboo-Sharp
        public PlanSample(Bamboo.Sharp.Api.BambooApi api, string projectKey, string buildKey)
        {
            var planService = api.GetService<PlanService>();

            #region Artifacts
            var artifacts = planService.ArtifactsGet(projectKey, buildKey);
            foreach (var artifact in artifacts.artifacts.All)
            {
                Console.WriteLine();
                Console.WriteLine("Artifact Name: {0}", artifact.name);
                Console.WriteLine("Artifact Id: {0}", artifact.id);
                Console.WriteLine("Artifact Location: {0}", artifact.location);
                Console.WriteLine("Artifact Shared: {0}", artifact.shared);
                Console.WriteLine("Artifact CopyPattern: {0}", artifact.copyPattern);
            }

            #endregion

            #region Favourites
            var planExpanded = planService.GetPlanSimple(projectKey, buildKey);
            if (planExpanded.IsFavourite)
                planService.FavouritesRemove(projectKey, buildKey);
            else
                planService.FavouritesAdd(projectKey, buildKey);
            #endregion

            #region Branches
            var branchName = "ILoveTheMonkeyHead";
            var newBranch = planService.BranchSet(projectKey, buildKey, branchName);
            var selectedBranches = planService.BranchGet(projectKey, buildKey, branchName);

            Console.WriteLine("Branch Name: {0}", selectedBranches.Name);
            Console.WriteLine("Branch ShortKey: {0}", selectedBranches.ShortKey);
            Console.WriteLine("Branch ShortName: {0}", selectedBranches.ShortName);
            Console.WriteLine("Branch Key: {0}", selectedBranches.Key);
            Console.WriteLine("Branch Enabled: {0}", selectedBranches.Enabled);

            #endregion
        }
コード例 #4
0
		/// <summary>
		/// When the expression passed as argument is an instance
		/// of FullTextSearchExpression this method behaves exactly
		/// as <see cref="Search(FullTextSearchExpression)" />, otherwise
		/// it behaves as expression.Evaluate(this).
		/// </summary>		
		/// <param name="expression">search expression</param>
		/// <returns>the result of applying the search against this index</returns>
		public Bamboo.Prevalence.Indexing.SearchResult Search(Bamboo.Prevalence.Indexing.ISearchExpression expression)
		{
			FullTextSearchExpression ftexpression = expression as FullTextSearchExpression;
			if (null != ftexpression)
			{
				return Search(ftexpression);
			}
			return expression.Evaluate(this);
		}
コード例 #5
0
		/// <summary>
		/// See <see cref="Bamboo.Prevalence.Indexing.IIndex.Update"/> for details.
		/// </summary>
		/// <param name="record">existing record that should have its index information updated</param>
		/// <remarks>reference comparison is always used</remarks>
		public void Update(Bamboo.Prevalence.Indexing.IRecord record)
		{
			Remove(record);
			Add(record);
		}
コード例 #6
0
		/// <summary>
		/// See <see cref="Bamboo.Prevalence.Indexing.IIndex.Remove"/> for details.
		/// </summary>
		/// <param name="record">record that should be removed from the index</param>
		/// <remarks>reference comparison is always used</remarks>
		public void Remove(Bamboo.Prevalence.Indexing.IRecord record)
		{
			foreach (Postings postings in _postings.Values)
			{
				postings.Remove(record);
			}
		}
コード例 #7
0
		/// <summary>
		/// See <see cref="Bamboo.Prevalence.Indexing.IIndex.Add"/> for details.
		/// </summary>
		/// <param name="record">record that should be indexed</param>
		/// <remarks>
		/// Indexes all the fields included in the
		/// <see cref="Fields"/> collection. Notice
		/// however that the record is never automatically
		/// reindexed should its fields change or should
		/// the collection of indexed fields (<see cref="Fields"/>)
		/// change.<br />
		/// The application is always responsible for calling
		/// <see cref="Update"/> in such cases.
		/// </remarks>
		public void Add(Bamboo.Prevalence.Indexing.IRecord record)
		{					
			foreach (IndexedField field in _fields)
			{
				IndexByField(record, field);
			}
		}
コード例 #8
0
		protected object ExecuteQuery(Bamboo.Prevalence.IQuery query)
		{
			return _engine.ExecuteQuery(query);
		}
コード例 #9
0
		protected object ExecuteCommand(Bamboo.Prevalence.ICommand command)
		{			
			return _engine.ExecuteCommand(command);
		}
コード例 #10
0
		/// <summary>
		/// Executes a query object against the prevalent system.
		/// </summary>
		/// <param name="query">the query object</param>
		/// <returns>query object return value</returns>
		public object ExecuteQuery(Bamboo.Prevalence.IQuery query)
		{
			Assertion.AssertParameterNotNull("query", query);

			BeforeQuery();

			try
			{				
				return query.Execute(_system);
			}
			finally
			{				
				AfterQuery();
			}
		}
コード例 #11
0
		System.IO.FileInfo[] ICleanUpPolicy.SelectFiles(Bamboo.Prevalence.PrevalenceEngine ignored)
		{
			return EmptyFileInfoArray;
		}
コード例 #12
0
		public ContextRecoveryCommand(Bamboo.Prevalence.ICommand command, System.DateTime dateTime)
		{
			_command = command;
			_dateTime = dateTime;			
		}
コード例 #13
0
		/// <summary>
		/// Delegates to <see cref="Bamboo.Prevalence.Indexing.FullText.FullTextSearchIndex.Search"/>.
		/// </summary>
		/// <param name="index">index</param>
		/// <returns></returns>
		/// <exception cref="ArgumentException">if the
		/// index argument is not of the correct type</exception>
		public Bamboo.Prevalence.Indexing.SearchResult Evaluate(Bamboo.Prevalence.Indexing.IIndex index)
		{
			FullTextSearchIndex ftindex = index as FullTextSearchIndex;
			if (null == ftindex)
			{
				throw new ArgumentException("FullTextSearchExpression objects can be evaluated against FullTextSearchIndex objects only!");
			}
			return ftindex.Search(this);
		}
コード例 #14
0
 private void UnequipBamboo()
 {
     equippedBamboo.Detach(mouth);
     equippedBamboo = null;
     _playerController.ResetSpeedMultiplier();
 }
コード例 #15
0
ファイル: Program.cs プロジェクト: al1s/Zoo
        /// <summary>
        /// Feed all animals
        /// </summary>
        /// <param name="animals">Animals to feed</param>
        public static void FeedAnimals(Animal[] animals)
        {
            int numberOfFoodEntities = 2;

            Plant[] plantFoodBank = new Plant[numberOfFoodEntities];
            for (int i = 0; i < plantFoodBank.Length / 2; i++)
            {
                plantFoodBank[i] = new Banana()
                {
                    Name = "Banana"
                };
            }
            for (int i = numberOfFoodEntities / 2; i < plantFoodBank.Length; i++)
            {
                plantFoodBank[i] = new Bamboo()
                {
                    Name = "Bamboo"
                };
            }

            Animal[] meatFoodBank = new Animal[2];
            int      numberOfFoodForMeatEaters = 0;

            foreach (Animal animal in animals)
            {
                if (animal is Turtle || animal is Monkey)
                {
                    meatFoodBank[numberOfFoodForMeatEaters] = animal;
                    numberOfFoodForMeatEaters += 1;
                }
            }

            Herbivore[] plantsEaters        = new Herbivore[3];
            Carnivore[] meatEaters          = new Carnivore[2];
            int         numberOfPlantEaters = 0;
            int         numberOfMeatEaters  = 0;

            foreach (Animal animal in animals)
            {
                if (animal is Herbivore)
                {
                    plantsEaters[numberOfPlantEaters] = (Herbivore)animal;
                    numberOfPlantEaters += 1;
                }
                else if (animal is Carnivore)
                {
                    meatEaters[numberOfMeatEaters] = (Carnivore)animal;
                    numberOfMeatEaters            += 1;
                }
            }
            foreach (Herbivore animal in plantsEaters)
            {
                foreach (Plant food in plantFoodBank)
                {
                    animal.NameYourself();
                    animal.Eat(food);
                }
            }
            foreach (Carnivore animal in meatEaters)
            {
                foreach (Animal food in meatFoodBank)
                {
                    animal.NameYourself();
                    if (food.FrightLevel < 2)
                    {
                        animal.Scare(food);
                    }
                    animal.Eat(food);
                }
            }
        }