public void VerifyInfoFields() { var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(HttpPayload.AggregateInfoField) }; var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK }; var client = GetUsageAggregationManagementClient(handler); UsageAggregationGetResponse result = client.UsageAggregates.Get(startDate, endDate, AggregationGranularity.Daily, false, null); // Validate headers Assert.Equal(HttpMethod.Get, handler.Method); // Validate "infoFields":{"meteredRegion":"East","meteredService":"Database","meteredServiceType":"P3","project":"audittest"} InfoField infoFields = result.UsageAggregations[0].Properties.InfoFields; Assert.Equal("audittest", infoFields.Project); }
/// <summary> /// Adds a new InfoField with the given type. /// </summary> public InfoField AddInfoField(InfoFieldType iType) { InfoField fieldInfo = new InfoField(); fieldInfo.Name = iType.ToString(); Add(fieldInfo); return(fieldInfo); }
public void MoveToType(InfoField infoField) { if (infoField.infoType == InfoField.InfoType.Money) { root.AnimateUp(); } else { root.AnimateDown(); } }
public IActionResult Edit(InfoField model) { if (ModelState.IsValid) { // Если модель верная, то сохраняем в БД и перенаправляем на начальную страницу панели dataManager.InfoFields.SaveInfoField(model); return(RedirectToAction(nameof(HomeController.Index), nameof(HomeController).Replace("Controller", ""))); } return(View(model)); }
public void SaveInfoField(InfoField entity) { if (entity.Id == default) { _context.Entry(entity).State = EntityState.Added; } else { _context.Entry(entity).State = EntityState.Modified; } _context.SaveChanges(); }
// [UnitTestFunction] public static void TestFields() { Document doc = new Document(); doc.Info.Author = "K.P."; Section sec = doc.Sections.AddSection(); Paragraph par = sec.AddParagraph(); par.AddBookmark("myBookmark1"); PageRefField prf = par.AddPageRefField("myBookmark1"); prf.Format = "ALPHABETIC"; PageField pf = par.AddPageField(); pf.Format = "ROMAN"; SectionField sf = par.AddSectionField(); sf.Format = "roman"; SectionPagesField spf = par.AddSectionPagesField(); spf.Format = "roman"; NumPagesField npf = par.AddNumPagesField(); npf.Format = "alphabetic"; InfoField inf = par.AddInfoField(InfoFieldType.Author); DateField df = par.AddDateField("D"); df = par.AddDateField("d"); df = par.AddDateField("s"); df = par.AddDateField("r"); df = par.AddDateField("G"); df = par.AddDateField("dddd dd.MM.yyyy"); DocumentRenderer docRndrr = new DocumentRenderer(); docRndrr.Render(doc, "RtfFields.txt", null); File.Copy("RtfFields.txt", "RtfFields.rtf", true); System.Diagnostics.Process.Start("RtfFields.txt"); }
public void SpawnOrderCube(Vector3 polPos, int i, Material mat) { GameObject oderCube = GameObject.CreatePrimitive(PrimitiveType.Cube); oderCube.transform.SetParent(colloseumRoot.transform); oderCube.transform.localScale = new Vector3(1, sales[i].orders / orderCruncFactor, 1); oderCube.transform.localPosition = polPos - Vector3.up * (oderCube.transform.localScale.y / 2f); MeshRenderer mr = oderCube.GetComponent <MeshRenderer>(); mr.sharedMaterial = mat; mr.material.color = new Color(0.6f + 0.4f * (i % 2), 0, 0, 1); InfoField infoF = oderCube.AddComponent <InfoField>(); string timestamps = TimestampHelper.Instance(sales [i].ts).FormatFromStr(); infoF.displayInfo = string.Format("{0}: {1} orders", timestamps, sales[i].orders); infoF.infoType = InfoField.InfoType.Quantity; }
public void SpawnProductPrizeCube(Vector3 polPos, int i, int t, Material mat, ref float amount) { GameObject salesCube = GameObject.CreatePrimitive(PrimitiveType.Cube); salesCube.transform.SetParent(colloseumRoot.transform); amount = amount + sales[i].products[t].prize * sales[i].products[t].sold; salesCube.transform.localScale = new Vector3(1, amount / salesCruncFactor, 1); salesCube.transform.localPosition = polPos + Vector3.up * (salesCube.transform.localScale.y / 2f); MeshRenderer mr = salesCube.GetComponent <MeshRenderer>(); mr.sharedMaterial = mat; mr.material.color = new Color(0, 0, 0.6f + 0.4f * (i % 2) - 0.15f * t, 1); InfoField infoF = salesCube.AddComponent <InfoField>(); string timestamps = TimestampHelper.Instance(sales [i].ts).FormatFromToStr(); infoF.displayInfo = string.Format("{0}: {1}€ Sales Volume of:\n{2}", timestamps, sales[i].products[t].prize * sales[i].products[t].sold, sales[i].products[t].name); infoF.infoType = InfoField.InfoType.Money; }
/// <summary> /// Adds a new InfoField /// </summary> public void Add(InfoField infoField) { this.Elements.Add(infoField); }
internal InfoFieldRenderer(DocumentObject domObj, CsvDocumentRenderer docRenderer) : base(domObj, docRenderer) { this.infoField = domObj as InfoField; }
/// <summary> /// Query aggregated Azure subscription consumption data for a date /// range. (see /// https://msdn.microsoft.com/library/azure/1ea5b323-54bb-423d-916f-190de96c6a3c /// for more information) /// </summary> /// <param name='reportedStartTime'> /// Required. The start of the time range to retrieve data for. /// </param> /// <param name='reportedEndTime'> /// Required. The end of the time range to retrieve data for. /// </param> /// <param name='aggregationGranularity'> /// Required. Value is either daily (default) or hourly to tell the API /// how to return the results grouped by day or hour. /// </param> /// <param name='showDetails'> /// Required. When set to true (default), the aggregates are broken /// down into the instance metadata which is more granular. /// </param> /// <param name='continuationToken'> /// Optional. Retrieved from previous calls, this is the bookmark used /// for progress when the responses are paged. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// The Get UsageAggregates operation response. /// </returns> public async Task <UsageAggregationGetResponse> GetAsync(DateTime reportedStartTime, DateTime reportedEndTime, AggregationGranularity aggregationGranularity, bool showDetails, string continuationToken, CancellationToken cancellationToken) { // Validate // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("reportedStartTime", reportedStartTime); tracingParameters.Add("reportedEndTime", reportedEndTime); tracingParameters.Add("aggregationGranularity", aggregationGranularity); tracingParameters.Add("showDetails", showDetails); tracingParameters.Add("continuationToken", continuationToken); TracingAdapter.Enter(invocationId, this, "GetAsync", tracingParameters); } // Construct URL string url = ""; url = url + "subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); } url = url + "/providers/Microsoft.Commerce/UsageAggregates"; List <string> queryParameters = new List <string>(); queryParameters.Add("api-version=2015-06-01-preview"); queryParameters.Add("reportedstartTime=" + Uri.EscapeDataString(reportedStartTime.ToString("O"))); queryParameters.Add("reportedEndTime=" + Uri.EscapeDataString(reportedEndTime.ToString("O"))); queryParameters.Add("showDetails=" + Uri.EscapeDataString(showDetails.ToString().ToLower())); queryParameters.Add("aggregationGranularity=" + Uri.EscapeDataString(UsageAggregationManagementClient.AggregationGranularityToString(aggregationGranularity))); if (continuationToken != null) { queryParameters.Add("continuationToken=" + Uri.EscapeDataString(continuationToken)); } if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); } string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result UsageAggregationGetResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new UsageAggregationGetResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { JToken valueArray = responseDoc["value"]; if (valueArray != null && valueArray.Type != JTokenType.Null) { foreach (JToken valueValue in ((JArray)valueArray)) { UsageAggregation usageAggregationInstance = new UsageAggregation(); result.UsageAggregations.Add(usageAggregationInstance); JToken idValue = valueValue["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { string idInstance = ((string)idValue); usageAggregationInstance.Id = idInstance; } JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); usageAggregationInstance.Name = nameInstance; } JToken typeValue = valueValue["type"]; if (typeValue != null && typeValue.Type != JTokenType.Null) { string typeInstance = ((string)typeValue); usageAggregationInstance.Type = typeInstance; } JToken propertiesValue = valueValue["properties"]; if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { UsageSample propertiesInstance = new UsageSample(); usageAggregationInstance.Properties = propertiesInstance; JToken meterIdValue = propertiesValue["meterId"]; if (meterIdValue != null && meterIdValue.Type != JTokenType.Null) { string meterIdInstance = (string)meterIdValue; propertiesInstance.MeterId = meterIdInstance; } JToken usageStartTimeValue = propertiesValue["usageStartTime"]; if (usageStartTimeValue != null && usageStartTimeValue.Type != JTokenType.Null) { DateTime usageStartTimeInstance = ((DateTime)usageStartTimeValue); propertiesInstance.UsageStartTime = usageStartTimeInstance.ToUniversalTime(); } JToken usageEndTimeValue = propertiesValue["usageEndTime"]; if (usageEndTimeValue != null && usageEndTimeValue.Type != JTokenType.Null) { DateTime usageEndTimeInstance = ((DateTime)usageEndTimeValue); propertiesInstance.UsageEndTime = usageEndTimeInstance.ToUniversalTime(); } JToken quantityValue = propertiesValue["quantity"]; if (quantityValue != null && quantityValue.Type != JTokenType.Null) { decimal quantityInstance = ((decimal)quantityValue); propertiesInstance.Quantity = quantityInstance; } JToken unitValue = propertiesValue["unit"]; if (unitValue != null && unitValue.Type != JTokenType.Null) { string unitInstance = ((string)unitValue); propertiesInstance.Unit = unitInstance; } JToken meterNameValue = propertiesValue["meterName"]; if (meterNameValue != null && meterNameValue.Type != JTokenType.Null) { string meterNameInstance = ((string)meterNameValue); propertiesInstance.MeterName = meterNameInstance; } JToken meterCategoryValue = propertiesValue["meterCategory"]; if (meterCategoryValue != null && meterCategoryValue.Type != JTokenType.Null) { string meterCategoryInstance = ((string)meterCategoryValue); propertiesInstance.MeterCategory = meterCategoryInstance; } JToken meterSubCategoryValue = propertiesValue["meterSubCategory"]; if (meterSubCategoryValue != null && meterSubCategoryValue.Type != JTokenType.Null) { string meterSubCategoryInstance = ((string)meterSubCategoryValue); propertiesInstance.MeterSubCategory = meterSubCategoryInstance; } JToken meterRegionValue = propertiesValue["meterRegion"]; if (meterRegionValue != null && meterRegionValue.Type != JTokenType.Null) { string meterRegionInstance = ((string)meterRegionValue); propertiesInstance.MeterRegion = meterRegionInstance; } JToken infoFieldsValue = propertiesValue["infoFields"]; if (infoFieldsValue != null && infoFieldsValue.Type != JTokenType.Null) { InfoField infoFieldsInstance = new InfoField(); propertiesInstance.InfoFields = infoFieldsInstance; JToken projectValue = infoFieldsValue["project"]; if (projectValue != null && projectValue.Type != JTokenType.Null) { string projectInstance = ((string)projectValue); infoFieldsInstance.Project = projectInstance; } } JToken instanceDataValue = propertiesValue["instanceData"]; if (instanceDataValue != null && instanceDataValue.Type != JTokenType.Null) { string instanceDataInstance = ((string)instanceDataValue); propertiesInstance.InstanceData = instanceDataInstance; } } } } JToken nextLinkValue = responseDoc["nextLink"]; if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) { string nextLinkInstance = ((string)nextLinkValue); result.NextLink = nextLinkInstance; if (!string.IsNullOrWhiteSpace(nextLinkInstance)) { string key = "continuationToken="; int startLocation = nextLinkInstance.IndexOf(key, StringComparison.OrdinalIgnoreCase); if (startLocation >= 0) { startLocation = startLocation + key.Length; int length = nextLinkInstance.Length - startLocation; string token = nextLinkInstance.Substring(startLocation, length); result.ContinuationToken = Uri.UnescapeDataString(token); } } } } } result.StatusCode = statusCode; if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return(result); } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } }
public void DisplayInfoField(InfoField infoField) { infoDisplay.text = infoField.displayInfo; }
// Info /// <summary> /// Compiles a formatted string of human-readable information about the model. /// </summary> /// <param name="info">Information fields to include.</param> public string GetInfo(InfoField info) { StringBuilder sb = new StringBuilder("Showing info for PMX model\n\n"); if ((info & InfoField.Header) != 0) { sb.AppendFormat("PMX version {0}\nName: {1} ({2})\n", Version, string.IsNullOrEmpty(NameEnglish) ? "<english name>" : NameEnglish, string.IsNullOrEmpty(NameJapanese) ? "<japanese name>" : NameJapanese) .AppendFormat("\nComments:\n{0}\n{1}\n\nGlobals:\n", string.IsNullOrEmpty(InfoEnglish) ? "<english info>" : InfoEnglish, string.IsNullOrEmpty(InfoJapanese) ? "<japanese info>" : InfoJapanese) .AppendFormat(" Text encoding: {0}\n", TextEncoding.GetType().ToString()) .AppendFormat(" Additional UV count: {0}\n", AdditionalUVCount) .AppendFormat("Index sizes (byte)\n Vertex index size: {0}\n", PmxTypes.VertexIndex) .AppendFormat(" Texture index size: {0}\n", PmxTypes.VertexIndex) .AppendFormat(" Material index size: {0}\n", PmxTypes.VertexIndex) .AppendFormat(" Bone index size: {0}\n", PmxTypes.VertexIndex) .AppendFormat(" Morph index size: {0}\n", PmxTypes.VertexIndex) .AppendFormat(" Rigidbody index size: {0}\n\n", PmxTypes.VertexIndex); } if ((info & InfoField.Vertex) != 0) { sb.AppendFormat("Vertex info\n") .AppendFormat("Count: {0}\n\n", Vertices.Count); } if ((info & InfoField.Triangle) != 0) { sb.AppendFormat("Triangle info\n") .AppendFormat("Count: {0}\n\n", Triangles.Count); } if ((info & InfoField.Texture) != 0) { sb.AppendFormat("Texture table\n") .AppendFormat("Count: {0}\n", Textures.Count); foreach (string str in Textures) { sb.AppendFormat(" {0}\n", str); } sb.Append("\n"); } if ((info & InfoField.Material) != 0) { sb.AppendFormat("Material data\n") .AppendFormat("Count: {0}\n", Materials.Count); foreach (PmxMaterial mat in Materials) { sb.Append(mat.ToString()); } sb.Append("\n"); } if ((info & InfoField.Bone) != 0) { sb.AppendFormat("Bone data\n") .AppendFormat("Count: {0}\n", Bones.Count); foreach (PmxBone bone in Bones) { sb.Append(bone.ToString()); } sb.Append("\n"); } if ((info & InfoField.Morph) != 0) { sb.Append("Morph data\n") .AppendFormat("Count: {0}\n", Morphs.Count); foreach (PmxMorph morph in Morphs) { sb.Append(morph.ToString()); } sb.Append("\n"); } return(sb.ToString()); }