コード例 #1
0
        public void Execute(BaseIndex index, Dependency dependecy)
        {
            try
            {
                StringBuilder sb = new StringBuilder();

                foreach (var constraint in dependecy.Constraints)
                {
                    index.Market = constraint.Market;
                    index.Fields = constraint.Fields;
                    sb.Append(index.Build());
                }

                // create jobject for index build
                IndexWrapper indexWrapper = new IndexWrapper();
                indexWrapper.Build(null);
                // create jobject and run the queue
                Queue.AddToQueue(null);
                // foreach market

                // create ADI object

                //
                // wait for all markets
                // submit to solr
                // AddToQueue()
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
        protected virtual void CreateAndAddMarker(object dataItem, int index)
        {
            FrameworkElement marker = null;
            int indexInData         = index;

            if (dataItem is IndexWrapper <Point> )
            {
                IndexWrapper <Point> indexWrapper = (IndexWrapper <Point>)dataItem;
                dataItem    = indexWrapper.Data;
                indexInData = indexWrapper.Index;
            }

            marker = markerGenerator.CreateMarker(dataItem);

            SetIndex(marker, indexInData);

            if (MarkerStyle != null)
            {
                marker.Style = MarkerStyle;
            }

            SetCommonBindings(marker);
            SetNamedBindings(marker);

            CurrentItemsPanel.Children.Insert(index, marker);
        }
コード例 #3
0
        [HttpGet("")]     //Http Method and the route
        public IActionResult Index()
        {
            IndexWrapper WMod = new IndexWrapper();

            WMod.TableModel = DbContext.Users.ToList();
            return(View("Index", WMod));
        }
コード例 #4
0
        public IActionResult Categories()
        {
            IndexWrapper CMod = new IndexWrapper();

            CMod.AllCategories = DbContext.Categories.ToList();

            return(View("Categories", CMod));
        }
コード例 #5
0
        public IActionResult UpdateRegUser(int id, IndexWrapper Form)
        {
            Form.FormModel.RegUserId = id;
            Console.WriteLine(id);
            DbContext.Update(Form.FormModel);
            DbContext.Entry(Form.FormModel).Property("CreatedAt").IsModified = false;
            DbContext.SaveChanges();

            return(RedirectToAction("Index"));
        }
コード例 #6
0
        public IActionResult Detail(int id)
        {
            IndexWrapper Wmod = new IndexWrapper();

            Wmod.OneWedding = _context.Weddings
                              .Include(w => w.Guests)
                              .ThenInclude(g => g.User)
                              .FirstOrDefault(w => w.WeddingId == id);

            return(View("Detail", Wmod));
        }
コード例 #7
0
        /// <summary>
        /// Sets the commit index status to completed.
        /// </summary>
        /// <param name="matterId">The matter identifier.</param>
        protected void SetCommitIndexStatusToCompleted(long matterId)
        {
            var pipelineProperty = GetPipelineSharedProperty(_pipelineSharedPropertyKey);

            lock (pipelineProperty)
            {
                if (pipelineProperty.Value != null && pipelineProperty.Value.ToString().Equals("Initialized"))
                {
                    IndexWrapper.CommitBulkIndex(matterId);
                    pipelineProperty.Value = "Completed";
                }
            }
        }
コード例 #8
0
        public IActionResult Index()
        {
            IndexWrapper WMod = new IndexWrapper();

            WMod.AllProducts = DbContext.Products
                               .Include(a => a.CategoryAssociations)
                               .ToList();
            WMod.AllCategories = DbContext.Categories
                                 .Include(c => c.ProductAssociations)
                                 .ToList();

            return(View("Index", WMod));
        }
コード例 #9
0
        [HttpGet("")]                //Http Method and the route
        public IActionResult Index() //When in doubt, use IActionResult
        {
            IndexWrapper WMod = new IndexWrapper()
            {
                MyStrings = new List <string>()
                {
                    "Hello", "Darkness", "My", "Old", "Friend"
                }
            };


            return(View("Index", WMod)); //or whatever you want to return
        }
コード例 #10
0
 public IActionResult CreateUser(IndexWrapper Form)
 {
     if (ModelState.IsValid)
     {
         DbContext.Add(Form.FormModel);
         DbContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(Index());
     }
 }
コード例 #11
0
        /// <summary>
        /// Sets the commiy index status to initialized.
        /// </summary>
        /// <param name="matterId">The matter identifier.</param>
        protected void SetCommiyIndexStatusToInitialized(long matterId)
        {
            var pipelineProperty = GetPipelineSharedProperty(_pipelineSharedPropertyKey);

            lock (pipelineProperty)
            {
                if (pipelineProperty.Value == null)
                {
                    IndexWrapper.InitBulkIndex(matterId);
                    pipelineProperty.Value = "Initialized";
                }
            }
        }
コード例 #12
0
            public void Initialize(IInitializationContext context)
            {
                PropertyInfo[] duplicationKeyProperties
                    = this.GetDuplicationKeyProperties();
                var indices = new IndexWrapper[duplicationKeyProperties.Length];

                for (int i = 0; i < duplicationKeyProperties.Length; i++)
                {
                    indices[i] = new IndexWrapper(
                        this.parent.cache, duplicationKeyProperties[i]);
                }
                this.parent.indices = indices;
                context.Message     = this.GetResultMessage(indices.Length);
            }
コード例 #13
0
 public IActionResult RegisterUser(IndexWrapper Form)
 {
     // To Do:
     // add check confirm password === password before       registering
     if (ModelState.IsValid)
     {
         DbContext.Add(Form.FormModel);
         DbContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(Index());
     }
 }
コード例 #14
0
        [HttpGet("")]                //Http Method and the route
        public IActionResult Index() //When in doubt, use IActionResult
        {
            IndexWrapper WMod = new IndexWrapper()
            {
                AllColors = _context.Colors
                            .Include(c => c.UsersWhoLike)
                            .ThenInclude(u => u.User)
                            .ToList(),
                AllUsers = _context.Users
                           .Include(u => u.ColorsLiked)
                           .ThenInclude(c => c.Color)
                           .ToList()
            };

            ViewBag.AllColors = WMod.AllColors;
            ViewBag.AllUsers  = WMod.AllUsers;
            return(View("Index", WMod)); //or whatever you want to return
        }
コード例 #15
0
 public IActionResult CreateUser(IndexWrapper Form)
 {
     if (ModelState.IsValid)
     {
         // Initializing a PasswordHasher object, providing our User class as its type
         PasswordHasher <User> Hasher = new PasswordHasher <User>();
         Form.FormModel.Password = Hasher.HashPassword(Form.FormModel, Form.FormModel.Password);
         _context.Add(Form.FormModel);
         _context.SaveChanges();
         HttpContext.Session.SetInt32("UserId", Form.FormModel.UserId);
         return(Dashboard());
     }
     else
     {
         return(Index());
     }
     //Save your user object to the database
 }
コード例 #16
0
 public IActionResult CreateAssociation(IndexWrapper FromForm)
 {
     if (ModelState.IsValid)
     {
         if (DbContext.Associations.Any(h => h.ProductId == FromForm.Form.ProductId && h.CategoryId == FromForm.Form.CategoryId))
         {
             ModelState.AddModelError("Product.ProductId", "Product Exists in that Category already");
             return(Index());
         }
         DbContext.Add(FromForm.Form);
         DbContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(Index());
     }
 }
コード例 #17
0
        public ViewResult Index()
        {
            IndexWrapper WMod = new IndexWrapper();

            WMod.AllHeroes = dbContext.Heroes
                             // Include the intermediary table
                             .Include(h => h.TeamsPartOf)
                             // And from that middle table, include the object on the OTHER side of the
                             // many to many relationship
                             .ThenInclude(i => i.Team)
                             .ToList();
            WMod.AllTeams = dbContext.Teams
                            // Including the navigation property of "HeroesOnTeam" in the Team class
                            .Include(t => t.HeroesOnTeam)
                            // Including the navigation property of "Hero" in the HeroOnTeam class that was already included
                            .ThenInclude(i => i.Hero)
                            .ToList();
            return(View("Index", WMod));
        }
コード例 #18
0
        public IActionResult JoinTeam(IndexWrapper FromForm)
        {
            if (ModelState.IsValid)
            {
                // BONUS: Uniqueness check to prevent duplicate Many To Many entries
                if (dbContext.HeroesOnTeam.Any(h => h.HeroId == FromForm.Form.HeroId && h.TeamId == FromForm.Form.TeamId))
                {
                    ModelState.AddModelError("Form.HeroId", "That hero is already on that team.");
                    return(Index());
                }

                dbContext.Add(FromForm.Form);
                dbContext.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(Index());
            }
        }
コード例 #19
0
        public IActionResult Dashboard()
        {
            int?uId = HttpContext.Session.GetInt32("UserId");

            if (uId == null)
            {
                return(RedirectToAction("Index"));
            }
            IndexWrapper Wrap       = new IndexWrapper();
            User         ActiveUser = _context.Users.FirstOrDefault(u => u.UserId == HttpContext.Session.GetInt32("UserId"));

            if (ActiveUser == null)
            {
                return(RedirectToAction("Index"));
            }
            Wrap.User        = ActiveUser;
            Wrap.AllWeddings = _context.Weddings.Include(w => w.Guests).ThenInclude(g => g.User).Where(w => w.WeddingDate > DateTime.Now).ToList();
            Wrap.CurrentUser = (int)uId;
            return(View("Dashboard", Wrap));
        }
コード例 #20
0
        public bool EnsureIndex(IndexDefinition indexDefinition)
        {
            // Try to not rebuild index, so we check if there exists an equal defintion already
            IndexWrapper existing;

            if (IndexCache.TryGetValue(indexDefinition.Path, out existing))
            {
                if (indexDefinition.Options.Equals(existing.IndexDefinition.Options))
                {
                    // phew, existing index was already matching. bail out
                    return(false);
                }
                DropIndex(indexDefinition.Path);
            }

            // An index can not both exclude certain values and at the same time include certain values
            var hasIncludeValues = (indexDefinition.Options.IncludeValues != null) &&
                                   (indexDefinition.Options.IncludeValues.Length > 0);
            var hasExcludeValues = (indexDefinition.Options.ExcludeValues != null) &&
                                   (indexDefinition.Options.ExcludeValues.Length > 0);

            if (hasIncludeValues && hasExcludeValues)
            {
                throw new KiwiDbException("An index can not have an exclusion list and an inclusion list at the same time.");
            }

            var index = new IndexWrapper(this, indexDefinition)
            {
                IsChanged = true
            };

            IndexCache.Add(indexDefinition.Path, index);
            Insert(indexDefinition.Path, JSON.FromObject(indexDefinition));

            // rebuild index
            foreach (var record in MasterTable.Scan())
            {
                UpdateIndex(record.Key, null, record.Value);
            }
            return(true);
        }
コード例 #21
0
 public IActionResult Register(IndexWrapper newUser)
 {
     if (ModelState.IsValid)
     {
         if (_context.Users.Any(au => au.Email == newUser.UserFormModel.Email))
         {
             ModelState.AddModelError("UserFormModel.Email", "Email already in use!");
             return(Index());
         }
         PasswordHasher <User> Hasher = new PasswordHasher <User>();
         newUser.UserFormModel.Password = Hasher.HashPassword(newUser.UserFormModel, newUser.UserFormModel.Password);
         _context.Add(newUser.UserFormModel);
         _context.SaveChanges();
         HttpContext.Session.SetInt32("AcitveUser", newUser.UserFormModel.UserId);
         return(RedirectToAction("Acct", new{ id = newUser.UserFormModel.UserId }));
     }
     else
     {
         return(Index());
     }
 }
コード例 #22
0
        public IActionResult AddWedding(IndexWrapper Form)
        {
            int?uId = HttpContext.Session.GetInt32("UserId");

            if (uId == null)
            {
                return(RedirectToAction("LogReg"));
            }

            if (ModelState.IsValid)
            {
                Form.OneWedding.WeddingId = (int)uId;
                _context.Add(Form.OneWedding);
                _context.SaveChanges();
                return(Dashboard());
            }
            else
            {
                return(View("New"));
            }
        }
コード例 #23
0
        public IActionResult ProcessLogin(IndexWrapper userSubmission)
        {
            Console.WriteLine("hello world");
            if (ModelState.IsValid)
            {
                // If inital ModelState is valid, query for a user with provided email
                var userInDb = _context.Users.FirstOrDefault(u => u.Email == userSubmission.UserLogin.Email);
                // If no user exists with provided email
                if (userInDb == null)
                {
                    Console.WriteLine("got null for email");
                    // Add an error to ModelState and return to View!
                    ModelState.AddModelError("Email", "Invalid Email/Password");
                    return(View("Index"));
                }

                // Initialize hasher object
                var hasher = new PasswordHasher <UserLogin>();
                Console.WriteLine("made it to hasher");

                // verify provided password against hash stored in db
                var result = hasher.VerifyHashedPassword(userSubmission.UserLogin, userInDb.Password, userSubmission.UserLogin.Password);

                // result can be compared to 0 for failure
                if (result == 0)
                {
                    Console.WriteLine("result was null");
                    return(View("Index"));
                }
                else
                {
                    HttpContext.Session.SetInt32("UserId", userInDb.UserId);
                    return(Dashboard());
                }
            }
            else
            {
                return(View("Index"));
            }
        }
コード例 #24
0
        public IActionResult Deposit(IndexWrapper deposit)
        {
            var TheUser = _context.Users
                          .Include(um => um.UserTransaction)
                          .SingleOrDefault(um => um.UserId == deposit.TransactionFormModel.UserId);

            System.Console.WriteLine(TheUser.FirstName);
            int UserBalance = TheUser.UserTransaction.Sum(s => s.Amount);

            if (ModelState.IsValid)
            {
                if (-deposit.TransactionFormModel.Amount > UserBalance)
                {
                    ModelState.AddModelError("TransactionFormModel.Amount", "You cannot takeout more then your balance!");
                    return(View("Acct", new{ id = deposit.TransactionFormModel.UserId }));
                }
                _context.Add(deposit.TransactionFormModel);
                _context.SaveChanges();
                return(RedirectToAction("Acct", new{ id = deposit.TransactionFormModel.UserId }));
            }
            return(RedirectToAction("Acct", new{ id = deposit.TransactionFormModel.UserId }));
        }
コード例 #25
0
        public IActionResult RSVP(int id, IndexWrapper Form)
        {
            int?uId = HttpContext.Session.GetInt32("UserId");

            if (uId == null)
            {
                return(RedirectToAction("Index"));
            }

            if (ModelState.IsValid)
            {
                WeddingGuest ToAdd = new WeddingGuest {
                    UserId    = (int)uId,
                    WeddingId = id
                };
                _context.Add(ToAdd);
                _context.SaveChanges();
                return(RedirectToAction("Dashboard"));
            }
            else
            {
                return(Dashboard());
            }
        }
コード例 #26
0
        private void CreateUIRepresentation()
        {
            if (Plotter == null)
            {
                return;
            }

            if (DataSource == null)
            {
                return;
            }

            drawnPaths.Clear();

            DataSourceEnvironment environment = CreateEnvironment();
            var points = DataSource.GetPoints(environment);

            var indexedPoints = IndexWrapper.Generate(points);

            // do nothing if there is nothing to draw
            if (!points.Any())
            {
                return;
            }

            transformWhileCreateUI = Plotter.Viewport.Transform;

            int globalMinIndex;
            int globalMaxIndex;

            CreateAndAddPath(indexedPoints, out globalMinIndex, out globalMaxIndex, transformWhileCreateUI);

            indexRange = new Range <int>(globalMinIndex, globalMaxIndex);

            ViewportPanel.SetViewportBounds(canvas, Plotter.Viewport.Visible);

            // switching off content bounds calculation for children of ViewportHostPanel.
            panel.BeginBatchAdd();

            if (canvas.Parent == null)
            {
                panel.Children.Add(canvas);
            }

            if (panel.Plotter == null)
            {
                Plotter.Dispatcher.BeginInvoke(() =>
                {
                    if (panel.Plotter == null && Plotter != null)
                    {
                        Plotter.Children.Add(panel);
                    }
                });
            }

            DataRect bounds = DataRect.Empty;

            if (environment.ContentBounds != null)
            {
                bounds = environment.ContentBounds.Value;
            }
            else
            {
                // todo is this necessary?
                bounds = points.GetBounds();
            }

            Viewport2D.SetContentBounds(this, bounds);
        }
コード例 #27
0
    //performs logic flow for a FireTag, starting its actions one by one, and even calling other FireTags
    IEnumerator RunFire(int i)
    {
        var ft = fireTags[i];
        var iw = new IndexWrapper();

        if (ft.actions.Length == 0)
        {
            Fire(tform, ft.actions[iw.idx], ft.param, ft.prw);
        }
        else
        {
            for (iw.idx = 0; iw.idx < ft.actions.Length; iw.idx++)
            {
                switch (ft.actions[iw.idx].type)
                {
                case (FireActionType.Wait):
                    float waitT;
                    if (ft.actions[iw.idx].randomWait)
                    {
                        waitT = Random.Range(ft.actions[iw.idx].waitTime.x, ft.actions[iw.idx].waitTime.y);
                    }
                    else
                    {
                        waitT = ft.actions[iw.idx].waitTime.x;
                    }
                    if (ft.actions[iw.idx].rankWait)
                    {
                        waitT += BulletManager.instance.rank * ft.actions[iw.idx].waitTime.z;
                    }
                    waitT *= BulletManager.instance.timePerFrame;
                    yield return(new WaitForSeconds(waitT));

                    break;

                case (FireActionType.Fire):
                    Fire(tform, ft.actions[iw.idx], ft.param, ft.prw);
                    break;

                case (FireActionType.CallFireTag):
                    var idx = ft.actions[iw.idx].fireTagIndex - 1;

                    if (ft.actions[iw.idx].passParam)
                    {
                        fireTags[idx].param = Random.Range(ft.actions[iw.idx].paramRange.x, ft.actions[iw.idx].paramRange.y);
                    }
                    else if (ft.actions[iw.idx].passPassedParam)
                    {
                        fireTags[idx].param = ft.param;
                    }

                    if (fireTags[idx].actions.Length > 0)
                    {
                        yield return(StartCoroutine(RunFire(idx)));
                    }
                    break;

                case (FireActionType.StartRepeat):
                    yield return(StartCoroutine(RunNestedFire(i, iw)));

                    break;
                }
            }
        }
    }
コード例 #28
0
    //This is basically the same function as above but for nested FireTag actions starting of with a StartRepeat action
    // this function ends and resumes to teh above function on a EndRepeat action. There is some duplicated code,
    // but I decided to avoid any extra function calls, and completely combining these two functions is too complicated to be worth it
    IEnumerator RunNestedFire(int i, IndexWrapper iw)
    {
        var ft         = fireTags[i];
        var startIndex = iw.idx;
        var endIndex   = 0;

        var repeatC = ft.actions[iw.idx].repeatCount.x;

        if (ft.actions[iw.idx].rankRepeat)
        {
            repeatC += ft.actions[iw.idx].repeatCount.y * BulletManager.instance.rank;
        }
        repeatC = Mathf.Floor(repeatC);

        iw.idx++;

        for (var y = 0; y < repeatC; y++)
        {
            while (ft.actions[iw.idx].type != FireActionType.EndRepeat)
            {
                switch (ft.actions[iw.idx].type)
                {
                case (FireActionType.Wait):
                    float waitT;
                    if (ft.actions[iw.idx].randomWait)
                    {
                        waitT = Random.Range(ft.actions[iw.idx].waitTime.x, ft.actions[iw.idx].waitTime.y);
                    }
                    else
                    {
                        waitT = ft.actions[iw.idx].waitTime.x;
                    }
                    if (ft.actions[iw.idx].rankWait)
                    {
                        waitT += BulletManager.instance.rank * ft.actions[iw.idx].waitTime.z;
                    }
                    waitT *= BulletManager.instance.timePerFrame;
                    yield return(new WaitForSeconds(waitT));

                    break;

                case (FireActionType.Fire):
                    Fire(tform, ft.actions[iw.idx], ft.param, ft.prw);
                    break;

                case (FireActionType.CallFireTag):
                    var idx = ft.actions[iw.idx].fireTagIndex - 1;

                    if (ft.actions[iw.idx].passParam)
                    {
                        fireTags[idx].param = Random.Range(ft.actions[iw.idx].paramRange.x, ft.actions[iw.idx].paramRange.y);
                    }
                    else if (ft.actions[iw.idx].passPassedParam)
                    {
                        fireTags[idx].param = ft.param;
                    }

                    if (fireTags[idx].actions.Length > 0)
                    {
                        yield return(StartCoroutine(RunFire(idx)));
                    }
                    break;

                case (FireActionType.StartRepeat):
                    yield return(StartCoroutine(RunNestedFire(i, iw)));

                    break;
                }

                iw.idx++;
            }

            endIndex = iw.idx;
            iw.idx   = startIndex + 1;
        }

        iw.idx = endIndex;
    }
コード例 #29
0
    //performs logic flow for a FireTag, starting its actions one by one, and even calling other FireTags
    IEnumerator RunFire(int i)
    {
        var ft = fireTags[i];
        var iw = new IndexWrapper();

        if (ft.actions.Length == 0)
            Fire(tform, ft.actions[iw.idx], ft.param, ft.prw);
        else
        {
            for (iw.idx = 0; iw.idx < ft.actions.Length; iw.idx++)
            {
                switch (ft.actions[iw.idx].type)
                {
                    case (FireActionType.Wait):
                        float waitT;
                        if (ft.actions[iw.idx].randomWait)
                            waitT = Random.Range(ft.actions[iw.idx].waitTime.x, ft.actions[iw.idx].waitTime.y);
                        else
                            waitT = ft.actions[iw.idx].waitTime.x;
                        if (ft.actions[iw.idx].rankWait)
                            waitT += BulletManager.use.rank * ft.actions[iw.idx].waitTime.z;
                        waitT *= BulletManager.use.timePerFrame;
                        yield return new WaitForSeconds(waitT);
                        break;

                    case (FireActionType.Fire):
                        Fire(tform, ft.actions[iw.idx], ft.param, ft.prw);
                        break;

                    case (FireActionType.CallFireTag):
                        var idx = ft.actions[iw.idx].fireTagIndex - 1;

                        if (ft.actions[iw.idx].passParam)
                            fireTags[idx].param = Random.Range(ft.actions[iw.idx].paramRange.x, ft.actions[iw.idx].paramRange.y);
                        else if (ft.actions[iw.idx].passPassedParam)
                            fireTags[idx].param = ft.param;

                        if (fireTags[idx].actions.Length > 0)
                            yield return StartCoroutine(RunFire(idx));
                        break;

                    case (FireActionType.StartRepeat):
                        yield return StartCoroutine(RunNestedFire(i, iw));
                        break;
                }

            }
        }
    }
コード例 #30
0
    //This is basically the same function as above but for nested FireTag actions starting of with a StartRepeat action
    // this function ends and resumes to teh above function on a EndRepeat action. There is some duplicated code,
    // but I decided to avoid any extra function calls, and completely combining these two functions is too complicated to be worth it
    IEnumerator RunNestedFire(int i, IndexWrapper iw)
    {
        var ft = fireTags[i];
        var startIndex = iw.idx;
        var endIndex = 0;

        var repeatC = ft.actions[iw.idx].repeatCount.x;
        if (ft.actions[iw.idx].rankRepeat)
            repeatC += ft.actions[iw.idx].repeatCount.y * BulletManager.use.rank;
        repeatC = Mathf.Floor(repeatC);

        iw.idx++;

        for (var y = 0; y < repeatC; y++)
        {
            while (ft.actions[iw.idx].type != FireActionType.EndRepeat)
            {
                switch (ft.actions[iw.idx].type)
                {
                    case (FireActionType.Wait):
                        float waitT;
                        if (ft.actions[iw.idx].randomWait)
                            waitT = Random.Range(ft.actions[iw.idx].waitTime.x, ft.actions[iw.idx].waitTime.y);
                        else
                            waitT = ft.actions[iw.idx].waitTime.x;
                        if (ft.actions[iw.idx].rankWait)
                            waitT += BulletManager.use.rank * ft.actions[iw.idx].waitTime.z;
                        waitT *= BulletManager.use.timePerFrame;
                        yield return new WaitForSeconds(waitT);
                        break;

                    case (FireActionType.Fire):
                        Fire(tform, ft.actions[iw.idx], ft.param, ft.prw);
                        break;

                    case (FireActionType.CallFireTag):
                        var idx = ft.actions[iw.idx].fireTagIndex - 1;

                        if (ft.actions[iw.idx].passParam)
                            fireTags[idx].param = Random.Range(ft.actions[iw.idx].paramRange.x, ft.actions[iw.idx].paramRange.y);
                        else if (ft.actions[iw.idx].passPassedParam)
                            fireTags[idx].param = ft.param;

                        if (fireTags[idx].actions.Length > 0)
                            yield return StartCoroutine(RunFire(idx));
                        break;

                    case (FireActionType.StartRepeat):
                        yield return StartCoroutine(RunNestedFire(i, iw));
                        break;
                }

                iw.idx++;

            }

            endIndex = iw.idx;
            iw.idx = startIndex + 1;
        }

        iw.idx = endIndex;
    }
コード例 #31
0
 protected override IEnumerable GetDataCore()
 {
     return(Filters.Filter(IndexWrapper.Generate(collection), Environment));
 }
コード例 #32
0
        protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
        {
            base.OnCollectionChanged(e);

            // todo temp
            HandleCollectionReset();
            return;

            if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                HandleCollectionReset();
            }
            else if (e.Action == NotifyCollectionChangedAction.Add)
            {
                if (e.NewItems != null)
                {
                    Range <int> addedRange = e.GetAddedRange();

                    if (indexRange.IntersectsWith(addedRange))
                    {
                        HandleCollectionAdd(e);
                    }
                    else if (indexRange.Max == addedRange.Min - 1)                     // item was added into the end of collection
                    {
                        Path        lastPath     = drawnPaths.Last();
                        int         lastCount    = LineChartBase.GetPointsCount(lastPath);
                        Range <int> requestRange = new Range <int>(addedRange.Min - 1, addedRange.Max);

                        // have path with non-filled geometry
                        if (lastCount + addedRange.GetLength() <= pathLength)
                        {
                            canvas.Children.Remove(lastPath);
                            drawnPaths.Remove(lastPath);
                            pathsPool.Put(lastPath);
                            Range <int> lastPathRange = PointChartBase.GetIndexRange(lastPath);
                            int         min           = requestRange.Min;

                            if (min % pathLength == 0)
                            {
                                min -= 1;
                            }

                            requestRange = new Range <int>(min, addedRange.Max);
                        }

                        var points = DataSource.GetPointData(requestRange);

                        var indexedPoints = IndexWrapper.Generate(points, requestRange.Min);

                        // do nothing if there is nothing to draw
                        if (!points.Any())
                        {
                            return;
                        }

                        int minIndex;
                        int maxIndex;
                        CreateAndAddPath(indexedPoints, out minIndex, out maxIndex, transformWhileCreateUI);

                        this.indexRange = new Range <int>(indexRange.Min, maxIndex);
                    }
                    else
                    {
                        // todo
                        // do nothing?
                    }
                }
                else
                {
                    HandleCollectionReset();
                }
            }
        }
コード例 #33
0
ファイル: RCLocalProxy.cs プロジェクト: o0111/ruralcafe
        /// <summary>
        /// Construtor for LocalProxy.
        /// </summary>
        /// <param name="listenAddress">Address to listen for requests on.</param>
        /// <param name="listenPort">Port to listen for requests on.</param>
        /// <param name="httpsListenPort">Port the proxy listens on for HTTPS</param>
        /// <param name="proxyPath">Path to the proxy's executable.</param>
        /// <param name="maxCacheSize">The max cache size in bytes.</param>
        /// <param name="indexPath">Path to the proxy's index.</param>
        /// <param name="cachePath">Path to the proxy's cache.</param>
        /// <param name="wikiDumpPath">Path to the wiki dump file.</param>
        /// <param name="packagesPath">Path to the downloaded packages.</param>
        public RCLocalProxy(IPAddress listenAddress, int listenPort, int httpsListenPort, string proxyPath, string indexPath,
            long maxCacheSize, string cachePath, string wikiDumpPath, string packagesPath)
            : base(LOCAL_PROXY_NAME, listenAddress, listenPort, httpsListenPort, proxyPath,
            maxCacheSize, cachePath, packagesPath)
        {
            // The UI pages are not stored in the proxy path.
            _uiPagesPath = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar +
                 "LocalProxy" + Path.DirectorySeparatorChar +
                 "RuralCafePages" + Path.DirectorySeparatorChar;

            _wikiDumpPath = wikiDumpPath;
            _clientRequestsMap = new Dictionary<int, List<LocalRequestHandler>>();
            _requestsWithoutUser = new IntKeyedCollection<LocalRequestHandler>();
            _random = new Random();
            _averageTimePerRequest = new TimeSpan(0);

            if (_maxInflightRequests == 0)
            {
                _maxInflightRequests = Properties.Network.Default.LOCAL_MAX_INFLIGHT_REQUESTS;
            }

            _sessionManager = new SessionManager(this);

            _wikiWrapper = new WikiWrapper(wikiDumpPath);

            // The index might have been initialized by the cache when creating a new DB
            if (_indexWrapper == null)
            {
                _indexWrapper = new IndexWrapper(indexPath);
                // initialize the index
                _indexWrapper.EnsureIndexExists();
            }
            // _indexWrapper.RemoveAllDeadLinks(this);

            bool success = false;
            // initialize the wiki index
            success = _wikiWrapper.InitializeWikiIndex();
            if (!success)
            {
                _logger.Warn("Error initializing the local proxy wiki index.");
            }

            // Deserialize the queue
            DeserializeQueue();
            // Tell the program to serialize the queue before shutdown
            Program.AddShutDownDelegate(SerializeQueue);
        }