コード例 #1
0
 public void ProcessFrx()
 {
     try
     {
         while (readerIndex < FrxFile.Length)
         {
             MoveIndexNextStartStylesImage();
             TrueDBGrid grid = new TrueDBGrid();
             totalImageBatches++;
             grid.Images    = ProcessImagesBatch();
             grid.AllStyles = ProcessStylesBatch();
             ProcessStyleAssignmentsBatch(grid);
             ReadNamedStyleInfoBatch(grid);
             if (grid.Images.Count > 0)
             {
                 totalGridWithImages++;
             }
             MoveIndexNextStartGridName();
             grid.Name = ProcessGridName();
             Grids.Add(grid);
             Console.WriteLine($"This images are from the grid {grid.Name}");
         }
     } catch (ArgumentException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
コード例 #2
0
 public void Add(int _x, int _y, float _offsX, float _offsY, float _dur, int _wait)
 {
     Grids.Add(_x);
     Grids.Add(_y);
     Offses.Add(_offsX);
     Offses.Add(_offsY);
     Durs.Add(_dur);
     Waits.Add(_wait);
 }
コード例 #3
0
            // Serialization
            public void RegisterGrid(IMapGrid grid)
            {
                if (GridIDMap.ContainsKey(grid.Index))
                {
                    throw new InvalidOperationException();
                }

                Grids.Add(grid);
                GridIDMap.Add(grid.Index, GridIDMap.Count);
            }
コード例 #4
0
 public void ajax_rsp_assign_grid(String GridName, Object GridObj)
 {
     try
     {
         Grids.Add(((IGxJSONAble)GridObj).GetJSONObject());
     }
     catch (JsonException)
     {
     }
 }
コード例 #5
0
 public void ajax_rsp_assign_grid(String GridName, Object GridObj)
 {
     try
     {
         Grids.Add(((IGxJSONAble)GridObj).GetJSONObject());
     }
     catch (Exception ex)
     {
         GXLogging.Error(log, "ajax_rsp_assign_grid error", ex);
     }
 }
コード例 #6
0
        private void CreateObserverTab()
        {
            Grids.Add("Observer", Resources["LoadObserverTemplate"] as Grid);
            Border border = Grids["Observer"].Children[0] as Border;

            if (!(border?.Child is Grid innerGrid))
            {
                return;
            }
            ((Grid)innerGrid.Children[1]).Children.Add(_manager.GetGameLoadGrid());
            ((Button)innerGrid.Children[3]).Click += (sender, arg) => { GameScroll.Content = Grids["Menu"]; };
        }
コード例 #7
0
        private void CreateSaveMapTab()
        {
            Grids.Add("SaveMap", Resources["SaveMapTemplate"] as Grid);
            Border border = Grids["SaveMap"].Children[0] as Border;

            if (!(border?.Child is Grid innerGrid))
            {
                return;
            }
            ((Grid)innerGrid.Children[1]).Children.Add(_manager.GetMapSaveGrid());
            ((Button)innerGrid.Children[3]).Click += (sender, arg) => GameScroll.Content = Grids["Admin"];
        }
コード例 #8
0
        internal void InitializeGrids()
        {
            double LastUpperEstimatedPricing = 0;
            double LastUnderEstimatedPricing = 0;

            if (c == null)
            {
                return;
            }
            double lotSize = (double)c.GridParameters.LotSize;

            OriginalAsk = robot.Symbol.Ask;
            OriginalBid = robot.Symbol.Bid;

            Grids.Clear();
            ActiveSince = robot.Time;

            UpperGroundStartingPoint = robot.ShiftPrice(OriginalAsk, (int)c.GridParameters.Intervals.Starting);
            UnderGroundStartingPoint = robot.ShiftPrice(OriginalBid, -Math.Abs((int)c.GridParameters.Intervals.Starting));

            GridSize = Math.Abs((int)c.GridParameters.Size);

            for (int i = 0; i < GridSize; i++)
            {
                LastUpperEstimatedPricing = i == 0 ? UpperGroundStartingPoint : robot.ShiftPrice(LastUpperEstimatedPricing, Math.Abs((int)c.GridParameters.Intervals.Grid));
                //robot.Print("EstimatedPricing-Upper: {0} at {1}", LastUpperEstimatedPricing.ToString(), i.ToString());
                var UpperGrid = new Grid()
                {
                    Side             = GridSide.UpperGround,
                    OrderType        = c.GridParameters.OrderType,
                    LotSize          = lotSize,
                    EstimatedPricing = LastUpperEstimatedPricing,
                    SideIndex        = i
                };
                Grids.Add(UpperGrid);

                LastUnderEstimatedPricing = i == 0 ? UnderGroundStartingPoint : robot.ShiftPrice(LastUnderEstimatedPricing, -Math.Abs((int)c.GridParameters.Intervals.Grid));
                //robot.Print("EstimatedPricing-Under: {0} at {1}", LastUnderEstimatedPricing.ToString(), i.ToString());
                var UnderGrid = new Grid()
                {
                    Side             = GridSide.UnderGround,
                    OrderType        = c.GridParameters.OrderType,
                    LotSize          = lotSize,
                    EstimatedPricing = LastUnderEstimatedPricing,
                    SideIndex        = i
                };
                Grids.Add(UnderGrid);
            }
        }
コード例 #9
0
        private void CreateSaveGameTab()
        {
            Grids.Add("SaveGame", Resources["SaveGameTemplate"] as Grid);
            Border border = Grids["SaveGame"].Children[0] as Border;

            if (!(border?.Child is Grid innerGrid))
            {
                return;
            }
            ((Grid)innerGrid.Children[1]).Children.Add(_manager.GetGameSaveGrid());
            ((Button)innerGrid.Children[3]).Click += (sender, arg) =>
            {
                GameScroll.Content = Grids["GameMap"];
                ChangeDisplayMode(true);
            };
        }
コード例 #10
0
        private void AddGrids(Side side)
        {
            int countTo = 0, x = 0, y = 0, xI = 0, yI = 0;

            switch (side)
            {
            case Side.Down:
                countTo     = Math.Abs(TopLeft.X) + BottomRight.X + 1;
                x           = TopLeft.X;
                y           = BottomRight.Y + 1;
                xI          = 1;
                BottomRight = new LogicalPosition(BottomRight.X, BottomRight.Y + 1);
                break;

            case Side.Left:
                countTo = Math.Abs(TopLeft.Y) + BottomRight.Y + 1;
                x       = TopLeft.X - 1;
                y       = TopLeft.Y;
                yI      = 1;
                TopLeft = new LogicalPosition(TopLeft.X - 1, TopLeft.Y);
                break;

            case Side.Right:
                countTo     = Math.Abs(TopLeft.Y) + BottomRight.Y + 1;
                x           = BottomRight.X + 1;
                y           = TopLeft.Y;
                yI          = 1;
                BottomRight = new LogicalPosition(BottomRight.X + 1, BottomRight.Y);
                break;

            case Side.Up:
                countTo = Math.Abs(TopLeft.X) + BottomRight.X + 1;
                x       = TopLeft.X;
                y       = TopLeft.Y - 1;
                xI      = 1;
                TopLeft = new LogicalPosition(TopLeft.X, TopLeft.Y - 1);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(side));
            }
            for (int count = 0; count < countTo; count++, x += xI, y += yI)
            {
                LogicalPosition position = new LogicalPosition(x, y);
                Grids.Add(position, new Grid(position));
            }
        }
コード例 #11
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void LoadContent(ContentManager content)
        {
            //load four sets of stuff
            for (int i = 0; i < 4; i++)
            {
                //load four grids
                Grids.Add(new TextureInfo(content.Load <Texture2D>("grid")));

                //add four 0's for their levels
                Levels.Add(0);
            }

            GridColors.Add(Color.Red);
            GridColors.Add(Color.Yellow);
            GridColors.Add(Color.DarkGreen);
            GridColors.Add(Color.Blue);
        }
コード例 #12
0
        // To user friedly model, like put 'Male' ou 'Femalle' otherwise 1 or 2
        // And another expansions
        static public void addConnectionModel(int Id, List <GridAdminViewer_Result> Grid)
        {
            List <GridViewer_Result> l = new List <GridViewer_Result>();

            if (Grid.Count > 0)
            {
                var gender         = new _ddlGenderId();
                var city           = new _ddlCityId();
                var region         = new _ddlRegionId();
                var purchase       = new _ddlLastPurchase();
                var classification = new _ddlClassificationId();
                var user           = new _ddlUserId();
                foreach (var g in Grid)
                {
                    GridViewer_Result g0 = new GridViewer_Result();
                    g0.Id               = g.Id;
                    g0.Name             = g.Name;
                    g0.Phone            = g.Phone;
                    g0.GenderId         = g.GenderId;
                    g0.CityId           = g.CityId;
                    g0.RegionId         = g.RegionId;
                    g0.LastPurchase     = g.LastPurchase;
                    g0.ClassificationId = g.ClassificationId;
                    g0.UserId           = g.UserId;
                    l.Add(g0);
                    gender.add_ddlGenderId(g.GenderId);
                    city.add_ddlCityId(g.CityId.GetValueOrDefault());
                    region.add_ddlRegionId(g.RegionId.GetValueOrDefault());
                    purchase.add_ddlLastPurchase(g.LastPurchase.GetValueOrDefault());
                    classification.add_ddlClassificationId(g.ClassificationId.GetValueOrDefault());
                    user.add_ddlUserId(g.UserId.GetValueOrDefault());
                }
                var model = new connectionModels
                            (
                    Id,
                    l,
                    gender.get_ddlGenderId(),
                    city.get_ddlCityId(),
                    region.get_ddlRegionId(),
                    purchase.get_ddlLastPurchase(),
                    classification.get_ddlClassificationId(),
                    user.get_ddlUserId()
                            );
                Grids.Add(model);
            }
        }
コード例 #13
0
            private void ReadGridSection()
            {
                var grids = RootNode.GetNode <YamlSequenceNode>("grids");

                foreach (var grid in grids)
                {
                    var newId = new GridId?();
                    YamlGridSerializer.DeserializeGrid(
                        _mapManager, TargetMap, ref newId,
                        (YamlMappingNode)grid["settings"],
                        (YamlSequenceNode)grid["chunks"],
                        _tileMap,
                        _tileDefinitionManager
                        );

                    if (newId != null)
                    {
                        Grids.Add(_mapManager.GetGrid(newId.Value));
                    }
                }
            }
コード例 #14
0
ファイル: GFS.cs プロジェクト: rdessart/WeatherService
        public void ParseFile(string path)
        {
            if (!File.Exists(path))
            {
                return;
            }
            string content = File.ReadAllText(path);

            string[] lines = content.Split('\n');
            Console.WriteLine($"{path} >> They are {lines.Length} lines in the file");
            List <GFSLine> GFSLines = new List <GFSLine>();

            foreach (string line in lines)
            {
                if (!string.IsNullOrWhiteSpace(line))
                {
                    GFSLines.Add(new GFSLine(line));
                }
            }
            var             levels = GFSLines.Where(g => g.Unit != GFSLine.Units.UNKNOWN && g.Pressure > double.MinValue && g.IsPressureAltitude == false).OrderBy(g => g.Pressure).GroupBy(g => g.Pressure);
            List <GFSLayer> layers = new List <GFSLayer>();

            foreach (var level in levels)
            {
                layers.Add(new GFSLayer(level.Key, level.ToList()));
            }
            layers = layers.OrderByDescending(l => l.GeoAltitudeFt).ToList();
            GFSGrid gGrid = new GFSGrid()
            {
                Layers    = layers,
                Latitude  = GFSLines[0].Latitude,
                Longitude = GFSLines[0].Longitude
            };

            Grids.Add(new KeyValuePair <double, double>(gGrid.Latitude, gGrid.Longitude), gGrid);
        }
コード例 #15
0
        private void CreateGrids(GovernorsDetailsDto dto, IEnumerable <GovernorModel> governors, bool isHistoric, int?groupUid, int?establishmentUrn)
        {
            var roles = dto.ApplicableRoles.Where(role => !EnumSets.eSharedGovernorRoles.Contains(role)
                                                  ||
                                                  (RoleEquivalence.GetLocalEquivalentToSharedRole(role) != null &&
                                                   !dto.ApplicableRoles.Contains(RoleEquivalence.GetLocalEquivalentToSharedRole(role).Value)));

            foreach (var role in roles)
            {
                var equivalantRoles = RoleEquivalence.GetEquivalentToLocalRole(role).Cast <int>().ToList();
                var pluralise       = !EnumSets.eSingularGovernorRoles.Contains(role);


                var grid = new GovernorGridViewModel($"{_nomenclatureService.GetGovernorRoleName(role, eTextCase.SentenceCase, pluralise)}{(isHistoric ? " (in past 12 months)" : string.Empty)}")
                {
                    Tag              = isHistoric ? "historic" : "current",
                    Role             = role,
                    IsSharedRole     = EnumSets.eSharedGovernorRoles.Contains(role),
                    GroupUid         = groupUid,
                    EstablishmentUrn = establishmentUrn,
                    IsHistoricRole   = isHistoric,
                    RoleName         = _nomenclatureService.GetGovernorRoleName(role)
                };

                var displayPolicy = dto.RoleDisplayPolicies.Get(role);
                Guard.IsNotNull(displayPolicy, () => new Exception($"The display policy should not be null for the role '{role}'"));
                bool includeEndDate = ((isHistoric && role == GR.Member || role != GR.Member) && displayPolicy.AppointmentEndDate) ||
                                      (role.OneOfThese(GR.ChiefFinancialOfficer, GR.AccountingOfficer) && isHistoric);

                SetupHeader(role, grid, displayPolicy, includeEndDate);

                var list = governors.Where(x => x.RoleId.HasValue && equivalantRoles.Contains(x.RoleId.Value));
                foreach (var governor in list)
                {
                    var isShared       = governor.RoleId.HasValue && EnumSets.SharedGovernorRoles.Contains(governor.RoleId.Value);
                    var establishments = string.Join(", ",
                                                     governor.Appointments?.Select(a => $"{a.EstablishmentName}, URN: {a.EstablishmentUrn}") ??
                                                     new string[] { });
                    var appointment = governor.Appointments?.SingleOrDefault(a => a.EstablishmentUrn == EstablishmentUrn);
                    var startDate   = (isShared && appointment != null) ? appointment.AppointmentStartDate : governor.AppointmentStartDate;
                    var endDate     = (isShared && appointment != null) ? appointment.AppointmentEndDate : governor.AppointmentEndDate;

                    var row = grid.AddRow(governor, endDate)
                              .AddCell(governor.GetFullName(), displayPolicy.FullName)
                              .AddCell(string.IsNullOrWhiteSpace(establishments) ? null : establishments, role.OneOfThese(GR.LocalGovernor, GR.ChairOfLocalGoverningBody))
                              .AddCell(governor.Id, displayPolicy.Id)
                              .AddCell(AppointingBodies.FirstOrDefault(x => x.Id == governor.AppointingBodyId)?.Name, displayPolicy.AppointingBodyId)
                              .AddCell(startDate?.ToString("dd/MM/yyyy"), displayPolicy.AppointmentStartDate)
                              .AddCell(endDate?.ToString("dd/MM/yyyy"), includeEndDate)
                              .AddCell(governor.PostCode, displayPolicy.PostCode)
                              .AddCell(governor.DOB?.ToString("dd/MM/yyyy"), displayPolicy.DOB)
                              .AddCell(governor.GetPreviousFullName(), displayPolicy.PreviousFullName)
                              .AddCell(governor.EmailAddress, displayPolicy.EmailAddress)
                              .AddCell(governor.TelephoneNumber, displayPolicy.TelephoneNumber);

                    if (isHistoric)
                    {
                        var gov = new HistoricGovernorViewModel
                        {
                            AppointingBodyId     = governor.AppointingBodyId,
                            AppointingBody       = AppointingBodies.FirstOrDefault(x => x.Id == governor.AppointingBodyId)?.Name,
                            AppointmentEndDate   = new DateTimeViewModel(governor.AppointmentEndDate),
                            AppointmentStartDate = new DateTimeViewModel(governor.AppointmentStartDate),
                            FullName             = governor.GetFullName(),
                            RoleName             = _nomenclatureService.GetGovernorRoleName(role)
                        };

                        HistoricGovernors.Add(gov);
                    }
                }

                grid.Rows         = grid.Rows.OrderByDescending(x => x.SortValue).ThenBy(x => x.Model.GetFullName()).ToList();
                HistoricGovernors = HistoricGovernors.OrderByDescending(x => x.AppointmentEndDate.ToDateTime()).ThenBy(x => x.FullName).ToList();

                if (isHistoric)
                {
                    HistoricGrids.Add(grid);
                }
                else
                {
                    Grids.Add(grid);
                }
            }
        }
コード例 #16
0
 public TileTextureCollection WithTextureGrid(TextureGrid g)
 {
     Grids.Add(g);
     return(this);
 }