public void Init()
 {
     _mocks = new MockRepository();
     _wr = new WorkflowRepository(new MemoryWorkItemRepository(), new MemoryWorkStepRepository());
     _timeSourceStub = _mocks.Stub<ITimeSource>();
     _mover = new WorkStepMover(_wr,_timeSourceStub);
 }
Exemplo n.º 2
0
        public AccountManager(
            ISecurityProvider securityProvider,
            IAccountRepository accountRepository,
            IAccountValidator accountValidator,
            ITimeSource timeSource,
            int accountSessionCollectionCapacity,
            ISessionRepository sessionRepository,
            IActionRightResolver actionRightResolver/*,
            Func<TBizAccountRegistrationData, TBizAccount> accountRegistrationDataToAccount*/)
        {
            // todo1[ak] check args
            _securityProvider = securityProvider;
            _accountRepository = accountRepository;
            _accountValidator = accountValidator;
            _timeSource = timeSource;

            _sessionManager = new SessionManager(
                _securityProvider,
                _timeSource,
                accountSessionCollectionCapacity,
                sessionRepository);

            _actionRightResolver = actionRightResolver;
            //_accountRegistrationDataToAccount = accountRegistrationDataToAccount;
        }
Exemplo n.º 3
0
        public SampleAttribute(
            string key,
            string displayName,
            Option <string> description,
            Option <Texture> icon,
            string target,
            TimeSpan period,
            ProcessMode processMode,
            ITimeSource timeSource,
            Map <string, IAttribute> children,
            bool active,
            ILoggerFactory loggerFactory) : base(
                key,
                displayName,
                description,
                icon,
                target,
                false,
                children,
                active,
                loggerFactory)
        {
            Ensure.That(timeSource, nameof(timeSource)).IsNotNull();

            Period      = period;
            ProcessMode = processMode;
            TimeSource  = timeSource;
        }
Exemplo n.º 4
0
 protected override void Dispose(bool disposing)
 {
     if (disposed)
     {
         return;
     }
     if (disposing)
     {
         if (timesource != null)
         {
             timesource.Invalidate();
         }
         timesource = null;
         if (stopwatch != null)
         {
             stopwatch.Stop();
         }
         stopwatch = null;
         DestroyFrameBuffer();
     }
     base.Dispose(disposing);
     disposed = true;
     if (disposing)
     {
         OnDisposed(EventArgs.Empty);
     }
 }
 public GpsPositionService(
     StatefulServiceContext context,
     ITimeSource timeSource)
     : base(context)
 {
     _timeSource = timeSource;
 }
Exemplo n.º 6
0
 private void SendExpired(ITimeSource timeSource)
 {
     if (_disposed)
     {
         return;
     }
     if (_pending.Count <= 0)
     {
         return;
     }
     do
     {
         var timeKey = _pending.Keys.FirstOrDefault();
         if (timeKey is null)
         {
             return;
         }
         if (timeKey > timeSource.Now())
         {
             return;
         }
         var toDispatch = _pending[timeKey];
         _pending.RemoveAt(0);
         for (int i = 0; i < toDispatch.Count; i++)
         {
             if (Interlocked.Read(ref _stop) == True)
             {
                 return;
             }
             _outbound.Publish(toDispatch[i]);
         }
     } while (_pending.Count <= 0);
 }
Exemplo n.º 7
0
        public AnimationDrivenLocomotion(
            AnimationTree animationTree,
            Skeleton skeleton,
            AnimationStates states,
            Blender2D blender,
            TimeScale timeScale,
            string idleState,
            string moveState,
            KinematicBody target,
            Physics3DSettings physicsSettings,
            ITimeSource timeSource,
            bool active,
            ILoggerFactory loggerFactory) : base(target, physicsSettings, timeSource, active, loggerFactory)
        {
            Ensure.That(animationTree, nameof(animationTree)).IsNotNull();
            Ensure.That(skeleton, nameof(skeleton)).IsNotNull();
            Ensure.That(states, nameof(states)).IsNotNull();
            Ensure.That(blender, nameof(blender)).IsNotNull();
            Ensure.That(timeScale, nameof(timeScale)).IsNotNull();
            Ensure.That(idleState, nameof(idleState)).IsNotNullOrEmpty();
            Ensure.That(moveState, nameof(moveState)).IsNotNullOrEmpty();

            AnimationTree = animationTree;
            Skeleton      = skeleton;
            States        = states;
            Blender       = blender;
            TimeScale     = timeScale;
            IdleState     = idleState;
            MoveState     = moveState;
        }
Exemplo n.º 8
0
 public InjectionApi(IApiBridge bridge, Metadata metadata, Globals globals, ITimeSource timeSource, Paths paths, Objects objects)
 {
     this.bridge = bridge;
     UO          = new InjectionApiUO(bridge, this, metadata, globals, timeSource, paths, objects);
     Register(metadata);
     this.timeSource = timeSource;
 }
Exemplo n.º 9
0
        internal InfusionTestProxy(ITimeSource timeSource, PacketDefinitionRegistry packetRegistry = null)
        {
            packetRegistry      = packetRegistry ?? PacketDefinitionRegistryFactory.CreateClassicClient();
            ServerPacketHandler = new ServerPacketHandler(PacketDefinitionRegistryFactory.CreateClassicClient());
            ClientPacketHandler = new ClientPacketHandler(PacketDefinitionRegistryFactory.CreateClassicClient());
            Server = new UltimaServer(ServerPacketHandler, packet =>
            {
                var filteredPacket = ClientPacketHandler.FilterOutput(packet);
                if (filteredPacket.HasValue)
                {
                    packetsSentToServer.Add(filteredPacket.Value);
                }
            }, packetRegistry);
            Client = new UltimaClient(ClientPacketHandler, packet =>
            {
                var filteredPacket = ServerPacketHandler.FilterOutput(packet);
                if (filteredPacket.HasValue)
                {
                    packetsSentToClient.Add(filteredPacket.Value);
                }
            });

            var console = new NullConsole();

            Api = new Legacy(new LogConfiguration(), new CommandHandler(console), Server, Client, console, packetRegistry,
                             timeSource, ClilocSource, KeywordSource, new MemoryConfigBagRepository(), new NullInjectionWindow(), new NullSoundPlayer());
            UO.Initialize(Api);
            ServerApi = new TestServerApi(PacketReceivedFromServer, Api);
        }
 public void Init()
 {
     _mocks          = new MockRepository();
     _wr             = new WorkflowRepository(new MemoryWorkItemRepository(), new MemoryWorkStepRepository());
     _timeSourceStub = _mocks.Stub <ITimeSource>();
     _mover          = new WorkStepMover(_wr, _timeSourceStub);
 }
Exemplo n.º 11
0
        public AnimationStateManager(
            AnimationPlayer player,
            AnimationTree animationTree,
            Option <IAnimationGraphFactory> graphFactory,
            Option <IAnimationControlFactory> controlFactory,
            ProcessMode processMode,
            ITimeSource timeSource,
            bool active,
            ILoggerFactory loggerFactory) : base(player, processMode, timeSource, active, loggerFactory)
        {
            Ensure.That(animationTree, nameof(animationTree)).IsNotNull();

            AnimationTree = animationTree;

            GraphFactory   = graphFactory.IfNone(() => new AnimationGraphFactory());
            ControlFactory = controlFactory.IfNone(() => new AnimationControlFactory());

            Context = new AnimationGraphContext(
                Player,
                AnimationTree,
                OnAdvance,
                GraphFactory,
                ControlFactory,
                loggerFactory);

            _graph = GraphFactory.TryCreate((AnimationRootNode)AnimationTree.TreeRoot, Context).IfNone(() =>
                                                                                                       throw new ArgumentException(
                                                                                                           "Failed to create animation graph from the specified animation tree.",
                                                                                                           nameof(animationTree)));

            AnimationTree.ProcessMode = AnimationTree.AnimationProcessMode.Manual;

            this.LogDebug("Using graph factory: {}.", GraphFactory);
            this.LogDebug("Using control factory: {}.", ControlFactory);
        }
Exemplo n.º 12
0
 public MetricsCollectionAspect(
     IMethodInvocationRecorder methodInvocationRecorder, ITimeSource timeSource)
 {
     this._methodInvocationRecorder = methodInvocationRecorder;
     this._timeSource = timeSource;
     _debugSessionStartTimestampUs = _timeSource.GetTimestampUs();
 }
Exemplo n.º 13
0
 public InjectionApi(IApiBridge bridge, Metadata metadata, InjectionRuntimeState state, ITimeSource timeSource, Paths paths)
 {
     this.bridge = bridge;
     UO          = new InjectionApiUO(bridge, this, metadata, state, timeSource, paths);
     Register(metadata);
     this.timeSource = timeSource;
 }
Exemplo n.º 14
0
 public DemoTimeSource(bool isLooping)
 {
     SoundFileName = string.Empty;
     timeSource = new TimeSource(10.0f);
     timeSource.IsLooping = isLooping;
     timeSource.OnTimeFinished += CallOnTimeFinished;
 }
Exemplo n.º 15
0
        public EntityLabel(
            IPlayerControl playerControl,
            string interactAction,
            Label titleLabel,
            Option <Label> shortcutLabel,
            Option <Label> actionLabel,
            Option <Godot.Control> actionPanel,
            ITimeSource timeSource,
            Godot.Control node,
            ILoggerFactory loggerFactory) : base(node, loggerFactory)
        {
            Ensure.That(playerControl, nameof(playerControl)).IsNotNull();
            Ensure.That(interactAction, nameof(interactAction)).IsNotNull();
            Ensure.That(titleLabel, nameof(titleLabel)).IsNotNull();
            Ensure.That(timeSource, nameof(timeSource)).IsNotNull();

            PlayerControl  = playerControl;
            InteractAction = interactAction;
            TitleLabel     = titleLabel;
            ShortcutLabel  = shortcutLabel;
            ActionLabel    = actionLabel;
            ActionPanel    = actionPanel;
            TimeSource     = timeSource;
            InteractAction = interactAction;
        }
Exemplo n.º 16
0
 /// <summary>
 /// Appends byte[] items to archive. The instance is NOT thread-safe
 /// </summary>
 public BinaryArchiveAppender(IVolume volume,
                              ITimeSource time,
                              Atom app,
                              string host,
                              Action <byte[], Bookmark> onPageCommit = null)
     : base(volume, time, app, host, onPageCommit)
 {
 }
Exemplo n.º 17
0
 /// <summary>
 /// Calculates the last date for an Id before a 'wrap around' will occur in the timestamp-part of an Id for the
 /// given <see cref="IdStructure"/>.
 /// </summary>
 /// <param name="epoch">The used epoch for the <see cref="IdGenerator"/> to use as offset.</param>'
 /// <param name="timeSource">The used <see cref="ITimeSource"/> for the <see cref="IdGenerator"/>.</param>
 /// <returns>The last date for an Id before a 'wrap around' will occur in the timestamp-part of an Id.</returns>
 /// <remarks>
 /// Please note that for dates exceeding the <see cref="DateTimeOffset.MaxValue"/> an
 /// <see cref="ArgumentOutOfRangeException"/> will be thrown.
 /// </remarks>
 /// <exception cref="ArgumentOutOfRangeException">
 /// Thrown when any combination of a <see cref="ITimeSource.TickDuration"/> and <see cref="MaxIntervals"/>
 /// results in a date exceeding the <see cref="TimeSpan.MaxValue"/> value.
 /// </exception>
 public DateTimeOffset WraparoundDate(DateTimeOffset epoch, ITimeSource timeSource)
 {
     if (timeSource == null)
     {
         throw new ArgumentNullException(nameof(timeSource));
     }
     return(epoch.AddDays(timeSource.TickDuration.TotalDays * MaxIntervals));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Calculates the interval at wich a 'wrap around' will occur in the timestamp-part of an Id for the given
 /// <see cref="IdStructure"/>.
 /// </summary>
 /// <param name="timeSource">The used <see cref="ITimeSource"/> for the <see cref="IdGenerator"/>.</param>
 /// <returns>
 /// The interval at wich a 'wrap around' will occur in the timestamp-part of an Id for the given
 /// <see cref="IdStructure"/>.
 /// </returns>
 /// <remarks>
 /// Please note that for intervals exceeding the <see cref="TimeSpan.MaxValue"/> an
 /// <see cref="OverflowException"/> will be thrown.
 /// </remarks>
 /// <exception cref="ArgumentNullException">
 /// Thrown when <paramref name="timeSource"/> is null.
 /// </exception>
 /// <exception cref="OverflowException">
 /// Thrown when any combination of a <see cref="ITimeSource.TickDuration"/> and <see cref="MaxIntervals"/>
 /// results in a TimeSpan exceeding the <see cref="TimeSpan.MaxValue"/> value.
 /// </exception>
 public TimeSpan WraparoundInterval(ITimeSource timeSource)
 {
     if (timeSource == null)
     {
         throw new ArgumentNullException(nameof(timeSource));
     }
     return(TimeSpan.FromDays(timeSource.TickDuration.TotalDays * MaxIntervals));
 }
Exemplo n.º 19
0
 /// <summary>
 /// Appends string items to archive. The instance is NOT thread-safe
 /// </summary>
 public JsonArchiveAppender(IVolume volume,
                            ITimeSource time,
                            Atom app,
                            string host,
                            Action <object, Bookmark> onPageCommit = null)
     : base(volume, time, app, host, onPageCommit)
 {
 }
 public SystemRoleLogic(ISystemRoleRepository systemRoleRepository,
                        IUnitOfWorkFactory unitOfWorkFactory,
                        ITimeSource timeSource)
 {
     _systemRoleRepository = systemRoleRepository;
     _unitOfWorkFactory    = unitOfWorkFactory;
     _timeSource           = timeSource;
 }
Exemplo n.º 21
0
        public TestDebuggerFacade(ITimeSource timeSource)
        {
            ScriptCancellation = new CancellationTokenSource();
            debuggerServer     = new DebuggerServer(() => ScriptCancellation.Token);

            runtime = new InjectionRuntime(null, debuggerServer, timeSource, () => ScriptCancellation.Token);
            tracer  = debuggerServer;
            debuggerServer.DebuggerBreakHit += HandleDebuggerBreakHit;
        }
 internal Step(StepsRecorder stepsRecorder, ITimeSource timeSource,
               ExpressionEvaluationEngine engine)
 {
     _startTicks    = timeSource.GetTimestampTicks();
     _stepsRecorder = stepsRecorder;
     _timeSource    = timeSource;
     _engine        = engine;
     _finalized     = false;
 }
Exemplo n.º 23
0
 internal InjectionApiUO(IApiBridge bridge, InjectionApi injectionApi, Metadata metadata, Globals globals, ITimeSource timeSource)
 {
     this.bridge       = bridge;
     this.injectionApi = injectionApi;
     this.globals      = globals;
     Register(metadata);
     random          = new Random();
     this.timeSource = timeSource;
 }
Exemplo n.º 24
0
 public TrackingService(ITimeSource timeSource = null)
 {
     this.timeSource               = timeSource ?? new RealTimeSource();
     this.reportSendTimer          = new Timer(30000);
     this.reportSendTimer.Elapsed += (sender, e) => this.PublishReports(TimeSpan.FromMinutes(5));
     this.reportSendTimer.Start();
     this.reportsSubject = new Subject <ITrackingReport>();
     this.Reports        = this.reportsSubject;
 }
        public virtual ITimeSource GetTimeSource()
        {
            if (_timeSource == null)
            {
                _timeSource = new StopwatchTimeSource();
            }

            return(_timeSource);
        }
Exemplo n.º 26
0
 public ImmediateLocomotion(
     Spatial target,
     ProcessMode processMode,
     ITimeSource timeSource,
     bool active,
     ILoggerFactory loggerFactory) : base(target, timeSource, active, loggerFactory)
 {
     ProcessMode = processMode;
 }
Exemplo n.º 27
0
 public LaterService(IPublisher outbound, ITimeSource timeSource)
 {
     _outbound   = outbound;
     _timeSource = timeSource;
     _inbound    = new ConcurrentQueue <DelaySendEnvelope>();
     //we can use a simple sorted list here because it is only accessed on the processing thread
     _pending     = new SortedList <TimePosition, List <Message> >();
     _processNext = new ManualResetEventSlim(true);
 }
Exemplo n.º 28
0
 public void Stop()
 {
     if (timeSource != null)
     {
         timeSource.Invalidate();
         timeSource = null;
     }
     DestroyFramebuffer();
 }
Exemplo n.º 29
0
 public SeekBar()
 {
     InitializeComponent();
     defaultTimeSource =	new TimeSource(10.0f);
     timeSource = defaultTimeSource;
     timeSource.IsLooping = true;
     timeSource.OnTimeFinished += CallOnFinished;
     markerBarPosition.Max = timeSource.Length;
     Playing = false;
 }
Exemplo n.º 30
0
 public TrackingSession(string code, string sessionId, string ip, ITimeSource timeSource)
 {
     this.Code           = code;
     this.sessionId      = sessionId;
     this.ip             = ip;
     this.timeSource     = timeSource;
     this.createTime     = timeSource.Now;
     this.topicEvents    = new List <Tuple <DateTime, TrackTopicsEvent> >();
     this.urlTrackEvents = new List <Tuple <DateTime, UrlTrackingEvent> >();
 }
 public RoleLogicService(IRoleRepository roleRepository,
                         IUnitOfWorkFactory unitOfWorkFactory,
                         ITimeSource timeSource,
                         IUserAuthenticationManager userAuthenticationManager)
 {
     _roleRepository            = roleRepository ?? throw new ArgumentNullException(nameof(roleRepository));
     _unitOfWorkFactory         = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory));
     _timeSource                = timeSource ?? throw new ArgumentNullException(nameof(timeSource));
     _userAuthenticationManager = userAuthenticationManager ?? throw new ArgumentNullException(nameof(userAuthenticationManager));
 }
Exemplo n.º 32
0
 public void Stop()
 {
     AssertValid();
     if (timesource != null) {
         timesource.Invalidate ();
         timesource = null;
     }
     suspended = false;
     OnUnload(EventArgs.Empty);
 }
Exemplo n.º 33
0
 public void Run()
 {
     if (timeSource != null)
     {
         timeSource.Invalidate();
     }
     timeSource = new CADisplayLinkTimeSource(this, frameInterval: 1);
     SetupContextAndFramebuffer();
     prevUpdateTime = TimeSpan.Zero;
     Resume();
 }
        public SystemUserLogic(ISystemUserRepository systemUserRepository,
                               ICacheManager cacheManager,
                               IUnitOfWorkFactory unitOfWorkFactory,
                               ITimeSource timeSource)
        {
            _systemUserRepository = systemUserRepository;
            _cacheManager         = cacheManager;
            _unitOfWorkFactory    = unitOfWorkFactory;

            _timeSource = timeSource;
        }
Exemplo n.º 35
0
        internal SessionManager(ISecurityProvider securityProvider, ITimeSource timeSource, int accountSessionCollectionCapacity, ISessionRepository sessionRepository)
        {
            // todo1[ak] check args

            _securityProvider = securityProvider;
            _timeSource = timeSource;

            _accountSessionCollectionCapacity = accountSessionCollectionCapacity;
            _accountSessions = new Dictionary<string, IAccountSessionCollection>();

            _lock = new object();
            _allSessions = new Dictionary<string, BizSession>();

            _sessionRepository = sessionRepository;
        }
Exemplo n.º 36
0
        public void Run(double updatesPerSecond)
        {
            if (updatesPerSecond < 0.0)
                throw new ArgumentException ("updatesPerSecond");

            if (updatesPerSecond == 0.0) {
                RunWithFrameInterval (1);
                return;
            }

            if (timesource != null)
            timesource.Invalidate ();

            timesource = new NSTimerTimeSource (this, updatesPerSecond);

            CreateFrameBuffer ();
            OnLoad (EventArgs.Empty);
            Start ();
        }
 public MockTimeSink(ITimeSource timeSource)
 {
     _timeSource = timeSource;
 }
Exemplo n.º 38
0
 public WorkItemCreator(IWorkflowRepository workflowRepository, ITimeSource timeSource)
     : base(workflowRepository)
 {
     _timeSource = timeSource;
 }
Exemplo n.º 39
0
        internal static IAccountManager CreateAdminManager(
            ITimeSource timeSource,
            IAccountRepository adminRepository,
            ISessionRepository sessionRepository,
            int accountSessionCollectionCapacity,
            IActionRightResolver actionRightResolver)
        {
            ISecurityProvider securityProvider = CreateAdminSecurityProvider();
            IAccountValidator adminValidator = CreateAdminValidator();

            IAccountManager adminManager = new AccountManager(
                securityProvider,
                adminRepository,
                adminValidator,
                timeSource,
                accountSessionCollectionCapacity,
                sessionRepository,
                actionRightResolver);

            return adminManager;
        }
Exemplo n.º 40
0
        public static IAccountManager CreateUserManager(
            ITimeSource timeSource,
            IAccountRepository userRepository,
            ISessionRepository sessionRepository,
            int accountSessionCollectionCapacity,
            IActionRightResolver actionRightResolver)
        {
            ISecurityProvider securityProvider = CreateUserSecurityProvider();
            IAccountValidator userValidator = CreateUserValidator();

            IAccountManager userManager = new AccountManager(
                securityProvider,
                userRepository,
                userValidator,
                timeSource,
                accountSessionCollectionCapacity,
                sessionRepository,
                actionRightResolver);

            return userManager;
        }
Exemplo n.º 41
0
 public WorkStepMover(IWorkflowRepository workflowRepository, ITimeSource timeSource)
 {
     _workflowRepository = workflowRepository;
     _timeSource = timeSource;
 }
Exemplo n.º 42
0
 public WorkItemMover(IWorkflowRepository workflowRepository, ITimeSource timeSource)
     : base(workflowRepository)
 {
     _timeSource = timeSource;
     WipLimitChecker = new WipLimitChecker(workflowRepository);
 }
Exemplo n.º 43
0
 public PipelineReportViewModel(PipelineReport pipelineReport, ITimeSource timeSource)
 {
     _pipelineReport = pipelineReport;
     _timeSource = timeSource;
 }
Exemplo n.º 44
0
        public void RunWithFrameInterval(int frameInterval)
        {
            AssertValid ();

            if (frameInterval < 1)
                throw new ArgumentException ("frameInterval");

            if (timesource != null)
            timesource.Invalidate ();

            timesource = new CADisplayLinkTimeSource (this, frameInterval);

            CreateFrameBuffer ();
            OnLoad (EventArgs.Empty);
            Start ();
        }
Exemplo n.º 45
0
 public void Stop()
 {
     AssertValid();
     if (timesource != null) {
         timesource.Invalidate ();
         timesource = null;
     }
     suspended = false;
     OnUnload(EventArgs.Empty);
 }
Exemplo n.º 46
0
 protected override void Dispose(bool disposing)
 {
     if (disposed)
         return;
     if (disposing) {
         if (timesource != null)
             timesource.Invalidate ();
         timesource = null;
         if (stopwatch != null)
             stopwatch.Stop();
         stopwatch = null;
         DestroyFrameBuffer();
     }
     base.Dispose (disposing);
     disposed = true;
     if (disposing)
         OnDisposed(EventArgs.Empty);
 }
Exemplo n.º 47
0
 public void Clear()
 {
     Debug.Assert(null != timeSource);
     //keep looping state
     bool isLooping = timeSource.IsLooping;
     //remove old
     timeSource.Dispose();
     //create new
     timeSource = new TimeSource(10.0f);
     SoundFileName = string.Empty;
     timeSource.IsLooping = isLooping;
     timeSource.OnTimeFinished += CallOnTimeFinished;
     OnLoaded?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 48
0
 public void Load(ITimeSource newTimeSource)
 {
     Debug.Assert(null != timeSource);
     if (null == newTimeSource)
     {
         Clear();
     }
     else
     {
         newTimeSource.IsLooping = IsLooping;
         newTimeSource.OnTimeFinished += CallOnTimeFinished;
         timeSource.Dispose();
         timeSource = newTimeSource;
         OnLoaded?.Invoke(this, EventArgs.Empty);
     }
 }