Exemple #1
0
        public CrawlSession With(Contexts contexts)
        {
            foreach (var context in contexts)
                Contexts.Add(context.Key, context.Value);

            return this;
        }
Exemple #2
0
        public override IEnumerable<Dictionary<string, object>> GetRows(Contexts.Sources.Source source)
        {
            var context = source as Contexts.Sources.Database;

            using (var connection = new SqlConnection(context.ConnectionString))
            {
                connection.Open();

                using (var cmd = new SqlCommand(context.Command, connection))
                {
                    cmd.CommandTimeout = context.CommandTimeout;

                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var rowObj = new Dictionary<string, object>();

                            for (int i = 0; i < reader.FieldCount; i++)
                            {
                                var data = reader[i];

                                if (context.SuppressNulls && data == DBNull.Value) continue;

                                ParseColumn(reader.GetName(i), data, rowObj);
                            }

                            yield return rowObj;
                        }
                    }
                }
            }
        }
Exemple #3
0
 public static Source GetSource(Contexts.Sources.Source source)
 {
     var contextType = source.GetType();
     if (contextType == typeof(Contexts.Sources.Database))
         return new Database();
     else if(contextType == typeof(Contexts.Sources.FlatFile))
         return new FlatFile();
     else
         throw new ArgumentException();
 }
 public SetupController(
     Contexts.IDS4Context context,
     LuigiTrabacchin.IdentityServer4.EntityFramework.Identity.UserManager<Int32> userManager,
     ScopeStore<Int32> scopeStore,
     ClientStore<Int32> clientStore
 )
 {
     this.Context = context;
     this._userManager = userManager;
     this._scopeStore = scopeStore;
     this._clientStore = clientStore;
 }
Exemple #5
0
        public override IEnumerable<Dictionary<string, object>> GetRows(Contexts.Sources.Source source)
        {
            var context = source as Contexts.Sources.FlatFile;

            using (var reader = new System.IO.StreamReader(context.Location))
            {
                string line = null;

                string[] columns = null;

                while ((line = reader.ReadLine()) != null)
                {
                    if (columns == null) columns = ParseLine(line, context.Delimiters);
                    else
                        yield return MakeRowObj(ParseLine(line, context.Delimiters), columns);
                }
            }
        }
        public void Activate(ActionContext actionContext, object controller)
        {
            var controllerType = controller.GetType();
            var propertiesToActivate = _activateActions.GetOrAdd(
                controllerType,
                _getPropertiesToActivate);

            var contexts = new Contexts()
            {
                ActionBindingContext = _actionBindingContextAccessor.ActionBindingContext,
                ActionContext = actionContext,
            };

            for (var i = 0; i < propertiesToActivate.Length; i++)
            {
                var activateInfo = propertiesToActivate[i];
                activateInfo.Activate(controller, contexts);
            }
        }
 public UsuarioRepository(
     Contexts.GerenciamentoProjetosDbContext context)
 {
     _context = context;
 }
Exemple #8
0
 public Mouth(Contexts.Destination destination)
 {
     _destination = destination;
     _client = new Nest.ElasticClient(new Nest.ConnectionSettings(new Uri(destination.Url)));
 }
Exemple #9
0
 public void init(Contexts contexts)
 {
     _contexts = contexts;
 }
Exemple #10
0
 public void AddOffset(int mod = 0)
 {
     Contexts.Peek().Offsets.Add(CurrentScript.Code.Count + mod);
 }
 public CleanupFeature(Contexts contexts, ServiceContainer services) : base("Cleanup")
 {
     Add(new RemoveDestroyedEntitiesFromView(contexts, services));
 }
Exemple #12
0
 // Start is called before the first frame update
 void Start()
 {
     _contexts = Contexts.sharedInstance;
     _systems  = CreateSystems(_contexts);
     InitWorld();
 }
 public StandardEntityEventRemovedEventSystem(Contexts contexts) : base(contexts.Test)
 {
     _listenerBuffer = new System.Collections.Generic.List <IStandardEntityEventRemovedListener>();
 }
 public PlayerAttackSystem(Contexts contexts) : base(contexts.game)
 {
     this.contexts = contexts;
     player        = contexts.game.GetGroup(GameMatcher.Player);
     enemy         = contexts.game.GetGroup(GameMatcher.Enemy);
 }
 public RegisterLocalStorageServiceSystem(Contexts contexts, ILocalStorageService localStorageService)
 {
     _context             = contexts.game;
     _localStorageService = localStorageService;
 }
Exemple #16
0
 public InitSystems(Contexts contexts) : base("Init Systems")
 {
     Add(new InitTerrainSystem(contexts));
     Add(new InitMountainSystem(contexts));
     Add(new InitColonistSystem(contexts));
 }
Exemple #17
0
 public RunCommandSystem(Contexts contexts)
 {
     _context = contexts.input;
 }
Exemple #18
0
 public AddVelocityToPositionSystem(Contexts _contexts)
 {
     gameContext = _contexts.game;
 }
 public BurstModeRemovedEventSystem(Contexts contexts) : base(contexts.input)
 {
     _listeners      = contexts.input.GetGroup(InputMatcher.BurstModeRemovedListener);
     _entityBuffer   = new System.Collections.Generic.List <InputEntity>();
     _listenerBuffer = new System.Collections.Generic.List <IBurstModeRemovedListener>();
 }
 public AbilityCooldownSubtractionSystem(Contexts contexts)
 {
     cooldownGroup = contexts.game.GetGroup(GameMatcher.AbilityCooldown);
 }
 public StunnedRemovedEventSystem(Contexts contexts) : base(contexts.logic)
 {
 }
Exemple #22
0
 public UpdateLookSystem(Contexts contexts)
 {
     _updates = contexts.game.GetGroup(GameMatcher.UpdateLook);
 }
Exemple #23
0
        public SpamProbability GetSpamProbability(ServerMessagesCacheService serverMessagesCacheService, Contexts contexts)
        {
            var howManyMessagesCount = this._configurationService.GetConfigurationItem <HowManyMessagesInShortTimeToBeSpam>(contexts.Server.Id).Value;
            var howManySeconds       = this._configurationService.GetConfigurationItem <HowLongIsShortTimeInSeconds>(contexts.Server.Id).Value;
            var minDate       = DateTime.UtcNow.AddSeconds(-howManySeconds);
            var messagesCount = serverMessagesCacheService.GetLastUserMessages(contexts.User.Id, contexts.Server.Id)
                                .TakeLast(howManyMessagesCount)
                                .Count(x => x.SentAt >= minDate);

            if (messagesCount <= howManyMessagesCount / 3)
            {
                return(SpamProbability.None);
            }
            var userIsSafe = this._userSafetyChecker.IsUserSafe(contexts.User.Id, contexts.Server.Id);

            return(userIsSafe switch
            {
                true when messagesCount < howManyMessagesCount => SpamProbability.None,
                false when messagesCount <= howManyMessagesCount / 2 => SpamProbability.Low,
                false when messagesCount < howManyMessagesCount => SpamProbability.Medium,
                _ => SpamProbability.Sure
            });
Exemple #24
0
 public AddViewSystem(Contexts contexts) : base(contexts.game)
 {
 }
 public CardViewCreatingSystem(Contexts contexts, CardSetting setting) : base(contexts.card)
 {
     _setting = setting;
 }
Exemple #26
0
 public WppViewDestroySystem(Contexts contexts)
 {
     uiSoundsManager   = UiSoundsManager.Instance();
     context           = contexts.wppAccrual;
     movingAwardsGroup = context.GetGroup(WppAccrualMatcher.MovingIcon);
 }
Exemple #27
0
 public PlayerServerStateUpdateSystem(Contexts contexts)
 {
     _contexts = contexts;
 }
Exemple #28
0
 public void AddContext(string name, int mod = 0)
 {
     Contexts.Push(new Context(name, CurrentScript.Code.Count + mod));
 }
 public CollisionFixedPenetrationDetectionSystem(Contexts contexts) : base(contexts.game)
 {
     gameContext = contexts.game;
 }
 public DeactivateFeatureSystem(Contexts contexts) : base(contexts.events)
 {
     _coreContext = contexts.core;
 }
Exemple #31
0
 public Test2EventSystems(Contexts contexts)
 {
     Add(new Test2MultipleContextStandardEventEventSystem(contexts));       // priority: 0
     Add(new Test2MultipleEventsStandardEventEventSystem(contexts));        // priority: 1
     Add(new Test2MultipleEventsStandardEventRemovedEventSystem(contexts)); // priority: 2
 }
Exemple #32
0
        public IEnumerable<TemporaryIdentifier> GetIdentifiers(Contexts contexts)
        {
            var methods = workspace.GetMethods(documentId);

            foreach (var method in methods)
            {
                var returnType = method.ReturnType.ToString();
                var identifier = method.Identifier.ToString();
                var parameter = method.ParameterList.Parameters.FirstOrDefault()?.Type.ToString();

                if (identifier.StartsWith("__") == false && parameter != null)
                {
                    var context = contexts.Find(parameter);
                    if (context != null)
                    {
                        var isBoolean = returnType == "bool" || returnType == "Boolean";

                        var contextType = ExtraxtContextType(returnType);
                        var childContext = contexts.Find(contextType)?.Name;
                        var isCollection = childContext != null && contextType != returnType;

                        yield return new TemporaryIdentifier(context, new Identifier
                        {
                            Name = identifier,
                            QuickInfo = "(extension) " + (isCollection ? contextType + "Collection" : contextType) + " " + identifier,
                            Context = childContext,
                            HasContext = childContext != null,
                            IsBoolean = isBoolean,
                            IsCollection = isCollection,
                            RequireTemplate = isCollection,
                            IsCustom = true
                        });
                    }
                }
            }
        }
Exemple #33
0
 public BoardSystem(Contexts contexts) : base(contexts.game)
 {
     gameContext = contexts.game;
 }
Exemple #34
0
 public AISupportProductsSystem(Contexts contexts) : base(contexts)
 {
 }
Exemple #35
0
 public RenderAnimationSystem(Contexts contexts) : base(contexts.game)
 {
     m_contexts = contexts;
 }
 public UpdateAnimationTimeSystem(Contexts contexts) : base(contexts.game)
 {
 }
Exemple #37
0
 public GameEventSystems(Contexts contexts)
 {
     Add(new DestroyedEventSystem(contexts)); // priority: 0
     Add(new PositionEventSystem(contexts));  // priority: 0
 }
 public CreateMoverSystem(Contexts contexts)
 {
     _gameContext = contexts.game;
 }
Exemple #39
0
 public PhysicsService(Contexts contexts) : base(contexts)
 {
     _collidedObjects  = new Collider2D[COLLIDED_OBJECT_SIZE];
     _castBuffer       = new RaycastHit2D[64];
     _triggeredObjects = new List <ITrigger>();
 }
Exemple #40
0
 public abstract IEnumerable<Dictionary<string, object>> GetRows(Contexts.Sources.Source source);
        static Context[] findAllContexts()
        {
            const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance;
            var allContextsProperty = typeof(Contexts).GetProperty("allContexts", bindingFlags);
            if(allContextsProperty != null) {
                var contextsType = typeof(Contexts);
                var setAllContextsMethod = contextsType.GetMethod("SetAllContexts", bindingFlags);
                if(setAllContextsMethod != null) {
                    var contexts = new Contexts();
                    setAllContextsMethod.Invoke(contexts, null);
                    var allContextsGetter = contextsType.GetProperty("allContexts", bindingFlags);

                    return (Context[])allContextsGetter.GetValue(contexts, null);
                }
            }

            return new Context[0];
        }