Example #1
1
        public static string FindPositionPart(IList<string> parts, int cursorPosition, out int foundPartsIndex, out int cursorInPartPosition)
        {
            cursorInPartPosition = 0;
              var partsComplete = parts.Aggregate(String.Empty, (aggr, s) => aggr + s);
              for (int i = 0; i < parts.Count(); i++) {
            var partsLower = parts.Take(i).Aggregate(String.Empty, (aggr, s) => aggr + s);
            var partsUpper = parts.Take(i + 1).Aggregate(String.Empty, (aggr, s) => aggr + s);

            var b = partsLower.Length;
            var t = partsUpper.Length;

            if ((cursorPosition >= b && cursorPosition < t) || partsUpper == partsComplete) {
              if (parts[i] == WorkDayParser.itemSeparator.ToString() || parts[i] == WorkDayParser.hourProjectInfoSeparator.ToString()) {
            // cursor left of separator
            foundPartsIndex = i - 1;
            var prevPart = parts.ElementAt(foundPartsIndex);
            // find out where in the found part the cursor is, need to use prevpart an its length
            cursorInPartPosition = prevPart.Length;
            return prevPart;
              } else {
            // find out where in the found part the cursor is
            cursorInPartPosition = cursorPosition - b;
            foundPartsIndex = i;
            return parts.ElementAt(i);
              }
            }
              }
              // not found
              foundPartsIndex = -1;
              return String.Empty;
        }
        protected void BindQuestion()
        {
            queslist = CY.CSTS.Core.Business.Question.GetSqlWhere("[IsHomePage]=1");
            unsolvequestion = new List<CY.CSTS.Core.Business.Question>();

            for (int i = 0; i <= queslist.Count - 1; i++)
            {
                if (!isanswer(queslist.ElementAt(i).Id))
                {
                    unsolvequestion.Add(queslist.ElementAt(i));

                }

            }

            for (int i = queslist.Count - 1; i >= 0; i--)
            {
                if (!isanswer(queslist.ElementAt(i).Id))
                {
                    queslist.RemoveAt(i);
                }

            }
            if (queslist.Count >= 4)
            {
                for (int i = queslist.Count - 1; i >= 4; i--)
                {
                    queslist.RemoveAt(i);
                }
            }
            for (int i = 0, j = queslist.Count; i < j; i++)
            {
                //queslist[i].Title = CY.Utility.Common.StringUtility.CutString(queslist[i].Title, 80, "...");
            }

            //Questionlist.DataSource = queslist;
            //Questionlist.DataBind();

            if (unsolvequestion.Count >= 4)
            {
                for (int i = unsolvequestion.Count - 1; i >= 4; i--)
                {
                    unsolvequestion.RemoveAt(i);
                }
            }
            for (int i = 0, j = unsolvequestion.Count; i < j; i++)
            {
                //unsolvequestion[i].Title = CY.Utility.Common.StringUtility.CutString(unsolvequestion[i].Title, 80, "...");
            }
        }
Example #3
0
        protected void bindbooklist()
        {
            booklist = CY.GFive.Core.Business.BookSchedule.GetAll();

            if (booklist != null)
            {
                for (int i = booklist.Count-1; i>=0; i--)
                {
                    if (booklist.ElementAt(i).Result == 2)
                    {
                        unarrivebook.Add(booklist.ElementAt(i));
                        if (booklist.ElementAt(i).Days <= 5)
                        {
                            warninglist.Add(booklist.ElementAt(i));
                        }
                        booklist.RemoveAt(i);

                    }
                }
            }
            WarnList.DataSource=warninglist;
            WarnList.DataBind();
            UnarrivBookList.DataSource = unarrivebook;
            UnarrivBookList.DataBind();
            ArrivBooklist.DataSource = booklist;
            ArrivBooklist.DataBind();
        }
Example #4
0
        public void bindunsolveques(IList<CY.CSTS.Core.Business.Question> list, int pagenum)
        {
            IList<CY.CSTS.Core.Business.Question> unsovlelist = new List<CY.CSTS.Core.Business.Question>();
            for (int i = 0; i <= list.Count-1; i++)
            {
                bool isnum = getanswernum(list.ElementAt(i).Id);
                if (!isnum)
                {
                    unsovlelist.Add(list.ElementAt(i));
                }

            }
            PagedDataSource ps2 = new PagedDataSource();
            ps2.DataSource = unsovlelist;
            ps2.AllowPaging = true;
            ps2.PageSize = 10;
            TotalPage2.Text = ps2.PageCount.ToString();
            ShowPage2.Text = pagenum.ToString();
            ps2.CurrentPageIndex = pagenum - 1;
            Pageup2.Enabled = true;
            Pagedown2.Enabled = true;
            if ((pagenum - 1) == 0)
            {

                this.Pageup2.Enabled = false;
            }
            if (pagenum == ps2.PageCount)
            {

                this.Pagedown2.Enabled = false;
            }

            Unsolvelist.DataSource = ps2;
            Unsolvelist.DataBind();
        }
        /// <summary>
        /// Metodo que ejecuta la accion de Selección de tipo de Consulta
        /// </summary>
        public void BotonSeleccionTipo()
        {
            #region SolicitudServicios

            if (_vista.opcion.SelectedIndex == 0) // Seleccion Cedula
            {

            }

            if (_vista.opcion.SelectedIndex == 1)// Seleccion Nombre
            {

            }

            if (_vista.opcion.SelectedIndex == 2)// Seleccion Cargo
            {
                cargo = BuscarCargos();
                for (int i = 0; i < cargo.Count; i++)
                {
                    _vista.drowListaCargo.Items.Add(cargo.ElementAt(i));
                }
                _vista.drowListaCargo.DataBind();
            }

            #endregion
        }
Example #6
0
        public void bindquestion(IList<CY.CSTS.Core.Business.Question> list ,int pagenum)
        {
            for (int i = list.Count - 1; i >= 0; i--)
            {
                bool isnum = getanswernum(list.ElementAt(i).Id);
                if (!isnum)
                {
                    list.RemoveAt(i);
                }

            }

            PagedDataSource ps = new PagedDataSource();
            ps.DataSource =list;
            ps.AllowPaging = true;
            ps.PageSize = 10;
            TotalPage.Text = ps.PageCount.ToString();
            ShowPage.Text = pagenum.ToString();
            ps.CurrentPageIndex = pagenum-1;
            Pageup.Enabled = true;
            Pagedown.Enabled = true;

            if ((pagenum-1) == 0)
            {
                this.Pageup.Enabled = false;

            }
            if (pagenum == ps.PageCount)
            {
                this.Pagedown.Enabled = false;

            }
            QuesList.DataSource = ps;
            QuesList.DataBind();
        }
Example #7
0
    /// <summary>
    /// 删除一条食物
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        //获取要删除的食物的索引
        LinkButton lbton = (LinkButton)sender;
        DataListItem gvr = (DataListItem)lbton.Parent;
        int foodindex = gvr.ItemIndex;

        OrderFoodControl ofc = new OrderFoodControl();
        OrderControl oc = new OrderControl();
        foodlist = oc.GetProductCarFoodList(userid);
        fooditemlist = oc.GetFoodItemByOrderFoodList(foodlist);

        int foodid = fooditemlist.ElementAt(foodindex).FoodId;
        int orderid = fooditemlist.ElementAt(foodindex).OrderId;
        Session["OrderId"] = orderid;

        //删除订单食物,如果订单里面没有食物了,就删除这个订单
        ofc.DeleteOrderFood(orderid, foodid);
        if(1 == foodlist.Count)
        {
            OrderData _order = new OrderData();
            _order.DeleteOrder(_order.GetOrderById(orderid));
        }
        Response.Write("<script language=javascript>window.location.href=window.location.href;</script>");
    }
        public void BuscaRol()
        {
            try
            {
                string anio = _vista.SeleccionAnio.Text;
                string ConstFechaI = "01/01/" + anio;
                string ConstFechaF = "31/12/" + anio;
                DateTime FechaI = Convert.ToDateTime(ConstFechaI);
                DateTime FechaF = Convert.ToDateTime(ConstFechaF);

                empleado = BuscarRoles(FechaI, FechaF);

                int i = 0;

                for ( i = 0; i < empleado.Count; i++ )
                    {
                        _vista.SeleccionRol.Items.Add( empleado.ElementAt(i) );
                    }

                _vista.SeleccionRol.DataBind();
                _vista.SeleccionRol.Visible = true;
            }
            catch (WebException e)
            {
                //EXCECION WEB
            }
        }
Example #9
0
        private static PuzzleName FindPuzzleNameByKey(IList<PuzzleName> puzzleNames, int position)
        {
            // Lookup the correct PuzzleName by its position as calculated
            // in the BuildPuzzleNames(...) method.

            //TODO: remove this code and add your implementation here
            return puzzleNames.ElementAt(position);
        }
Example #10
0
        public IBee GetRandomBee(IList<IBee> hive)
        {
            var random = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);

            var randomBee = random.Next(0, hive.Count());

            return hive.ElementAt(randomBee);
        }
Example #11
0
        public DeckDealer(List<string>[] players, IList<string> deck, int handOut)
        {
            if (players == null || deck == null) throw new Exception("One of arguments is null");
            if (handOut<1 || handOut> deck.Count/ players.GetLength(0)) throw new Exception("Wrong number of cards to handout");
            foreach (var variable in players)
            {
                for (var i = 0; i < handOut; i++)
                {
                    var tmpCard = deck.ElementAt(0);
                    Console.WriteLine("Card taken form deck "+tmpCard);
                    deck.RemoveAt(0);
                    Console.WriteLine("Next card should be "+deck.ElementAt(0));
                    variable.Add(tmpCard);
                }

            }
            _tabLists = players;
        }
Example #12
0
 public DeckShuffler(IList<string> scards)
 {
     for (var i = 0; i < 52; i++)
     {
         if (scards == null) throw new Exception("Shuffled deck is null");
         var index = _random.Next(0, scards.Count - 1);
         var tmpCard = scards.ElementAt(index);
         _tmpList.Add(tmpCard);
         scards.RemoveAt(index);
     }
 }
        public void LlenarLista( bool o )
        {
            List<string> ListaRecibida = new List<string>();
               if ( o == true )
               // SE SELECCIONO PROPUESTA SE PROCEDE A ELIMINAR
               {
               try
               {
                   ListaRecibida.Add(_vista.ListaPropuesta.SelectedItem.Text);
                   Core.LogicaNegocio.Comandos.ComandoPropuesta.Eliminar comando;
                   comando = FabricaComandosPropuesta.CrearComandoEliminar(ListaPropuesta);
                   ListaPropuesta = comando.Ejecutar(ListaRecibida);

                   int i = 0;
                   for (i = 0; i < ListaPropuesta.Count; i++)
                   {
                       _vista.ListaPropuesta.Items.Add(ListaPropuesta.ElementAt(i));
                   }
                   _vista.ListaPropuesta.DataBind();
                   _vista.ListaPropuesta.Visible = false;
                   _vista.LabelEliminarCompletado.Text = _vista.ListaPropuesta.SelectedItem.Text + " ELIMINADO";
                   _vista.LabelEliminarCompletado.Visible = true;
               }
               catch (WebException e)
               {
                   //Excepcipon WEB
               }
               catch (NullReferenceException e)
               {

               }
               }
               else
               {
               try
               {
                   Core.LogicaNegocio.Comandos.ComandoPropuesta.Eliminar comando;
                   comando = FabricaComandosPropuesta.CrearComandoEliminar( ListaPropuesta );
                   ListaPropuesta = comando.Ejecutar( ListaRecibida );

                   int i = 0;
                   for ( i = 0; i < ListaPropuesta.Count; i++ )
                   {
                       _vista.ListaPropuesta.Items.Add( ListaPropuesta.ElementAt(i) );
                   }
                   _vista.ListaPropuesta.DataBind();
                   _vista.ListaPropuesta.Visible = true;
               }
               catch
               {

               }
               }
        }
Example #14
0
        private void cargargrilla(IList<HorarioDetalle> listaDet)
        {
            dgDetalle.Rows.Clear();
               for (int i = 0; i < listaDet.Count; i++)
               {
                HorarioDetalle horarioDet = listaDet.ElementAt<HorarioDetalle>(i);
                dgDetalle.Rows.Add(horarioDet.Dia.Descripcion, horarioDet.HoraDesde.ToShortTimeString(), horarioDet.HoraHasta.ToShortTimeString(), horarioDet.Frecuencia, horarioDet.Id);
               }

               dgDetalle.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
        }
 private static void MostrarAlumnos(IList <Alumno> alumnos)
 {
     Alumno al = null;
     Console.WriteLine("*******************");
     Console.WriteLine("*  Lista Alumnos  *");
     Console.WriteLine("*******************");
     for (int i = 0; i < alumnos.Count; i++)
     {
         al=alumnos.ElementAt(i);
         Console.WriteLine(i+" "+al.Nombre+" "+al.Apellido);
     }
 }
        private CoreDataSet GetDataByOffset(IList<CoreDataSet> dataList)
        {
            int maximumIndex = dataList.Count() - 1;

            if (maximumIndex < dataPointOffset)
            {
                // Run out of data
                return null;
            }

            return dataList.ElementAt(maximumIndex - dataPointOffset);
        }
Example #17
0
        /// <summary>
        /// Constructeur privé afin d'éviter la création de plusieurs objets (Singleton).
        /// </summary>
        private DalManager()
        {
            // Création artistes
            _artistes = new List<Artiste>();

            _artistes.Add(new Artiste(0, new DateTime(1999, 12, 25), "Man", "Iron"));
            _artistes.Add(new Artiste(1, new DateTime(1998, 7, 6), "Zidane", "Zinedine"));
            _artistes.Add(new Artiste(2, new DateTime(1920, 2, 2), "Wayne", "Bruce"));
            _artistes.Add(new Artiste(3, new DateTime(1945, 6, 14), "Parker", "Peter"));
            _artistes.Add(new Artiste(4, new DateTime(1982, 3, 12), "Abar", "Ben"));
            _artistes.Add(new Artiste(5, new DateTime(1958, 11, 24), "Chabat", "Alain"));
            _artistes.Add(new Artiste(6, new DateTime(1957, 3, 23), "Lauby", "Chantal"));

            // Création evenements
            _events = new List<Evenement>();

            IList<Artiste> artistesTmp = ((List<Artiste>)_artistes).GetRange(0, 4);

            _events.Add(new Exposition(artistesTmp, "La ligues des justiciers", 0, 8.50f, "The avengers", 50));
            _events.Add(new Exposition(artistesTmp, "Le retour des supers héros", 1, 8.50f, "Le retour des supers héros", 50));
            _events.Add(new Exposition(artistesTmp, "La suite du film \"Le retour des supers héros\"", 2, 8.50f, "Le re-retour des supers héros", 50));

            artistesTmp = ((List<Artiste>)_artistes).GetRange(4, 1);
            _events.Add(new Concert(artistesTmp, "Concert de Benabar", 3, 1.5f, "Benabar", false, 200, 10));

            artistesTmp = ((List<Artiste>)_artistes).GetRange(5, 2);
            _events.Add(new Exposition(artistesTmp, "La cité de la peur, le retour.", 4, 16f, "La cité de la peur 2", 20));

            // Création des lieux
            _lieux = new List<Lieu>();

            _lieux.Add(new Lieu(0, "Liberty Island", "53000", "Statue de liberté", 50, "USA", 22f, "06 06 06 06 06", "New York city"));
            _lieux.Add(new Lieu(1, "à droite du champs", "26823", "Prairie", 2, "France", 0f, "06 06 06 06 06", "Rochefourchat "));
            _lieux.Add(new Lieu(2, "3 rue du capitole", "75005", "Boucherie", 200, "France", 12.5f, "06 06 06 06 06", "Paris"));

            // Création des PlanningElements
            _pe = new List<PlanningElement>();

            _pe.Add(new PlanningElement(new DateTime(2012, 12, 21, 0, 0, 0), new DateTime(2012, 12, 21, 23, 59, 59), 0,
                _events.ElementAt(0),_lieux.ElementAt(0),0));

            _pe.Add(new PlanningElement(new DateTime(2013, 1, 21, 0, 0, 0), new DateTime(2013, 1, 21, 23, 59, 59), 0,
                _events.ElementAt(1), _lieux.ElementAt(0), 0));

            _pe.Add(new PlanningElement(new DateTime(2013, 2, 21, 0, 0, 0), new DateTime(2013, 2, 21, 23, 59, 59), 0,
                _events.ElementAt(2), _lieux.ElementAt(0), 0));

            _pe.Add(new PlanningElement(new DateTime(2013, 1, 15, 21, 0, 0), new DateTime(2013, 1, 15, 23, 30, 0), 1,
                _events.ElementAt(3), _lieux.ElementAt(1), 0));

            _pe.Add(new PlanningElement(new DateTime(2013, 2, 3, 21, 0, 0), new DateTime(2013, 2, 3, 23, 30, 0), 2,
                _events.ElementAt(4), _lieux.ElementAt(2), 0));
        }
        public void BuscarPropuesta()
        {
            _presentadorPropuesta = new ConsultarPropuestaPresentador();

            int i = 0;
            int estado = 1;

            propuestas = _presentadorPropuesta.BuscarPorTitulo(estado);
            for (i = 0; i < propuestas.Count; i++)
            {
                _vista.PropuestaAsociada.Items.Add(propuestas.ElementAt(i).Titulo);
            }
        }
Example #19
0
        public static IList<Car.Part> GetStorehouseParts(string xmlResource, IList<Car> cars)
        {
            XElement xml = XElement.Parse(xmlResource);
            IList<Car.Part> parts =
            (
                from e in xml.Elements("Parts").Elements("Part")
                select new Car.Part
                (
                    cars.ElementAt(Int32.Parse(e.Attribute("car").Value) - 1).
                        Parts.ElementAt(Int32.Parse(e.Attribute("part").Value) - 1)
                )
             ).ToList();

            return parts;
        }
        public static bool ActionsAreEquals(this IList<DeploymentActionResource> dpar1, IList<DeploymentActionResource> dpar2)
        {

            if (dpar1 == null || dpar2 == null || dpar1.Count != dpar2.Count)
            {
                return false;
            }
            for (var i = 0; i < dpar1.Count; i++)
            {
                if (!dpar1.ElementAt(i).ActionsAreEquals(dpar2.ElementAt(i)))
                {
                    return false;
                }
            }
            return true;
        }
Example #21
0
        public Quote AddQuote(Quote newQuote, IList<int> zanyIds, int userId, IList<byte[]> files)
        {
            Quote quote = context.Quotes.Create();

            quote.AddedOn = newQuote.AddedOn;
            quote.Description = newQuote.Description;
            quote.GameId = newQuote.GameId;
            quote.QuoteText = newQuote.QuoteText;
            quote.UpdatedById = newQuote.UpdatedById;
            quote.UpdatedOn = newQuote.AddedOn; // updated and added dates are the same for creation
            quote.Zanies = zanyRepo.GetZanies(zanyIds);

            if (files != null && files.Count > 0)
            {
                Game quoteGame = gameRepo.GetGame(quote.GameId);

                if (quoteGame != null)
                {
                    newQuote.MediaItems = new List<MediaItem>();

                    // add media items
                    for(int i=0; i < files.Count; i++)
                    {
                        quote.MediaItems.Add(
                            mediaRepo.AddMediaItem(
                                files.ElementAt(i)
                                , this.CreateQuoteMediaFileName(
                                    newQuote.Description
                                    , newQuote.GameId
                                    , ".png"
                                    , i.ToString())
                                , quoteGame.ShortName));
                    }
                }
            }

            context.Quotes.Add(quote);
            context.SaveChanges();

            return quote;
        }
        public void BuscaCargo()
        {
            try
            {
                cargo = BuscarCargos();
                int i = 0;

                for (i = 0; i < cargo.Count; i++)
                {
                    _vista.SeleccionCargo.Items.Add(cargo.ElementAt(i));

                }

                _vista.SeleccionCargo.DataBind();
                _vista.SeleccionCargo.Visible = true;
            }
            catch (WebException e)
            {
                //EXCECION WEB
            }
        }
Example #23
0
    protected void FoodNum_TextChanged(object sender, EventArgs e)
    {
        //获取修改了的TextBox的FoodItem项的索引
        TextBox tb = (TextBox)sender;
        if (tb.Text == "0")
        {
            Page.Response.Write("<script>alert('食物数量不能为0!您可以选择删除该食物。')</script>");
            Response.Write("<script language=javascript>window.location.href=window.location.href;</script>");
            return;
        }
        DataListItem gvr = (DataListItem)tb.Parent;
        int foodindex = gvr.ItemIndex;

        //调用逻辑层修改食物数量
        int userid = Convert.ToInt32(Session["UserId"]);
        OrderFoodControl ofc = new OrderFoodControl();
        OrderControl oc = new OrderControl();
        foodlist = oc.GetProductCarFoodList(userid);
        fooditemlist = oc.GetFoodItemByOrderFoodList(foodlist);
        int foodid = fooditemlist.ElementAt(foodindex).FoodId;
        int foodnum = Convert.ToInt32(tb.Text.ToString());
        ofc.ModifyFoodNum(userid, foodid, foodnum);
        Response.Write("<script language=javascript>window.location.href=window.location.href;</script>");
    }
Example #24
0
File: Habolt.cs Project: JFFby/KSKR
        private IList<State> Solve(IList<State> states)
        {
            var ic = IntegrationConstants();
            var effectiveK = Inputs.K + ic[0] * Inputs.M + ic[1] * Inputs.C;
            for (double t = Inputs.T0; t < Inputs.Tk; t += Inputs.DeltaT)
            {
                var ancientState = states.ElementAt(states.Count - 2);
                var lastState = states.Last();
                var effectiveR = Inputs.R.ToVector(t + Inputs.DeltaT) +
                                    Inputs.M * (ic[2] * lastState.NextStateMovementU + ic[4] * lastState.MovementU +
                                              ic[6] * ancientState.MovementU) +
                                    Inputs.C * (ic[3] * lastState.NextStateMovementU
                                              + ic[5] * lastState.MovementU + ic[1] * ancientState.MovementU);
                var nextMovementU = effectiveR * effectiveK.Inverse();
                var nextSpeed = ic[1] * nextMovementU - ic[3] * lastState.NextStateMovementU -
                                ic[5] * lastState.MovementU - ic[7] * ancientState.MovementU;
                var nextAcceleration = ic[0] * nextMovementU - ic[2] * lastState.NextStateMovementU -
                                ic[4] * lastState.MovementU - ic[6] * ancientState.MovementU;

                states.Add(new State(t, effectiveR, lastState.NextStateMovementU, nextSpeed, nextAcceleration,
                    nextMovementU));
            }
            return states;
        }
 private double getTeamPoints(IList<Game> homeTeamLatestGames, int teamId, int gamesCount)
 {
     double points = 0;
     for (int i = 0; i < gamesCount; i++) {
         Game game = homeTeamLatestGames.ElementAt(i);
         string result = game.result;
         string[] goals = result.Split(':');
         int homeTeamGoals = int.Parse(goals[0]);
         int awayTeamGoals = int.Parse(goals[1]);
         if (game.homeTeam.Id == teamId) {
             if (homeTeamGoals > awayTeamGoals) {
                 points += 3;
             }
         } else {
             if (awayTeamGoals > homeTeamGoals) {
                 points += 3;
             }
         }
         if (homeTeamGoals == awayTeamGoals) {
             points += 1;
         }
     }
     return points;
 }
        public void BotonSeleccionTipo()
        {
            if (_vista.opcion.SelectedIndex == 0)
            {

                _vista.opcion.Visible = false;
                _vista.LabelTipoC.Visible = false;
                _vista.SeleccionOpcion.Visible = true;
                _vista.LabelSelec.Visible = true;

            }

            if (_vista.opcion.SelectedIndex == 1)
            {

                _vista.opcion.Visible = false;
                _vista.SeleccionOpcion.Visible = true;

            }

            #region SolicitudServicios
            if (_vista.opcion.SelectedIndex == 0) // PROPUESTAS EN ESPERA 
            {

                int i = 0;
                propuesta = BuscarPropuestasEnEspera();
                for (i = 0; i < propuesta.Count; i++)
                {

                    _vista.SeleccionOpcion.Items.Add(propuesta.ElementAt(i).Titulo);

                }
                _vista.SeleccionOpcion.DataBind();
            }

        }
 static Type ExtractNodeTypeAtPosition(IList<Type> messageTypesToDeserialize, int position)
 {
     Type nodeType = null;
     if (messageTypesToDeserialize != null && position < messageTypesToDeserialize.Count)
     {
         nodeType = messageTypesToDeserialize.ElementAt(position);
     }
     return nodeType;
 }
Example #28
0
        private void PrettyPrintSub(IList<object> node)
        {
            stringWriter.Write("(");

            for (int i = 0; i < node.Count; i++)
            {
                var printnode = node.ElementAt(i);
                PrettyPrintSub(printnode);

                if (i < node.Count - 1)
                {
                    stringWriter.Write(" ");
                }
            }

            stringWriter.Write(")");
        }
Example #29
0
 private void resetRegions(IList<Region> regions, Tile[][] tiles)
 {
     for (int i = 0; i < regions.Count; ++i)
     {
         Region region = regions.ElementAt(i);
         if (region.UpRegionId >= 0)
         {
             region.UpRegion = regions.ElementAt(region.UpRegionId);
         }
         if (region.LeftRegionId >= 0)
         {
             region.LeftRegion = regions.ElementAt(region.LeftRegionId);
         }
         if (region.DownRegionId >= 0)
         {
             region.DownRegion = regions.ElementAt(region.DownRegionId);
         }
         if (region.RightRegionId >= 0)
         {
             region.RightRegion = regions.ElementAt(region.RightRegionId);
         }
         region.CenterTile = tiles[region.CenterTileRow][region.CenterTileCol];
     }
 }
Example #30
0
 private Tile readTile(FileStream fs, IList<Region> regions)
 {
     Tile tile = new Tile();
     short regionId = readShort(fs);
     if (regionId >= 0)
     {
         tile.Region = regions.ElementAt(regionId);
         tile.Region.AddTile(tile);
     }
     return tile;
 }