public void AddPolygon(int count, IEnumerable<int> indices, int? tag)
        {
            PrevalidateGeometry();

            //Error out on polygons not matching, for the sake of being consistent with AW and other RWX loaders.
            if(indices.Count() != count)
            {
                throw new InvalidOperationException("Polygon vertex count mismatch.");
            }

            _currentMeshGeometry.Faces.Add(new Face
                                               {
                                                   Indices = indices.ToList(),
                                                   MaterialId = _model.AddMaterial(_currentMaterial),
                                                   Tag = tag,
                                                   Triangles = TessellatePolygon(indices).ToList()
                                               });

            if(_currentMaterial.MaterialMode == MaterialMode.Double)
            {
                _currentMeshGeometry.Faces.Add(new Face
                {
                    Indices = indices.Reverse().ToList(),
                    MaterialId = _model.AddMaterial(_currentMaterial),
                    Tag = tag,
                    Triangles = TessellatePolygon(indices.Reverse()).ToList()
                });
            }
        }
Ejemplo n.º 2
0
        public IActionResult NotificationsPartial(string sort, int page)
        {
            int  entitiesPerPage = 10;
            User owner           = userRepo.GetByEmail(User.Identity.Name);

            IEnumerable <Notification> notifications = notificationRepo.GetAllByUserId(owner.Id);

            if (sort == "track")
            {
                notifications = notifications.Where(n => n.Type == NotificationType.PriceTrack);
            }
            else if (sort == "purchase")
            {
                notifications = notifications.Where(n => n.Type == NotificationType.Purchase);
            }
            else if (sort == "order")
            {
                notifications = notifications.Where(n => n.Type == NotificationType.Sale);
            }
            else if (sort == "report")
            {
                notifications = notifications.Where(n => n.Type == NotificationType.Report);
            }

            List <Notification> list = notifications?.Reverse().Skip((page - 1) * entitiesPerPage).Take(entitiesPerPage).ToList();
            int pageAmount           = (int)Math.Ceiling(list.Count() / (double)entitiesPerPage);

            Console.WriteLine(pageAmount);

            NotificationsVM vm = new NotificationsVM(list, page, pageAmount);

            return(PartialView(vm));
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Implementation using kill
		/// </summary>
		/// <param name="pids"></param>
		internal static void KillImpl (IEnumerable<int> pids)
		{
			using (Process quit = new Process ()) {
				quit.StartInfo.FileName = "kill";
				quit.StartInfo.Arguments = "-QUIT ";
				foreach (int pid in pids.Reverse()) {
					quit.StartInfo.Arguments += pid.ToString () + " ";
				}
				quit.StartInfo.UseShellExecute = false;
				quit.Start ();

				if (!quit.WaitForExit (1000 * 15 /* 15 seconds */))
					throw new ApplicationException (string.Format ("The 'kill -QUIT' process didn't exit in 15 seconds."));
			}
			using (Process kill = new Process ()) {
				kill.StartInfo.FileName = "kill";
				kill.StartInfo.Arguments = "-9 ";
				foreach (int pid in pids) {
					kill.StartInfo.Arguments += pid.ToString () + " ";
				}
				kill.StartInfo.UseShellExecute = false;
				kill.Start ();

				if (!kill.WaitForExit (1000 * 15 /* 15 seconds */))
					throw new ApplicationException (string.Format ("The 'kill' process didn't exit in 15 seconds."));
			}
		}
Ejemplo n.º 4
0
 static public MotionParam KeyboardPressCombined(
     this IEnumerable <VirtualKeyCode> setKey) =>
 new MotionParam
 {
     KeyDown = setKey?.ToArray(),
     KeyUp   = setKey?.Reverse()?.ToArray(),
 };
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="indexPath">The path of indexes from the root <c>content.json</c> to this patch; see <see cref="IPatch.IndexPath"/>.</param>
        /// <param name="path">The path to the patch from the root content file.</param>
        /// <param name="assetName">The normalized asset name to intercept.</param>
        /// <param name="conditions">The conditions which determine whether this patch should be applied.</param>
        /// <param name="fromAsset">The asset key to load from the content pack instead.</param>
        /// <param name="fromArea">The map area from which to read tiles.</param>
        /// <param name="patchMode">Indicates how the map should be patched.</param>
        /// <param name="toArea">The map area to overwrite.</param>
        /// <param name="mapProperties">The map properties to change when editing a map, if any.</param>
        /// <param name="mapTiles">The map tiles to change when editing a map.</param>
        /// <param name="addWarps">The warps to add to the location.</param>
        /// <param name="textOperations">The text operations to apply to existing values.</param>
        /// <param name="updateRate">When the patch should be updated.</param>
        /// <param name="contentPack">The content pack which requested the patch.</param>
        /// <param name="parentPatch">The parent patch for which this patch was loaded, if any.</param>
        /// <param name="monitor">Encapsulates monitoring and logging.</param>
        /// <param name="reflection">Simplifies access to private code.</param>
        /// <param name="normalizeAssetName">Normalize an asset name.</param>
        public EditMapPatch(int[] indexPath, LogPathBuilder path, IManagedTokenString assetName, IEnumerable <Condition> conditions, IManagedTokenString fromAsset, TokenRectangle fromArea, TokenRectangle toArea, PatchMapMode patchMode, IEnumerable <EditMapPatchProperty> mapProperties, IEnumerable <EditMapPatchTile> mapTiles, IEnumerable <IManagedTokenString> addWarps, IEnumerable <TextOperation> textOperations, UpdateRate updateRate, IContentPack contentPack, IPatch parentPatch, IMonitor monitor, IReflectionHelper reflection, Func <string, string> normalizeAssetName)
            : base(
                indexPath: indexPath,
                path: path,
                type: PatchType.EditMap,
                assetName: assetName,
                fromAsset: fromAsset,
                conditions: conditions,
                updateRate: updateRate,
                contentPack: contentPack,
                parentPatch: parentPatch,
                normalizeAssetName: normalizeAssetName
                )
        {
            this.FromArea       = fromArea;
            this.ToArea         = toArea;
            this.PatchMode      = patchMode;
            this.MapProperties  = mapProperties?.ToArray() ?? new EditMapPatchProperty[0];
            this.MapTiles       = mapTiles?.ToArray() ?? new EditMapPatchTile[0];
            this.AddWarps       = addWarps?.Reverse().ToArray() ?? new IManagedTokenString[0]; // reversing the warps allows later ones to 'overwrite' earlier ones, since the game checks them in the listed order
            this.TextOperations = textOperations?.ToArray() ?? new TextOperation[0];
            this.Monitor        = monitor;
            this.Reflection     = reflection;

            this.Contextuals
            .Add(this.FromArea)
            .Add(this.ToArea)
            .Add(this.MapProperties)
            .Add(this.MapTiles)
            .Add(this.AddWarps)
            .Add(this.TextOperations);
        }
    public void VisitNodes( IEnumerable<DependencyObject> nodes )
    {
      if( nodes == null )
        return;

      m_collection.AddRange( nodes.Reverse() );
    }
 /// <summary>Creates a new instance of the <see cref="T:System.Net.Http.HttpClient" /> which should be pipelined.</summary>
 /// <returns>A new instance of the <see cref="T:System.Net.Http.HttpClient" /> which should be pipelined.</returns>
 /// <param name="innerHandler">The inner handler which is responsible for processing the HTTP response messages.</param>
 /// <param name="handlers">The list of HTTP handler that delegates the processing of HTTP response messages to another handler.</param>
 public static HttpMessageHandler CreatePipeline(HttpMessageHandler innerHandler, IEnumerable<DelegatingHandler> handlers)
 {
     if (innerHandler == null)
     {
         throw Error.ArgumentNull("innerHandler");
     }
     if (handlers == null)
     {
         return innerHandler;
     }
     HttpMessageHandler handler = innerHandler;
     foreach (DelegatingHandler handler2 in handlers.Reverse<DelegatingHandler>())
     {
         if (handler2 == null)
         {
             // todo: reenable error throw
             throw Error.Argument("handlers", FSR.DelegatingHandlerArrayContainsNullItem, new object[] { typeof(DelegatingHandler).Name });
         }
         if (handler2.InnerHandler != null)
         {
             // todo: reenable error throw
             throw Error.Argument("handlers", FSR.DelegatingHandlerArrayHasNonNullInnerHandler, new object[] { typeof(DelegatingHandler).Name, "InnerHandler", handler2.GetType().Name });
         }
         handler2.InnerHandler = handler;
         handler = handler2;
     }
     return handler;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates an instance of an <see cref="HttpMessageHandler"/> using the <see cref="DelegatingHandler"/> instances
        /// provided by <paramref name="handlers"/>. The resulting pipeline can be used to manually create <see cref="HttpClient"/>
        /// or <see cref="HttpMessageInvoker"/> instances with customized message handlers.
        /// </summary>
        /// <param name="innerHandler">The inner handler represents the destination of the HTTP message channel.</param>
        /// <param name="handlers">An ordered list of <see cref="DelegatingHandler"/> instances to be invoked as part 
        /// of sending an <see cref="HttpRequestMessage"/> and receiving an <see cref="HttpResponseMessage"/>.
        /// The handlers are invoked in a top-down fashion. That is, the first entry is invoked first for 
        /// an outbound request message but last for an inbound response message.</param>
        /// <returns>The HTTP message channel.</returns>
        public static HttpMessageHandler CreatePipeline(HttpMessageHandler innerHandler, IEnumerable<DelegatingHandler> handlers)
        {
            if (innerHandler == null)
            {
                throw Error.ArgumentNull("innerHandler");
            }

            if (handlers == null)
            {
                return innerHandler;
            }

            // Wire handlers up in reverse order starting with the inner handler
            HttpMessageHandler pipeline = innerHandler;
            IEnumerable<DelegatingHandler> reversedHandlers = handlers.Reverse();
            foreach (DelegatingHandler handler in reversedHandlers)
            {
                if (handler == null)
                {
                    throw Error.Argument("handlers", Properties.Resources.DelegatingHandlerArrayContainsNullItem, typeof(DelegatingHandler).Name);
                }

                if (handler.InnerHandler != null)
                {
                    throw Error.Argument("handlers", Properties.Resources.DelegatingHandlerArrayHasNonNullInnerHandler, typeof(DelegatingHandler).Name, "InnerHandler", handler.GetType().Name);
                }

                handler.InnerHandler = pipeline;
                pipeline = handler;
            }

            return pipeline;
        }
Ejemplo n.º 9
0
        public static SchedulerStats GatherOveralStatistics(IEnumerable<WorkItem> _work)
        {
            var stats = new SchedulerStats();

            stats.CurrentJobs = _work
                .Reverse()
                .Select(x => new SchedulerJobStats
                   {
                        WorkKey = x.WorkKey,
                        Description = x.Description,
                        CurrentStatus = (SchedulerJobStatus)x.Status,
                        LastRunStarted = x.LastStart,
                        LastRunCompleted = x.LastComplete,
                        PreviousRuns = x.PreviousRuns.Select(xx => new SchedulerJobRunStats
                        {
                            Started = xx.Started,
                            Completed = xx.Completed,
                            Result = (SchedulerJobRunResult)xx.Result,
                            ResultMessage = xx.ResultMessage
                        }).ToList()
                    }).ToList();

            stats.PendingJobs = stats.CurrentJobs.Count(x => x.CurrentStatus == SchedulerJobStatus.Pending);
            stats.RunningJobs = stats.CurrentJobs.Count(x => x.CurrentStatus == SchedulerJobStatus.Running);
            stats.ScheduledJobs = stats.CurrentJobs.Count(x => x.CurrentStatus == SchedulerJobStatus.Scheduled);

            return stats;
        }
Ejemplo n.º 10
0
        static void run(IEnumerable<String> filePaths)
        {
            var p = new Parser();
            var modules = new Dictionary<String, IReadOnlyList<IClassItem>>();
            foreach (var path in filePaths.Reverse())
            {
                Contract.Assume(path != null);
                var txt = File.ReadAllText(path);
                var items = p.Parse(txt, ValidationList);
                modules.Add(Path.GetFileNameWithoutExtension(path), items.Cast<IClassItem>().ToList());
            }

            var preludeTxt = File.ReadAllText(libPath + "prelude.ef");
            var preludeTxtItems = p.Parse(preludeTxt, ValidationList);

            var rw = new Rewriter();
            var prog = rw.MakeProgram(preludeTxtItems.Cast<Declr>().ToList(), modules);

            var n = new Namer();
            n.Name(prog, ValidationList);

            var ti = new TypeInferer();
            ti.VisitDeclr(prog.GlobalModule);

            var i = new Interpreter();
            var res = i.Run(prog, ValidationList);
            Console.Write("Result: ");
            Console.WriteLine(res.Accept(DefaultPrinter));
        }
        /// <summary>
        /// Convert a list of digits into a number.
        /// </summary>
        /// <param name="DigitsToConvertToANumber">Digits to convert to a number</param>
        /// <returns>The combined number</returns>
        private static int ArrayOfSingleDigitsToNumber(IEnumerable<int> DigitsToConvertToANumber)
        {
            //ie:
            //[0] = 3
            //[1] = 5
            //[2] = 7
            // ==> 357

            //tally
            var RunningTally = 0;

            //what we multiple with
            var MultiplyValue = 1;

            //loop through all of them and multiple everything
            foreach (var Digit in DigitsToConvertToANumber.Reverse())
            {
                //multiply and add it
                RunningTally += Digit * MultiplyValue;

                //now multiple by 10
                MultiplyValue *= 10;
            }

            //return the result
            return RunningTally;
        }
Ejemplo n.º 12
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="indexPath">The path of indexes from the root <c>content.json</c> to this patch; see <see cref="IPatch.IndexPath"/>.</param>
        /// <param name="path">The path to the patch from the root content file.</param>
        /// <param name="assetName">The normalized asset name to intercept.</param>
        /// <param name="conditions">The conditions which determine whether this patch should be applied.</param>
        /// <param name="fromAsset">The asset key to load from the content pack instead.</param>
        /// <param name="fromArea">The map area from which to read tiles.</param>
        /// <param name="patchMode">Indicates how the map should be patched.</param>
        /// <param name="toArea">The map area to overwrite.</param>
        /// <param name="mapProperties">The map properties to change when editing a map, if any.</param>
        /// <param name="mapTiles">The map tiles to change when editing a map.</param>
        /// <param name="addWarps">The warps to add to the location.</param>
        /// <param name="textOperations">The text operations to apply to existing values.</param>
        /// <param name="updateRate">When the patch should be updated.</param>
        /// <param name="contentPack">The content pack which requested the patch.</param>
        /// <param name="parentPatch">The parent patch for which this patch was loaded, if any.</param>
        /// <param name="monitor">Encapsulates monitoring and logging.</param>
        /// <param name="parseAssetName">Parse an asset name.</param>
        public EditMapPatch(int[] indexPath, LogPathBuilder path, IManagedTokenString assetName, IEnumerable <Condition> conditions, IManagedTokenString?fromAsset, TokenRectangle?fromArea, TokenRectangle?toArea, PatchMapMode patchMode, IEnumerable <EditMapPatchProperty>?mapProperties, IEnumerable <EditMapPatchTile>?mapTiles, IEnumerable <IManagedTokenString>?addWarps, IEnumerable <ITextOperation>?textOperations, UpdateRate updateRate, IContentPack contentPack, IPatch?parentPatch, IMonitor monitor, Func <string, IAssetName> parseAssetName)
            : base(
                indexPath: indexPath,
                path: path,
                type: PatchType.EditMap,
                assetName: assetName,
                fromAsset: fromAsset,
                conditions: conditions,
                updateRate: updateRate,
                contentPack: contentPack,
                parentPatch: parentPatch,
                parseAssetName: parseAssetName
                )
        {
            this.FromArea       = fromArea;
            this.ToArea         = toArea;
            this.PatchMode      = patchMode;
            this.MapProperties  = mapProperties?.ToArray() ?? Array.Empty <EditMapPatchProperty>();
            this.MapTiles       = mapTiles?.ToArray() ?? Array.Empty <EditMapPatchTile>();
            this.AddWarps       = addWarps?.Reverse().ToArray() ?? Array.Empty <IManagedTokenString>(); // reversing the warps allows later ones to 'overwrite' earlier ones, since the game checks them in the listed order
            this.TextOperations = textOperations?.ToArray() ?? Array.Empty <ITextOperation>();
            this.Monitor        = monitor;

            this.Contextuals
            .Add(this.FromArea)
            .Add(this.ToArea)
            .Add(this.MapProperties)
            .Add(this.MapTiles)
            .Add(this.AddWarps)
            .Add(this.TextOperations);
        }
Ejemplo n.º 13
0
        public static void BreathFirstStep <T>(this IEnumerable <ITree <T> > ext, Action <ITree <T> > reduce, bool rootToLeaf = true, bool leftToRight = true)
        {
            if (ext == null || ext.Count() == 0)
            {
                return;
            }

            IEnumerable <ITree <T> > items = (leftToRight ?
                                              ext : ext?.Reverse()) ?? new List <ITree <T> >();

            if (rootToLeaf)
            {
                foreach (ITree <T> item in items)
                {
                    reduce(item);
                }
            }

            (ext?.SelectMany(p => p.Branches) ?? new List <ITree <T> >()).BreathFirstStep(reduce, rootToLeaf, leftToRight);

            if (!rootToLeaf)
            {
                foreach (ITree <T> item in items)
                {
                    reduce(item);
                }
            }
        }
Ejemplo n.º 14
0
        internal string ExpandString(IEnumerable<object> expandedValues)
        {
            expandedValues = expandedValues.Reverse();
            var exValEnumerator = expandedValues.GetEnumerator();

            var resultStr = new StringBuilder();
            string rest = Value;

            // we expand this string in reversed order so we don't need to adjust start indexes
            foreach (var item in NestedExpressions.Reverse())
            {
                if (!exValEnumerator.MoveNext())
                {
                    break;
                }
                // first find the relative position of the expandable part inside our string
                string value = LanguagePrimitives.ConvertTo<string>(exValEnumerator.Current);
                var relStart = item.Extent.StartOffset - Extent.StartOffset - 1;
                var relEnd = item.Extent.EndOffset - Extent.StartOffset - 1;
                // the end are constant words between this expression and the last resolved expression
                // we need to resolve escape constants before adding it
                var resolvedEnd = StringExpressionHelper.ResolveEscapeCharacters(rest.Substring(relEnd), StringConstantType);
                // as we do it in reverse order: insert at the beginning, in reverse order
                resultStr.Insert(0, resolvedEnd).Insert(0, value);
                // finally strip the rest which needs to be expanded
                rest = rest.Substring(0, relStart);
            }
            // now insert the rest at the beginning (other constant string)
            resultStr.Insert(0, StringExpressionHelper.ResolveEscapeCharacters(rest, StringConstantType));
            return resultStr.ToString();
        }
Ejemplo n.º 15
0
		/// <summary>
		/// Creates a set of new Sound Resources based on the specified AudioData, saves it and returns references to it.
		/// The incoming AudioData is automatically grouped to the least number of Sounds, according to naming and path conventions.
		/// </summary>
		/// <param name="baseRes"></param>
		/// <returns></returns>
		public static List<ContentRef<Sound>> CreateMultipleFromAudioData(IEnumerable<ContentRef<AudioData>> baseRes)
		{
			char[] trimEndChars = new []{'0','1','2','3','4','5','6','7','8','9','_','-','.','#','~'};
			List<ContentRef<AudioData>> sourceData = baseRes.Reverse().ToList();
			List<ContentRef<Sound>> result = new List<ContentRef<Sound>>();

			// Split data into singular data and grouped data
			while (sourceData.Count > 0)
			{
				ContentRef<AudioData> data = sourceData[sourceData.Count - 1];
				string mutualName = data.Name.TrimEnd(trimEndChars);
				string mutualDir = System.IO.Path.GetDirectoryName(data.Path);

				// Group similar AudioData
				List<ContentRef<AudioData>> localGroup = new List<ContentRef<AudioData>>();
				for (int i = sourceData.Count - 1; i >= 0; i--)
				{
					if (System.IO.Path.GetDirectoryName(sourceData[i].Path) != mutualDir) continue;
					if (!sourceData[i].Name.StartsWith(mutualName)) continue;
					localGroup.Add(sourceData[i]);
					sourceData.RemoveAt(i);
				}
				result.Add(Sound.CreateFromAudioData(localGroup, localGroup.Count > 1 ? mutualName : null));
			}

			return result;
		}
 public static List<MinimalJobStats> GatherCurrentJobs(IEnumerable<JobItem> work, string filter)
 {
     return work
         .Reverse()
         .Where(x =>
         {
             if (String.IsNullOrWhiteSpace(filter) || filter == "all")
             {
                 return true;
             }
             if (filter == "running" && x.Status == JobStatus.Running)
             {
                 return true;
             }
             if (filter == "failing" && GatherJobHealth(x) == JobHealth.Bad)
             {
                 return true;
             }
             return false;
         })
         .Select(x => new MinimalJobStats
         {
             JobKey = x.JobKey,
             Description = x.Description,
             CurrentStatus = (InlineScheduler.JobStatus)x.Status,
             Health = GatherJobHealth(x),
             Report = GatherJobReport(x)
         }).ToList();
 }
Ejemplo n.º 17
0
 public virtual void InsertToCheckUpdateQueue(IEnumerable <string> productIds, bool forceCheckUpdate = false)
 {
     foreach (var productId in productIds?.Reverse() ?? Enumerable.Empty <string>())
     {
         InsertToCheckUpdateQueue(productId, forceCheckUpdate);
     }
 }
Ejemplo n.º 18
0
        public ForecastEntry Forecast(IEnumerable<DataEntry> dataEntries, int period, dynamic strategyParameters)
        {
            if (period - 1 < 0)
                return null;

            int numberOfPeriods = strategyParameters.PeriodCount;

            if (numberOfPeriods > dataEntries.Count())
                throw new ArgumentException("The number of periods can not be greater than the number of entries.");

            double value;

            if (dataEntries.Count() == 1 || period == 1)
                value = dataEntries.ElementAt(0).Value;
            else if (period < numberOfPeriods)
                value = dataEntries.ElementAt(period - 1).Value;
            else if (dataEntries.Count() > 1 && period <= dataEntries.Count() + 1)
                value =
                    dataEntries.Take(period - 1).Reverse().Take(numberOfPeriods).Reverse().Sum(entry => (entry.Value))/
                    numberOfPeriods;
            else
                value = dataEntries.Reverse().Take(numberOfPeriods).Reverse().Sum(entry => (entry.Value))/
                        numberOfPeriods;

            return new ForecastEntry
                {
                    Period = period,
                    DataEntry = period > dataEntries.Count() ? dataEntries.Last() : dataEntries.ElementAt(period - 1),
                    ForecastValue = value,
                    ConfidenceIntervalLow = value,
                    ConfidenceIntervalHigh = value,
                    IsHoldout = period > dataEntries.Count()*0.7 //holdout data is always 70 percent
                };
        }
Ejemplo n.º 19
0
		/// <summary>
		/// Inserts a group of instructions after the target instruction
		/// </summary>
		public static void InsertAfter(this Mono.Cecil.Cil.ILProcessor processor, Instruction target, IEnumerable<Instruction> instructions)
		{
			foreach (var instruction in instructions.Reverse())
			{
				processor.InsertAfter(target, instruction);
			}
		}
Ejemplo n.º 20
0
		public void AddRange(Player player, IEnumerable<Card> cardCollection, DeckPosition deckPosition)
		{
			switch (deckPosition)
			{
				case DeckPosition.Top:
					_Cards.InsertRange(0, cardCollection.Reverse());
					break;
				case DeckPosition.Bottom:
					_Cards.AddRange(cardCollection);
					break;
			}
			this.Sort();

			if (cardCollection.Count() > 0)
			{
				if (_AsynchronousChanging)
				{
					if (_AsynchronousPileChangedEventArgs == null)
						_AsynchronousPileChangedEventArgs = new PileChangedEventArgs(player, PileChangedEventArgs.Operation.Added, cardCollection);
					else
						_AsynchronousPileChangedEventArgs.AddedCards.AddRange(cardCollection);
				}
				else if (PileChanged != null)
				{
					lock (PileChanged)
					{
						PileChangedEventArgs pcea = new PileChangedEventArgs(player, PileChangedEventArgs.Operation.Added, cardCollection);
						PileChanged(this, pcea);
					}
				}
			}
		}
Ejemplo n.º 21
0
 public EsiFragmentParser(
     IReadOnlyDictionary <string, IEsiFragmentParser> parsers,
     IEnumerable <IFragmentParsePipeline> pipelines)
 {
     _parsers   = parsers ?? throw new ArgumentNullException(nameof(parsers));
     _pipelines = pipelines?.Reverse().ToArray() ?? throw new ArgumentNullException(nameof(pipelines));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Standard constructor
 /// </summary>
 public RationalPolynom(IEnumerable <BigRational> items)
 {
     m_Items = items
               ?.Reverse()
               ?.SkipWhile(x => x == 0)
               ?.Reverse()
               ?.ToList() ?? throw new ArgumentNullException(nameof(items));
 }
Ejemplo n.º 23
0
 static public MotionResult KeyboardPressCombined(
     this IHostToScript sanderling,
     IEnumerable <VirtualKeyCode> setKey) =>
 sanderling?.MotionExecute(new Motor.MotionParam()
 {
     KeyDown = setKey?.ToArray(),
     KeyUp   = setKey?.Reverse()?.ToArray(),
 });
Ejemplo n.º 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptReader"/> class.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        public ScriptReader(IEnumerable<string> tokens)
        {
            #region Contract
            // Contract.Requires<ArgumentNullException>(tokens != null);
            #endregion

            this.tokens = new Stack<string>(tokens.Reverse());
        }
Ejemplo n.º 25
0
 public static IArrayFunctionInstance ToInstance(IEnumerable<IFunctionInstance> enumerable)
 {
     IArrayFunctionInstance tail = ArrayTailFunction.Instance;
     foreach (IFunctionInstance t in enumerable.Reverse()) {
         tail = new ArrayHeadTailFunctionInstance (t, tail);
     }
     return tail;
 }
 public static int Insert(this Collection<Instruction> collection, int index, IEnumerable<Instruction> instructions)
 {
     foreach (var instruction in instructions.Reverse())
     {
         collection.Insert(index, instruction);
     }
     return index + instructions.Count();
 }
Ejemplo n.º 27
0
 private static IDictionary<string, object> NamedArgumentsToDictionary(IEnumerable<string> argumentNames, IEnumerable<object> args)
 {
     return argumentNames
         .Reverse()
         .Zip(args.Reverse(), (k, v) => new KeyValuePair<string, object>(k, v))
         .Reverse()
         .ToDictionary(StringComparer.InvariantCultureIgnoreCase);
 }
Ejemplo n.º 28
0
 public TMSimulation(TM machine, IEnumerable<Character> chars)
 {
     this.CurrentState = machine.BeginState;
     foreach (Character c in chars.Reverse()) {
         RStack.Push (c);
     }
     this.Fix ();
 }
Ejemplo n.º 29
0
 public static void Insert(this MethodBody body, int index, IEnumerable<Instruction> instructions)
 {
     instructions = instructions.Reverse();
     foreach (var instruction in instructions)
     {
         body.Instructions.Insert(index, instruction);
     }
 }
Ejemplo n.º 30
0
 public static IDictionary<string, object> ArgumentsToDictionary(this InvokeMemberBinder binder, IEnumerable<object> args)
 {
     return args.Reverse()
         .Zip(binder.CallInfo.ArgumentNames.Reverse().ExtendInfinite(), (v, k) => new KeyValuePair<string, object>(k, v))
         .Reverse()
         .Select((kvp, i) => kvp.Key == null ? new KeyValuePair<string, object>("_" + i.ToString(), kvp.Value) : kvp)
         .ToDictionary();
 }
Ejemplo n.º 31
0
    public static Expression AggregateExpressionsIntoTuple (IEnumerable<Expression> expressions)
    {
      ArgumentUtility.CheckNotNull ("expressions", expressions);

      return expressions
          .Reverse ()
          .Aggregate ((current, expression) => CreateTupleExpression (expression, current));
    }
Ejemplo n.º 32
0
 private static IDictionary<string, object> NamedArgumentsToDictionary(IEnumerable<string> argumentNames, IEnumerable<object> args)
 {
     return argumentNames
         .Reverse()
         .Zip(args.Reverse(), (k, v) => new KeyValuePair<string, object>(k, v))
         .Reverse()
         .ToDictionary();
 }
Ejemplo n.º 33
0
 public void Beweeg(IEnumerable<Point> stack)
 {
     foreach (var point in stack.Reverse())
     {
         _queue.Enqueue(point);
     }
     Start();
 }
Ejemplo n.º 34
0
 internal static IDictionary<string, object> NamedArgumentsToDictionary(this InvokeMemberBinder binder, IEnumerable<object> args)
 {
     return binder.CallInfo.ArgumentNames
         .Reverse()
         .Zip(args.Reverse(), (k, v) => new KeyValuePair<string, object>(k, v))
         .Reverse()
         .ToDictionary();
 }
Ejemplo n.º 35
0
 public static int CalculateSuccessInARow(PersonSetting personSetting, IEnumerable<BuildStatus> allActiveBuildDefinitionsOrderedChronoligically)
 {
     return allActiveBuildDefinitionsOrderedChronoligically
         .Reverse()
         .Where(i => i.RequestedBy == personSetting.RawName)
         .TakeWhile(i => i.BuildStatusEnum != BuildStatusEnum.Broken)
         .Count();
 }
Ejemplo n.º 36
0
 public void AddSupPops(IEnumerable<SubPop> pops)
 {
     this._speciesContainer.SuspendLayout();
     foreach (SubPop sp in pops.Reverse())
     {
         this.AddSubPop(sp);
     }
     this._speciesContainer.ResumeLayout(false);
 }
    public ISymbolicDataAnalysisModel Backtransform(ISymbolicDataAnalysisModel model, IEnumerable<ITransformation> transformations, string targetVariable) {
      var symbolicModel = (ISymbolicDataAnalysisModel)model.Clone();

      foreach (var transformation in transformations.Reverse()) {
        ApplyBacktransformation(transformation, symbolicModel.SymbolicExpressionTree, targetVariable);
      }

      return symbolicModel;
    }
Ejemplo n.º 38
0
		/// <summary>
		/// Restores every window in the list that is minimized
		/// </summary>
		/// <param name="windows">
		/// A <see cref="IEnumerable"/>
		/// </param>
		public static void RestoreWindows (IEnumerable<Window> windows)
		{
			foreach (Window window in windows.Reverse ()) {
				if (window.IsInViewport (window.Screen.ActiveWorkspace) && window.IsMinimized) {
					window.Unminimize (Gtk.Global.CurrentEventTime);
					System.Threading.Thread.Sleep (SleepTime);
				}
			}
		}
Ejemplo n.º 39
0
        public static string Fill(
            this string src,
            IEnumerable <QueryParams>?queryParams
            )
        {
            if (queryParams?.Any() == false || string.IsNullOrEmpty(src))
            {
                return(src);
            }

            Dictionary <string, int> varNameCount = new();

            var paramList = queryParams?.Reverse()
                            .SelectMany(x =>
            {
                var dicParams = x.DataModel?.GetDataModelParameters();
                return(Regex.Matches(src, x.OpenMarker + QueryParams.RegexPattern + x.CloseMarker)
                       .Cast <Match>()
                       .Select(x => x.Groups["param"].Value)
                       .Where(x => !string.IsNullOrWhiteSpace(x))
                       .Distinct()
                       .Select(varName => new
                {
                    VarName = varName,
                    NestedParamName =
                        $"@vxv_{(varNameCount.ContainsKey(varName) ? ++varNameCount[varName] : varNameCount[varName] = 1) }_{varName}"
                    ,
                    x.OpenMarker,
                    x.CloseMarker,
                    x.NullReplacement,
                    Value = dicParams?.ContainsKey(varName) == true ? dicParams[varName] : null
                }));
            }).ToList();

            if (paramList?.Count > 0)
            {
                foreach (var item in paramList)
                {
                    if (item.Value == null)
                    {
                        src = src
                              .Replace(item.OpenMarker + item.VarName + item.CloseMarker,
                                       item.NullReplacement, true,
                                       CultureInfo.InstalledUICulture);
                    }
                    else
                    {
                        src = src
                              .Replace(item.OpenMarker + item.VarName + item.CloseMarker,
                                       item.Value.ToString(), true,
                                       CultureInfo.InvariantCulture);
                    }
                }
            }
            return(src);
        }
Ejemplo n.º 40
0
 public HttpLoader(
     HttpClientFactory httpClientFactory,
     HttpRequestMessageFactory httpRequestMessageFactory,
     IEnumerable <IHttpLoaderPipeline> pipelines,
     Log log)
 {
     _httpClientFactory         = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
     _httpRequestMessageFactory = httpRequestMessageFactory ?? throw new ArgumentNullException(nameof(httpRequestMessageFactory));
     _log       = log ?? throw new ArgumentNullException(nameof(log));
     _pipelines = pipelines?.Reverse().ToArray() ?? throw new ArgumentNullException(nameof(pipelines));
 }
Ejemplo n.º 41
0
        public IActionResult Notifications()
        {
            int  entitiesPerPage = 10;
            User owner           = userRepo.GetByEmail(User.Identity.Name);

            IEnumerable <Notification> notifications = notificationRepo.GetAllByUserId(owner.Id);

            List <Notification> list = notifications?.Reverse().Take(entitiesPerPage).ToList();
            int pageAmount           = (int)Math.Ceiling(list.Count() / (double)entitiesPerPage);

            NotificationsVM vm = new NotificationsVM(list, 1, pageAmount);

            return(View(vm));
        }
Ejemplo n.º 42
0
        public static int GetSequenceHashDirected <T>(this IEnumerable <T> items)
        {
            var hash = items.GetSequenceHash();

            var reverseHash = items?
                              .Reverse()
                              .GetSequenceHash() ?? 0;

            var result = hash < reverseHash
                ? hash
                : reverseHash;

            return(result);
        }
Ejemplo n.º 43
0
        public void OrderShapesBy(Type type = Type.Area, OrderBy orderBy = OrderBy.Asc)
        {
            IEnumerable <Shape> result = type switch
            {
                Type.Area => _shapes.OrderBy(x => x.Area),
                Type.Perimeter => _shapes.OrderBy(x => x.Perimeter),
                _ => null
            };

            if (orderBy == OrderBy.Desc)
            {
                _shapes = result?.Reverse().ToList();
            }

            _shapes = result?.ToList();
        }
Ejemplo n.º 44
0
 static IEnumerable <T> MirrorAndFuse <T>(IEnumerable <T> l) =>
 l.Concat(l.Reverse <T>().Skip <T>(1));
Ejemplo n.º 45
0
 private static IEnumerable <char> LastEndtWith(this IEnumerable <char> source, Predicate <char> select)
 {
     return(source.Reverse()
            .FirstStartWith(select)
            .Reverse());
 }
Ejemplo n.º 46
0
        /// <summary>
        /// Processes stop will call the hosted process's Stop method and waiting for the result.
        /// </summary>
        internal void ProcessingStop()
        {
            lock (_lock)
            {
                if (_stopped)
                {
                    return;
                }

                _stopped = true;

                if (Status != HostStatus.Faulted)
                {
                    Status = HostStatus.Stopping;
                }

                try
                {
                    _cancellation.Cancel(true);

                    if (!_usingServiceEndpoints &&
                        _hostedProcessTypes != null && _hostedProcessTypes.Any())
                    {
                        foreach (Type processType in _hostedProcessTypes.Reverse())
                        {
                            var hostedProcess = _serviceProvider.GetService(processType);
                            try
                            {
                                _logger?.LogWarning($"Stopping {processType.Name}");

                                Task t = null;

                                if (hostedProcess is IHostedProcess process)
                                {
                                    t = process.Stop();
                                }
                                else if (hostedProcess is IHostedService service)
                                {
                                    t = service.StopAsync(_cancellation.Token);
                                }

                                t?.GetAwaiter().GetResult();
                            }
                            catch (Exception e)
                            {
                                _logger?.LogError(e, $"Error during \"Stop\" execution for {processType.Name}: {e.Message}");
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    _logger?.LogError(e, $"Error stopping process host: {e.Message}");
                }
                finally
                {
                    _logger?.LogWarning("Releasing KeepAliveEvent main app thread will exit");
                    _keepAliveEvent.Set();

                    _webHost?.Dispose();
                    _context.StopMonitor();

                    if (Status != HostStatus.Faulted)
                    {
                        Status = HostStatus.Stopped;
                    }

                    _logger?.LogInformation("Exiting app host");
                }
            }
        }
Ejemplo n.º 47
0
 public IEnumerable <T> TakeRight <T>(IEnumerable <T> collection, int count)
 {
     return(collection.Reverse().Take(count));
 }
Ejemplo n.º 48
0
 public IEnumerable <T> TakeRightWhile <T>(IEnumerable <T> collection, Func <T, bool> predicate)
 {
     return(collection.Reverse().TakeWhile(predicate));
 }
Ejemplo n.º 49
0
 private static string FormatPropertyChainDescription(IEnumerable <string> propertyChainDescription)
 {
     return(string.Join(".", propertyChainDescription.Reverse()));
 }
Ejemplo n.º 50
0
 public static TSource Pernultimate <TSource>(this IEnumerable <TSource> source)
 {
     //from http://stackoverflow.com/questions/8724179/linq-how-to-get-second-last
     return(source.Reverse().Skip(1).Take(1).FirstOrDefault());
 }
 public static IEnumerable <TSource> TakeLast <TSource>(this IEnumerable <TSource> source, int count)
 {
     return(source.Reverse().Take(count).Reverse());
 }
Ejemplo n.º 52
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                PrintHelp();
                Environment.Exit(0);
            }

            int max_result = 35;

            if (args.Length == 1)
            {
                PrintLogo();
            }

            if (args.Length == 2)
            {
                if (Int32.TryParse(args[1], out int max) && max <= 70)
                {
                    max_result = max;
                    PrintLogo();
                }
                else
                {
                    Console.WriteLine("The second argument has to be an integer and have a value lesser than 70."); Environment.Exit(0);
                }
            }

            Auth.SetUserCredentials(
                "qpHCXcV4IEap3T02zJHi234Ev",
                "zjSizlzsC9YmN9qm1BTheXF4delq1CwALA7fBnykBtLCaMb946",
                "316723929-0zRG0RzpDYRwMTw3UvgUu37wni0PHKJBU9IL5BKQ",
                "cCJN2wIPubXBsNCBbVTRXzelIp9vHRXh9Jur5bF9SG52i"
                );

            void PrintLogo()
            {
                Console.WriteLine("       _____      _   _                     _   _             ");
                Console.WriteLine("      / ____|    | | | |                   | | (_)            ");
                Console.WriteLine("     | |  __  ___| |_| |     ___   ___ __ _| |_ _  ___  _ __  ");
                Console.WriteLine(@"     | | |_ |/ _ \ __| |    / _ \ / __/ _` | __| |/ _ \| '_ \ ");
                Console.WriteLine("     | |__| |  __/ |_| |___| (_) | (_| (_| | |_| | (_) | | | |");
                Console.WriteLine(@"      \_____|\___|\__|______\___/_\___\__,_|\__|_|\___/|_| |_|");
                Console.WriteLine("                   |__   __|     (_) | | |                     ");
                Console.WriteLine("                      | |_      ___| |_| |_ ___ _ __           ");
                Console.WriteLine(@"                      | \ \ /\ / / | __| __/ _ \ '__|          ");
                Console.WriteLine(@"                      | |\ V  V /| | |_| ||  __/ |             ");
                Console.WriteLine(@"                      |_| \_/\_/ |_|\__|\__\___|_|             ");
                Console.WriteLine(@"                                                               ");
                Console.WriteLine(@"                           [+] [email protected]        ");
                Console.WriteLine(@"                           [+] Created by Sharki.       ");
            }

            void PrintHelp() => Console.WriteLine("Invalid username. Usage: [ProgramName.exe] + Target's username (@Example/example) to track. [Optional: (Integer) Maximum number of searches allowed < 70]");

            string findLocation(List <string> locations)
            {
                IEnumerable <dynamic> query = locations.GroupBy(r => r)
                                              .Select(grp => new
                {
                    Location = grp.Key,
                    Count    = grp.Count()
                });

                int n = 0;

                foreach (var Q in query)
                {
                    if (Q.Count > n)
                    {
                        n = Q.Count;
                    }
                }

                return(query.Where(x => x.Count == n).First().Location);
            }

            Tweetinvi.Models.IUser User = Tweetinvi.User.GetUserFromScreenName(args[0]);

            if (User == null)
            {
                Console.WriteLine("This twitter's account doesn't exist or the rate limit has been reached");
                Environment.Exit(0);
            }

            IEnumerable <long> People              = User.FollowersCount < User.FriendsCount ? User.GetFollowerIds() : User.GetFriendIds();
            List <string>      Location_firstlist  = new List <string>();
            List <string>      Location_secondlist = new List <string>();

            int count = 0;

            foreach (long person in People.Reverse())
            {
                var Relation = Friendship.GetRelationshipDetailsBetween(person, User.UserIdentifier);

                if (Relation == null)
                {
                    Console.WriteLine("Exception"); break;
                }
                if (Relation.Following && Relation.FollowedBy)
                {
                    var      person_  = Tweetinvi.User.GetUserFromId(person);
                    string[] Location = person_.Location.Split(',', '-');

                    if (Location[0] != "" && Location[0] != "??")
                    {
                        Location_firstlist.Add(Location[0]);
                        try { Location_secondlist.Add(Location[1]); } catch { };
                        count++;
                        Console.WriteLine("[+] ---> " + person_.ScreenName);
                    }
                    else
                    {
                        Console.WriteLine("[-] ---> " + person_.ScreenName);
                    }
                }
                if (count > max_result)
                {
                    break;
                }
            }

            Console.WriteLine("\nProbable location based on target's followers/follows {0}", findLocation(Location_firstlist));
            Console.WriteLine("Probable zone/country based on target's followers/follows{0}", findLocation(Location_secondlist));

            if (!String.IsNullOrEmpty(User.Location))
            {
                Console.WriteLine("User's set location: {0}", User.Location);
            }
        }
Ejemplo n.º 53
0
 public static T Last <T>(this IEnumerable <T> items, int offset)
 => items.Reverse().Skip(offset).Take(1).First();
Ejemplo n.º 54
0
 public static T LastOrDefault <T>(this IEnumerable <T> items, int offset)
 {
     return(items.Reverse().Skip(offset).Take(1).FirstOrDefault());
 }
 public static IEnumerable <T> Last <T>(this IEnumerable <T> source, int count)
 {
     return(source?.Reverse().Take(count).Reverse());
 }
 // Another name for IEnumerable.Reverse()
 // This is useful to distinguish betweeh List.Reverse() when dealing with a list
 public static IEnumerable <T> Reversed <T>(this IEnumerable <T> list)
 {
     return(list.Reverse());
 }
Ejemplo n.º 57
0
 public void Enqueue(IEnumerable <Tile> tiles)
 {
     PushRange(tiles.Reverse().ToArray());
 }
        /// <summary>
        ///   Combines several <see cref="IGlobalizationService"/>-instances to a single <see cref="CompoundGlobalizationService"/>.
        /// </summary>
        /// <param name="globalizationServices"> The <see cref="IGlobalizationService"/>s, starting with the least specific.</param>
        public CompoundGlobalizationService(IEnumerable <IGlobalizationService> globalizationServices)
        {
            ArgumentUtility.CheckNotNull("globalizationServices", globalizationServices);

            _globalizationServices = globalizationServices.Reverse().ToList().AsReadOnly();
        }
Ejemplo n.º 59
0
        /// <summary>
        /// Insert a new search element under the category.
        /// </summary>
        /// <param name="entry">This could represent a function of a given
        /// class. For example, 'MyAssembly.MyNamespace.MyClass.Foo'.</param>
        /// <param name="categoryNames">A list of entries that make up the fully qualified
        /// class name that contains function 'Foo', e.g. 'MyAssembly.MyNamespace.MyClass'.
        /// </param>
        internal void InsertEntry(NodeSearchElementViewModel entry, IEnumerable <string> categoryNames)
        {
            var    nameStack = new Stack <string>(categoryNames.Reverse());
            var    target    = libraryRoot;
            string fullyQualifiedCategoryName        = "";
            ClassesNodeCategoryViewModel targetClass = null;

            while (nameStack.Any())
            {
                var next = nameStack.Pop();
                fullyQualifiedCategoryName = MakeFullyQualifiedName(fullyQualifiedCategoryName, next);

                var categories = target.SubCategories;
                NodeCategoryViewModel targetClassSuccessor = null;
                var newTarget = categories.FirstOrDefault(c =>
                {
                    // Each path has one class. We should find and save it.
                    if (c is ClassesNodeCategoryViewModel)
                    {
                        targetClass = c as ClassesNodeCategoryViewModel;
                        // As soon as ClassesNodeCategoryViewModel is found we should search
                        // through all it classes and save result.
                        targetClassSuccessor = c.SubCategories.FirstOrDefault(c2 => c2.Name == next);
                        return(targetClassSuccessor != null);
                    }

                    return(c.Name == next);
                });
                if (newTarget == null)
                {
                    // For the first iteration, this would be 'MyAssembly', and the second iteration 'MyNamespace'.
                    var targetIsRoot = target == libraryRoot;
                    newTarget = targetIsRoot ? new RootNodeCategoryViewModel(next) : new NodeCategoryViewModel(next);
                    newTarget.FullCategoryName = fullyQualifiedCategoryName;
                    newTarget.Assembly         = entry.Assembly;
                    // Situation when we to add only one new category and item as it child.
                    // New category should be added to existing ClassesNodeCategoryViewModel.
                    // Make notice: ClassesNodeCategoryViewModel is always first item in
                    // all subcategories.
                    if (nameStack.Count == 0 && !target.IsClassButton &&
                        target.SubCategories[0] is ClassesNodeCategoryViewModel)
                    {
                        target.SubCategories[0].SubCategories.Add(newTarget);
                        AddEntryToExistingCategory(newTarget, entry);
                        return;
                    }

                    // We are here when target is the class. New category should be added
                    // as child of it. So class will turn into usual category.
                    // Here we are take class, remove it from ClassesNodeCategoryViewModel
                    // and attach to it parrent.
                    if (targetClass != null)
                    {
                        if (targetClass.SubCategories.Remove(target))
                        {
                            targetClass.Parent.SubCategories.Add(target);
                        }
                        // Delete empty classes container.
                        if (targetClass.IsClassButton)
                        {
                            targetClass.Parent.SubCategories.RemoveAt(0);
                        }

                        targetClass.Dispose();
                    }

                    // Situation when we need to add only one new category and item.
                    // Before adding of it we need create new ClassesNodeCategoryViewModel
                    // as soon as new category will be a class.
                    if (nameStack.Count == 0 && !targetIsRoot)
                    {
                        targetClass = new ClassesNodeCategoryViewModel(target);

                        target.SubCategories.Insert(0, targetClass);
                        target.SubCategories[0].SubCategories.Add(newTarget);
                        AddEntryToExistingCategory(newTarget, entry);
                        return;
                    }

                    target.InsertSubCategory(newTarget);

                    // Proceed to insert the new entry under 'newTarget' category with the remaining
                    // name stack. In the first iteration this would have been 'MyNamespace.MyClass'.
                    InsertEntryIntoNewCategory(newTarget, entry, nameStack);
                    return;
                }
                // If we meet ClassesNodecategoryViewModel during the search of newTarget,
                // next newTarget is specified in targetClassSuccessor.
                if (targetClassSuccessor != null)
                {
                    target = targetClassSuccessor;
                }
                else
                {
                    target = newTarget;
                }
            }
            AddEntryToExistingCategory(target, entry);
        }
Ejemplo n.º 60
-1
		private void LoadButtons(IEnumerable<CustomDialogButtonInfo> buttons)
		{
			const int buttonMargin = 20;
			var leftPosition = pnButtons.Width;
			var buttonHeight = pnButtons.Height - buttonMargin;
			var topPosition = (pnButtons.Height - buttonHeight) / 2;

			foreach (var buttonInfo in buttons.Reverse().ToList())
			{
				var button = new ButtonX();
				button.ColorTable = eButtonColor.OrangeWithBackground;
				button.Text = buttonInfo.Title;
				button.DialogResult = buttonInfo.DialogResult;
				button.TextColor = Color.Black;
				button.Height = buttonHeight;
				button.Width = buttonInfo.Width;
				button.Style = eDotNetBarStyle.StyleManagerControlled;
				button.Top = topPosition;
				button.Anchor = AnchorStyles.Top | AnchorStyles.Right;

				leftPosition -= button.Width;
				button.Left = leftPosition;
				leftPosition -= buttonMargin;

				pnButtons.Controls.Add(button);
			}
		}