Beispiel #1
0
 private void CodeModelEvents_ElementAdded(CodeElement element)
 {
     if (element != null)
     {
         _codeModelEventSubscribers.For(s => s.ElementAdded(element));
     }
 }
        private static void ParseClaims(Acl acl, JObject item)
        {
            var           sid           = item.Property("sid").Value.ToString();
            var           type          = item.Property("type").Value.ToString();
            List <Access> allowed       = new List <Access>();
            List <Access> denied        = new List <Access>();
            var           allowProperty = item.Property("allow");

            if (allowProperty != null)
            {
                allowProperty
                .Values()
                .Select(x => (Access)Enum.Parse(typeof(Access), x.ToString(), true))
                .For(x => allowed.Add(x));
            }
            var denyProperty = item.Property("deny");

            if (denyProperty != null)
            {
                denyProperty
                .Values()
                .Select(x => (Access)Enum.Parse(typeof(Access), x.ToString(), true))
                .For(x => denied.Add(x));
            }
            ClaimType    claimType = (ClaimType)Enum.Parse(typeof(ClaimType), type, true);
            List <Claim> claims    = new List <Claim>();

            allowed.For(x => claims.Add(new Claim(Permission.Allow, x, claimType, sid)));
            denied.For(x => claims.Add(new Claim(Permission.Deny, x, claimType, sid)));
            acl.SetInternal(claims);
        }
Beispiel #3
0
 protected virtual void InvalidateWidth()
 {
     List.For(
         (i, e) =>
     {
         string str = GetLabelText(i, (int)Math.Ceiling((i + 1) / (double)EntriesPerPage), e);
         GuessWidth = Math.Max(GuessWidth, 50 + str.ComputeWidth(UOFont.Font0));
     });
 }
        private void InvokeOnSpawn(GameObject clone)
        {
            switch (notification)
            {
            case NotificationType.IPoolable:
                clone.GetComponents(TempPoolables);
                TempPoolables.For(component => component.OnSpawn());
                break;

            case NotificationType.BroadcastIPoolable:
                clone.GetComponentsInChildren(TempPoolables);
                TempPoolables.For(component => component.OnSpawn());
                break;

            case NotificationType.None:
                break;

            default:
                throw new System.ArgumentOutOfRangeException();
            }
        }
        private StringBuilder AppendExpectation(StringBuilder builder)
        {
            if (_expectations.Any())
            {
                builder.AppendLine("Verify:");
                builder.AppendLine("=======");
                _expectations.For((index, expects) => builder.AppendLine(String.Format("{0}. {1}", index, expects)));
                builder.AppendLine();
            }

            return(builder);
        }
        private StringBuilder AppendExecution(StringBuilder builder)
        {
            if (_executions.Any())
            {
                builder.AppendLine("Execute:");
                builder.AppendLine("========");
                _executions.For((index, exec) => builder.AppendLine(String.Format("{0}. {1}", index, exec)));
                builder.AppendLine();
            }

            return(builder);
        }
        private StringBuilder AppendPreparation(StringBuilder builder)
        {
            if (_preparations.Any())
            {
                builder.AppendLine("Prepare:");
                builder.AppendLine("========");
                _preparations.For((index, prepare) => builder.AppendLine(String.Format("{0}. {1}", index, prepare)));
                builder.AppendLine();
            }

            return(builder);
        }
        public void ForTest()
        {
            IList <int> list = new List <int>
            {
                1, 2, 3, 4
            };

            int total      = 0;
            int totalIndex = 0;

            list.For((item, index) =>
            {
                total      += item;
                totalIndex += index;
            });

            Assert.AreEqual(10, total);
            Assert.AreEqual(6, totalIndex);
        }
Beispiel #9
0
        public void SetDb(DapperContext _db)
        {
            this.db = _db;

            if (moedas.Count() == 0 && this.db != null)
            {
                // Pegando os estados da base de dados
                var estado  = db.GetAsync <Estado>("E002", nameof(Estado.CodEstado)).Await();
                var cambios = db.GetAsync <ISS.Application.Models.Cambio>(e => e.DapperInclude(d => d.MoedaBase)).Await();

                // Pegando as moedas ativas
                moedas = db.GetAsync <Moeda>(null, estado.IdEstado, nameof(Moeda.EstadoId)).Await().ToList();

                // TODO: Resolver, adicionado para o caso da Moeda UCF
                moedas?.AddRange(db.GetAsync <Moeda>(null, "987", nameof(Moeda.CodMoeda)).Await());

                moedas.For(e =>
                {
                    e.CambioMoeda = cambios.Where(x => x.MoedaId == e.IdMoeda).ToList();
                });
            }
        }
Beispiel #10
0
        public int OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
        {
            if (fAdded == Convert.ToInt32(true))
            {
                var project = _shellProjectService.GetHierarchyProject(pHierarchy);
                if (project != null)
                {
                    _solutionEventSubscribers.For(s => s.ProjectAdded(project));
                }
            }

            return(VSConstants.S_OK);
        }
 /// <summary>
 /// Writes a list of avatars to the message.
 /// </summary>
 public static void Write(this NetworkMessage message, List <Avatar> avatars)
 {
     avatars.For(message.Write);
 }
        private static void WriteAcls(JsonWriter writer, List<Claim> allowed, List<Claim> denied, List<ResetRequest> reset)
        {
            var map = new Dictionary<SidTypeKey, ClaimGroup>();
            allowed.For(x =>
            {
                ClaimGroup group;
                var key = new SidTypeKey { Sid = x.Sid, Type = x.ClaimType };
                if (map.TryGetValue(key, out group) == false)
                    group = new ClaimGroup { Sid = x.Sid, Type = x.ClaimType };
                group.Allowed.Add(x.AccessType);
            });
            denied.For(x =>
            {
                ClaimGroup group;
                var key = new SidTypeKey { Sid = x.Sid, Type = x.ClaimType };
                if (map.TryGetValue(key, out group) == false)
                    group = new ClaimGroup { Sid = x.Sid, Type = x.ClaimType };
                group.Denied.Add(x.AccessType);
            });
            reset.For(x =>
            {
                ClaimGroup group;
                var key = new SidTypeKey { Sid = x.Sid, Type = x.Type };
                if (map.TryGetValue(key, out group) == false)
                    group = new ClaimGroup { Sid = x.Sid, Type = x.Type };
                group.Reset.Add(x.Access);
            });

            writer.WriteStartArray();
            map.Values.For(x =>
            {
                writer.WriteStartObject();
                writer.WriteProperty("sid", x.Sid);
                writer.WriteProperty("type", x.Type.ToString().ToLower());
                if (x.Allowed.Count > 0)
                    writer.WriteArray("allow", x.Allowed.Select(y => y.ToString().ToLower()));
                if (x.Denied.Count > 0)
                    writer.WriteArray("deny", x.Denied.Select(y => y.ToString().ToLower()));
                if (x.Reset.Count > 0)
                    writer.WriteArray("dontcare", x.Reset.Select(y => y.ToString().ToLower()));
                writer.WriteEndObject();
            });
            writer.WriteEndArray();
        }
 private static void ParseClaims(Acl acl, JObject item)
 {
     var sid = item.Property("sid").Value.ToString();
     var type = item.Property("type").Value.ToString();
     List<Access> allowed = new List<Access>();
     List<Access> denied = new List<Access>();
     var allowProperty = item.Property("allow");
     if (allowProperty != null)
     {
         allowProperty
             .Values()
             .Select(x => (Access)Enum.Parse(typeof(Access), x.ToString(), true))
             .For(x => allowed.Add(x));
     }
     var denyProperty = item.Property("deny");
     if (denyProperty != null)
     {
         denyProperty
             .Values()
             .Select(x => (Access)Enum.Parse(typeof(Access), x.ToString(), true))
             .For(x => denied.Add(x));
     }
     ClaimType claimType = (ClaimType)Enum.Parse(typeof(ClaimType), type, true);
     List<Claim> claims = new List<Claim>();
     allowed.For(x => claims.Add(new Claim(Permission.Allow, x, claimType, sid)));
     denied.For(x => claims.Add(new Claim(Permission.Deny, x, claimType, sid)));
     acl.SetInternal(claims);
 }
Beispiel #14
0
        public void Test01_NullReference()
        {
            List <decimal> testList = default;

            Assert.ThrowsException <ArgumentNullException>(() => testList.For((i, d) => testList[i] = d + 1));
        }
Beispiel #15
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this._timer          = new Timer();
            this._timer.Interval = 20;
            this._shotCounter    = 0;
            this._shotInterval   = 6;
            // this._timer.Interval = 1000;

            this._isPaused = false;

            this.SuspendLayout();
            //
            // GamePlayControl
            //


            //
            // pauseMenu
            //

            this._pauseMenu           = new TableLayoutPanel();
            this._pauseMenu.Dock      = DockStyle.Fill;
            this._pauseMenu.BackColor = Color.Transparent;


            //this.pauseMenu.BackgroundImage = coolDog;
            this._pauseMenu.BackColor = Color.FromArgb(50, Color.Gray);

            this._pauseMenu.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 10F));
            this._pauseMenu.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 90F));

            //resume
            //restart -> confirm
            //settings
            //exit

            var resume = new MainMenuButton("Resume");

            resume.Click += (sender, args) => ManagePauseMenu();

            var selectLevel = new MainMenuButton("SelectLevel");

            selectLevel.Click += (sender, args) => this._controller.ChangeState(Controller.State.LevelSelect);

            var settings = new MainMenuButton("Settings");

            settings.Click += (sender, args) => this._controller.ChangeState(Controller.State.Settings);

            var mainMenuButton = new MainMenuButton("Main Menu");

            mainMenuButton.Click += (sender, args) => this._controller.ChangeState(Controller.State.MainMenu);

            var pauseMenuButtons = new List <MainMenuButton>
            {
                resume,
                selectLevel,
                settings,
                mainMenuButton
            };

            this._pauseMenu.RowStyles.Add(new RowStyle(SizeType.Percent, 23));
            this._pauseMenu.Controls.Add(new Label
            {
                Text     = "Pause",
                Font     = new Font(FontFamily.GenericSerif, 24),
                Anchor   = AnchorStyles.Left,
                AutoSize = true,
            }, 1, 0);
            pauseMenuButtons.For((button, index) =>
            {
                button.Anchor    = AnchorStyles.Left;
                button.AutoSize  = true;
                button.BackColor = Color.Transparent;

                this._pauseMenu.Controls.Add(button, 1, index + 1);
                this._pauseMenu.RowStyles.Add(new RowStyle(SizeType.Percent, 10F));
            });

            this.Controls.Add(_pauseMenu);
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.Margin         = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.Name           = "GamePlayControl";
            this.DoubleBuffered = true;

            this.MouseDown += OnMouseDown;
            this.MouseUp   += OnMouseUp;
            this.KeyDown   += OnKeyDown;
            this.KeyUp     += OnKeyUp;

            // this.Click += OnClick;
            this._timer.Tick += OnTimerTick;

            HidePauseMenu();
            Invalidate();
            this.ResumeLayout(false);
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.startButton        = new MainMenuButton("Start");
            this.startButton.Click += (sender, args) =>
            {
                _controller.SetGame(Level.Name.First);
                _controller.ChangeState(Controller.State.GamePlay);
            };

            this.levelSelectButton        = new MainMenuButton("Select Level");
            this.levelSelectButton.Click += (sender, args) => _controller.ChangeState(Controller.State.LevelSelect);

            this.settingsButton        = new MainMenuButton("Settings");
            this.settingsButton.Click += (sender, args) => _controller.ChangeState(Controller.State.Settings);

            this.exitButton        = new MainMenuButton("Exit");
            this.exitButton.Click += (sender, args) => _controller.ChangeState(Controller.State.Exit);

            this.layout = new System.Windows.Forms.TableLayoutPanel();
            var buttons = new List <MainMenuButton>
            {
                this.startButton,
                this.levelSelectButton,
                this.settingsButton,
                this.exitButton
            };

            this.SuspendLayout();
            //
            // layout
            //
            this.layout.AutoSize    = true;
            this.layout.Dock        = DockStyle.Fill;
            this.layout.Location    = new System.Drawing.Point(0, 0);
            this.layout.Name        = "layout";
            this.layout.TabIndex    = 0;
            this.layout.ColumnCount = 1;
            this.layout.ColumnStyles.Add(new ColumnStyle(System.Windows.Forms.SizeType.Percent, 100));
            this.layout.RowCount = buttons.Count;

            this.layout.RowStyles.Add(new RowStyle(System.Windows.Forms.SizeType.Percent, 25));
            this.layout.Controls.Add(new Label(), 0, 0);
            buttons.For((button, index) =>
            {
                this.layout.RowStyles.Add(new RowStyle(System.Windows.Forms.SizeType.Percent, 10));
                this.layout.Controls.Add(buttons[index], 0, index + 1);
            });
            this.layout.RowStyles.Add(new RowStyle(System.Windows.Forms.SizeType.Percent, 15));
            this.layout.Controls.Add(new Label(), 0, 9);
            //
            // MainMenu
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor           = Color.FromArgb(red: 20, green: 161, blue: 204);
            this.ForeColor           = Color.White;

            this.Controls.Add(this.layout);
            this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
            this.Name   = "MainMenu";
            this.ResumeLayout(false);
        }
Beispiel #17
0
 private void Update()
 => gizmos.For(gizmo => gizmo.durationLeft -= Time.deltaTime);