Inheritance: MonoBehaviour
コード例 #1
0
    private IEnumerator ClearBucket(Bucket bucket)
    {
        // Get all keys in the given bucket.
        var getKeysRequest = bucket.GetKeys();
        yield return getKeysRequest.WaitUntilDone();
        if (getKeysRequest.hasFailed)
        {
            Debug.LogError("Unable to clear " + bucket + ". " + getKeysRequest.GetErrorString());
            yield break;
        }

        // Remove each one of the keys. Issue the requests all at once.
        var removeRequests = new List<RemoveRequest>();
        foreach (var key in getKeysRequest.GetKeyEnumerable())
        {
            removeRequests.Add(bucket.Remove(key));
        }

        // Then wait for each request to finish.
        foreach (var removeRequest in removeRequests)
        {
            yield return removeRequest.WaitUntilDone();
            if (removeRequest.hasFailed)
                Debug.LogError("Unable to remove '" + removeRequest.key + "' from " + removeRequest.bucket + ". " +
                               removeRequest.GetErrorString());
        }

        // Finally refresh the list.
        StartCoroutine(RefreshList());
    }
コード例 #2
0
ファイル: GenericQueue.cs プロジェクト: takayuki/Erlang.NET
        /**
         * Add an object to the tail of the queue.
         * 
         * @param o
         *                Object to insert in the queue
         */
        public void put(Object o)
        {
            Monitor.Enter(this);
            try
            {
                Bucket b = new Bucket(o);

                if (tail != null)
                {
                    tail.setNext(b);
                    tail = b;
                }
                else
                {
                    // queue was empty but has one element now
                    head = tail = b;
                }
                count++;

                // notify any waiting tasks
                Monitor.Pulse(this);
            }
            finally
            {
                Monitor.Exit(this);
            }
        }
コード例 #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="buffer">A <see cref="Bucket"/> object.</param>
        public BucketStream(Bucket buffer)
        {
            if (buffer == null)
                throw new ArgumentNullException("buffer");

            _targetBuffer = buffer;
        }
コード例 #4
0
ファイル: BooleanScorer.cs プロジェクト: carrie901/mono
			public override void  Collect(int doc)
			{
				BucketTable table = bucketTable;
				int i = doc & Mono.Lucene.Net.Search.BooleanScorer.BucketTable.MASK;
				Bucket bucket = table.buckets[i];
				if (bucket == null)
					table.buckets[i] = bucket = new Bucket();
				
				if (bucket.doc != doc)
				{
					// invalid bucket
					bucket.doc = doc; // set doc
					bucket.score = scorer.Score(); // initialize score
					bucket.bits = mask; // initialize mask
					bucket.coord = 1; // initialize coord
					
					bucket.next = table.first; // push onto valid list
					table.first = bucket;
				}
				else
				{
					// valid bucket
					bucket.score += scorer.Score(); // increment score
					bucket.bits |= mask; // add bits in mask
					bucket.coord++; // increment coord
				}
			}
コード例 #5
0
 public static void DifferentPathsNoRevisions(Bucket bucket)
 {
     bucket.Upload("/monkey.mp4", TestBytes.NoChunks);
     bucket.Upload("/animals/dog.mp4", TestBytes.NoChunks);
     bucket.Upload("/animals/cat.mp4", TestBytes.NoChunks);
     bucket.Upload("/animals/fish.mp4", TestBytes.NoChunks);
     bucket.Upload("/people/father.mp4", TestBytes.NoChunks);
     bucket.Upload("/people/mother.mp4", TestBytes.NoChunks);
 }
コード例 #6
0
        public void Init()
        {
            bucket = Bucket.Instance;

            bucket.Register<XmlModelBinder>(() => new XmlModelBinder());
            bucket.Register<XmlSerializer>(() => new XmlSerializer());
            bucket.Register<JsonModelBinder>(() => new JsonModelBinder());
            bucket.Register<JsonSerializer>(() => new JsonSerializer());
            bucket.Register<StringSerializer>(() => new StringSerializer());
        }
コード例 #7
0
    // Use this for initialization
    void Start()
    {
        transform = GetComponent<Transform>();
        bucketScript = GetComponentInChildren<Bucket>();
        prenableScript = GetComponent<PrenableObject>();
        size = transform.localScale.y;
        gravityEmpty = new Vector3(0, -3.0F * size, 0);
        gravityFull  = new Vector3(0, -6.2F * size, 0);

        Debug.Log(name + "--> " + prenableScript.m_Gravity);
    }
コード例 #8
0
 private void UpdateGamingConsoleHashWithBucketValues(Bucket<Game> gameBucket, int dataIndex)
 {
     gameBucket
         .Values
         .ToList()
         .ForEach(game =>
         {
             var gamingConsoleData = gamingConsoleHash[game.ConsoleName];
             gamingConsoleData[dataIndex]++;
         });
 }
コード例 #9
0
ファイル: TimerTest.cs プロジェクト: radiohaktive/mono
		public void TestZeroDueTime ()
		{
			Bucket bucket = new Bucket();

			Timer t = new Timer (new TimerCallback (Callback), bucket, 0, Timeout.Infinite);
			Thread.Sleep (100);
			Assert.AreEqual (1, bucket.count, "#1");
			t.Change (0, Timeout.Infinite);
			Thread.Sleep (100);
			Assert.AreEqual (2, bucket.count, "#2");
			t.Dispose ();
		}
コード例 #10
0
		public void TestChange ()
		{
			Bucket bucket = new Bucket();
			Timer t = new Timer (new TimerCallback (Callback), bucket, 1, 1);
			Thread.Sleep (500);
			int c = bucket.count;
			Assert.IsTrue(c > 20, "#1");
			t.Change (100, 100);
			Thread.Sleep (500);
			Assert.IsTrue(bucket.count <= c + 20, "#2");
			t.Dispose ();
		}
コード例 #11
0
ファイル: TimerTest.cs プロジェクト: ItsVeryWindy/mono
		public void TestZeroDueTime ()
		{
			Bucket bucket = new Bucket();

			using (Timer t = new Timer (o => Callback (o), bucket, 0, Timeout.Infinite)) {
				Thread.Sleep (100);
				Assert.AreEqual (1, bucket.count, "#1");
				t.Change (0, Timeout.Infinite);
				Thread.Sleep (100);
				Assert.AreEqual (2, bucket.count, "#2");
			}
		}
コード例 #12
0
        static CollisionHashMap()
        {
            int divisionSizeX = MomolikeGame.SCREEN_WIDTH / BUCKETS_PER_ROW;
            int divisionSizeY = MomolikeGame.SCREEN_HEIGHT / BUCKETS_PER_COLUMN;

            // Initialize partition coordinates
            for (int x = 0; x < BUCKETS_PER_ROW; x++)
                for (int y = 0; y < BUCKETS_PER_COLUMN; y++)
                {
                    BUCKETS[x, y] = new Bucket();
                    BUCKETS[x, y].BucketArea = new Rectangle(x * divisionSizeX, y * divisionSizeY, divisionSizeX, divisionSizeY);
                }
        }
コード例 #13
0
        public void issue_28_should_be_able_to_download_on_windows_preview()
        {
            Bucket bucket = new Bucket(conn, "query", "file");
            bucket.Purge();
            bucket.Mount();

            var uploadId = bucket.Upload("MyNameIsBob.jpg", TestBytes.TwoMB);
            uploadId.Dump();

            byte[] bytes = bucket.DownloadAsBytes(uploadId, new DownloadOptions());

            bytes.Should().Equal(TestBytes.TwoMB);
        }
コード例 #14
0
 public void SetUp()
 {
     consoleNames = new[] { "Console1", "Console2", "Console3", "Console4" };
     games = consoleNames.Take(3).Select(consoleName => new Game { ConsoleName = consoleName });
     gameBuckets = new[]
                       {
                           new Bucket<Game> {Label = "9-11", Values = games},
                           new Bucket<Game> {Label = "11-13", Values = games},
                           new Bucket<Game> {Label = "13-15", Values = games.Take(2)},
                           new Bucket<Game> {Label = "15-17", Values = new[] { new Game{ConsoleName = consoleNames.Last()}}}
                       };
     trendChartEngine = new TrendChartEngine();
 }
コード例 #15
0
        private static Bucket[] CreateWheel(int ticksPerWheel, ILoggingAdapter log)
        {
            if (ticksPerWheel <= 0)
                throw new ArgumentOutOfRangeException(nameof(ticksPerWheel), ticksPerWheel, "Must be greater than 0.");
            if (ticksPerWheel > 1073741824)
                throw new ArgumentOutOfRangeException(nameof(ticksPerWheel), ticksPerWheel, "Cannot be greater than 2^30.");

            ticksPerWheel = NormalizeTicksPerWheel(ticksPerWheel);
            var wheel = new Bucket[ticksPerWheel];
            for (var i = 0; i < wheel.Length; i++)
                wheel[i] = new Bucket(log);
            return wheel;
        }
コード例 #16
0
        /// <param name="min">minimum delta presence threshold</param>
        /// <param name="max">maximum delta presence threshold</param>
        /// <param name="bucket">the bucket that to be examined</param>
        /// <param name="qid">QI indecies</param>
        /// <returns>Returns true, if the bucket is delta present, false otherwise.</returns>
        public bool IsDeltaPresent(double min, double max, Bucket bucket, int[] qid)
        {
            CreateAB(bucket, qid);
            double[] probabilities = Probability(A, B);

            for (int k = 0; k < probabilities.Count(); k++)
            {
                double curValue = probabilities[k];
                if (curValue < min || curValue > max)
                    return false;
            }
            return true;
        }
コード例 #17
0
ファイル: TimerTest.cs プロジェクト: ItsVeryWindy/mono
		public void TestChange ()
		{
			Bucket bucket = new Bucket();

			using (Timer t = new Timer (o => Callback (o), bucket, 10, 10)) {
				Thread.Sleep (500);
				int c = bucket.count;
				Assert.IsTrue (c > 20, "#1 " + c.ToString ());
				t.Change (100, 100);
				c = bucket.count;
				Thread.Sleep (500);
				Assert.IsTrue (bucket.count <= c + 20, "#2 " + c.ToString ());
			}
		}
コード例 #18
0
ファイル: TimerTest.cs プロジェクト: radiohaktive/mono
		public void TestDueTime ()
		{
			Bucket bucket = new Bucket();
			Timer t = new Timer (new TimerCallback (Callback), bucket, 200, Timeout.Infinite);
			Thread.Sleep (50);
			Assert.AreEqual (0, bucket.count, "#1");
			Thread.Sleep (200);
			Assert.AreEqual (1, bucket.count, "#2");
			Thread.Sleep (500);
			Assert.AreEqual (1, bucket.count, "#3");
			t.Change (10, 10);
			Thread.Sleep (1000);
			Assert.IsTrue(bucket.count > 20, "#4");
			t.Dispose ();
		}
コード例 #19
0
ファイル: DatabaseHelper.cs プロジェクト: 2m0nd/CMS
        public static void CreateBucket(string bucketName)
        {
            var cc = GetCouchbaseCluster();

            var cf = DatabaseHelper.GetCouchbaseClientConfiguration();

            Bucket bucket = new Bucket();
            bucket.Name = bucketName;
            bucket.AuthType = AuthTypes.Sasl;
            bucket.BucketType = BucketTypes.Membase;
            bucket.Quota = new Quota() { RAM = DatabaseSettings.Instance.BucketRAM };//RamQuotaMB must be at least 100
            bucket.FlushOption = FlushOptions.Enabled;//支持清空
            bucket.ReplicaNumber = (ReplicaNumbers)DatabaseSettings.Instance.ReplicaNumber;
            bucket.ReplicaIndex = DatabaseSettings.Instance.ReplicaIndex;
            cc.CreateBucket(bucket);
        }
コード例 #20
0
ファイル: Hasher.cs プロジェクト: sdether/Ketchup
        public static Node GetNode(Bucket bucket, string key, HashingAlgortihm hashAlgorithm)
        {
            int hash;
            switch (hashAlgorithm) {
                case HashingAlgortihm.Ketama:
                    hash = KetamaHash(key);
                    break;
                default:
                    hash = DefaultHash(key);
                    break;
            }

            var nodes = config.GetNodes(bucket);
            var idx = Math.Abs(hash % nodes.Count);
            return nodes[idx];
        }
コード例 #21
0
    public void HandleFullBucket(Bucket bucket)
    {
        string layer = colorToLayer[bucket.Color];
        colorToLayer.Remove(bucket.Color);

        buckets.Remove(bucket.Direction);

        Destroy(bucket.gameObject);

        HashSet<Color> usedColors = new HashSet<Color>(colorToLayer.Keys);

        Color[] colors = colorManager.UniqueColors(1, usedColors);
        BuildBucket(colors[0], layer, bucket.Direction);

        tileGroupManager.UpdateTileGroupLayers();
    }
        /*
        * It returns a delta present Bucket with as less generalization as possible.
        */
        public Bucket GeneralizeAndPermute(double min, double max, Bucket bucket, List<int> qid, List<Node> nodeList, List<IHierarchy> hierarchies)
        {
            Node mostgeneralizedNode = bucket.node;

            foreach (var node in nodeList)
            {
                bucket.node = CopyNode(node);
                var generalizedBucket = GeneralizeBucket(bucket, hierarchies);
                DeltaPresence dp5 = new DeltaPresence();
                if (dp5.IsDeltaPresent(min, max, generalizedBucket, qid.ToArray()))
                {
                    generalizedBucket.node = CopyNode(node);
                    return generalizedBucket;
                }
            }
            return null;
        }
コード例 #23
0
        public BucketViewModel(GcsSourceRootViewModel owner, Bucket bucket)
        {
            _owner = owner;
            _bucket = bucket;
            _item = new Lazy<BucketItem>(GetItem);
            _openOnCloudConsoleCommand = new ProtectedCommand(OnOpenConCloudConsoleCommand);

            Caption = _bucket.Name;
            Icon = s_bucketIcon.Value;

            var menuItems = new List<MenuItem>
            {
                new MenuItem { Header = Resources.UiOpenOnCloudConsoleMenuHeader, Command = _openOnCloudConsoleCommand },
                new MenuItem { Header = Resources.UiPropertiesMenuHeader, Command = new ProtectedCommand(OnPropertiesCommand) },
            };
            ContextMenu = new ContextMenu { ItemsSource = menuItems };
        }
コード例 #24
0
        internal RollingNumber(IClock clock, int timeInMs, int numberOfBuckets)
        {
            this.TimeInMs = timeInMs;
            this.clock = clock;
            this.bucketSizeInMs = timeInMs/numberOfBuckets;
            var cx = numberOfBuckets + 1; // + one spare
            buckets = new Bucket[cx];
            this.numberOfBuckets = numberOfBuckets;
            cumulativeSum = new Bucket();

            for (int i = 0; i < cx; i++)
            {
                buckets[i] = new Bucket();
            }

            buckets[0].bucketStartInMs = clock.EllapsedTimeInMs;
        }
コード例 #25
0
        public Bucket ConvertDataTableToBucket(DataTable dt)
        {
            Bucket bucket = new Bucket();

            foreach (DataRow row in dt.Rows)
            {
                var tuple = new data.Tuple();
                tuple.SetQid(qid);
                foreach (DataColumn column in dt.Columns)
                {
                    string value = row[column].ToString().Trim();
                    tuple.AddValue(value);
                }
                bucket.Add(tuple);
            }
            return bucket;
        }
コード例 #26
0
        internal RollingPercentileNumber(IClock clock, int timeInMs, int numberOfBuckets, int dataLength, IDynamicProperty<bool> enabled)
        {
            this.enabled = enabled;
            this.TimeInMs = timeInMs;
            this.clock = clock;
            this.bucketSizeInMs = timeInMs / numberOfBuckets;
            var cx = numberOfBuckets + 1; // + one spare
            buckets = new Bucket[cx];
            this.numberOfBuckets = numberOfBuckets;

            for (int i = 0; i < cx; i++)
            {
                buckets[i] = new Bucket(dataLength);
            }

            buckets[0].bucketStartInMs = clock.EllapsedTimeInMs;
            _percentileSnapshot = new PercentileSnapshot(GetBuckets().Select(b=>new SnapshotItem { Length = b.Length, Data = b.data }).ToArray());
        }
コード例 #27
0
        public void CreatePolygonWithNormals(AABRHalfEdge2 l, List<Vector3D> verts, int count, Bucket bucket)
        {
            if (verts.Count < 3)
                throw new Exception("Too few vertices specified");
            Vector3D v0 = verts[0];
            Vector3D v1 = verts[1];
            Vector3D v2 = verts[2];

            List<Vertex3F> list;
            bucket.ConcentricSegments.TryGetValue(l, out list);
            if (list == null)
            {
                list = new List<Vertex3F>();
                bucket.ConcentricSegments.Add(l, list);
            }
               // List<Vertex3F> lf = new List<Vertex3F>(verts.Count);
            if (count == 3)
            {
                Vector3D normal = Vector3D.PlaneNormal(v0, v1, v2).Unit(); // important for lighting
                verts.ForEach(x => list.Add(new Vertex3F((float)x.X, (float)x.Y, (float)x.Z, (float)normal.X, (float)normal.Y, (float)normal.Z)));
            }
            else if (count == 4)
            {
                Vector3D v3 = verts[3];
                Vector3D n0 = new Vector3D(0, v0.Y, v0.Z).Unit();
                Vector3D n1 = new Vector3D(0, v1.Y, v1.Z).Unit();

                if (EpsilonTests.IsNearlyZeroEpsHigh(v0.X - v2.X))
                {
                    Debug.Assert(EpsilonTests.IsNearlyZeroEpsHigh(v1.X - v3.X));
                    n0 = Vector3D.PlaneNormal(v0, v1, v2).Unit();
                    n1 = n0;
                }
                list.Add(new Vertex3F((float)v0.X, (float)v0.Y, (float)v0.Z, (float)n0.X, (float)n0.Y, (float)n0.Z));
                list.Add(new Vertex3F((float)v1.X, (float)v1.Y, (float)v1.Z, (float)n1.X, (float)n1.Y, (float)n1.Z));
                list.Add(new Vertex3F((float)v2.X, (float)v2.Y, (float)v2.Z, (float)n1.X, (float)n1.Y, (float)n1.Z));

                list.Add(new Vertex3F((float)v0.X, (float)v0.Y, (float)v0.Z, (float)n0.X, (float)n0.Y, (float)n0.Z));
                list.Add(new Vertex3F((float)v2.X, (float)v2.Y, (float)v2.Z, (float)n1.X, (float)n1.Y, (float)n1.Z));
                list.Add(new Vertex3F((float)v3.X, (float)v3.Y, (float)v3.Z, (float)n0.X, (float)n0.Y, (float)n0.Z));
            }
            else
                throw new Exception("The count was " + Environment.NewLine + count);
        }
コード例 #28
0
ファイル: GameMain.cs プロジェクト: h3xx/nodadventure
        private static void englishDemo()
        {
            /* ENGLISH TEST */
            Bucket b = new Bucket(3);
            b.Fill = 5;
            Console.WriteLine("I am holding " + b.LongDesc(true));
            Console.WriteLine("I am holding " + b.ShortDesc(true));
            Console.WriteLine("I am holding " + b.BaseDesc(true));
            Console.WriteLine("emptying the " + b.TerseDesc() + "...");
            b.Fill = 0;
            Console.WriteLine("now I am holding " + b.LongDesc(true));
            Bucket a = new Bucket(8);
            a.Fillup();
            Console.WriteLine("now I am holding " + a.LongDesc(true));
            Console.WriteLine("now I am holding " + a.ShortDesc(true));
            Console.WriteLine("now I am holding " + a.BaseDesc(true));

            Console.WriteLine("looking at it...");
            Console.WriteLine(a.Look());
        }
コード例 #29
0
        public override bool Next()
        {
            bool more;
            do
            {
                while (bucketTable.first != null)
                {
                    // more queued
                    current = bucketTable.first;
                    bucketTable.first = current.next; // pop the queue

                    // check prohibited & required, and minNrShouldMatch
                    if ((current.bits & prohibitedMask) == 0 && (current.bits & requiredMask) == requiredMask && current.coord >= minNrShouldMatch)
                    {
                        return true;
                    }
                }

                // refill the queue
                more = false;
                end += BucketTable.SIZE;
                for (SubScorer sub = scorers; sub != null; sub = sub.next)
                {
                    Scorer scorer = sub.scorer;
                    while (!sub.done && scorer.Doc() < end)
                    {
                        sub.collector.Collect(scorer.Doc(), scorer.Score());
                        sub.done = !scorer.Next();
                    }
                    if (!sub.done)
                    {
                        more = true;
                    }
                }
            }
            while (bucketTable.first != null || more);

            return false;
        }
コード例 #30
0
        public void Add(string directory, string file, FileState value)
        {
            if(_nextValuesIndex >= Values.Length) // Resize
            {
                Resize();
            }

            Values[_nextValuesIndex] = value;
            var bucket = ComputeBucket(file);

            while (true)
            {
                if (Buckets[bucket].IsEmpty)
                {
                    Buckets[bucket] = new Bucket(directory, file, _nextValuesIndex);
                    _count++;
                    _nextValuesIndex++;
                    return;
                }
                bucket = NextCandidateBucket(bucket);
            }
        }
コード例 #31
0
 /// <inheritdoc />
 public override void DeleteBucket(Bucket bucket, DeleteBucketOptions options = null) =>
 DeleteBucketImpl(ValidateBucket(bucket, nameof(bucket)), options);
コード例 #32
0
        /// <summary>
        /// List all labels of a bucket.
        /// </summary>
        /// <param name="bucket">bucket of the labels</param>
        /// <returns>the List all labels of a bucket</returns>
        public async Task <List <Label> > GetLabelsAsync(Bucket bucket)
        {
            Arguments.CheckNotNull(bucket, nameof(bucket));

            return(await GetLabelsAsync(bucket.Id));
        }
コード例 #33
0
 public RefreshBucketTask(DhtEngine engine, Bucket bucket)
 {
     this.engine = engine;
     this.bucket = bucket;
 }
コード例 #34
0
 /// <inheritdoc />
 public override Bucket CreateBucket(string projectId, Bucket bucket, CreateBucketOptions options = null) =>
 CreateCreateBucketRequest(projectId, bucket, options).Execute();
コード例 #35
0
 /// <inheritdoc />
 public override Task <Bucket> CreateBucketAsync(string projectId, Bucket bucket, CreateBucketOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 CreateCreateBucketRequest(projectId, bucket, options).ExecuteAsync(cancellationToken);
コード例 #36
0
 public BucketItem(Bucket bucket) : base(className: Resources.CloudExplorerGcsBucketCategory, componentName: bucket.Name)
 {
     _bucket = bucket;
 }
コード例 #37
0
 /// <inheritdoc />
 public override Task <Bucket> UpdateBucketAsync(
     Bucket bucket,
     UpdateBucketOptions options         = null,
     CancellationToken cancellationToken = default(CancellationToken))
 => CreateUpdateBucketRequest(bucket, options).ExecuteAsync(cancellationToken);
コード例 #38
0
 public void StartAnimationWithBucket(Bucket bucket)
 {
     collectedBucket = bucket;
     collectedBucket.squaresTaking++;
     hasCollected = true;
 }
コード例 #39
0
        public override bool Score(ICollector collector, int max)
        {
            bool       more;
            Bucket     tmp;
            FakeScorer fs = new FakeScorer();

            // The internal loop will set the score and doc before calling collect.
            collector.SetScorer(fs);
            do
            {
                bucketTable.first = null;

                while (current != null) // more queued
                {
                    // check prohibited & required
                    if ((current.Bits & PROHIBITED_MASK) == 0)
                    {
                        // TODO: re-enable this if BQ ever sends us required
                        // clauses
                        //&& (current.bits & requiredMask) == requiredMask) {
                        // NOTE: Lucene always passes max =
                        // Integer.MAX_VALUE today, because we never embed
                        // a BooleanScorer inside another (even though
                        // that should work)... but in theory an outside
                        // app could pass a different max so we must check
                        // it:
                        if (current.Doc >= max)
                        {
                            tmp               = current;
                            current           = current.Next;
                            tmp.Next          = bucketTable.first;
                            bucketTable.first = tmp;
                            continue;
                        }

                        if (current.Coord >= minNrShouldMatch)
                        {
                            fs.score = (float)(current.Score * coordFactors[current.Coord]);
                            fs.doc   = current.Doc;
                            fs.freq  = current.Coord;
                            collector.Collect(current.Doc);
                        }
                    }

                    current = current.Next; // pop the queue
                }

                if (bucketTable.first != null)
                {
                    current           = bucketTable.first;
                    bucketTable.first = current.Next;
                    return(true);
                }

                // refill the queue
                more = false;
                end += BucketTable.SIZE;
                for (SubScorer sub = scorers; sub != null; sub = sub.Next)
                {
                    if (sub.More)
                    {
                        sub.More = sub.Scorer.Score(sub.Collector, end);
                        more    |= sub.More;
                    }
                }
                current = bucketTable.first;
            } while (current != null || more);

            return(false);
        }
コード例 #40
0
ファイル: TakeBucket.cs プロジェクト: AmpScm/AmpScm
 protected override PositionBucket NewPositionBucket(Bucket duplicatedInner)
 {
     return(new TakeBucket(duplicatedInner, Limit, _ensure));
 }
コード例 #41
0
        /// <summary>
        /// List all owners of a bucket.
        /// </summary>
        /// <param name="bucket">bucket of the owners</param>
        /// <returns>the List all owners of a bucket</returns>
        public async Task <List <ResourceOwner> > GetOwnersAsync(Bucket bucket)
        {
            Arguments.CheckNotNull(bucket, nameof(bucket));

            return(await GetOwnersAsync(bucket.Id));
        }
コード例 #42
0
 private float ExtractFloat(Bucket bucket)
 => (from ds in bucket.DataSets
     from p in ds.DataPoints
     from f in p.DataType.Fields
     select p.GetValue(f).AsFloat()).Sum();
コード例 #43
0
 void IStoreSupport.Store(Bucket bucket)
 {
     bucket.Add(Key.TypeInfo, TypeInfo.ExternalDataExpressionNode);
     bucket.Add(Key.Uri, Uri);
 }
コード例 #44
0
 /// <summary>
 /// Updates the metadata for a storage bucket synchronously.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If no preconditions are explicitly set in <paramref name="options"/>, the metageneration of <paramref name="bucket"/>
 /// is used as a precondition for the update, unless <see cref="UpdateBucketOptions.ForceNoPreconditions"/> is
 /// set to <c>true</c>.
 /// </para>
 /// </remarks>
 /// <param name="bucket">Bucket to update. Must not be null, and must have a populated <c>Name</c>.</param>
 /// <param name="options">Additional options for the update. May be null, in which case appropriate
 /// defaults will be used.</param>
 /// <returns>The <see cref="Bucket"/> representation of the updated storage bucket.</returns>
 public virtual Bucket UpdateBucket(
     Bucket bucket,
     UpdateBucketOptions options = null)
 {
     throw new NotImplementedException();
 }
コード例 #45
0
        // A simple construct that contains a collection of AWS S3 buckets.
        public StaticSiteConstruct(Construct scope, string id, StaticSiteConstructProps props) : base(scope, id)
        {
            var zone = HostedZone.FromLookup(this, "Zone", new HostedZoneProviderProps
            {
                DomainName = props.DomainName
            });

            var siteDomain = (string)($"{props.SiteSubDomain}.{props.DomainName}");

            new CfnOutput(this, "Site", new CfnOutputProps
            {
                Value = $"https://{siteDomain}"
            });

            var siteBucket = new Bucket(this, "SiteBucket", new BucketProps
            {
                BucketName           = siteDomain,
                WebsiteIndexDocument = "index.html",
                WebsiteErrorDocument = "error.html",
                PublicReadAccess     = true,

                // The default removal policy is RETAIN, which means that cdk destroy will not attempt to delete
                // the new bucket, and it will remain in your account until manually deleted. By setting the policy to
                // DESTROY, cdk destroy will attempt to delete the bucket, but will error if the bucket is not empty.
                RemovalPolicy = RemovalPolicy.DESTROY // NOT recommended for production code
            });

            new CfnOutput(this, "Bucket", new CfnOutputProps
            {
                Value = siteBucket.BucketName
            });

            var certificateArn = new DnsValidatedCertificate(this, "SiteCertificate", new DnsValidatedCertificateProps
            {
                DomainName = siteDomain,
                HostedZone = zone
            }).CertificateArn;

            new CfnOutput(this, "Certificate", new CfnOutputProps {
                Value = certificateArn
            });

            var behavior = new Behavior();

            behavior.IsDefaultBehavior = true;

            var distribution = new CloudFrontWebDistribution(this, "SiteDistribution", new CloudFrontWebDistributionProps
            {
                AliasConfiguration = new AliasConfiguration
                {
                    AcmCertRef     = certificateArn,
                    Names          = new string[] { siteDomain },
                    SslMethod      = SSLMethod.SNI,
                    SecurityPolicy = SecurityPolicyProtocol.TLS_V1_2016
                },
                OriginConfigs = new ISourceConfiguration[]
                {
                    new SourceConfiguration
                    {
                        S3OriginSource = new S3OriginConfig
                        {
                            S3BucketSource = siteBucket
                        },
                        Behaviors = new Behavior[] { behavior }
                    }
                }
            });

            new CfnOutput(this, "DistributionId", new CfnOutputProps
            {
                Value = distribution.DistributionId
            });

            new ARecord(this, "SiteAliasRecord", new ARecordProps
            {
                RecordName = siteDomain,
                Target     = RecordTarget.FromAlias(new CloudFrontTarget(distribution)),
                Zone       = zone
            });

            new BucketDeployment(this, "DeployWithInvalidation", new BucketDeploymentProps
            {
                Sources           = new ISource[] { Source.Asset("./site-contents") },
                DestinationBucket = siteBucket,
                Distribution      = distribution,
                DistributionPaths = new string[] { "/*" }
            });
        }
コード例 #46
0
        /// <summary>
        /// Create IResourceLocator object
        /// </summary>
        /// <param name="providerSuffix">If specified, this value will be appeneded to all provider ids.  This is used when loading additional catalogs that need to have unique providers.</param>
        /// <returns>ResourceLocationMap, which implements the IResourceLocator interface.</returns>
        public ResourceLocationMap CreateLocator(string providerSuffix = null)
        {
            var bucketData  = Convert.FromBase64String(m_BucketDataString);
            int bucketCount = BitConverter.ToInt32(bucketData, 0);
            var buckets     = new Bucket[bucketCount];
            int bi          = 4;

            for (int i = 0; i < bucketCount; i++)
            {
                var index = SerializationUtilities.ReadInt32FromByteArray(bucketData, bi);
                bi += 4;
                var entryCount = SerializationUtilities.ReadInt32FromByteArray(bucketData, bi);
                bi += 4;
                var entryArray = new int[entryCount];
                for (int c = 0; c < entryCount; c++)
                {
                    entryArray[c] = SerializationUtilities.ReadInt32FromByteArray(bucketData, bi);
                    bi           += 4;
                }
                buckets[i] = new Bucket {
                    entries = entryArray, dataOffset = index
                };
            }
            if (!string.IsNullOrEmpty(providerSuffix))
            {
                for (int i = 0; i < m_ProviderIds.Length; i++)
                {
                    if (!m_ProviderIds[i].EndsWith(providerSuffix, StringComparison.Ordinal))
                    {
                        m_ProviderIds[i] = m_ProviderIds[i] + providerSuffix;
                    }
                }
            }
            var extraData = Convert.FromBase64String(m_ExtraDataString);

            var keyData  = Convert.FromBase64String(m_KeyDataString);
            var keyCount = BitConverter.ToInt32(keyData, 0);
            var keys     = new object[keyCount];

            for (int i = 0; i < buckets.Length; i++)
            {
                keys[i] = SerializationUtilities.ReadObjectFromByteArray(keyData, buckets[i].dataOffset);
            }

            var locator = new ResourceLocationMap(m_LocatorId, buckets.Length);

            var entryData = Convert.FromBase64String(m_EntryDataString);
            int count     = SerializationUtilities.ReadInt32FromByteArray(entryData, 0);
            var locations = new IResourceLocation[count];

            for (int i = 0; i < count; i++)
            {
                var index      = kBytesPerInt32 + i * (kBytesPerInt32 * k_EntryDataItemPerEntry);
                var internalId = SerializationUtilities.ReadInt32FromByteArray(entryData, index);
                index += kBytesPerInt32;
                var providerIndex = SerializationUtilities.ReadInt32FromByteArray(entryData, index);
                index += kBytesPerInt32;
                var dependencyKeyIndex = SerializationUtilities.ReadInt32FromByteArray(entryData, index);
                index += kBytesPerInt32;
                var depHash = SerializationUtilities.ReadInt32FromByteArray(entryData, index);
                index += kBytesPerInt32;
                var dataIndex = SerializationUtilities.ReadInt32FromByteArray(entryData, index);
                index += kBytesPerInt32;
                var primaryKey = SerializationUtilities.ReadInt32FromByteArray(entryData, index);
                index += kBytesPerInt32;
                var resourceType = SerializationUtilities.ReadInt32FromByteArray(entryData, index);
                index += kBytesPerInt32;
                EnumLocalResourceMode allowMode = (EnumLocalResourceMode)SerializationUtilities.ReadInt32FromByteArray(entryData, index);
                object data = dataIndex < 0 ? null : SerializationUtilities.ReadObjectFromByteArray(extraData, dataIndex);
                locations[i] = new CompactLocation(locator, Addressables.ResolveInternalId(ExpandInternalId(m_InternalIdPrefixes, m_InternalIds[internalId])),
                                                   m_ProviderIds[providerIndex], dependencyKeyIndex < 0 ? null : keys[dependencyKeyIndex], data, depHash, keys[primaryKey].ToString(), m_resourceTypes[resourceType].Value, allowMode);
            }

            for (int i = 0; i < buckets.Length; i++)
            {
                var bucket = buckets[i];
                var key    = keys[i];
                var locs   = new IResourceLocation[bucket.entries.Length];
                for (int b = 0; b < bucket.entries.Length; b++)
                {
                    locs[b] = locations[bucket.entries[b]];
                }
                locator.Add(key, locs);
            }

            return(locator);
        }
コード例 #47
0
 /// <inheritdoc />
 public override Bucket UpdateBucket(
     Bucket bucket,
     UpdateBucketOptions options = null)
 => CreateUpdateBucketRequest(bucket, options).Execute();
コード例 #48
0
        Value GetLastValueInBucket(Bucket bucket)
        {
            DataSet dataSet = bucket.DataSets.LastOrDefault();

            return(GetLastValueInDataSet(dataSet));
        }
コード例 #49
0
        private BucketsResource.InsertRequest CreateCreateBucketRequest(string projectId, Bucket bucket, CreateBucketOptions options)
        {
            GaxPreconditions.CheckNotNull(projectId, nameof(projectId));
            ValidateBucket(bucket, nameof(bucket));
            var request = Service.Buckets.Insert(bucket, projectId);

            request.ModifyRequest += _versionHeaderAction;
            options?.ModifyRequest(request);
            return(request);
        }
コード例 #50
0
ファイル: LocalFS.cs プロジェクト: jpompeii/MediaStore
        public void StoreObject(string bucketName, string objectName, Stream content)
        {
            Bucket        bucket  = getBucket(bucketName, true);
            StorageObject obj     = _dataContext.FindObject(bucket, objectName);
            bool          newFile = false;

            if (obj == null)
            {
                obj = new StorageObject
                {
                    BucketId    = bucket.Id,
                    Name        = objectName,
                    DateCreated = DateTime.UtcNow,
                    LastUpdate  = DateTime.UtcNow,
                    Size        = content.Length,
                    Directory   = GetDirectoryName(DateTime.UtcNow)
                };
                _dataContext.StorageObjects.InsertOne(obj);
                newFile = true;
            }
            string path        = Path.Combine(_fsRoot, bucket.Name, obj.Directory);
            string tempPath    = Path.Combine(path, Path.GetRandomFileName() + ".tmp");
            string objPath     = Path.Combine(path, obj.Id);
            string tempObjPath = objPath + ".tmp";

            try
            {
                using (var outStr = new FileStream(path, FileMode.Create, FileAccess.Write))
                {
                    content.CopyTo(outStr);
                }
                if (!newFile)
                {
                    File.Move(objPath, tempObjPath);
                }

                File.Move(tempPath, objPath);
                if (!newFile)
                {
                    File.Delete(tempObjPath);
                }
            }
            catch (Exception ex)
            {
                // make an attempt to undo changes
                try
                {
                    if (newFile)
                    {
                        _dataContext.DeleteObject <StorageObject>(obj.Id);
                    }

                    if (File.Exists(tempObjPath))
                    {
                        File.Move(tempObjPath, objPath);
                    }

                    File.Delete(tempPath);
                }
                catch (Exception) { }
                throw ex;
            }
        }
コード例 #51
0
ファイル: ObjectService.cs プロジェクト: Neus252/uplink.net
 public async Task <UploadOperation> UploadObjectAsync(Bucket bucket, string targetPath, UploadOptions uploadOptions, Stream stream, bool immediateStart = true)
 {
     return(await UploadObjectAsync(bucket, targetPath, uploadOptions, stream, null, immediateStart));
 }
コード例 #52
0
 public BucketController(Bucket bucket, BucketEventListener eventListener)
 {
     this.bucket        = bucket;
     this.eventListener = eventListener;
 }
コード例 #53
0
        internal LambdaNetPipelineStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            var codeBuildRole = new Role(this, "CodeBuildRole", new RoleProps
            {
                ManagedPolicies = new IManagedPolicy[] { ManagedPolicy.FromAwsManagedPolicyName("PowerUserAccess") },
                AssumedBy       = new ServicePrincipal("codebuild.amazonaws.com")
            });

            var cloudFormationRole = new Role(this, "CloudFormationRole", new RoleProps
            {
                ManagedPolicies = new IManagedPolicy[] { ManagedPolicy.FromAwsManagedPolicyName("AdministratorAccess") },
                AssumedBy       = new ServicePrincipal("cloudformation.amazonaws.com")
            });

            var artifactStore = new Bucket(this, "ArtifactStore");


            var build = new PipelineProject(this, id, new PipelineProjectProps
            {
                Role        = codeBuildRole,
                Environment = new BuildEnvironment
                {
                    BuildImage           = LinuxBuildImage.AMAZON_LINUX_2_3,
                    EnvironmentVariables = new Dictionary <string, IBuildEnvironmentVariable>
                    {
                        { "S3_BUCKET", new BuildEnvironmentVariable {
                              Type = BuildEnvironmentVariableType.PLAINTEXT, Value = artifactStore.BucketName
                          } }
                    }
                }
            });


            var githubOwner = this.Node.TryGetContext("github-owner")?.ToString();

            if (string.IsNullOrEmpty(githubOwner))
            {
                throw new Exception("Context variable \"github-owner\" required to be set.");
            }

            var githubRepository = this.Node.TryGetContext("github-repo")?.ToString();

            if (string.IsNullOrEmpty(githubRepository))
            {
                throw new Exception("Context variable \"github-repo\" required to be set.");
            }

            var githubOauthToken = this.Node.TryGetContext("github-oauth-token")?.ToString();

            if (string.IsNullOrEmpty(githubOauthToken))
            {
                Console.WriteLine($"Looking for GitHub oauth token in SSM Parameter Store using key: {DEFAULT_OAUTH_PARAMETER_STORE_KEY}");
                githubOauthToken = FetchGitHubPersonalAuthToken();
            }

            Console.WriteLine($"Defining pipelines for {githubOwner}/{githubRepository}");


            CreatePipeline(cloudFormationRole, build, githubOwner, githubRepository, githubOauthToken, "dev");
            CreatePipeline(cloudFormationRole, build, githubOwner, githubRepository, githubOauthToken, "master");
        }
コード例 #54
0
ファイル: StateEntityNode.cs プロジェクト: TSSArt/Xtate.Core
 void IStoreSupport.Store(Bucket bucket) => Store(bucket);
コード例 #55
0
 public ReplaceNodeTask(DhtEngine engine, Bucket bucket, Node newNode)
 {
     this.engine  = engine;
     this.bucket  = bucket;
     this.newNode = newNode;
 }
コード例 #56
0
ファイル: AppStack.cs プロジェクト: 7474/html-render-function
        internal AppStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            // 面倒くさいのでスタックは分けない。
            var vpc = new Vpc(this, "Vpc");
            var efs = new EFS.FileSystem(this, "Efs", new EFS.FileSystemProps()
            {
                Vpc = vpc,
            });
            var efsUser = new PosixUser()
            {
                Gid = "1001",
                Uid = "1001",
            };
            var efsCreateAcl = new Acl()
            {
                OwnerGid    = "1001",
                OwnerUid    = "1001",
                Permissions = "755",
            };
            var efsAccessPoint = new EFS.AccessPoint(this, "EfsAccessPoint", new EFS.AccessPointProps()
            {
                FileSystem = efs,
                // 他の設定そのままで "/" では書き込み権限が得られていなかった。
                // CDK上ではなく、NFSマウント後にルートユーザーで権限を操作すればよい。
                // (ルートディレクトリは既定でルートユーザーが所有している状態)
                // See. https://docs.aws.amazon.com/ja_jp/efs/latest/ug/using-fs.html
                //      https://docs.aws.amazon.com/ja_jp/efs/latest/ug/accessing-fs-nfs-permissions-per-user-subdirs.html
                Path = "/",
                // ファイルIOに用いるユーザーとディレクトリ作成時権限の設定は必須である様子。
                // CDKが既定のユーザーを構成してくれるようなことはない。
                // -> ↑嘘。必要がなければ構成しなくても問題ない。所詮はNFSなので、権限が他のユーザーに解放されているディレクトリは操作できる。はず。
                PosixUser = efsUser,
                CreateAcl = efsCreateAcl,
            });

            // Assets
            // https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-assets-readme.html
            // vs
            // https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-deployment-readme.html
            // 静的にS3にファイルを残し、スタックのデプロイ後にDataSyncでEFSに転送するのでDeployment。
            var assetBucket = new Bucket(this, "AssetBucket", new BucketProps()
            {
            });

            new BucketDeployment(this, "AssetBucketDeployment", new BucketDeploymentProps()
            {
                Sources           = new ISource[] { Source.Asset("assets") },
                DestinationBucket = assetBucket,
            });

            // https://github.com/shelfio/chrome-aws-lambda-layer
            var chromeLayer = new LayerVersion(this, "ChromeLayer", new LayerVersionProps()
            {
                Code = AssetCode.FromAsset("chrome_aws_lambda.zip"),
                CompatibleRuntimes = new Runtime[] { Runtime.NODEJS_12_X }
            });

            var renderImageBucket = new Bucket(this, "RenderImageBucket", new BucketProps()
            {
            });

            var renderHtmlToS3Function = new Function(this, "RenderHtmlToS3Function", new FunctionProps()
            {
                Vpc         = vpc,
                Runtime     = Runtime.NODEJS_12_X,
                MemorySize  = 1024,
                Timeout     = Duration.Seconds(10),
                Code        = Code.FromAsset("handlers"),
                Handler     = "render-html-to-s3.handler",
                Environment = new Dictionary <string, string>()
                {
                    ["BucketName"]   = renderImageBucket.BucketName,
                    ["EfsMountPath"] = "/mnt/efs",
                },
                Layers     = new ILayerVersion[] { chromeLayer },
                Filesystem = Lambda.FileSystem.FromEfsAccessPoint(efsAccessPoint, "/mnt/efs"),
            });

            // VPCやEFSに関してはCDK上の関連から
            // セキュリティグループや既定のロールへのインラインポリシーが構成される。
            // S3バケットはCDK上の関連はないため明に権限を付与する。
            renderImageBucket.GrantReadWrite(renderHtmlToS3Function);

            // 踏み台
            var bastion = new BastionHostLinux(this, "Bastion", new BastionHostLinuxProps()
            {
                InstanceType = InstanceType.Of(InstanceClass.BURSTABLE3, InstanceSize.NANO),
                Vpc          = vpc,
            });

            assetBucket.GrantRead(bastion);
            // https://docs.aws.amazon.com/cdk/api/latest/docs/aws-efs-readme.html
            efs.Connections.AllowDefaultPortFrom(bastion);
            bastion.Instance.UserData.AddCommands(
                "yum check-update -y",                          // Ubuntu: apt-get -y update
                "yum upgrade -y",                               // Ubuntu: apt-get -y upgrade
                "yum install -y amazon-efs-utils",              // Ubuntu: apt-get -y install amazon-efs-utils
                "yum install -y nfs-utils",                     // Ubuntu: apt-get -y install nfs-common
                "file_system_id_1=" + efs.FileSystemId,
                "efs_mount_point_1=/mnt/efs/fs1",
                "mkdir -p \"${efs_mount_point_1}\"",
                "test -f \"/sbin/mount.efs\" && echo \"${file_system_id_1}:/ ${efs_mount_point_1} efs defaults,_netdev\" >> /etc/fstab || " +
                "echo \"${file_system_id_1}.efs." + Stack.Of(this).Region + ".amazonaws.com:/ ${efs_mount_point_1} nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,_netdev 0 0\" >> /etc/fstab",
                "mount -a -t efs,nfs4 defaults",
                "chmod go+rw /mnt/efs/fs1"
                );

            new CfnOutput(this, "BastionInstanceId", new CfnOutputProps()
            {
                ExportName = "BastionInstanceId",
                Value      = bastion.InstanceId,
            });
            new CfnOutput(this, "AssetBucketName", new CfnOutputProps()
            {
                ExportName = "AssetBucketName",
                Value      = assetBucket.BucketName,
            });
        }
コード例 #57
0
 protected ConversionBucket(Bucket inner) : base(inner)
 {
 }
コード例 #58
0
ファイル: BucketStream.cs プロジェクト: AmpScm/AmpScm
 public BucketStream(Bucket bucket)
 {
     Bucket = bucket ?? throw new ArgumentNullException(nameof(bucket));
 }
コード例 #59
0
 /// <inheritdoc />
 public override Task DeleteBucketAsync(
     Bucket bucket,
     DeleteBucketOptions options         = null,
     CancellationToken cancellationToken = default) =>
 DeleteBucketAsyncImpl(ValidateBucket(bucket, nameof(bucket)), options, cancellationToken);
コード例 #60
0
    // OnGUI
    void OnGUI()
    {
        if (GUI.skin.font != font)
        {
            GUI.skin.font = font;
        }

        // Left column
        GUILayout.BeginArea(new Rect(0, 0, Screen.width * 0.25f, Screen.height));
        GUILayout.BeginVertical("box");

        bucketsScrollPosition = GUILayout.BeginScrollView(bucketsScrollPosition);
        foreach (var bucket in _buckets)
        {
            GUILayout.BeginHorizontal();

            if (bucket == currentBucket)
            {
                GUI.contentColor = Color.green;
            }
            else
            {
                GUI.contentColor = Color.white;
            }

            if (GUILayout.Button(bucket.name, bucketNameStyle))
            {
                StartCoroutine(GetKeysAndValues(bucket));
            }
            GUILayout.EndHorizontal();
        }
        GUI.contentColor = Color.white;

        GUILayout.FlexibleSpace();
        GUILayout.EndScrollView();

        // Footer
        GUILayout.BeginHorizontal();
        //GUILayout.Label(currentBucket.name, bucketNameStyle);
        GUILayout.FlexibleSpace();

        GUI.enabled = _enableRefresh;
        if (GUILayout.Button("Refresh"))
        {
            StartCoroutine(RefreshList());
        }

        GUI.enabled = true;
        if (currentBucket != null && GUILayout.Button("Clear bucket"))
        {
            clearBucket = currentBucket;
        }

        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();
        GUILayout.EndArea();

        // Right column
        GUILayout.BeginArea(new Rect(Screen.width * 0.25f, 0, Screen.width * 0.75f, Screen.height));
        GUILayout.BeginVertical("box");

        keysScrollPosition = GUILayout.BeginScrollView(keysScrollPosition);
        foreach (var entry in data)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(entry.Key, GUILayout.Width(Screen.width / 7.0f));

            if (entry.Value != null)
            {
                if (entry.Value.encoding == Encoding.Json && GUILayout.Button(entry.Value.expanded ? "-" : "+"))
                {
                    entry.Value.expanded = !entry.Value.expanded;
                }

                if (entry.Value.expanded)
                {
                    DrawJsonTreeExpanded(entry.Value.tree);
                }
                else
                {
                    GUILayout.Label(entry.Value.text);
                    GUILayout.FlexibleSpace();
                }

                if (entry.Value.tree != null)
                {
                    if (entry.Value.tree.IsString)
                    {
                        GUILayout.Label(entry.Value.tree.AsString.ToString());
                    }
                }

                GUILayout.Label(entry.Value.encoding.ToString());

                // Toolbar
                if (entry.Value.encoding == Encoding.Bitstream && GUILayout.Button("Edit"))
                {
                    editKey   = entry.Key;
                    editValue = entry.Value;
                }
            }
            else
            {
                GUILayout.FlexibleSpace();
            }

            if (GUILayout.Button("Remove"))
            {
                deleteKey = entry.Key;
            }

            GUILayout.EndHorizontal();
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndScrollView();
        GUILayout.EndVertical();
        GUILayout.EndArea();

        if (deleteKey != "")
        {
            GUI.backgroundColor = Color.red;
            GUILayout.Window(0, new Rect(Screen.width / 2 - Screen.width / 4, Screen.height / 2 - 50, Screen.width / 2, 100), DeleteWindow, "Are you sure you want to delete '" + deleteKey + "'?");
        }
        else if (editKey != "")
        {
            GUI.backgroundColor = Color.green;
            GUILayout.Window(1, new Rect(Screen.width / 2 - Screen.width / 4, Screen.height / 2 - Screen.height / 4, Screen.width / 2, Screen.height / 2), EditWindow, editKey);
        }
        else if (clearBucket != null)
        {
            GUI.backgroundColor = Color.red;
            GUILayout.Window(0, new Rect(Screen.width / 2 - Screen.width / 4, Screen.height / 2 - 50, Screen.width / 2, 100), DeleteBucketWindow, "Are you sure you want to delete '" + clearBucket.name + "'?");
        }
    }