public void SendSync(string[] numbers, SyncMode mode = SyncMode.Delta, SyncContext context = SyncContext.Background, int index = 0, bool last = true) { List<ProtocolTreeNode> users = new List<ProtocolTreeNode>(); foreach (string number in numbers) { string _number = number; if (!_number.StartsWith("+", StringComparison.InvariantCulture)) _number = string.Format("+{0}", number); users.Add(new ProtocolTreeNode("user", null, System.Text.Encoding.UTF8.GetBytes(_number))); } ProtocolTreeNode node = new ProtocolTreeNode("iq", new KeyValue[] { new KeyValue("to", GetJID(this.phoneNumber)), new KeyValue("type", "get"), new KeyValue("id", TicketCounter.MakeId("sendsync_")), new KeyValue("xmlns", "urn:xmpp:whatsapp:sync") }, new ProtocolTreeNode("sync", new KeyValue[] { new KeyValue("mode", mode.ToString().ToLowerInvariant()), new KeyValue("context", context.ToString().ToLowerInvariant()), new KeyValue("sid", DateTime.Now.ToFileTimeUtc().ToString()), new KeyValue("index", index.ToString()), new KeyValue("last", last.ToString()) }, users.ToArray() ) ); this.SendNode(node); }
public void Delete(string identifier, SyncMode syncMode = SyncMode.NoSync) { if (IsSlaveCache && syncMode != SyncMode.NoSync) _masterCache.Delete(identifier, GetSyncModeForParentCache(syncMode)); lock (_locker) _cacheInfraestructure.Remove(identifier); }
public SyncOperation(VBucketNodeLocator locator, IList<KeyValuePair<string, ulong>> keys, SyncMode mode, int replicationCount) { if (keys == null) throw new ArgumentNullException("keys"); if (keys.Count > 0xffff) throw new ArgumentException("Maximum 0xFFFF items are supported."); this.flags = GetFlags(mode, replicationCount); this.locator = locator; this.keys = keys; }
public SyncOperation(VBucketNodeLocator locator, KeyValuePair<string, ulong>[] keys, SyncMode mode, int replicationCount) { if (keys == null) throw new ArgumentNullException("keys"); if (keys.Length > 0xffff) throw new ArgumentException("Only 0xffff items are supported"); this.flags = GetFlags(mode, replicationCount); this.locator = locator; this.keys = keys; }
public void Set(CacheableEntity cacheItem, SyncMode syncMode = SyncMode.NoSync) { var item = new CacheItem(cacheItem.GetUniqueHash(), cacheItem); if (IsSlaveCache && syncMode != SyncMode.NoSync) _masterCache.Set(cacheItem, GetSyncModeForParentCache(syncMode)); lock (_locker) _cacheInfraestructure.Set(item.Key, item, GetDefaultCacheItemPolicy()); ItemEstablished(cacheItem); }
public SyncService(String repoKey, INoteAppService remoteModel, User user, SyncMode mode) : base(repoKey) { watcher = new DataWatcher(this, user); this.user = user; this.mode = mode; watcher.DataAvailable += (sender, args) => onWatcherEvent(sender, args); this.remoteModel = remoteModel; if (mode == SyncMode.TwoWay) { this.bookService = new SyncBookService(repoKey, this, remoteModel); this.noteService = new SyncNoteService(repoKey, this, remoteModel); } }
public async void Run(SyncMode mode = SyncMode.Full) { var authManager = ServiceContainer.Resolve <AuthManager> (); if (!authManager.IsAuthenticated) { return; } if (IsRunning) { return; } var bus = ServiceContainer.Resolve <MessageBus> (); var network = ServiceContainer.Resolve <INetworkPresence> (); if (authManager.OfflineMode) { bus.Send(new SyncFinishedMessage(this, mode, false, null)); return; } if (!network.IsNetworkPresent) { network.RegisterSyncWhenNetworkPresent(); // Notify views that sync ended because a network failure. bus.Send(new SyncFinishedMessage(this, mode, true, new System.Net.Http.HttpRequestException())); return; } network.UnregisterSyncWhenNetworkPresent(); IsRunning = true; // Unsubscribe from models commited messages (our actions trigger them as well, // so need to ignore them to prevent infinite recursion. if (subscriptionDataChange != null) { bus.Unsubscribe(subscriptionDataChange); subscriptionDataChange = null; } try { // Make sure that the RunInBackground is actually started on a background thread LastRun = await await Task.Factory.StartNew(() => RunInBackground (mode, LastRun)); } finally { IsRunning = false; subscriptionDataChange = bus.Subscribe <DataChangeMessage> (OnDataChange); } }
/// <summary> /// Constructor with default values. /// </summary> public Options() { // initialize a blank new one with default values this.reminderSet = false; this.reminderMinutesBeforeStart = 0; this.availStatus = Outlook.OlBusyStatus.olFree; this.meetingPrefix = DEFAULT_MEETING_PREFIX; this.daysToPull = 28; this.pollingIntervalInMinutes = 480; this.segmentFilter = DEFAULT_SEGMENT_FILTER; this.syncMode = SyncMode.Exclusive; this.categoryName = CONFIG_MESSAGE_SUBJECT; this.wfmUrl = "http://azwfmprdis02.partners.extranet.microsoft.com/EAMWeb/WFMPRD/ENU/Common/servlet"; }
private EffectTracker <AudioSource> FindAvailableSource(SyncMode syncMode) { List <EffectTracker <AudioSource> > audioSources = GetCorrectList(syncMode); for (int s = 0; s < audioSources.Count; s++) { if (!audioSources[s].reference.isPlaying) { return(audioSources[s]); } } return(CreateNewAudioSource(syncMode)); }
/// <summary> /// Change standard expectations based on beacon sync mode. /// </summary> /// <param name="baseExpectations">Sync mode expectations to change.</param> /// <returns>Enhanced expectations based on beacon sync mode.</returns> private SyncMode GetBeaconSyncExpectations(SyncMode baseExpectations) { // when beacon control mode, Disconnected, Fill, FastSync, StateNodes, SnapSync are ignored, instead we are waiting from block from beacon node baseExpectations = ChangeSyncMode(BeaconSync.ControlMode, baseExpectations, SyncMode.WaitingForBlock, true, SyncMode.Disconnected, SyncMode.Full, SyncMode.FastSync, SyncMode.StateNodes, SyncMode.SnapSync); // when beacon control mode, FastHeaders, FastBodies, FastReceipts, are run in parallel with waiting from block from beacon node baseExpectations = ChangeSyncMode(BeaconSync.ControlMode, baseExpectations, SyncMode.WaitingForBlock, false, SyncMode.FastHeaders, SyncMode.FastBodies, SyncMode.FastReceipts); // when beacon headers, WaitingForBlock, Fill, FastSync, StateNodes, SnapSync are ignored, instead we are syncing beacon headers baseExpectations = ChangeSyncMode(BeaconSync.Headers, baseExpectations, SyncMode.BeaconHeaders, true, SyncMode.WaitingForBlock, SyncMode.Full, SyncMode.FastSync, SyncMode.StateNodes, SyncMode.SnapSync); // when beacon headers, FastHeaders, FastBodies, FastReceipts, are run in parallel with beacon headers baseExpectations = ChangeSyncMode(BeaconSync.Headers, baseExpectations, SyncMode.BeaconHeaders, false, SyncMode.FastHeaders, SyncMode.FastBodies, SyncMode.FastReceipts); return(baseExpectations); }
public CacheableEntity Get(string identifier, SyncMode syncMode = SyncMode.NoSync) { if (IsSlaveCache && syncMode != SyncMode.NoSync) { var syncObject = _masterCache.Get(identifier, GetSyncModeForParentCache(syncMode)); if (syncObject != null) Set(syncObject, SyncMode.NoSync); } CacheItem result; lock (_locker) result = _cacheInfraestructure.Get(identifier) as CacheItem; return result != null ? result.Value as CacheableEntity : null; }
public JObject ToJSON() { JObject json = new JObject { { "ID", new JValue(ID) }, { "Name", new JValue(Name) }, { "Description", new JValue(Description) }, { "SyncMode", new JValue(SyncMode.ToString()) }, { "Provider", new JValue(Provider) }, { "FullPath", new JValue(FullPath) }, { "CloudProviderPath", new JValue(CloudProviderPath) }, { "Unopened", new JValue(Unopened) } }; return(json); }
public async Task SyncAsync <T>(SyncMode mode) where T : new() { var t = typeof(T); var key = _typeProviders.Keys .Where(c => c.IsAssignableFrom(t)) .OrderBy(c => Depth(t, c)) .FirstOrDefault() ?? throw new InvalidOperationException($"No provider was found for type {typeof(T)}"); var config = _typeProviders[key]; switch (mode) { case SyncMode.Pull: await config.Pull <T>(); break; case SyncMode.Push: await config.Put <T>(); await config.Push <T>(); break; case SyncMode.RemoteWins: await config.Pull <T>(); await config.Put <T>(); await config.Push <T>(); break; case SyncMode.LocalWins: await config.Put <T>(); await config.Pull <T>(); await config.Push <T>(); break; default: break; } }
public void BeforeStartGame(SyncMode mode) { _syncMode = mode; //初始化数据 TickerManager.Instance.ClearAllTicks(); CharacterManager.Instance.Clear(); //第一帧是1 _nextFrameStep = 1; TickerManager.Instance.FixedTickCount = 0; _frameUpdateReq.data.Uin = _uin; _frameUpdateReq.data.Keys.Clear(); _inputListeners.Clear(); _needUpdate = false; BattleUIManager.Instance.DirectionUI.Enable = true; BattleUIManager.Instance.AttackUI.Enable = true; CameraManager.Instance.SetTarget(GameClient.Instance.MainPlayer.ThisView.MainTransform); }
public Bot(int processId, IAsyncRecogniser recogniser, IRepository <TestQuestion> testRepository, IRepository <NumericQuestion> numberRepository, ICutter cutter, IClicker clicker, IReopener reopener) { _process = Process.GetProcesses().FirstOrDefault(p => p.Id == processId); if (_process == null) { Console.WriteLine("Процесс не найден"); throw new Exception(); } _recogniserAsync = recogniser; mode = SyncMode.Async; // Ассинхронный распознаватель _testRepository = testRepository; _numericRepository = numberRepository; _cutter = cutter; _clicker = clicker; _reopener = reopener; }
public override void Load(DescriptorList description, AssetManager assets) { CustomDescriptor fmConfig = description.FindCustomDescriptor("fm2c"); cIndex = (double)fmConfig.Objects[0]; mIndex = (double)fmConfig.Objects[1]; feedBack = (double)fmConfig.Objects[2]; sync = GetSyncModeFromString((string)fmConfig.Objects[3]); if (description.GenDescriptions[0].LoopMethod != LoopModeEnum.Continuous || description.GenDescriptions[1].LoopMethod != LoopModeEnum.Continuous) { throw new Exception("Fm2 patches must have continuous generators with wrapping bounds."); } genList[0] = description.GenDescriptions[0].ToGenerator(assets); genList[1] = description.GenDescriptions[1].ToGenerator(assets); envList[0] = description.EnvelopeDescriptions[0]; envList[1] = description.EnvelopeDescriptions[1]; lfoList[0] = description.LfoDescriptions[0]; }
public async void Run(SyncMode mode = SyncMode.Full) { if (!ServiceContainer.Resolve <AuthManager> ().IsAuthenticated) { return; } if (IsRunning) { return; } var network = ServiceContainer.Resolve <INetworkPresence> (); if (!network.IsNetworkPresent) { network.RegisterSyncWhenNetworkPresent(); return; } else { network.UnregisterSyncWhenNetworkPresent(); } var bus = ServiceContainer.Resolve <MessageBus> (); IsRunning = true; // Unsubscribe from models commited messages (our actions trigger them as well, // so need to ignore them to prevent infinite recursion. if (subscriptionDataChange != null) { bus.Unsubscribe(subscriptionDataChange); subscriptionDataChange = null; } try { // Make sure that the RunInBackground is actually started on a background thread LastRun = await await Task.Factory.StartNew(() => RunInBackground (mode, LastRun)); } finally { IsRunning = false; subscriptionDataChange = bus.Subscribe <DataChangeMessage> (OnDataChange); } }
/// <summary> /// Stops the audio that is being played on the audiosource with audioSourceID. /// </summary> /// <param name="audiosourceID">ID of the Audio Source that will be checked.</param> public void StopAudio(int audioSourceID, SyncMode syncMode, bool fade = false, float step = 0.1f) { List <EffectTracker <AudioSource> > audioSources = GetCorrectList(syncMode); for (int i = 0; i < audioSources.Count; i++) { if (audioSources[i].ID == audioSourceID) { if (!fade) { audioSources[i].reference.Stop(); } else { StartCoroutine(AudioFadeOut(audioSources[i].reference, step)); } } } }
internal VaultIndex(string id, string name, string description, SyncMode syncMode, string provider, string fullPath, string cloudProviderPath, bool unopened) { _id = id; _name = name; _description = description; _syncMode = syncMode; _provider = provider; _fullPath = fullPath; _cloudProviderPath = cloudProviderPath; _unopened = unopened; UpdateLastModified(); }
/// <summary> /// Checks if the toCheck AudioClip is already being played. /// </summary> /// <param name="toCheck"></param> /// <returns></returns> public bool AudioClipIsPlaying(AudioClip toCheck, SyncMode syncMode) { List <EffectTracker <AudioSource> > audioSources = GetCorrectList(syncMode); for (int i = 0; i < audioSources.Count; i++) { if (audioSources[i].reference.clip != null) { if (audioSources[i].reference.clip.name == toCheck.name) { if (audioSources[i].reference.isPlaying) { return(true); } } } } return(false); }
public IDisposable Sync(ISynchronizationContext <T> sourceContext, ISynchronizationContext <T> targetContext, SyncMode syncMode = SyncMode.TwoWay) { switch (syncMode) { case SyncMode.OneWay: return(sourceContext.Subscribe(targetContext)); case SyncMode.OneWayToSource: return(targetContext.Subscribe(sourceContext)); default: return(new CompositeDisposable { targetContext.Subscribe(sourceContext), sourceContext.Subscribe(targetContext) }); } }
public int ConvertToBeats(float delay, SyncMode syncMode) { int beats = 0; switch (syncMode) { case SyncMode.None: beats = (int)delay.Round(); break; case SyncMode.Beat: beats = (int)delay.Round(); break; case SyncMode.Measure: beats = (int)delay.Round() * BeatsPerMeasure; break; } return(beats); }
public float GetAdjustedDelay(float delay, SyncMode syncMode) { float adjustedDelay = 0; switch (syncMode) { case SyncMode.None: adjustedDelay = delay; break; case SyncMode.Beat: adjustedDelay = (float)(nextBeatTime - AudioSettings.dspTime + delay * beatDuration); break; case SyncMode.Measure: adjustedDelay = (float)(nextMeasureTime - AudioSettings.dspTime + delay * measureDuration); break; } return(adjustedDelay); }
public override void OnInspectorGUI() { GUI.backgroundColor = Color.cyan; nb = target as NetworkBehaviour; syncMode = nb.syncMode; // Header showNetworkInspector = EditorGUILayout.Foldout(showNetworkInspector, "Network Replication"); if (showNetworkInspector) { // Send Rate nb.SendRate = EditorGUILayout.IntSlider("Send Rate", nb.SendRate, 0, 60); nb.transformSyncMode = (ETransformSyncMode)EditorGUILayout.EnumPopup("Transform Sync Mode", nb.transformSyncMode); switch (nb.transformSyncMode) { case ETransformSyncMode.SyncNone: syncMode = new SyncMode(); break; case ETransformSyncMode.SyncTransform: SyncTransform(); break; case ETransformSyncMode.SyncRigidbody2D: SyncRigidbody2D(); break; case ETransformSyncMode.SyncRigidbody3D: SyncRigidbody3D(); break; case ETransformSyncMode.SyncCharacterController: SyncCharacterController(); break; } } }
protected void Synchronize(SyncMode mode = SyncMode.Read) { if (String.IsNullOrEmpty(Path)) { return; } switch (mode) { case SyncMode.Read: SyncRead(); break; case SyncMode.Write: SyncWrite(); break; default: throw new InvalidEnumArgumentException("Invalid synchronisation mode for Config synchronisation.", new ArgumentException()); } }
public static async Task <DbConnectionRunner> GetConnectionAsync(this BaseOrchestrator orchestrator, SyncContext context, SyncMode syncMode = SyncMode.Writing, SyncStage syncStage = SyncStage.None, DbConnection connection = default, DbTransaction transaction = default, CancellationToken cancellationToken = default, IProgress <ProgressArgs> progress = default) { // Get context or create a new one context.SyncStage = syncStage; if (orchestrator.Provider == null) { return(new DbConnectionRunner(null, context, null, null, true, true, cancellationToken, progress)); } if (connection == null) { connection = orchestrator.Provider.CreateConnection(); } var alreadyOpened = connection.State == ConnectionState.Open; var alreadyInTransaction = transaction != null && transaction.Connection == connection; // Open connection if (!alreadyOpened) { await orchestrator.OpenConnectionAsync(context, connection, cancellationToken, progress).ConfigureAwait(false); } // Create a transaction if (!alreadyInTransaction && syncMode == SyncMode.Writing) { transaction = connection.BeginTransaction(orchestrator.Provider.IsolationLevel); await orchestrator.InterceptAsync(new TransactionOpenedArgs(context, connection, transaction), progress, cancellationToken).ConfigureAwait(false); } return(new DbConnectionRunner(orchestrator, context, connection, transaction, alreadyOpened, alreadyInTransaction, cancellationToken, progress)); }
private void SyncRunModeToView(SyncMode mode = SyncMode.TsmToRadio) { bool global = false, geoip = false, gfwlist = false, none = false; switch (Config.RunMode.ToLower()) { case "gfwlist": gfwlist = true; break; case "global": global = true; break; case "geoip": geoip = true; break; case "none": none = true; break; } switch (mode) { case SyncMode.TsmToRadio: tsmGlobal.Checked = rdoGlobal.Checked = global; tsmGeoIP.Checked = rdoGeoIP.Checked = geoip; tsmGFWList.Checked = rdoGfwlist.Checked = gfwlist; tsmNone.Checked = rdoNone.Checked = none; break; case SyncMode.RadioToTsm: tsmGlobal.Checked = global; tsmGeoIP.Checked = geoip; tsmGFWList.Checked = gfwlist; tsmNone.Checked = none; break; } }
private void SyncTransform() { syncMode = new SyncTransform(); var s = syncMode as SyncTransform; showMovement = EditorGUILayout.Foldout(showMovement, "Movement"); if (showMovement) { s.MovementThreshold = EditorGUILayout.FloatField("Movement Threshold", s.MovementThreshold); s.SnapThreshold = EditorGUILayout.FloatField("Snap Threshold", s.SnapThreshold); s.InterpolateMovement = EditorGUILayout.FloatField("Interpolate Movement", s.InterpolateMovement); } showRotation = EditorGUILayout.Foldout(showRotation, "Rotation"); if (showRotation) { s.RotationAxis = (ERotationAxis)EditorGUILayout.EnumPopup("Rotation Axis", s.RotationAxis); s.InterpolateRotation = EditorGUILayout.FloatField("Interpolate Rotation", s.InterpolateRotation); s.CompressRotation = (ECompression)EditorGUILayout.EnumPopup("Compress Rotation", s.CompressRotation); s.SyncAngularVelocity = EditorGUILayout.Toggle("Sync Angular Velocity", s.SyncAngularVelocity); } }
public void TheSyncModeShouldBe(SyncMode syncMode) { void Test() { foreach (Action overwrite in _overwrites) { overwrite.Invoke(); } MultiSyncModeSelector selector = new MultiSyncModeSelector(SyncProgressResolver, SyncPeerPool, SyncConfig, LimboLogs.Instance, false); selector.DisableTimer(); selector.Update(); selector.Current.Should().Be(syncMode); } SetDefaults(); foreach (Func <string> syncProgressSetup in _syncProgressSetups) { foreach (Func <string> peeringSetup in _peeringSetups) { foreach (Func <string> configSetups in _configActions) { string syncProgressSetupName = syncProgressSetup.Invoke(); string peeringSetupName = peeringSetup.Invoke(); string configSetupName = configSetups.Invoke(); Console.WriteLine("====================="); Console.WriteLine(syncProgressSetupName); Console.WriteLine(peeringSetupName); Console.WriteLine(configSetupName); Test(); Console.WriteLine("====================="); } } } }
private EffectTracker <AudioSource> CreateNewAudioSource(SyncMode syncMode) { List <EffectTracker <AudioSource> > audioSources = GetCorrectList(syncMode); string sync = syncMode == SyncMode.Singleplayer ? "Singleplayer" : "Multiplayer"; GameObject newSource = new GameObject { name = "AudioSource " + sync + " " + audioSources.Count }; newSource.transform.SetParent(transform); AudioSource source = newSource.AddComponent <AudioSource>(); source.playOnAwake = false; EffectTracker <AudioSource> toReturn = new EffectTracker <AudioSource>(audioSources.Count); toReturn.CreateReference(source); audioSources.Add(toReturn); return(toReturn); }
public VideoPlayerViewModel(DisplayVideoFrameDelegate displayVideoFrameCallback, VideoLib.VideoPlayer.DecodedVideoFormat decodedVideoFormat) { this.displayVideoFrameCallback = displayVideoFrameCallback; this.decodedVideoFormat = decodedVideoFormat; videoDecoder = new VideoLib.VideoPlayer(); videoDecoder.setLogCallback(videoDecoderLogCallback, true, true); audioPlayer = new AudioPlayer(); videoRefreshTimer = HRTimerFactory.create(HRTimerFactory.TimerType.TIMER_QUEUE); videoRefreshTimer.Tick += new EventHandler(videoRefreshTimer_Tick); //videoRefreshTimer.SynchronizingObject = this; videoRefreshTimer.AutoReset = false; audioRefreshTimer = HRTimerFactory.create(HRTimerFactory.TimerType.TIMER_QUEUE); audioRefreshTimer.Tick += new EventHandler(audioRefreshTimer_Tick); audioRefreshTimer.AutoReset = false; //audioRefreshTimer.SynchronizingObject = null; audioDiffAvgCoef = Math.Exp(Math.Log(0.01) / AUDIO_DIFF_AVG_NB); syncMode = SyncMode.AUDIO_SYNCS_TO_VIDEO; VideoState = VideoState.CLOSED; playCommand = new Command(new Action(() => startPlay())); pauseCommand = new Command(new Action(() => pausePlay())); closeCommand = new Command(new Action(() => close())); DurationSeconds = 0; PositionSeconds = 0; }
public SyncStartedMessage (ISyncManager sender, SyncMode mode) : base (sender) { this.mode = mode; }
ISyncOperation IMembaseOperationFactory.Sync(SyncMode mode, IList<KeyValuePair<string, ulong>> keys, int replicationCount) { return new SyncOperation(this.locator, keys, mode, replicationCount); }
private static uint GetFlags(SyncMode mode, int replicationCount) { #region [ Flag definitions ] /* Size Field 4 rep count 1 persist flag 1 Mutation flag 1 and/or for rep+persist Replication count: 4 bits. Block until has sent this many replicas (16 replicas ought to be enough for anybody). Persistence count: 1 bit. If 1, block until persisted. Mutation flag: If 1, block while the key’s CAS is valid. And/Or flag: If 0 and a replica count and persistence flag are both given, block until either condition is satisfied, else block until both conditions are satisfied. Flags layout (32-bit) 16 8 4 1 1 1 1 RESERVED RESERVED R P M R+P RESERVED R = Replication count P = Persistence count M = Observe mutation events R+P = replica + persistence operation */ #endregion if (replicationCount > 16 || replicationCount < 0) throw new ArgumentOutOfRangeException("replicationCount", "<= 0 replicationCount <= 16!"); uint retval = (uint)(replicationCount << 4); var hasRepl = (mode & SyncMode.Replication) == SyncMode.Replication && replicationCount > 0; var hasPers = (mode & SyncMode.Persistence) == SyncMode.Persistence; var hasMut = (mode & SyncMode.Mutation) == SyncMode.Mutation; if (hasMut) retval |= 4; if (hasPers) retval |= 8; if (hasRepl && hasPers) retval |= 2; return retval; }
/// <summary> /// Sync in the background. /// </summary> public void SyncInBackground(SyncMode syncMode) { if (this.Status == SyncStatus.Idle) { if (IsSyncingInProgress()) { Logger.Debug("Sync already running in background: " + SyncFolderInfo.LocalPath); return; } syncWorker.RunWorkerAsync(syncMode); } else { Logger.Info(String.Format("Repo {0} - Sync skipped. Status={1}", this.SyncFolderInfo.DisplayName, this.Status)); } }
/// <summary> /// Synchronize between CMIS folder and local folder. /// </summary> public void Sync(SyncMode syncMode) { if (Status == SyncStatus.Syncing) { Logger.Debug(SyncFolderInfo.DisplayName + ": sync in progress, cannot start again"); return; } Logger.Debug(SyncFolderInfo.DisplayName + ": syncWorker.DoWork(syncMode=" + syncMode + ")"); if (this.Status == SyncStatus.Idle) { Status = SyncStatus.Syncing; syncAutoResetEvent.Reset(); Logger.Info((syncMode == SyncMode.FULL ? "Full" : "Partial") + " Sync Started: " + SyncFolderInfo.LocalPath); if (syncMode == SyncMode.FULL) { remote_timer.Stop(); } watcher.Enable = false;//Disable events while syncing... OnEvent(new SyncronizationStarted(this)); try { doSync(syncMode); } catch (OperationCanceledException e) { Logger.Info("OperationCanceled: " + e.Message); if(Status != SyncStatus.Suspended){ Status = SyncStatus.Idle; } } catch (CmisPermissionDeniedException e) { NotifySyncException(EventLevel.ERROR, e); } catch (MissingRootSyncFolderException e) { NotifySyncException(EventLevel.ERROR, e); } catch (CmisConnectionException e) { if (e.Message.StartsWith("Cannot access")) { NotifySyncException(EventLevel.ERROR, new NetworkException(e)); //probably a network error (or the network cable disconnected) } else { NotifySyncException(EventLevel.ERROR, e); } } catch (UnhandledException e) { NotifySyncException(EventLevel.ERROR, e); } catch (Exception e) { NotifySyncException(EventLevel.ERROR, new UnhandledException(e)); } finally { if (syncMode == SyncMode.FULL) { remote_timer.Start(); last_sync = DateTime.Now; } else { last_partial_sync = DateTime.Now; } if (watcher.GetChangeCount() > 0) { //Watcher was stopped (due to error) so clear and restart sync watcher.Clear(); } watcher.Enable = true; Logger.Info((syncMode == SyncMode.FULL ? "Full" : "Partial") + " Sync Completed: " + SyncFolderInfo.LocalPath); // Save last sync SyncFolderInfo.LastSuccessedSync = DateTime.Now; ConfigManager.CurrentConfig.Save(); syncAutoResetEvent.Set(); if (Status != SyncStatus.Suspended) { Status = SyncStatus.Idle; } //TODO: signal if the syncronization has ended normally or has been interrupted OnEvent(new SyncronizationComleted(this)); } } else { Logger.Info(String.Format("Repo {0} - Sync skipped.Status={1}", this.SyncFolderInfo.DisplayName, this.Status)); } }
public VideoPlayerViewModel(Control owner, VideoLib.VideoPlayer.OutputPixelFormat decodedVideoFormat = VideoLib.VideoPlayer.OutputPixelFormat.YUV420P) { this.owner = owner; DecodedVideoFormat = decodedVideoFormat; videoDecoder = new VideoLib.VideoPlayer(); videoDecoder.FrameQueue.Finished += new EventHandler((s, e) => { owner.BeginInvoke(new Func<Task>(async () => await close())); }); videoDecoder.FrameQueue.IsBufferingChanged += new EventHandler((s, e) => { owner.BeginInvoke(new Action(() => { if (IsBufferingChanged != null) { IsBufferingChanged(this, videoDecoder.FrameQueue.IsBuffering); } })); }); audioPlayer = new AudioPlayer(owner); videoRender = new VideoRender(owner); audioDiffAvgCoef = Math.Exp(Math.Log(0.01) / AUDIO_DIFF_AVG_NB); //syncMode = SyncMode.AUDIO_SYNCS_TO_VIDEO; syncMode = SyncMode.VIDEO_SYNCS_TO_AUDIO; videoRefreshTimer = HRTimerFactory.create(HRTimerFactory.TimerType.TIMER_QUEUE); videoRefreshTimer.Tick += new EventHandler(videoRefreshTimer_Tick); videoRefreshTimer.AutoReset = false; audioRefreshTimer = HRTimerFactory.create(HRTimerFactory.TimerType.TIMER_QUEUE); audioRefreshTimer.Tick += new EventHandler(audioRefreshTimer_Tick); audioRefreshTimer.AutoReset = false; DurationSeconds = 0; PositionSeconds = 0; videoPts = 0; audioPts = 0; owner.HandleDestroyed += new EventHandler(async (s, e) => await close()); VideoState = VideoState.CLOSED; VideoLocation = ""; Subtitles = new Subtitles(Log); //interruptIOTokenSource = new CancellationTokenSource(); }
/// <summary> /// Sets the options of this connection /// </summary> /// <param name="me">Owner of the connection</param> /// <param name="other">the partner Control Point </param> /// <param name="heading">the heading mode</param> /// <param name="sync">the synchronization mode</param> /// <param name="tags">tags of this connection</param> public void Set(CurvySplineSegment me, CurvySplineSegment other, HeadingMode heading, SyncMode sync, params string[] tags) { Owner = me; Other = other; Other.ConnectedBy.Add(me); Heading = heading; Sync = sync; SetTags(tags); }
private bool CanMigrate(SyncMode syncMode) => syncMode.NotSyncing();
public SyncFinishedMessage (ISyncManager sender, SyncMode mode, bool hadErrors, Exception fatalError) : base (sender) { this.mode = mode; this.hadErrors = hadErrors; this.fatalError = fatalError; }
private SyncMode GetSyncModeForParentCache(SyncMode syncMode) { return syncMode != SyncMode.Sync ? SyncMode.NoSync : SyncMode.Sync; }
/// <summary> /// Synchronize between CMIS folder and local folder, without any check on concurrent executions or any notification. /// </summary> protected override void doSync(SyncMode syncMode) { Logger.Debug(SyncFolderInfo.DisplayName + ": doSync(syncMode=" + syncMode + ", _forceFullSyncAtNextSync=" + _forceFullSyncAtNextSync + ")"); if (_forceFullSyncAtNextSync) { syncMode = SyncMode.FULL; _forceFullSyncAtNextSync = false; } CheckPendingCancelation(); // Add ACL in the context, or ACL is null // OperationContext context = new OperationContext(); // context.IncludeAcls = true; //IFolder remoteFolder = (IFolder)session.GetObjectByPath(remoteFolderPath, context); //reset cache getSession().Clear(); IFolder remoteFolder = tryGetObjectByPath(remoteFolderPath); checkDirectories(); if (syncMode == SyncMode.FULL) { Logger.Debug("invoke a full crawl sync"); CrawlSyncAndUpdateChangeLogToken(remoteFolder, SyncFolderInfo.LocalPath); } else if (syncMode == SyncMode.PARTIAL) { // Apply local changes noticed by the filesystem watcher. bool succes = WatcherSync(remoteFolderPath, SyncFolderInfo.LocalPath); if (succes == false) { //something went wrong, but just slightly CrawlSyncAndUpdateChangeLogToken(remoteFolder, SyncFolderInfo.LocalPath); } ////TODO: should not crawn on Partial Sync //if (ChangeLogCapability) //{ // Logger.Debug("Invoke a remote change log sync"); // ChangeLogThenCrawlSync(remoteFolder, SyncFolderInfo.LocalPath); //} //else //{ // // Have to crawl remote. // Logger.Warn("Invoke a full crawl sync (the remote does not support ChangeLog)"); // //FIXME: why do we need to clear the watcher? it should already be // watcher.Clear(); // CrawlSyncAndUpdateChangeLogToken(remoteFolder, SyncFolderInfo.LocalPath); //} } else { throw new ArgumentException("Unknown syncMode: " + syncMode); } }
protected abstract void doSync(SyncMode syncMode);
public StaticSelector(SyncMode syncMode) { Current = syncMode; }
ISyncOperation IMembaseOperationFactory.Sync(SyncMode mode, IList<KeyValuePair<string, ulong>> keys, int replicationCount) { throw new NotSupportedException("Sync is not supported on memcached buckets."); }
public void Delete(string identifier, SyncMode syncMode = SyncMode.NoSync) { _masterCache.Delete(identifier, syncMode); }
public CacheableEntity Get(string identifier, SyncMode syncMode = SyncMode.NoSync) { return _masterCache.Get(identifier, syncMode); }
public bool CheckArgs(string[] args) { int lCount = args.Length; bool lBadParam = false; if (lCount > 0) { fLocalDirectory = args[0]; } else { lBadParam = true; } if (lCount > 1) { Match lMatch = Regex.Match(args[1], @"(?<user>\S+):(?<pass>\S+)@(?<server>[^/\s]+)/(?<dir>\S*)"); if (lMatch.Success) { fUserName = lMatch.Groups["user"].Value; fPassword = lMatch.Groups["pass"].Value; fServer = lMatch.Groups["server"].Value; fServerDirectory = lMatch.Groups["dir"].Value; } else { lBadParam = true; Console.WriteLine("Invalid server parameters"); Console.WriteLine(""); } } else { lBadParam = true; } for (int i = 2; i < lCount; i++) { switch (args[i].ToLower()) { case "-local": fSyncMode = SyncMode.Local; break; case "-remote": fSyncMode = SyncMode.Remote; break; case "-nodelete": fDoNotDeleteMissingItems = true; break; case "-passive": fPassiveMode = true; break; case "-r": fRecursiveSync = true; break; case "-l": fDoShowFtpClientLog = true; break; case "-help": lBadParam = true; break; case "/help": lBadParam = true; break; default: Console.WriteLine("Invalid command line paramter \"" + args[i] + "\""); Console.WriteLine(""); lBadParam = true; break; } } if (lBadParam) { Console.WriteLine("RemObjects Internet Pack - FtpSync Sample"); Console.WriteLine(""); Console.WriteLine(" Usage: FtpSync directory user:pass@server/remote [-local] [-remote] [-nodelete] [-passive] [-l] [-r]"); Console.WriteLine(); Console.WriteLine(" Compares files on local computer against those on the remote server, "); Console.WriteLine(" downloading those that are new or have changed."); Console.WriteLine(); Console.WriteLine(" directory : local directory - long file names with spaces should be quoted"); Console.WriteLine(" user/pass : ftp username & password"); Console.WriteLine(" server : ftp server (i.e., ftp.whatever.com"); Console.WriteLine(" remote : directory on remote server"); Console.WriteLine(); Console.WriteLine(" -nodelete : forbid to delete missing files"); Console.WriteLine(" -passive : turn on 'Passive mode'"); Console.WriteLine(" -r : recursive synchronization (through subdirectories)"); Console.WriteLine(" -l : log - show FTP commands"); Console.WriteLine(" -local : Local mode of sync (Master = ftp; slave = localhost). By default"); Console.WriteLine(" -remote : Remote mode of sync (Master = localhost; slave = ftp)"); Console.WriteLine(); Console.WriteLine("Press enter to exit."); Console.ReadLine(); } return(!lBadParam); }
public void Set(CacheableEntity item, SyncMode syncMode = SyncMode.NoSync) { _masterCache.Set(item, syncMode); }
public PDModule Play(string moduleName, string soundName, GameObject source, float delay, SyncMode syncMode, params AudioOption[] audioOptions) { PDModule module = GetModule(moduleName, source); module.AddAudioItem(GetAudioItem(moduleName, soundName, module.spatializer.Source, audioOptions)); LimitVoices(); module.Play(delay, syncMode); return(module); }
public VideoPanelViewModel() { // //TODO: Add the constructor code here // //videoRender = null; //mediaPlayer.Dock = DockStyle.Fill; //mediaPlayer.stretchToFit = true; videoRender = new VideoRender(VideoPanel); audioPlayer = new StreamingAudioBuffer(this); //videoRender.initialize(0,0); videoDecoder = new VideoPlayer(); videoDecoder.FrameQueue.Closed += new EventHandler(frameQueue_Closed); videoDecoder.setLogCallback(new VideoPlayer.LogCallbackDelegate(videoDecoderLogCallback), true, true); videoRefreshTimer = HRTimerFactory.create(HRTimerFactory.TimerType.TIMER_QUEUE); videoRefreshTimer.Tick += new EventHandler(videoRefreshTimer_Tick); //videoRefreshTimer.SynchronizingObject = this; videoRefreshTimer.AutoReset = false; audioRefreshTimer = HRTimerFactory.create(HRTimerFactory.TimerType.TIMER_QUEUE); audioRefreshTimer.Tick += new EventHandler(audioRefreshTimer_Tick); audioRefreshTimer.AutoReset = false; audioRefreshTimer.SynchronizingObject = null; videoDebug = new VideoDebugForm(); audioDiffAvgCoef = Math.Exp(Math.Log(0.01) / AUDIO_DIFF_AVG_NB); //syncMode = SyncMode.VIDEO_SYNCS_TO_AUDIO; syncMode = SyncMode.AUDIO_SYNCS_TO_VIDEO; VideoState = VideoState.CLOSED; updateTimeTrackBar = true; timeTrackBarToolTip = new CustomToolTip(); timeTrackBarToolTip.BackColor = SystemColors.Info; this.Controls.Add(timeTrackBarToolTip); timeTrackBarToolTip.Show(); timeTrackBarToolTip.BringToFront(); timeTrackBarToolTip.Visible = false; muteCheckBox.Checked = bool.Parse(Settings.getVar(Settings.VarName.VIDEO_MUTED)); volumeTrackBar.Value = Util.lerp<int>(Double.Parse(Settings.getVar(Settings.VarName.VIDEO_VOLUME)), volumeTrackBar.Minimum, volumeTrackBar.Maximum); }
void ReleaseDesignerOutlets() { if (ConnectionTimeout != null) { ConnectionTimeout.Dispose(); ConnectionTimeout = null; } if (DBInitialisedOn != null) { DBInitialisedOn.Dispose(); DBInitialisedOn = null; } if (UpdateAppUri != null) { UpdateAppUri.Dispose(); UpdateAppUri = null; } if (EventUTCOffset != null) { EventUTCOffset.Dispose(); EventUTCOffset = null; } if (NotificationsBtn != null) { NotificationsBtn.Dispose(); NotificationsBtn = null; } if (PromptsBtn != null) { PromptsBtn.Dispose(); PromptsBtn = null; } if (LogsBtn != null) { LogsBtn.Dispose(); LogsBtn = null; } if (PromptView != null) { PromptView.Dispose(); PromptView = null; } if (NotificationView != null) { NotificationView.Dispose(); NotificationView = null; } if (CancelBtn != null) { CancelBtn.Dispose(); CancelBtn = null; } if (DatabaseSize != null) { DatabaseSize.Dispose(); DatabaseSize = null; } if (RunningMode != null) { RunningMode.Dispose(); RunningMode = null; } if (CurrentVersion != null) { CurrentVersion.Dispose(); CurrentVersion = null; } if (GoLiveDate != null) { GoLiveDate.Dispose(); GoLiveDate = null; } if (ResponderRegion != null) { ResponderRegion.Dispose(); ResponderRegion = null; } if (EventPasscode != null) { EventPasscode.Dispose(); EventPasscode = null; } if (RefreshViewBtn != null) { RefreshViewBtn.Dispose(); RefreshViewBtn = null; } if (EventName != null) { EventName.Dispose(); EventName = null; } if (SyncDataBtn != null) { SyncDataBtn.Dispose(); SyncDataBtn = null; } if (ResponderId != null) { ResponderId.Dispose(); ResponderId = null; } if (SyncDataInterval != null) { SyncDataInterval.Dispose(); SyncDataInterval = null; } if (SyncMode != null) { SyncMode.Dispose(); SyncMode = null; } if (WANServiceUri != null) { WANServiceUri.Dispose(); WANServiceUri = null; } if (SaveChangesBtn != null) { SaveChangesBtn.Dispose(); SaveChangesBtn = null; } if (LANServiceUri != null) { LANServiceUri.Dispose(); LANServiceUri = null; } if (LastSuccessfulDataPush != null) { LastSuccessfulDataPush.Dispose(); LastSuccessfulDataPush = null; } if (LogView != null) { LogView.Dispose(); LogView = null; } if (LastSuccessfulServiceUpdate != null) { LastSuccessfulServiceUpdate.Dispose(); LastSuccessfulServiceUpdate = null; } }
public bool CheckArgs(string[] args) { int lCount = args.Length; bool lBadParam = false; if (lCount > 0) fLocalDirectory = args[0]; else lBadParam = true; if (lCount > 1) { Match lMatch = Regex.Match(args[1], @"(?<user>\S+):(?<pass>\S+)@(?<server>[^/\s]+)/(?<dir>\S*)"); if (lMatch.Success) { fUserName = lMatch.Groups["user"].Value; fPassword = lMatch.Groups["pass"].Value; fServer = lMatch.Groups["server"].Value; fServerDirectory = lMatch.Groups["dir"].Value; } else { lBadParam = true; Console.WriteLine("Invalid server parameters"); Console.WriteLine(""); } } else lBadParam = true; for (int i = 2; i < lCount; i++) { switch (args[i].ToLower()) { case "-local": fSyncMode = SyncMode.Local; break; case "-remote": fSyncMode = SyncMode.Remote; break; case "-nodelete": fDoNotDeleteMissingItems = true; break; case "-passive": fPassiveMode = true; break; case "-r": fRecursiveSync = true; break; case "-l": fDoShowFtpClientLog = true; break; case "-help": lBadParam = true; break; case "/help": lBadParam = true; break; default: Console.WriteLine("Invalid command line paramter \"" + args[i] + "\""); Console.WriteLine(""); lBadParam = true; break; } } if (lBadParam) { Console.WriteLine("RemObjects Internet Pack - FtpSync Sample"); Console.WriteLine(""); Console.WriteLine(" Usage: FtpSync directory user:pass@server/remote [-local] [-remote] [-nodelete] [-passive] [-l] [-r]"); Console.WriteLine(); Console.WriteLine(" Compares files on local computer against those on the remote server, "); Console.WriteLine(" downloading those that are new or have changed."); Console.WriteLine(); Console.WriteLine(" directory : local directory - long file names with spaces should be quoted"); Console.WriteLine(" user/pass : ftp username & password"); Console.WriteLine(" server : ftp server (i.e., ftp.whatever.com"); Console.WriteLine(" remote : directory on remote server"); Console.WriteLine(); Console.WriteLine(" -nodelete : forbid to delete missing files"); Console.WriteLine(" -passive : turn on 'Passive mode'"); Console.WriteLine(" -r : recursive synchronization (through subdirectories)"); Console.WriteLine(" -l : log - show FTP commands"); Console.WriteLine(" -local : Local mode of sync (Master = ftp; slave = localhost). By default"); Console.WriteLine(" -remote : Remote mode of sync (Master = localhost; slave = ftp)"); Console.WriteLine(); Console.WriteLine("Press enter to exit."); Console.ReadLine(); } return !lBadParam; }
ISyncOperation ICouchbaseOperationFactory.Sync(SyncMode mode, IList <KeyValuePair <string, ulong> > keys, int replicationCount) { return(new SyncOperation(this.locator, keys, mode, replicationCount)); }
public override void Load(DescriptorList description, AssetManager assets) { CustomDescriptor fmConfig = description.FindCustomDescriptor("fm2c"); cIndex = (double)fmConfig.Objects[0]; mIndex = (double)fmConfig.Objects[1]; feedBack = (double)fmConfig.Objects[2]; sync = GetSyncModeFromString((string)fmConfig.Objects[3]); if (description.GenDescriptions[0].LoopMethod != LoopModeEnum.Continuous || description.GenDescriptions[1].LoopMethod != LoopModeEnum.Continuous) throw new Exception("Fm2 patches must have continuous generators with wrapping bounds."); cGen = description.GenDescriptions[0].ToGenerator(assets); mGen = description.GenDescriptions[1].ToGenerator(assets); cEnv = description.EnvelopeDescriptions[0]; mEnv = description.EnvelopeDescriptions[1]; lfo = description.LfoDescriptions[0]; }