public Task <StorageStream> GetModelStream(string setId, string versionId, string detail, string xpos, string ypos, string zpos, string format) { LoaderResults setData = this.loadedSetData.Get(); if (setData == null) { throw new NotFoundException("setData"); } SetVersion setVersion = setData.FindSetVersion(setId, versionId); SetVersionLevelOfDetail lod; if (!setVersion.DetailLevels.TryGetValue(detail, out lod)) { throw new NotFoundException("detailLevel"); } ModelFormats modelFormat; if (format == null) { modelFormat = ModelFormats.Ebo; } else if (!ModelFormats.TryParse(format, true, out modelFormat)) { throw new NotFoundException("format"); } string modelPath = lod.ModelTemplate.ToString(); modelPath = ExpandCoordinatePlaceholders(modelPath, xpos, ypos, zpos, modelFormat); return(this.GetStorageStreamForPath(modelPath)); }
private static string ExpandCoordinatePlaceholders(string modelPath, object xpos, object ypos, object zpos, ModelFormats format) { modelPath = modelPath.Replace(X_PLACEHOLDER, xpos.ToString()); modelPath = modelPath.Replace(Y_PLACEHOLDER, ypos.ToString()); modelPath = modelPath.Replace(Z_PLACEHOLDER, zpos.ToString()); modelPath = modelPath.Replace(FORMAT_PLACEHOLDER, format.ToString().ToLower()); return(modelPath); }