public void AddError(string entityId, string message, Exception ex)
 {
     Write(_messageTmpl,
           "Error",
           _syncType.ToString(),
           entityId,
           message + (ex != null ? " (exception details: " + ex.Message + ")" : String.Empty));
 }
Beispiel #2
0
 /// <summary>
 /// Change the synchronization settings of the selected drive
 /// </summary>
 /// <param name="syncType">The type of synchronization that is selected</param>
 private void updateSyncType(SyncType syncType)
 {
     try
     {
         if (selectedDrive == null)
         {
             return;
         }
         drives.Remove(selectedDrive);
         selectedDrive.syncType = syncType;
         drives.Add(selectedDrive);
         FileDetailsMgmt.saveDrive(drives);
         drives           = FileDetailsMgmt.getRegisteredDrives();
         lblSyncType.Text = syncType.ToString();
     }
     catch (Exception e) { Helper.WriteLog(e); }
 }
        private string BuildSyncQuery(SyncType syncType = SyncType.All, string contentTypeId = null, bool initial = false, string syncToken = null, int?limit = null)
        {
            var querystringValues = new List <KeyValuePair <string, string> >();

            if (syncType != SyncType.All)
            {
                querystringValues.Add(new KeyValuePair <string, string>("type", syncType.ToString()));
            }

            if (syncType == SyncType.Entry && !string.IsNullOrEmpty(contentTypeId))
            {
                querystringValues.Add(new KeyValuePair <string, string>("content_type", contentTypeId));
            }

            if (initial)
            {
                querystringValues.Add(new KeyValuePair <string, string>("initial", "true"));
            }

            if (!string.IsNullOrEmpty(syncToken))
            {
                querystringValues.Add(new KeyValuePair <string, string>("sync_token", syncToken));
            }

            if (limit.HasValue)
            {
                querystringValues.Add(new KeyValuePair <string, string>("limit", limit.Value.ToString()));
            }

            var query = new StringBuilder();

            var hasQuery = false;

            foreach (var parameter in querystringValues)
            {
                query.Append(hasQuery ? '&' : '?');
                query.Append(parameter.Key);
                query.Append('=');
                query.Append(parameter.Value);
                hasQuery = true;
            }

            return(query.ToString());
        }
Beispiel #4
0
        /// <summary>
        ///     json representation of sync
        /// </summary>
        /// <returns></returns>
        public JObject AsJson()
        {
            var sync = new JObject
            {
                { SmartStore.Store.SmartStore.SoupEntryId, Id },
                { Constants.SyncType, SyncType.ToString() },
                { Constants.SyncSoupName, SoupName },
                { Constants.SyncStatus, Status.ToString() },
                { Constants.SyncProgress, Progress },
                { Constants.SyncTotalSize, TotalSize },
                { Constants.SyncMaxTimeStamp, MaxTimeStamp }
            };

            if (Target != null)
            {
                sync[Constants.SyncTarget] = Target.AsJson();
            }
            if (Options != null)
            {
                sync[Constants.SyncOptions] = Options.AsJson();
            }
            return(sync);
        }
Beispiel #5
0
        public static string ConvertSyncTypeToString(SyncType syncType)
        {
            string newSyncType = syncType.ToString();

            return(newSyncType);
        }
Beispiel #6
0
        /// <summary>
        /// Called when when the track sync event is fired
        /// </summary>
        private void OnSampleSync(int handle, int channel, int data, IntPtr pointer)
        {
            SyncType syncType = (SyncType)(pointer.ToInt32());

            Debug.WriteLine("Event Fired: " + syncType.ToString());
        }
Beispiel #7
0
 /// <summary>
 /// Returns the fully qualified type name of this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.String"/> containing a fully qualified type name.
 /// </returns>
 /// <remarks>Documented by Dev05, 2009-03-05</remarks>
 public override string ToString()
 {
     return("LM-ID " + LmId.ToString() + " on " + ConnectionString + " (" + Typ.ToString() + " - " + SyncType.ToString() + ")");
 }
Beispiel #8
0
        public void SyncData()
        {
            if (syncType != SyncType.OnDemand)
            {
                logger.LogWarning(Tag, "SyncData will only work when syncType is OnDemand, sync type is now " + syncType.ToString());
                return;
            }

            if (!_dataSyncEnabled)
            {
                logger.LogWarning(Tag, "DataSync is disabled, will not attempt to sync player state");
                return;
            }


            _timedOut = false;

            if (_syncState == SyncLoopState.Connected)
            {
                _coroutineFactory.StartCoroutine(TrySyncData);
            }
            else if (!_loggedIn)            // If the login process wasn't completed, run it again.
            {
                _syncState = SyncLoopState.LoggingIn;
                _coroutineFactory.StartCoroutine(() => StartOnDemandMode(true));
            }
            else
            {
                logger.LogWarning(Tag, "Sync Data was called before sync state is ready, listen to the ModelSyncCompletedSignal to know when it is safe to sync data. Current Sync State:" + _syncState);
            }
        }
Beispiel #9
0
 /// <summary>
 /// Change the synchronization settings of the selected drive
 /// </summary>
 /// <param name="syncType">The type of synchronization that is selected</param>
 private void updateSyncType(SyncType syncType)
 {
     try
     {
         if (selectedDrive == null) return;
         drives.Remove(selectedDrive);
         selectedDrive.syncType = syncType;
         drives.Add(selectedDrive);
         FileDetailsMgmt.saveDrive(drives);
         drives = FileDetailsMgmt.getRegisteredDrives();
         lblSyncType.Text = syncType.ToString();
     }
     catch (Exception e) { Helper.WriteLog(e); }
 }