private static void SetAutoImportSetting(IDevice device, SqmDeviceInfoStream stream) { bool?nullable = (bool?)DeviceSettings.Get(device.WinMoDeviceId, "ImportPictures"); bool flag = nullable.HasValue ? nullable.GetValueOrDefault() : false; if (device.IsFirstConnect) { if (flag) { stream.IsAutoImportEnabled = SqmAutoImportSetting.FirstConnectYes; } else { stream.IsAutoImportEnabled = SqmAutoImportSetting.FirstConnectNo; } } else if (flag) { stream.IsAutoImportEnabled = SqmAutoImportSetting.Yes; } else { stream.IsAutoImportEnabled = SqmAutoImportSetting.No; } }
public void CreateSyncContentStream(ISyncPartnership partnership, SyncStartType type, SyncStoppedReason reason, TimeSpan syncDuration) { if ((partnership != null) && this.isSqmEnabled) { SqmSyncContentStream stream = new SqmSyncContentStream(); SetSyncType(partnership, type, stream); if (partnership.Device != null) { string winMoDeviceId = partnership.Device.WinMoDeviceId; long? nullable = (long?)DeviceSettings.Get(winMoDeviceId, "SyncCount"); uint num = 0; if (nullable.HasValue) { num = (uint)nullable.Value; } stream.SyncIndex = ++num; DeviceSettings.Set(winMoDeviceId, "SyncCount", num); } ISyncRules ruleManager = partnership.RuleManager; SetGlobalRules(stream, ruleManager); CalculateMusicSyncSelections(partnership.MusicAndMovieProvider, partnership.RuleManager, stream); this.CalculatePhotoSyncSelections(partnership.PhotoAndVideoProvider, partnership.RuleManager, stream); CalculateSyncResults(partnership, stream); stream.OperationTime = (uint)syncDuration.TotalMilliseconds; SetSyncResult(reason, stream); this.sqmManager.SetStream(stream); } }
public void Init() { IDevice device = this.Device; if (device != null) { if (!this.controller.IsDevicePartnered(device)) { this.SyncAutomatically = true; this.ImportPictures = DeviceSettings.ImportPicturesDefault; this.ResizePhotos = false; this.VideoOptimizationStrategy = "Quality"; } else { this.SyncAutomatically = (bool)DeviceSettings.Get(device.WinMoDeviceId, "SyncAutomatically"); this.ImportPictures = (bool)DeviceSettings.Get(device.WinMoDeviceId, "ImportPictures"); this.ResizePhotos = (bool)DeviceSettings.Get(device.WinMoDeviceId, "ResizePhotos"); this.VideoOptimizationStrategy = (string)DeviceSettings.Get(device.WinMoDeviceId, "VideoOptimizationStrategy"); } this.Name = device.Name; } }