Exemple #1
0
 public Select(Expression selectItem, From.From from, Where.Where where)
 {
     SelectList = new List<Expression>();
     SelectList.Add(selectItem);
     From = from;
     Where = where;
 }
 public static ViewCardViewModel GetViewCardViewModel(int id, From from)
 {
     return new ViewCardViewModel(
         Container.Resolve<INavigationService>(),
         Container.Resolve<BaseCardProvider>(),
         Container.Resolve<ISecondaryTileService>(),
         Container.Resolve<StatisticsService>(), from, id);
 }
 public ViewCardViewModel([NotNull] INavigationService navigation, [NotNull] BaseCardProvider cardProvider,
     [NotNull] ISecondaryTileService secondaryTileService,
     [NotNull] StatisticsService statistics, From from, int id)
 {
     if (navigation == null) throw new ArgumentNullException("navigation");
     if (cardProvider == null) throw new ArgumentNullException("cardProvider");
     if (secondaryTileService == null) throw new ArgumentNullException("secondaryTileService");
     if (statistics == null) throw new ArgumentNullException("statistics");
     _navigation = navigation;
     _secondaryTileService = secondaryTileService;
     _statistics = statistics;
     Card = cardProvider.GetById(id).ToViewModel();
     _statistics.PublishViewCardPageLoaded(from == From.Tile);
 }
        public SmsHelper(string toPhoneNumber, string fromPhoneNumber, string smsText)
        {

            to = new List<To>();

            var toSms = new To { phoneNumber = toPhoneNumber };

            to.Add(toSms);

            var fromSms = new From { phoneNumber = fromPhoneNumber };

            from = fromSms;

            text = smsText;
        }
        public PagerHelper(IEnumerable<string> toExtensionNumbers, string fromExtensionNumber, string messageText)
        {

            to = new List<To>();

            foreach (var newNumber in toExtensionNumbers.Select(phoneNumber => new To { extensionNumber = phoneNumber }))
            {
                to.Add(newNumber);
            }

            var fromExtension = new From { extensionNumber = fromExtensionNumber };

            from = fromExtension;

            text = messageText;
        }
Exemple #6
0
        public static Vector2 EastFrom(From from, Transition transition, float time, Vector2 origin, Vector2 dest, float duration)
        {
            float ox = origin.X;
              float oy = origin.Y;

              switch (from)
              {
            case From.Top: oy = 0; break;
            case From.Right: ox = Game1.SCREEN_WIDTH; break;
            case From.Bottom: oy = Game1.SCREEN_HEIGHT; break;
            case From.Left: ox = 0; break;
              }

              float x = Ease(transition, time, ox, dest.X, duration);
              float y = Ease(transition, time, oy, dest.Y, duration);

              return new Vector2(x, y);
        }
 /// <summary>
 /// Gets a list of pages from any supported kind of source
 /// </summary>
 /// <param name="What">Which source to use</param>
 /// <param name="Limit">Max. number of pages to return, -1 if no limit</param>
 /// <param name="Params">Optional parameters, depend on source</param>
 /// <returns>The list of pages</returns>
 public static List<Article> FromVariant(From what, int limit, params string[] params1)
 {
     switch (what)
     {
         case From.Category:
             return FromCategory(false, params1);
         case From.CategoryRecursive:
             return FromCategory(true, params1);
         case From.Google:
             return FromGoogleSearch(params1);
         case From.ImageLinks:
             return FromImageLinks(params1);
         case From.ImagesOnPage:
             return FromImagesOnPage(params1);
         case From.WhatTranscludesThis:
             return FromTransclusionsOnPage(params1);
         case From.Listusers:
             return FromListUsers(params1[0], params1[1], limit);
         case From.Redirects:
             return FromRedirects(params1);
         case From.SpecialPage:
             return FromSpecialPage(limit, params1);
         case From.TextFile:
             return FromTextFile(params1);
         case From.UserContribs:
             return FromUserContribs(params1);
         case From.AllUserContribs:
             return FromUserContribs(true, params1);
         case From.Watchlist:
             return FromWatchList();
         case From.Whatlinkshere:
             return FromWhatLinksHere(false, params1);
         case From.WhatTranscludesHere:
             return FromWhatLinksHere(true, params1);
         case From.WikiSearch:
             return FromWikiSearch(params1);
         default:
             throw new Exception("Invalid argument to GetLists.FromVariant()");
     }
 }
Exemple #8
0
 public Select(Column[] selectItem, From.From from, OrderBy.OrderBy orderBy)
 {
     List<Expression> list = new List<Expression>();
     foreach (var c in selectItem)
     {
         this.SelectList.Add(c);
     }
     From = from;
     OrderBy = orderBy;
 }
 public bool Contains(T point)
 {
     return(From.CompareTo(point) <= 0 &&
            To.CompareTo(point) >= 0);
 }
Exemple #10
0
 public ScalarSelect(Top top, Expression selectItem, From.From from, Where.Where where, GroupBy.GroupBy groupBy, OrderBy.OrderBy orderBy)
     : base(null)
 {
     _select = new Select(top, selectItem, from, where, groupBy, orderBy);
 }
Exemple #11
0
 public GroupBy(From.From from, params Column[] items)
     : this(from, new List<Column>(items))
 {
     //
 }
Exemple #12
0
 public DateTimeToString_SmartConvertor(From from, To to)
     : base(from,to)
 {
 }
Exemple #13
0
        public async Task <string> SaveToDbAsync(SaveToDbInputModel input, string userId)
        {
            var frameId = framesRepository.All().Where(f => f.FilePath == input.Background)
                          .Select(f => f.Id).FirstOrDefault();

            var crossId = crossesRepository.All().Where(c => c.FilePath == input.Cross)
                          .Select(c => c.Id).FirstOrDefault();

            var pictureId = pictureRepository.All().Where(p => p.FilePath == input.Picture)
                            .Select(p => p.Id).FirstOrDefault();

            var crossText = crossTextsRepository.All()
                            .Where(ct => ct.Text == input.CrossText)
                            .FirstOrDefault();

            var afterCrossText = afterCrossTextsRepository.All()
                                 .Where(act => act.Text == input.AfterCrossText)
                                 .FirstOrDefault();

            var fullName = fullNamesRepository.All()
                           .Where(fn => fn.Name == input.FullName)
                           .FirstOrDefault();

            var year = yearsRepository.All().Where(y => y.Text == input.Year).FirstOrDefault();

            var textTemplate = textTemplatesRepository.All()
                               .Where(t => t.Text == input.MainText).FirstOrDefault();

            var panahida = panahidasRepository.All()
                           .Where(p => p.Text == input.Panahida).FirstOrDefault();

            var from = fromsRepository.All()
                       .Where(f => f.Text == input.FromWhere).FirstOrDefault();

            var obituary = new Obituary
            {
                UserId    = userId,
                FrameId   = frameId,
                CrossId   = crossId,
                PictureId = pictureId,
            };

            if (afterCrossText == null)
            {
                afterCrossText = new AfterCrossText
                {
                    Text = input.AfterCrossText
                };
            }
            obituary.AfterCrossTexts = afterCrossText;

            if (crossText == null)
            {
                crossText = new CrossText
                {
                    Text = input.CrossText
                };
            }
            obituary.CrossTexts = crossText;

            if (fullName == null)
            {
                fullName = new FullName
                {
                    Name = input.FullName
                };
            }
            obituary.FullNames = fullName;

            if (year == null)
            {
                year = new Year
                {
                    Text = input.Year
                };
            }
            obituary.Years = year;

            if (textTemplate == null)
            {
                var customText = new CustomText
                {
                    Text = input.MainText
                };
                obituary.CustomText = customText;
            }
            else
            {
                obituary.TextTemplate = textTemplate;
            }

            if (panahida == null)
            {
                panahida = new Panahida
                {
                    Text = input.Panahida
                };
            }
            obituary.Panahidas = panahida;

            if (from == null)
            {
                from = new From
                {
                    Text = input.FromWhere
                };
            }
            obituary.Froms = from;

            var userObituary = new UserObituary
            {
                Obituary = obituary,
                UserId   = userId
            };

            await obituaryRepository.AddAsync(obituary);

            await userObituaryRepository.AddAsync(userObituary);

            await obituaryRepository.SaveChangesAsync();

            return(obituary.Id);
        }
        public static IRoutingBuilder AddAccountsController(this IRoutingBuilder builder, AccountsRoleConfiguration roles)
        {
            builder.AddController <AccountsController>(controller =>
            {
                controller.AddRoute("accounts", c => c.Create(From.Body <CreateAccountRequest>()))
                .HttpPost();

                controller.AddRoute("accounts", c => c.Read())
                .HttpGet()
                .Authorize();

                controller.AddRoute("accounts", c => c.Update(From.Body <UpdateAccountRequest>()))
                .HttpPut()
                .Authorize();

                controller.AddRoute("accounts", c => c.Delete(From.Any <DeleteAccountRequest>()))
                .HttpDelete()
                .Authorize();

                controller.AddRoute("admin/accounts", c => c.AdminRead(From.Query <FilterRequest>()))
                .HttpGet()
                .Authorize(roles.Admin);

                controller.AddRoute("admin/accounts/{accountId}", c => c.AdminReadById(From.Route <int>()))
                .HttpGet()
                .Authorize(roles.Admin);

                controller.AddRoute("admin/accounts/{accountId}",
                                    c => c.AdminUpdateById(From.Route <int>(), From.Body <AdminUpdateByIdAccountRequest>()))
                .HttpPut()
                .Authorize(roles.Admin);

                controller.AddRoute("admin/accounts/{accountId}", c => c.AdminDeleteById(From.Route <AdminDeleteByIdAccountRequest>()))
                .HttpDelete()
                .Authorize(roles.Admin);
            });

            return(builder);
        }
Exemple #15
0
        public IDateRange GetPreviousRange()
        {
            var prevFirstDate = From.AddDays(-1).GetMonthFirstDate();

            return(new RangeMonthToDate(prevFirstDate, _dayCount));
        }
Exemple #16
0
        public IDateRange GetNextRange()
        {
            var nextFirstDate = From.GetMonthLastDate().AddDays(1);

            return(new RangeMonthToDate(nextFirstDate, _dayCount));
        }
Exemple #17
0
        /// <summary>
        ///     Returns the unit health when the spell hits the unit.
        /// </summary>
        public float GetHealthPrediction(Obj_AI_Base unit)
        {
            var time = (int)(Delay * 1000 + From.Distance(unit.ServerPosition) / Speed - 100);

            return(HealthPrediction.GetHealthPrediction(unit, time));
        }
 public bool Overlaps(Interval <T> other)
 {
     return(From.CompareTo(other.To) <= 0 &&
            To.CompareTo(other.From) >= 0);
 }
 public bool Contains(Interval <T> other)
 {
     return(From.CompareTo(other.From) <= 0 &&
            To.CompareTo(other.To) >= 0);
 }
Exemple #20
0
 protected internal OrderBy(List<OrderByExpression> orderByExpressions, From.From from)
 {
     _orderByExpressions = new List<OrderByExpression>(orderByExpressions);
     From = from;
 }
Exemple #21
0
 protected internal OrderBy(List<OrderByExpression> orderByExpressions, From.From from, Where.Where where, GroupBy.GroupBy groupBy)
     : this(orderByExpressions, from, groupBy)
 {
     Where = where;
 }
Exemple #22
0
 public override string ToString()
 {
     return
         ($"{Select?.ToString()} {From?.ToString()} {Where?.ToString()} {GroupBy?.ToString()} {OrderBy?.ToString()} {Skip?.ToString()} {Take?.ToString()}");
 }
Exemple #23
0
 /// <inheritdoc/>
 protected override (Vector3?, Vector3?) GetParsedValues()
 {
     return(To?.ToVector3(), From?.ToVector3());
 }
Exemple #24
0
        protected override void StartLoop(NativeActivityContext context)
        {
            var SelectorString = Selector.Get(context);

            SelectorString = OpenRPA.Interfaces.Selector.Selector.ReplaceVariables(SelectorString, context.DataContext);
            var sel     = new JavaSelector(SelectorString);
            var timeout = Timeout.Get(context);

            if (Timeout == null || Timeout.Expression == null)
            {
                timeout = TimeSpan.FromSeconds(3);
            }
            var maxresults = MaxResults.Get(context);
            var minresults = MinResults.Get(context);
            var from       = From.Get(context);

            if (maxresults < 1)
            {
                maxresults = 1;
            }
            if (timeout.Minutes > 5 || timeout.Hours > 1)
            {
                Activity _Activity = null;
                try
                {
                    var strProperty = context.GetType().GetProperty("Activity", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                    var strGetter   = strProperty.GetGetMethod(nonPublic: true);
                    _Activity = (Activity)strGetter.Invoke(context, null);
                }
                catch (Exception)
                {
                }
                if (_Activity != null)
                {
                    Log.Warning("Timeout for Activity " + _Activity.Id + " is above 5 minutes, was this the intention ? calculated value " + timeout.ToString());
                }
                else
                {
                    Log.Warning("Timeout for on of your Java.GetElements is above 5 minutes, was this the intention ? calculated value " + timeout.ToString());
                }
            }

            JavaElement[] elements = { };
            var           sw       = new Stopwatch();

            sw.Start();
            do
            {
                var selector = new JavaSelector(SelectorString);
                elements = JavaSelector.GetElementsWithuiSelector(selector, from, maxresults);
            } while (elements.Count() == 0 && sw.Elapsed < timeout);
            Log.Debug(string.Format("OpenRPA.Java::GetElement::found {1} elements in {0:mm\\:ss\\.fff}", sw.Elapsed, elements.Count()));
            if (elements.Count() > maxresults)
            {
                elements = elements.Take(maxresults).ToArray();
            }
            if (elements.Count() < minresults)
            {
                Log.Selector(string.Format("Windows.GetElement::Failed locating " + minresults + " item(s) {0:mm\\:ss\\.fff}", sw.Elapsed));
                throw new ElementNotFoundException("Failed locating " + minresults + " item(s)");
            }
            context.SetValue(Elements, elements);
            IEnumerator <JavaElement> _enum = elements.ToList().GetEnumerator();

            context.SetValue(_elements, _enum);
            bool more = _enum.MoveNext();

            if (more)
            {
                IncIndex(context);
                SetTotal(context, elements.Length);
                context.ScheduleAction(Body, _enum.Current, OnBodyComplete);
            }
        }
Exemple #25
0
 public GroupBy(From.From from, Where.Where where, params Column[] items)
     : this(from, where, new List<Column>(items))
 {
     //
 }
 /// <inheritdoc/>
 protected override (Quaternion?, Quaternion?) GetParsedValues()
 {
     return(To?.ToQuaternion(), From?.ToQuaternion());
 }
Exemple #27
0
 public ScalarSelect(Top top, Expression selectItem, From.From from, Where.Where where)
     : base(null)
 {
     _select = new Select(null, selectItem, from, where);
 }
Exemple #28
0
 public Select(Top top, List<Expression> selectList, From.From from, Where.Where where, GroupBy.GroupBy groupBy)
     : this(top, selectList, from, where)
 {
     GroupBy = groupBy;
 }
Exemple #29
0
 internal override void WriteSql(StringBuilder sqlText)
 {
     sqlText.Append("SELECT ");
     if (Distinct)
     {
         sqlText.Append("DISTINCT ");
     }
     if (Projection != null)
     {
         Projection.WriteSql(sqlText);
     }
     else
     {
         if (ColumnsToProject.Count == 0)
         {
             sqlText.Append("1");                              // Could be arbitrary, let's pick 1
         }
         else
         {
             bool first = true;
             foreach (var column in ColumnsToProject)
             {
                 if (!first)
                 {
                     sqlText.Append(", ");
                 }
                 else
                 {
                     first = false;
                 }
                 sqlText.Append(SqlBaseGenerator.QuoteIdentifier(column.Key.Item1));
                 sqlText.Append(".");
                 sqlText.Append(SqlBaseGenerator.QuoteIdentifier(column.Key.Item2));
                 if (column.Key.Item2 != column.Value)
                 {
                     sqlText.Append(" AS ");
                     sqlText.Append(SqlBaseGenerator.QuoteIdentifier(column.Value));
                 }
             }
         }
     }
     sqlText.Append(" FROM ");
     From.WriteSql(sqlText);
     if (Where != null)
     {
         Where.WriteSql(sqlText);
     }
     if (GroupBy != null)
     {
         GroupBy.WriteSql(sqlText);
     }
     if (OrderBy != null)
     {
         OrderBy.WriteSql(sqlText);
     }
     if (Skip != null)
     {
         Skip.WriteSql(sqlText);
     }
     if (Limit != null)
     {
         Limit.WriteSql(sqlText);
     }
     base.WriteSql(sqlText);
 }
Exemple #30
0
 public Select(List<Expression> selectedItems, From.From from, Where.Where where, GroupBy.GroupBy groupBy)
     : this(selectedItems, from, where)
 {
     GroupBy = groupBy;
 }
Exemple #31
0
 /// <summary>
 /// Hash code
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     return(From.GetHashCode() + (To ?? default(DateTime)).GetHashCode());
 }
Exemple #32
0
        protected override void StartLoop(NativeActivityContext context)
        {
            WindowsCacheExtension ext = context.GetExtension <WindowsCacheExtension>();
            var sw = new Stopwatch();

            sw.Start();
            Log.Selector(string.Format("Windows.GetElement::begin {0:mm\\:ss\\.fff}", sw.Elapsed));

            UIElement[] elements = null;
            var         selector = Selector.Get(context);

            selector = OpenRPA.Interfaces.Selector.Selector.ReplaceVariables(selector, context.DataContext);
            var sel        = new WindowsSelector(selector);
            var timeout    = Timeout.Get(context);
            var maxresults = MaxResults.Get(context);
            var minresults = MinResults.Get(context);

            if (maxresults < 1)
            {
                maxresults = 1;
            }
            var interactive = Interactive.Get(context);
            var from        = From.Get(context);
            int failcounter = 0;

            if (timeout.Minutes > 5 || timeout.Hours > 1)
            {
                Activity _Activity = null;
                try
                {
                    var strProperty = context.GetType().GetProperty("Activity", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                    var strGetter   = strProperty.GetGetMethod(nonPublic: true);
                    _Activity = (Activity)strGetter.Invoke(context, null);
                }
                catch (Exception)
                {
                }
                if (_Activity != null)
                {
                    Log.Warning("Timeout for Activity " + _Activity.Id + " is above 5 minutes, was this the intention ? calculated value " + timeout.ToString());
                }
                else
                {
                    Log.Warning("Timeout for on of your Windows.GetElements is above 5 minutes, was this the intention ? calculated value " + timeout.ToString());
                }
            }
            do
            {
                if (ClearCache != null && ClearCache.Get(context))
                {
                    Log.Selector(string.Format("Windows.GetElement::Clearing windows element cache {0:mm\\:ss\\.fff}", sw.Elapsed));
                    WindowsSelectorItem.ClearCache();
                }
                if (PluginConfig.get_elements_in_different_thread)
                {
                    elements = OpenRPA.AutomationHelper.RunSTAThread <UIElement[]>(() =>
                    {
                        try
                        {
                            Log.Selector(string.Format("Windows.GetElement::GetElementsWithuiSelector in non UI thread {0:mm\\:ss\\.fff}", sw.Elapsed));
                            return(WindowsSelector.GetElementsWithuiSelector(sel, from, maxresults, ext));
                        }
                        catch (System.Threading.ThreadAbortException)
                        {
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex.ToString());
                        }
                        return(new UIElement[] { });
                    }, PluginConfig.search_timeout).Result;
                }
                else
                {
                    Log.Selector(string.Format("Windows.GetElement::GetElementsWithuiSelector using UI thread {0:mm\\:ss\\.fff}", sw.Elapsed));
                    elements = WindowsSelector.GetElementsWithuiSelector(sel, from, maxresults, ext);
                    if (elements == null || elements.Length == 0)
                    {
                        elements = WindowsSelector.GetElementsWithuiSelector(sel, from, maxresults, ext);
                    }
                }
                //elements = WindowsSelector.GetElementsWithuiSelector(sel, from, maxresults);
                if (elements == null)
                {
                    elements = new UIElement[] { };
                }
                if (elements.Length == 0)
                {
                    Log.Selector(string.Format("Windows.GetElement::Found no elements {0:mm\\:ss\\.fff}", sw.Elapsed));
                    failcounter++;
                }
                if (failcounter > 2)
                {
                    WindowsSelectorItem.ClearCache();
                }
            } while (elements != null && elements.Length == 0 && sw.Elapsed < timeout);
            if (PluginConfig.get_elements_in_different_thread && elements.Length > 0)
            {
                // Get them again, we need the COM objects to be loaded in the UI thread
                elements = WindowsSelector.GetElementsWithuiSelector(sel, from, maxresults, ext);
            }
            context.SetValue(Elements, elements);

            var lastelements = context.GetValue(_lastelements);

            if (lastelements == null)
            {
                lastelements = new UIElement[] { }
            }
            ;
            context.SetValue(_lastelements, elements);
            if ((elements.Length + lastelements.Length) < minresults)
            {
                Log.Selector(string.Format("Windows.GetElement::Failed locating " + minresults + " item(s) {0:mm\\:ss\\.fff}", sw.Elapsed));
                throw new ElementNotFoundException("Failed locating " + minresults + " item(s)");
            }
            IEnumerator <UIElement> _enum = elements.ToList().GetEnumerator();
            bool more = _enum.MoveNext();

            if (lastelements.Length == elements.Length && lastelements.Length > 0)
            {
                more = !System.Collections.StructuralComparisons.StructuralEqualityComparer.Equals(lastelements, elements);
            }
            if (more)
            {
                if (interactive)
                {
                    var testelement = _enum.Current;
                    Wait.UntilResponsive(testelement.RawElement, PluginConfig.search_timeout);
                }
                context.SetValue(_elements, _enum);
                context.SetValue(_sw, sw);
                Log.Selector(string.Format("Windows.GetElement::end:: call ScheduleAction: {0:mm\\:ss\\.fff}", sw.Elapsed));
                IncIndex(context);
                SetTotal(context, elements.Length);
                context.ScheduleAction <UIElement>(Body, _enum.Current, OnBodyComplete);
            }
            else
            {
                Log.Selector(string.Format("Windows.GetElement:end {0:mm\\:ss\\.fff}", sw.Elapsed));
            }
        }
Exemple #33
0
 public Select(List<Expression> selectList, From.From from, Where.Where where)
 {
     SelectList = selectList;
     From = from;
     Where = where;
 }
Exemple #34
0
 /// <summary>
 /// For en grei stringrepresentasjon av Periode for debugging.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return($"Period: {From.ToShortDateString()}, To: {To?.ToShortDateString() ?? " (null)"}");
 }
Exemple #35
0
 public Select(Top top, Expression selectItem, From.From from, Where.Where where, GroupBy.GroupBy groupBy)
     : this(top, selectItem, from, where)
 {
     GroupBy = groupBy;
 }
        public override void OnTick()
        {
            if (From.DebugSniffer != null)
            {
                From.DebugSniffer.SendMessage("PredatorAI::OnTick");
            }
            if (From.AIState == AIStates.Attack && From.AttackTarget != null)
            {
                if (From.Distance(From.AttackTarget) > 30 * 30 * 2)
                {
                    From.AIState      = AIStates.LookingForPrey;
                    From.AttackTarget = null;
                    return;
                }
            }

            /*
             *      if ( From.AttackTarget == null || From.AttackTarget.Dead )
             *              foreach( Character c in World.allConnectedChars )
             *              {
             *                      float dist = From.Distance( c );
             *                      bool canSee = From.CanSee( c );
             *                      if ( canSee && c.Visible && !c.Dead && dist < 30 * 30 * 2 )
             *                      {
             *                              From.AIState = AIStates.BeingAttacked;
             *                              From.AttackTarget = (Mobile)c;
             *                              if ( From.DebugSniffer != null )
             *                                      From.DebugSniffer.SendMessage( "PredatorAI::OnTick::SeePrey" );
             *                              return;
             *                      }
             *              }*/
            if (From.AttackTarget == null || From.AttackTarget.Dead)
            {
                ArrayList mobs = From.KnownObjects();
                foreach (Object o in mobs)
                {
                    if (o is Mobile)
                    {
                        Mobile mob = o as Mobile;
                        if (From.Distance(mob) < MaxViewDistance && Utility.Random4() == 0 && From.IsHostile(mob) && From.CanSee(mob) &&
                            !mob.Dead)
                        {
                            From.AIState      = AIStates.BeingAttacked;
                            From.AttackTarget = mob;
                            return;
                        }
                    }
                }
            }
            switch (AIState)
            {
            case AIStates.DoingNothing:
                //	retour a l'ai par defaut
                AIState      = AIStates.Pause1;
                From.Running = false;
                break;

            case AIStates.LookingForPrey:
                AIState = AIStates.Pause1;
                break;

            case AIStates.Pause1:
                break;
            }
        }
Exemple #37
0
 public Select(List<Expression> selectedItems, From.From from, Where.Where where, GroupBy.GroupBy groupBy, Having.Having having)
     : this(selectedItems, from, where, groupBy)
 {
     Having = having;
 }
 protected bool Equals(WorkingHours other)
 {
     return(Enabled.Equals(other.Enabled) && From.Equals(other.From) && To.Equals(other.To));
 }
Exemple #39
0
 public Select(Expression selectItem, From.From from, OrderBy.OrderBy orderBy)
     : this(null, selectItem, from, null, orderBy)
 {
     //
 }
Exemple #40
0
        protected override void StartLoop(NativeActivityContext context)
        {
            var selector = Selector.Get(context);

            selector = OpenRPA.Interfaces.Selector.Selector.ReplaceVariables(selector, context.DataContext);
            var sel        = new NMSelector(selector);
            var timeout    = Timeout.Get(context);
            var from       = From.Get(context);
            var maxresults = MaxResults.Get(context);
            var minresults = MinResults.Get(context);

            if (maxresults < 1)
            {
                maxresults = 1;
            }
            NMElement[] elements = { };
            var         sw       = new Stopwatch();

            sw.Start();
            string browser = sel.browser;

            if (WaitForReady.Get(context))
            {
                if (from != null)
                {
                    browser = from.browser;
                }
                DoWaitForReady(browser);
            }
            var allelements = context.GetValue(_allelements);

            if (allelements == null)
            {
                allelements = new NMElement[] { }
            }
            ;

            var s = new NMSelectorItem(sel[0]);

            if (!string.IsNullOrEmpty(s.url))
            {
                var tab = NMHook.FindTabByURL(browser, s.url);
                if (tab != null)
                {
                    if (!tab.highlighted || !tab.selected)
                    {
                        var _tab = NMHook.selecttab(browser, tab.id);
                    }
                }
            }

            do
            {
                elements = NMSelector.GetElementsWithuiSelector(sel, from, maxresults);
                Log.Selector("BEGIN:: I have " + elements.Count() + " elements, and " + allelements.Count() + " in all elements");

                // allelements = allelements.Concat(elements).ToArray();
                if (allelements.Length > 0)
                {
                    var newelements = new List <NMElement>();
                    for (var i = elements.Length - 1; i >= 0; i--)
                    {
                        var element = elements[i];
                        if (!allelements.Contains(element))
                        {
                            newelements.Insert(0, element);
                        }
                    }
                    elements = newelements.ToArray();
                    //if(elements.Count() > 20)
                    //{
                    //    for(var i=0; i < allelements.Length && i < elements.Length; i++)
                    //    {
                    //        if (!eq.Equals(allelements[i], elements[i]) || allelements[i].GetHashCode() != elements[i].GetHashCode())
                    //        {
                    //            Log.Output(allelements[i].GetHashCode() + " / " + elements[i].GetHashCode());
                    //        }

                    //    }

                    //}
                }
            } while (elements.Count() == 0 && sw.Elapsed < timeout);
            if (elements.Count() > maxresults)
            {
                elements = elements.Take(maxresults).ToArray();
            }

            if ((elements.Length + allelements.Length) < minresults)
            {
                Log.Selector(string.Format("Windows.GetElement::Failed locating " + minresults + " item(s) {0:mm\\:ss\\.fff}", sw.Elapsed));
                throw new ElementNotFoundException("Failed locating " + minresults + " item(s)");
            }



            IEnumerator <NMElement> _enum = elements.ToList().GetEnumerator();
            bool more = _enum.MoveNext();

            //if (lastelements.Length == elements.Length && lastelements.Length > 0)
            //{
            //    var eq = new Activities.NMEqualityComparer();
            //    more = !System.Collections.StructuralComparisons.StructuralEqualityComparer.Equals(lastelements, elements);
            //}
            if (more)
            {
                allelements = allelements.Concat(elements).ToArray();
                var eq = new Activities.NMEqualityComparer();
                allelements = allelements.Distinct(eq).ToArray();

                //var allelementslength = allelements.Length;
                //Array.Resize(ref allelements, allelements.Length + elements.Length);
                //Array.Copy(elements, 0, allelements, allelementslength, elements.Length);
            }

            context.SetValue(_allelements, allelements);
            context.SetValue(Elements, allelements);
            Log.Selector("END:: I have " + elements.Count() + " elements, and " + allelements.Count() + " in all elements");

            if (more)
            {
                context.SetValue(_elements, _enum);
                IncIndex(context);
                SetTotal(context, allelements.Length);
                context.ScheduleAction(Body, _enum.Current, OnBodyComplete);
            }
        }
Exemple #41
0
 protected internal OrderBy(List<OrderByExpression> orderByExpressions, From.From from, Where.Where where)
     : this(orderByExpressions, from)
 {
     Where = where;
 }
Exemple #42
0
 public override int GetHashCode()
 {
     return(From.GetHashCode() + To.GetHashCode());
 }
Exemple #43
0
 protected internal OrderBy(List<OrderByExpression> orderByExpressions, From.From from, GroupBy.GroupBy groupBy)
     : this(orderByExpressions, from)
 {
     GroupBy = groupBy;
 }
 public override string ToString()
 {
     return(From.ToString() + ";" + To.ToString());
 }
Exemple #45
0
 public DateTimeToString_SmartConvertor(From from)
     : base(from)
 {
 }
Exemple #46
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (Url != null)
            {
                p.Add(new KeyValuePair <string, string>("Url", Url.AbsoluteUri.TrimEnd('/')));
            }

            if (ApplicationSid != null)
            {
                p.Add(new KeyValuePair <string, string>("ApplicationSid", ApplicationSid.ToString()));
            }

            if (Method != null)
            {
                p.Add(new KeyValuePair <string, string>("Method", Method.ToString()));
            }

            if (FallbackUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackUrl", FallbackUrl.AbsoluteUri.TrimEnd('/')));
            }

            if (FallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("FallbackMethod", FallbackMethod.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/')));
            }

            if (StatusCallbackEvent != null)
            {
                p.AddRange(StatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("StatusCallbackEvent", prop)));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            if (SendDigits != null)
            {
                p.Add(new KeyValuePair <string, string>("SendDigits", SendDigits));
            }

            if (IfMachine != null)
            {
                p.Add(new KeyValuePair <string, string>("IfMachine", IfMachine));
            }

            if (Timeout != null)
            {
                p.Add(new KeyValuePair <string, string>("Timeout", Timeout.Value.ToString()));
            }

            if (Record != null)
            {
                p.Add(new KeyValuePair <string, string>("Record", Record.Value.ToString().ToLower()));
            }

            if (RecordingChannels != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingChannels", RecordingChannels));
            }

            if (RecordingStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallback", RecordingStatusCallback));
            }

            if (RecordingStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallbackMethod", RecordingStatusCallbackMethod.ToString()));
            }

            if (SipAuthUsername != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthUsername", SipAuthUsername));
            }

            if (SipAuthPassword != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthPassword", SipAuthPassword));
            }

            if (MachineDetection != null)
            {
                p.Add(new KeyValuePair <string, string>("MachineDetection", MachineDetection));
            }

            if (MachineDetectionTimeout != null)
            {
                p.Add(new KeyValuePair <string, string>("MachineDetectionTimeout", MachineDetectionTimeout.Value.ToString()));
            }

            return(p);
        }
Exemple #47
0
 public GroupBy(From.From from, List<Column> items)
     : this(from, null, items)
 {
     //
 }
Exemple #48
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public override List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (ParentCallSid != null)
            {
                p.Add(new KeyValuePair <string, string>("ParentCallSid", ParentCallSid.ToString()));
            }

            if (Status != null)
            {
                p.Add(new KeyValuePair <string, string>("Status", Status.ToString()));
            }

            if (StartTime != null)
            {
                p.Add(new KeyValuePair <string, string>("StartTime", Serializers.DateTimeIso8601(StartTime)));
            }
            else
            {
                if (StartTimeBefore != null)
                {
                    p.Add(new KeyValuePair <string, string>("StartTime<", Serializers.DateTimeIso8601(StartTimeBefore)));
                }

                if (StartTimeAfter != null)
                {
                    p.Add(new KeyValuePair <string, string>("StartTime>", Serializers.DateTimeIso8601(StartTimeAfter)));
                }
            }

            if (EndTime != null)
            {
                p.Add(new KeyValuePair <string, string>("EndTime", Serializers.DateTimeIso8601(EndTime)));
            }
            else
            {
                if (EndTimeBefore != null)
                {
                    p.Add(new KeyValuePair <string, string>("EndTime<", Serializers.DateTimeIso8601(EndTimeBefore)));
                }

                if (EndTimeAfter != null)
                {
                    p.Add(new KeyValuePair <string, string>("EndTime>", Serializers.DateTimeIso8601(EndTimeAfter)));
                }
            }

            if (PageSize != null)
            {
                p.Add(new KeyValuePair <string, string>("PageSize", PageSize.ToString()));
            }

            return(p);
        }
Exemple #49
0
 public GroupBy(From.From from, Where.Where where, List<Column> items)
 {
     From = from;
     Where = where;
     Items = items;
 }
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", StatusCallback.AbsoluteUri.TrimEnd('/')));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            if (StatusCallbackEvent != null)
            {
                p.AddRange(StatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("StatusCallbackEvent", prop)));
            }

            if (Timeout != null)
            {
                p.Add(new KeyValuePair <string, string>("Timeout", Timeout.Value.ToString()));
            }

            if (Record != null)
            {
                p.Add(new KeyValuePair <string, string>("Record", Record.Value.ToString().ToLower()));
            }

            if (Muted != null)
            {
                p.Add(new KeyValuePair <string, string>("Muted", Muted.Value.ToString().ToLower()));
            }

            if (Beep != null)
            {
                p.Add(new KeyValuePair <string, string>("Beep", Beep));
            }

            if (StartConferenceOnEnter != null)
            {
                p.Add(new KeyValuePair <string, string>("StartConferenceOnEnter", StartConferenceOnEnter.Value.ToString().ToLower()));
            }

            if (EndConferenceOnExit != null)
            {
                p.Add(new KeyValuePair <string, string>("EndConferenceOnExit", EndConferenceOnExit.Value.ToString().ToLower()));
            }

            if (WaitUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("WaitUrl", WaitUrl.AbsoluteUri.TrimEnd('/')));
            }

            if (WaitMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("WaitMethod", WaitMethod.ToString()));
            }

            if (EarlyMedia != null)
            {
                p.Add(new KeyValuePair <string, string>("EarlyMedia", EarlyMedia.Value.ToString().ToLower()));
            }

            if (MaxParticipants != null)
            {
                p.Add(new KeyValuePair <string, string>("MaxParticipants", MaxParticipants.Value.ToString()));
            }

            if (ConferenceRecord != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceRecord", ConferenceRecord));
            }

            if (ConferenceTrim != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceTrim", ConferenceTrim));
            }

            if (ConferenceStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceStatusCallback", ConferenceStatusCallback.AbsoluteUri.TrimEnd('/')));
            }

            if (ConferenceStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceStatusCallbackMethod", ConferenceStatusCallbackMethod.ToString()));
            }

            if (ConferenceStatusCallbackEvent != null)
            {
                p.AddRange(ConferenceStatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("ConferenceStatusCallbackEvent", prop)));
            }

            if (RecordingChannels != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingChannels", RecordingChannels));
            }

            if (RecordingStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallback", RecordingStatusCallback.AbsoluteUri.TrimEnd('/')));
            }

            if (RecordingStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("RecordingStatusCallbackMethod", RecordingStatusCallbackMethod.ToString()));
            }

            if (SipAuthUsername != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthUsername", SipAuthUsername));
            }

            if (SipAuthPassword != null)
            {
                p.Add(new KeyValuePair <string, string>("SipAuthPassword", SipAuthPassword));
            }

            if (Region != null)
            {
                p.Add(new KeyValuePair <string, string>("Region", Region));
            }

            if (ConferenceRecordingStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceRecordingStatusCallback", ConferenceRecordingStatusCallback.AbsoluteUri.TrimEnd('/')));
            }

            if (ConferenceRecordingStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceRecordingStatusCallbackMethod", ConferenceRecordingStatusCallbackMethod.ToString()));
            }

            return(p);
        }
 /// <summary>
 /// Gets a list of pages from any supported kind of source
 /// </summary>
 /// <param name="What">Which source to use</param>
 /// <param name="Params">Optional parameters, depend on source</param>
 /// <returns>The list of pages</returns>
 public static List<Article> FromVariant(From what, params string[] params1)
 {
     return FromVariant(what, -1, params1);
 }
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (MessagingServiceSid != null)
            {
                p.Add(new KeyValuePair <string, string>("MessagingServiceSid", MessagingServiceSid.ToString()));
            }

            if (Body != null)
            {
                p.Add(new KeyValuePair <string, string>("Body", Body));
            }

            if (MediaUrl != null)
            {
                p.AddRange(MediaUrl.Select(prop => new KeyValuePair <string, string>("MediaUrl", Serializers.Url(prop))));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", Serializers.Url(StatusCallback)));
            }

            if (ApplicationSid != null)
            {
                p.Add(new KeyValuePair <string, string>("ApplicationSid", ApplicationSid.ToString()));
            }

            if (MaxPrice != null)
            {
                p.Add(new KeyValuePair <string, string>("MaxPrice", MaxPrice.Value.ToString()));
            }

            if (ProvideFeedback != null)
            {
                p.Add(new KeyValuePair <string, string>("ProvideFeedback", ProvideFeedback.Value.ToString().ToLower()));
            }

            if (ValidityPeriod != null)
            {
                p.Add(new KeyValuePair <string, string>("ValidityPeriod", ValidityPeriod.ToString()));
            }

            if (SmartEncoded != null)
            {
                p.Add(new KeyValuePair <string, string>("SmartEncoded", SmartEncoded.Value.ToString().ToLower()));
            }

            if (InteractiveData != null)
            {
                p.Add(new KeyValuePair <string, string>("InteractiveData", InteractiveData));
            }

            if (ForceOptIn != null)
            {
                p.Add(new KeyValuePair <string, string>("ForceOptIn", ForceOptIn.Value.ToString().ToLower()));
            }

            return(p);
        }
Exemple #53
0
 public ScalarSelect(Expression selectItem, From.From from, Where.Where where)
     : this(null, selectItem, from, where)
 {
     //
 }
Exemple #54
0
 public override string ToString()
 {
     return($"{Color} {From.GetNumber(Color)} -> {To.GetNumber(Color)}");
 }
Exemple #55
0
 public ScalarSelect(Expression selectItem, From.From from, Where.Where where, OrderBy.OrderBy orderBy)
     : this(null, selectItem, from, where, orderBy)
 {
     //
 }
 /// <summary>
 /// Returns the text representation of the value formatted according to the NNTP specifications.
 /// </summary>
 /// <returns>The text representation of the value formatted according to the NNTP specifications</returns>
 public override string ToString() =>
 To == null ? $"{From}-" : (To.Value == From ? From.ToString() : $"{From}-{To.Value}");
Exemple #57
0
 public Where(From.From from, Expression expression)
 {
     From = from;
     SearchCondition = expression;
 }
Exemple #58
0
 private bool Equals(MetricsGossipEnvelope other)
 {
     return(From.Equals(other.From) && Gossip.Equals(other.Gossip) && Reply.Equals(other.Reply));
 }
Exemple #59
0
        protected override void SetUp()
        {
            base.SetUp();

            string sql =
                @"CREATE TABLE [dbo].[Tests](
	[chi] [varchar](10) NULL,
	[Date] [datetime] NULL,
	[hb_extract] [varchar](1) NULL,
	[TestId] [int] NOT NULL,
 CONSTRAINT [PK_Tests] PRIMARY KEY CLUSTERED 
(
	[TestId] ASC
)
) 

GO

CREATE TABLE [dbo].[Results](
	[TestId] [int] NOT NULL,
	[Measure] [varchar](10) NOT NULL,
	[Value] [int] NULL,
 CONSTRAINT [PK_Results] PRIMARY KEY CLUSTERED 
(
	[TestId] ASC,
	[Measure] ASC
)
)

GO

ALTER TABLE [dbo].[Results]  WITH CHECK ADD  CONSTRAINT [FK_Results_Tests] FOREIGN KEY([TestId])
REFERENCES [dbo].[Tests] ([TestId])
GO";

            var server = From.Server;

            using (var con = server.GetConnection())
            {
                con.Open();
                UsefulStuff.ExecuteBatchNonQuery(sql, con);
            }

            var importer1 = new TableInfoImporter(CatalogueRepository, From.ExpectTable("Tests"));
            var importer2 = new TableInfoImporter(CatalogueRepository, From.ExpectTable("Results"));

            importer1.DoImport(out t1, out c1);

            importer2.DoImport(out t2, out c2);

            var engineer1 = new ForwardEngineerCatalogue(t1, c1, true);
            var engineer2 = new ForwardEngineerCatalogue(t2, c2, true);

            engineer1.ExecuteForwardEngineering(out cata1, out cataItems1, out eis1);
            engineer2.ExecuteForwardEngineering(out cata2, out cataItems2, out eis2);

            new JoinInfo(CatalogueRepository,
                         c1.Single(e => e.GetRuntimeName().Equals("TestId")),
                         c2.Single(e => e.GetRuntimeName().Equals("TestId")),
                         ExtractionJoinType.Left, null);

            _anoTable = new ANOTable(CatalogueRepository, ANOStore_ExternalDatabaseServer, "ANOTes", "T");
            _anoTable.NumberOfCharactersToUseInAnonymousRepresentation = 10;
            _anoTable.SaveToDatabase();
            _anoTable.PushToANOServerAsNewTable("int", new ThrowImmediatelyCheckNotifier());

            _comboCata = new Catalogue(CatalogueRepository, "Combo Catalogue");

            //pk
            var ciTestId  = new CatalogueItem(CatalogueRepository, _comboCata, "TestId");
            var colTestId = c1.Single(c => c.GetRuntimeName().Equals("TestId"));

            ciTestId.ColumnInfo_ID = colTestId.ID;
            ciTestId.SaveToDatabase();
            var eiTestId = new ExtractionInformation(CatalogueRepository, ciTestId, colTestId, colTestId.Name);

            //Measure
            var ciMeasure  = new CatalogueItem(CatalogueRepository, _comboCata, "Measuree");
            var colMeasure = c2.Single(c => c.GetRuntimeName().Equals("Measure"));

            ciMeasure.ColumnInfo_ID = colMeasure.ID;
            ciMeasure.SaveToDatabase();
            var eiMeasure = new ExtractionInformation(CatalogueRepository, ciMeasure, colMeasure, colMeasure.Name);

            //Date
            var ciDate = new CatalogueItem(CatalogueRepository, _comboCata, "Dat");

            var colDate = c1.Single(c => c.GetRuntimeName().Equals("Date"));

            ciDate.ColumnInfo_ID = colDate.ID;
            ciDate.SaveToDatabase();
            var eiDate = new ExtractionInformation(CatalogueRepository, ciDate, colDate, colDate.Name);

            _destinationDatabase = To;
        }
Exemple #60
0
 public bool IsFrom(STerminal terminal)
 {
     return(From.Equals(terminal));
 }