public void PopulateTrackDataFromAudioFile(string filePath, LocationMode locationMode, string originalFilePath, bool converted = false) { _log.Debug("Loading " + filePath); string extension = Path.GetExtension(filePath); if (extension == ".wav") { string filename = Path.GetFileNameWithoutExtension(filePath); //Should never happen, but if we have a wav with a non md5 name, make it md5 if (!converted) { TrackId trackId = new TrackId(filePath); filename = trackId.trackId; } string str = Paths.WavDataFolder(locationMode) + filename + ".wav"; if (!System.IO.File.Exists(str) && filePath != str) { System.IO.File.Copy(filePath, str); } LoadWav(str, locationMode, originalFilePath); } else { if (!(extension == ".mp3") && !(extension == ".m4a") && !(extension == ".ogg")) { return; } TrackId trackId = new TrackId(filePath); string outputPath = Paths.WavDataFolder(locationMode) + trackId.trackId + ".wav"; //Convert to WAV FFmpegQueue.instance.Queue((FFmpegJob) new FFmpegJobConvert(filePath, outputPath, OnConvertedToWav)); } }
internal RetryContext(int currentRetryCount, RequestResult lastRequestResult, StorageLocation nextLocation, LocationMode locationMode) { this.CurrentRetryCount = currentRetryCount; this.LastRequestResult = lastRequestResult; this.NextLocation = nextLocation; this.LocationMode = locationMode; }
public bool DoesTrackDataExist(string filePath, LocationMode locationMode, Game gameType) { TrackId trackId = new TrackId(filePath); string locationpathPath = this.GetLocationpathPath(trackId, locationMode, gameType); return(System.IO.File.Exists(locationpathPath) && new FileInfo(locationpathPath).Length > 0L); }
public void WavLoaded(TagLib.File track, string wavPath, LocationMode locationMode) { _log.Debug("Wav Loaded"); this.audioTrack = track; SongParser.instance.onParsingComplete += new SongParser.OnParsingComplete(OnParsingComplete); SongParser.instance.CreateSongClipFromAudioClip(audioTrack, wavPath, locationMode); }
public string GetLocationpathPath( TrackId trackId, LocationMode locationMode, Game gameType) { string str = Paths.TrackDataFolder(locationMode); switch (locationMode) { case LocationMode.PlayerData: case LocationMode.Editor: if (!Directory.Exists(Paths.RootDataFolder(locationMode))) { Directory.CreateDirectory(Paths.RootDataFolder(locationMode)); } str = str + trackId.trackId + ".trackdata.txt"; break; case LocationMode.Workouts: case LocationMode.Downloadable: case LocationMode.MyWorkout: str = str + trackId.trackId + ".trackdata"; break; } return(str); }
public TrackData NewTrackData( UserSongClip clip, BeatStructureMadmom bsm, LocationMode locationMode) { TrackData trackData = new TrackData(); trackData.originalFilePath = clip.originalFilePath; trackData.originalTrackName = clip.trackData.originalTrackName; trackData.originalArtist = clip.trackData.originalArtist; trackData.trackId = new TrackId(clip.originalFilePath); trackData.bpm = bsm._beatList.AverageBpm; trackData.beatStrucureJSON = BeatStructureToJSON(bsm); trackData.duration = clip.trackData.duration; trackData.locationMode = locationMode; trackData.firstBeatOffset = bsm.Beats[0]._triggerTime; SaveTrackData(trackData); TrackDefinition trackDefinition = new TrackDefinition(); trackDefinition.locationMode = locationMode; trackDefinition.trackId = trackData.trackId; trackDefinition.tagLibTitle = trackData.originalTrackName; trackDefinition.tagLibArtist = trackData.originalArtist; trackDefinition.duration = trackData.duration; trackDefinition.bpm = trackData.bpm; trackDefinition.trackData = trackData; trackDefinition.SaveTrackDefinition(); this.trackDefinitionsPlayer.Add(trackDefinition); return(trackData); }
private void OnConvertedToWav(FFmpegJob job) { _log.Debug("FFMPEG complete: " + job._outputPath); LocationMode locationMode = LocationMode.PlayerData; this.originalFileNameBackup = Path.GetFileNameWithoutExtension(job._inputPath); this.PopulateTrackDataFromAudioFile(job._outputPath, locationMode, job._inputPath, true); }
public void SaveWorkout(WorkoutPlaylist workout, LocationMode savingMode) { string str = Paths.WorkoutDefinitionFolder(savingMode, workout.definition.game); for (int index = 0; index < workout.songs.Count; ++index) { workout.songs[index].serialisedActionList = new MusicActionListSerializable(); workout.songs[index].serialisedActionList.actionList = MusicActionListSerializer.Instance.BuildSerializableMusicActionList(workout.songs[index].musicActionList); } this.currentpath = str + "/" + workout.definition.workoutName + ".workoutplaylist.txt"; File.WriteAllText(this.currentpath, JsonConvert.SerializeObject(workout)); }
/// <summary> /// Table Storage /// </summary> /// <param name="tableName">Table Name</param> /// <param name="account">Storage Account</param> /// <param name="location">Location Mode</param> public TableStorage(string tableName, CloudStorageAccount account, LocationMode location = LocationMode.PrimaryThenSecondary) : base(account) { if (string.IsNullOrWhiteSpace(tableName)) { throw new ArgumentException("tableName"); } this.client = base.Account.CreateCloudTableClient(); this.client.DefaultRequestOptions.LocationMode = location; this.reference = client.GetTableReference(tableName); }
internal bool ValidateLocationMode(LocationMode mode) { switch (mode) { case LocationMode.PrimaryOnly: return(this.PrimaryUri != null); case LocationMode.SecondaryOnly: return(this.SecondaryUri != null); default: return((this.PrimaryUri != null) && (this.SecondaryUri != null)); } }
private static StorageLocation GetInitialLocation(LocationMode locationMode) { switch (locationMode) { case LocationMode.PrimaryOnly: case LocationMode.PrimaryThenSecondary: return(StorageLocation.Primary); case LocationMode.SecondaryOnly: case LocationMode.SecondaryThenPrimary: return(StorageLocation.Secondary); default: throw new ArgumentOutOfRangeException("locationMode"); } }
public void PopulateTrackDataFromAudioFile( string filePath, LocationMode locationMode, Game gameType) { this.trackDataState = TrackDataState.Loading; TrackDataManager.instance.onTrackDataComplete += new TrackDataManager.OnTrackDataComplete(OnTrackDataCreated); if (TrackDataManager.instance.DoesTrackDataExist(filePath, locationMode, gameType)) { this.LoadTrackData(new TrackId(filePath).trackId, locationMode); } else { TrackDataManager.instance.PopulateTrackDataFromAudioFile(filePath, locationMode, filePath); } }
/// <summary> /// Entry to processing tasks /// </summary> /// <param name="audioTrack">Original audio track</param> /// <param name="wavPath">File path to the .wav track</param> /// <param name="locationMode"></param> /// <returns></returns> public bool CreateSongClipFromAudioClip( TagLib.File audioTrack, string wavPath, LocationMode locationMode) { if (busy) { _log.Debug("Parsing a track already"); return(false); } busy = true; passedPath = wavPath; passedlocationMode = locationMode; WavLoaded(audioTrack); return(true); }
Object[] FilterObjects(LocationMode locMode, GameObject root, string text) { switch (locMode) { case LocationMode.Scene: { var sceneFindTool = new SceneFindTool(FindFunc); return(sceneFindTool.FilterObjects(root, text)); } case LocationMode.Project: { var projFindTool = new ProjectFindTool(FindFunc); return(projFindTool.FilterObjects(text)); } default: return(null); } }
public static string WorkoutDefinitionFolder(LocationMode locationMode, Game gameType) { string str = ""; switch (locationMode) { case LocationMode.PlayerData: case LocationMode.Editor: str = Paths.RootDataFolder(locationMode) + "/WorkoutPlaylists/" + gameType.ToString(); break; case LocationMode.Workouts: str = "WorkoutData/WorkoutPlaylists/" + gameType.ToString(); break; } return(str.Replace("/", "\\")); }
internal bool ValidateLocationMode(LocationMode mode) { switch (mode) { case LocationMode.PrimaryOnly: return(PrimaryUri != null); case LocationMode.SecondaryOnly: return(SecondaryUri != null); default: if (PrimaryUri != null) { return(SecondaryUri != null); } return(false); } }
private static StorageLocation GetNextLocation(LocationMode locationMode, StorageLocation currentLocation) { switch (locationMode) { case LocationMode.PrimaryOnly: return(StorageLocation.Primary); case LocationMode.SecondaryOnly: return(StorageLocation.Secondary); case LocationMode.PrimaryThenSecondary: case LocationMode.SecondaryThenPrimary: return(currentLocation == StorageLocation.Primary ? StorageLocation.Secondary : StorageLocation.Primary); default: throw new ArgumentOutOfRangeException("locationMode"); } }
public static string DefinitionsFolder(LocationMode locationMode) { string str = ""; switch (locationMode) { case LocationMode.PlayerData: case LocationMode.Editor: str = Paths.RootDataFolder(locationMode) + "/TrackDefinitions/"; break; case LocationMode.Workouts: case LocationMode.MyWorkout: str = "WorkoutData/TrackDefinitions/"; break; } return(str.Replace("/", "\\")); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SDKInitializer.Initialize(ApplicationContext); SetContentView(Resource.Layout.Main); mapView = FindViewById <MapView>(Resource.Id.mapView); currentLocationMode = LocationMode.Normal; var baiduMap = mapView.Map; //定义Maker坐标点 LatLng point = new LatLng(30.691359, 104.052236); //构建Marker图标 BitmapDescriptor bitmap = BitmapDescriptorFactory.FromResource(Resource.Drawable.marker); //构建MarkerOption,用于在地图上添加Marker OverlayOptions option = new MarkerOptions().InvokePosition(point).InvokeIcon(bitmap); //在地图上添加Marker,并显示 baiduMap.AddOverlay(option); baiduMap.MyLocationEnabled = true; }
private static void TestTableRetrieve(LocationMode?optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList <RetryContext> retryContextList, IList <RetryInfo> retryInfoList) { CloudTable table = GenerateCloudTableClient().GetTableReference(TableTestBase.GenerateRandomTableName()); using (MultiLocationTestHelper helper = new MultiLocationTestHelper(table.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList)) { table.ServiceClient.LocationMode = clientLocationMode; TableRequestOptions options = new TableRequestOptions() { LocationMode = optionsLocationMode, RetryPolicy = helper.RetryPolicy, }; TestHelper.ExpectedException( () => table.GetPermissions(options, helper.OperationContext), "GetPermissions on a non-existing table should fail", HttpStatusCode.NotFound); } }
private void Initialize(IdentityConfiguration config) { _config = config; _client = CloudStorageAccount.Parse(_config.StorageConnectionString).CreateCloudTableClient(); _client.DefaultRequestOptions.PayloadFormat = TablePayloadFormat.Json; if (!string.IsNullOrWhiteSpace(_config.LocationMode)) { LocationMode mode = LocationMode.PrimaryOnly; if (Enum.TryParse <LocationMode>(_config.LocationMode, out mode)) { _client.DefaultRequestOptions.LocationMode = mode; } else { throw new ArgumentException("Invalid LocationMode defined in config. For more information on geo-replication location modes: http://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.retrypolicies.locationmode.aspx", "config.LocationMode"); } } _indexTable = _client.GetTableReference(FormatTableNameWithPrefix(Constants.TableNames.IndexTable)); _roleTable = _client.GetTableReference(FormatTableNameWithPrefix(Constants.TableNames.RolesTable)); _userTable = _client.GetTableReference(FormatTableNameWithPrefix(Constants.TableNames.UsersTable)); }
public static string RootDataFolder(LocationMode locationMode) { string str = ""; switch (locationMode) { case LocationMode.PlayerData: str = _persistentDataPath + "/Playlists"; break; case LocationMode.Workouts: case LocationMode.Downloadable: case LocationMode.MyWorkout: App.logger.Error("No root path for these locations"); break; case LocationMode.Editor: str = _persistentDataPath + "/WorkoutEditor"; break; } return(str.Replace("/", "\\")); }
public void LoadTrackData(string trackId, LocationMode locationMode) { string str = ""; switch (locationMode) { case LocationMode.PlayerData: case LocationMode.Editor: string path = Paths.TrackDataFolder(locationMode) + trackId + ".trackdata.txt"; if (File.Exists(path)) { str = File.ReadAllText(path); } break; } if (str != "") { TrackData trackData = JsonConvert.DeserializeObject <TrackData>(str); this.originalTrackName = trackData.originalTrackName; this.trackId = trackData.trackId; this.duration = trackData.duration; this.bpm = trackData.bpm; this.locationMode = locationMode; this.beatStrucureJSON = trackData.beatStrucureJSON; this.originalFilePath = trackData.originalFilePath; this.originalArtist = trackData.originalArtist; this.LoadBeatStructure(); if (this.onTrackDataReady != null) { this.onTrackDataReady(this); } this.trackDataState = TrackDataState.Ready; } else { this.trackDataState = TrackDataState.Failed; } }
public void PlaylistAddProcess() { this.isProcessing = true; string originalFilePath = this.playlistQueue[0].originalFilePath; LocationMode location = this.playlistQueue[0].location; _log.Debug("Location mode = " + location.ToString()); var trackHash = MD5.MD5Sum(Path.GetFileNameWithoutExtension(originalFilePath)); if (this.playlistQueue[0].songToAdd.trackDefinition.LoadTrackDefinition(trackHash, location)) { this.playlistQueue[0].songToAdd.trackDataName = this.playlistQueue[0].songToAdd.trackDefinition.trackId.trackId; this.playlistQueue[0].playlistToAdd.AddSong(this.playlistQueue[0].songToAdd); this.ExportPlaylistJson(this.playlistQueue[0].playlistToAdd); this.WaitingOver(); } else { this.playlistQueue[0].songToAdd.trackDefinition.trackData = new TrackData(); this.playlistQueue[0].songToAdd.trackDefinition.trackData.PopulateTrackDataFromAudioFile(originalFilePath, location, Game.BoxVR); WaitForTrackData(); } }
private static async Task TestContainerFetchAttributesAsync(LocationMode? optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList<RetryContext> retryContextList, IList<RetryInfo> retryInfoList) { CloudBlobContainer container = BlobTestBase.GetRandomContainerReference(); using (MultiLocationTestHelper helper = new MultiLocationTestHelper(container.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList)) { container.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode; BlobRequestOptions options = new BlobRequestOptions() { LocationMode = optionsLocationMode, RetryPolicy = helper.RetryPolicy, }; await TestHelper.ExpectedExceptionAsync( async () => await container.FetchAttributesAsync(null, options, helper.OperationContext), helper.OperationContext, "FetchAttributes on a non-existing container should fail", HttpStatusCode.NotFound); } }
/// <inheritdoc /> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Visible != null) { hashCode = hashCode * 59 + Visible.GetHashCode(); } if (LegendGroup != null) { hashCode = hashCode * 59 + LegendGroup.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (UId != null) { hashCode = hashCode * 59 + UId.GetHashCode(); } if (Ids != null) { hashCode = hashCode * 59 + Ids.GetHashCode(); } if (CustomData != null) { hashCode = hashCode * 59 + CustomData.GetHashCode(); } if (Meta != null) { hashCode = hashCode * 59 + Meta.GetHashCode(); } if (MetaArray != null) { hashCode = hashCode * 59 + MetaArray.GetHashCode(); } if (SelectedPoints != null) { hashCode = hashCode * 59 + SelectedPoints.GetHashCode(); } if (HoverLabel != null) { hashCode = hashCode * 59 + HoverLabel.GetHashCode(); } if (Stream != null) { hashCode = hashCode * 59 + Stream.GetHashCode(); } if (Transforms != null) { hashCode = hashCode * 59 + Transforms.GetHashCode(); } if (UiRevision != null) { hashCode = hashCode * 59 + UiRevision.GetHashCode(); } if (Locations != null) { hashCode = hashCode * 59 + Locations.GetHashCode(); } if (LocationMode != null) { hashCode = hashCode * 59 + LocationMode.GetHashCode(); } if (Z != null) { hashCode = hashCode * 59 + Z.GetHashCode(); } if (GeoJson != null) { hashCode = hashCode * 59 + GeoJson.GetHashCode(); } if (FeatureIdKey != null) { hashCode = hashCode * 59 + FeatureIdKey.GetHashCode(); } if (Text != null) { hashCode = hashCode * 59 + Text.GetHashCode(); } if (TextArray != null) { hashCode = hashCode * 59 + TextArray.GetHashCode(); } if (HoverText != null) { hashCode = hashCode * 59 + HoverText.GetHashCode(); } if (HoverTextArray != null) { hashCode = hashCode * 59 + HoverTextArray.GetHashCode(); } if (Marker != null) { hashCode = hashCode * 59 + Marker.GetHashCode(); } if (Selected != null) { hashCode = hashCode * 59 + Selected.GetHashCode(); } if (Unselected != null) { hashCode = hashCode * 59 + Unselected.GetHashCode(); } if (HoverInfo != null) { hashCode = hashCode * 59 + HoverInfo.GetHashCode(); } if (HoverInfoArray != null) { hashCode = hashCode * 59 + HoverInfoArray.GetHashCode(); } if (HoverTemplate != null) { hashCode = hashCode * 59 + HoverTemplate.GetHashCode(); } if (HoverTemplateArray != null) { hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode(); } if (ShowLegend != null) { hashCode = hashCode * 59 + ShowLegend.GetHashCode(); } if (ZAuto != null) { hashCode = hashCode * 59 + ZAuto.GetHashCode(); } if (ZMin != null) { hashCode = hashCode * 59 + ZMin.GetHashCode(); } if (ZMax != null) { hashCode = hashCode * 59 + ZMax.GetHashCode(); } if (ZMid != null) { hashCode = hashCode * 59 + ZMid.GetHashCode(); } if (ColorScale != null) { hashCode = hashCode * 59 + ColorScale.GetHashCode(); } if (AutoColorScale != null) { hashCode = hashCode * 59 + AutoColorScale.GetHashCode(); } if (ReverseScale != null) { hashCode = hashCode * 59 + ReverseScale.GetHashCode(); } if (ShowScale != null) { hashCode = hashCode * 59 + ShowScale.GetHashCode(); } if (ColorBar != null) { hashCode = hashCode * 59 + ColorBar.GetHashCode(); } if (ColorAxis != null) { hashCode = hashCode * 59 + ColorAxis.GetHashCode(); } if (Geo != null) { hashCode = hashCode * 59 + Geo.GetHashCode(); } if (IdsSrc != null) { hashCode = hashCode * 59 + IdsSrc.GetHashCode(); } if (CustomDataSrc != null) { hashCode = hashCode * 59 + CustomDataSrc.GetHashCode(); } if (MetaSrc != null) { hashCode = hashCode * 59 + MetaSrc.GetHashCode(); } if (LocationsSrc != null) { hashCode = hashCode * 59 + LocationsSrc.GetHashCode(); } if (ZSrc != null) { hashCode = hashCode * 59 + ZSrc.GetHashCode(); } if (TextSrc != null) { hashCode = hashCode * 59 + TextSrc.GetHashCode(); } if (HoverTextSrc != null) { hashCode = hashCode * 59 + HoverTextSrc.GetHashCode(); } if (HoverInfoSrc != null) { hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode(); } if (HoverTemplateSrc != null) { hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode(); } return(hashCode); } }
/// <inheritdoc /> public bool Equals([AllowNull] Choropleth other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Type == other.Type || Type != null && Type.Equals(other.Type) ) && ( Visible == other.Visible || Visible != null && Visible.Equals(other.Visible) ) && ( LegendGroup == other.LegendGroup || LegendGroup != null && LegendGroup.Equals(other.LegendGroup) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( UId == other.UId || UId != null && UId.Equals(other.UId) ) && ( Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids) ) && ( Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData) ) && ( Meta == other.Meta || Meta != null && Meta.Equals(other.Meta) ) && ( Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray) ) && ( SelectedPoints == other.SelectedPoints || SelectedPoints != null && SelectedPoints.Equals(other.SelectedPoints) ) && ( HoverLabel == other.HoverLabel || HoverLabel != null && HoverLabel.Equals(other.HoverLabel) ) && ( Stream == other.Stream || Stream != null && Stream.Equals(other.Stream) ) && ( Equals(Transforms, other.Transforms) || Transforms != null && other.Transforms != null && Transforms.SequenceEqual(other.Transforms) ) && ( UiRevision == other.UiRevision || UiRevision != null && UiRevision.Equals(other.UiRevision) ) && ( Equals(Locations, other.Locations) || Locations != null && other.Locations != null && Locations.SequenceEqual(other.Locations) ) && ( LocationMode == other.LocationMode || LocationMode != null && LocationMode.Equals(other.LocationMode) ) && ( Equals(Z, other.Z) || Z != null && other.Z != null && Z.SequenceEqual(other.Z) ) && ( GeoJson == other.GeoJson || GeoJson != null && GeoJson.Equals(other.GeoJson) ) && ( FeatureIdKey == other.FeatureIdKey || FeatureIdKey != null && FeatureIdKey.Equals(other.FeatureIdKey) ) && ( Text == other.Text || Text != null && Text.Equals(other.Text) ) && ( Equals(TextArray, other.TextArray) || TextArray != null && other.TextArray != null && TextArray.SequenceEqual(other.TextArray) ) && ( HoverText == other.HoverText || HoverText != null && HoverText.Equals(other.HoverText) ) && ( Equals(HoverTextArray, other.HoverTextArray) || HoverTextArray != null && other.HoverTextArray != null && HoverTextArray.SequenceEqual(other.HoverTextArray) ) && ( Marker == other.Marker || Marker != null && Marker.Equals(other.Marker) ) && ( Selected == other.Selected || Selected != null && Selected.Equals(other.Selected) ) && ( Unselected == other.Unselected || Unselected != null && Unselected.Equals(other.Unselected) ) && ( HoverInfo == other.HoverInfo || HoverInfo != null && HoverInfo.Equals(other.HoverInfo) ) && ( Equals(HoverInfoArray, other.HoverInfoArray) || HoverInfoArray != null && other.HoverInfoArray != null && HoverInfoArray.SequenceEqual(other.HoverInfoArray) ) && ( HoverTemplate == other.HoverTemplate || HoverTemplate != null && HoverTemplate.Equals(other.HoverTemplate) ) && ( Equals(HoverTemplateArray, other.HoverTemplateArray) || HoverTemplateArray != null && other.HoverTemplateArray != null && HoverTemplateArray.SequenceEqual(other.HoverTemplateArray) ) && ( ShowLegend == other.ShowLegend || ShowLegend != null && ShowLegend.Equals(other.ShowLegend) ) && ( ZAuto == other.ZAuto || ZAuto != null && ZAuto.Equals(other.ZAuto) ) && ( ZMin == other.ZMin || ZMin != null && ZMin.Equals(other.ZMin) ) && ( ZMax == other.ZMax || ZMax != null && ZMax.Equals(other.ZMax) ) && ( ZMid == other.ZMid || ZMid != null && ZMid.Equals(other.ZMid) ) && ( ColorScale == other.ColorScale || ColorScale != null && ColorScale.Equals(other.ColorScale) ) && ( AutoColorScale == other.AutoColorScale || AutoColorScale != null && AutoColorScale.Equals(other.AutoColorScale) ) && ( ReverseScale == other.ReverseScale || ReverseScale != null && ReverseScale.Equals(other.ReverseScale) ) && ( ShowScale == other.ShowScale || ShowScale != null && ShowScale.Equals(other.ShowScale) ) && ( ColorBar == other.ColorBar || ColorBar != null && ColorBar.Equals(other.ColorBar) ) && ( ColorAxis == other.ColorAxis || ColorAxis != null && ColorAxis.Equals(other.ColorAxis) ) && ( Geo == other.Geo || Geo != null && Geo.Equals(other.Geo) ) && ( IdsSrc == other.IdsSrc || IdsSrc != null && IdsSrc.Equals(other.IdsSrc) ) && ( CustomDataSrc == other.CustomDataSrc || CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc) ) && ( MetaSrc == other.MetaSrc || MetaSrc != null && MetaSrc.Equals(other.MetaSrc) ) && ( LocationsSrc == other.LocationsSrc || LocationsSrc != null && LocationsSrc.Equals(other.LocationsSrc) ) && ( ZSrc == other.ZSrc || ZSrc != null && ZSrc.Equals(other.ZSrc) ) && ( TextSrc == other.TextSrc || TextSrc != null && TextSrc.Equals(other.TextSrc) ) && ( HoverTextSrc == other.HoverTextSrc || HoverTextSrc != null && HoverTextSrc.Equals(other.HoverTextSrc) ) && ( HoverInfoSrc == other.HoverInfoSrc || HoverInfoSrc != null && HoverInfoSrc.Equals(other.HoverInfoSrc) ) && ( HoverTemplateSrc == other.HoverTemplateSrc || HoverTemplateSrc != null && HoverTemplateSrc.Equals(other.HoverTemplateSrc) )); }
private static StorageLocation GetNextLocation(LocationMode locationMode, StorageLocation currentLocation) { switch (locationMode) { case LocationMode.PrimaryOnly: return StorageLocation.Primary; case LocationMode.SecondaryOnly: return StorageLocation.Secondary; case LocationMode.PrimaryThenSecondary: case LocationMode.SecondaryThenPrimary: return currentLocation == StorageLocation.Primary ? StorageLocation.Secondary : StorageLocation.Primary; default: throw new ArgumentOutOfRangeException("locationMode"); } }
public static string ImgDataFolder(LocationMode locationMode) => Paths.TrackDataFolder(locationMode);
private static void VerifyRetryInfoList(IExtendedRetryPolicy retryPolicy, HttpStatusCode primaryStatusCode, HttpStatusCode secondaryStatusCode, LocationMode locationMode, Func<int, double> allowedDelta, params RetryInfo[] expectedRetryInfoList) { StorageLocation initialLocation = GetInitialLocation(locationMode); StorageLocation currentLocation = GetNextLocation(locationMode, initialLocation); OperationContext operationContext = new OperationContext(); RequestResult requestResult = new RequestResult() { Exception = new Exception(), TargetLocation = initialLocation, HttpStatusCode = initialLocation == StorageLocation.Primary ? (int)primaryStatusCode : (int)secondaryStatusCode, StartTime = DateTime.Now, EndTime = DateTime.Now, }; for (int i = 0; i < expectedRetryInfoList.Length; i++) { RetryInfo retryInfo = retryPolicy.Evaluate(new RetryContext(i, requestResult, currentLocation, locationMode), operationContext); string message = string.Format("Failed at retry {0}", i); Assert.IsNotNull(retryInfo, message); Assert.AreEqual(expectedRetryInfoList[i].TargetLocation, retryInfo.TargetLocation, message); Assert.AreEqual(expectedRetryInfoList[i].UpdatedLocationMode, retryInfo.UpdatedLocationMode, message); Assert.AreEqual(expectedRetryInfoList[i].RetryInterval.TotalSeconds, retryInfo.RetryInterval.TotalSeconds, allowedDelta(i), message); Thread.Sleep(retryInfo.RetryInterval); requestResult.TargetLocation = retryInfo.TargetLocation; requestResult.HttpStatusCode = retryInfo.TargetLocation == StorageLocation.Primary ? (int)primaryStatusCode : (int)secondaryStatusCode; requestResult.StartTime = DateTime.Now; requestResult.EndTime = DateTime.Now; locationMode = retryInfo.UpdatedLocationMode; currentLocation = GetNextLocation(locationMode, currentLocation); } Assert.IsNull(retryPolicy.Evaluate(new RetryContext(expectedRetryInfoList.Length, requestResult, currentLocation, locationMode), operationContext)); }
private static void VerifyRetryInfoList(IExtendedRetryPolicy retryPolicy, HttpStatusCode primaryStatusCode, HttpStatusCode secondaryStatusCode, LocationMode locationMode, Func <int, double> allowedDelta, params RetryInfo[] expectedRetryInfoList) { StorageLocation initialLocation = GetInitialLocation(locationMode); StorageLocation currentLocation = GetNextLocation(locationMode, initialLocation); OperationContext operationContext = new OperationContext(); RequestResult requestResult = new RequestResult() { Exception = new Exception(), TargetLocation = initialLocation, HttpStatusCode = initialLocation == StorageLocation.Primary ? (int)primaryStatusCode : (int)secondaryStatusCode, StartTime = DateTime.Now, EndTime = DateTime.Now, }; for (int i = 0; i < expectedRetryInfoList.Length; i++) { RetryInfo retryInfo = retryPolicy.Evaluate(new RetryContext(i, requestResult, currentLocation, locationMode), operationContext); string message = string.Format("Failed at retry {0}", i); Assert.IsNotNull(retryInfo, message); Assert.AreEqual(expectedRetryInfoList[i].TargetLocation, retryInfo.TargetLocation, message); Assert.AreEqual(expectedRetryInfoList[i].UpdatedLocationMode, retryInfo.UpdatedLocationMode, message); Assert.AreEqual(expectedRetryInfoList[i].RetryInterval.TotalSeconds, retryInfo.RetryInterval.TotalSeconds, allowedDelta(i), message); Thread.Sleep(retryInfo.RetryInterval); requestResult.TargetLocation = retryInfo.TargetLocation; requestResult.HttpStatusCode = retryInfo.TargetLocation == StorageLocation.Primary ? (int)primaryStatusCode : (int)secondaryStatusCode; requestResult.StartTime = DateTime.Now; requestResult.EndTime = DateTime.Now; locationMode = retryInfo.UpdatedLocationMode; currentLocation = GetNextLocation(locationMode, currentLocation); } Assert.IsNull(retryPolicy.Evaluate(new RetryContext(expectedRetryInfoList.Length, requestResult, currentLocation, locationMode), operationContext)); }
private static async Task TestContainerFetchAttributesAsync(LocationMode?optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList <RetryContext> retryContextList, IList <RetryInfo> retryInfoList) { CloudBlobContainer container = BlobTestBase.GetRandomContainerReference(); using (MultiLocationTestHelper helper = new MultiLocationTestHelper(container.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList)) { container.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode; BlobRequestOptions options = new BlobRequestOptions() { LocationMode = optionsLocationMode, RetryPolicy = helper.RetryPolicy, }; await TestHelper.ExpectedExceptionAsync( async() => await container.FetchAttributesAsync(null, options, helper.OperationContext), helper.OperationContext, "FetchAttributes on a non-existing container should fail", HttpStatusCode.NotFound); } }
private static async Task TestTableRetrieveAsync(LocationMode? optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList<RetryContext> retryContextList, IList<RetryInfo> retryInfoList) { CloudTable table = GenerateCloudTableClient().GetTableReference(TableTestBase.GenerateRandomTableName()); using (MultiLocationTestHelper helper = new MultiLocationTestHelper(table.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList)) { table.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode; TableRequestOptions options = new TableRequestOptions() { LocationMode = optionsLocationMode, RetryPolicy = helper.RetryPolicy, }; await TestHelper.ExpectedExceptionAsync( async () => await table.GetPermissionsAsync(options, helper.OperationContext), helper.OperationContext, "GetPermissions on a non-existing table should fail", HttpStatusCode.NotFound); } }
private static async Task TestQueueFetchAttributesAsync(LocationMode?optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList <RetryContext> retryContextList, IList <RetryInfo> retryInfoList) { CloudQueue queue = GenerateCloudQueueClient().GetQueueReference(QueueTestBase.GenerateNewQueueName()); using (MultiLocationTestHelper helper = new MultiLocationTestHelper(queue.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList)) { queue.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode; QueueRequestOptions options = new QueueRequestOptions() { LocationMode = optionsLocationMode, RetryPolicy = helper.RetryPolicy, }; await TestHelper.ExpectedExceptionAsync( async() => await queue.FetchAttributesAsync(options, helper.OperationContext), helper.OperationContext, "FetchAttributes on a non-existing queue should fail", HttpStatusCode.NotFound); } }
private static async Task TestQueueFetchAttributesAsync(LocationMode? optionsLocationMode, LocationMode clientLocationMode, StorageLocation initialLocation, IList<RetryContext> retryContextList, IList<RetryInfo> retryInfoList) { CloudQueue queue = GenerateCloudQueueClient().GetQueueReference(QueueTestBase.GenerateNewQueueName()); using (MultiLocationTestHelper helper = new MultiLocationTestHelper(queue.ServiceClient.StorageUri, initialLocation, retryContextList, retryInfoList)) { queue.ServiceClient.DefaultRequestOptions.LocationMode = clientLocationMode; QueueRequestOptions options = new QueueRequestOptions() { LocationMode = optionsLocationMode, RetryPolicy = helper.RetryPolicy, }; await TestHelper.ExpectedExceptionAsync( async () => await queue.FetchAttributesAsync(options, helper.OperationContext), helper.OperationContext, "FetchAttributes on a non-existing queue should fail", HttpStatusCode.NotFound); } }