mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge branch '1.9.x' into dev
This commit is contained in:
@@ -87,9 +87,16 @@ namespace Orchard.Tests.Localization {
|
||||
var container = TestHelpers.InitializeContainer(culture.Name, "GregorianCalendar", TimeZoneInfo.Utc);
|
||||
var formats = container.Resolve<IDateTimeFormatProvider>();
|
||||
var target = container.Resolve<IDateFormatter>();
|
||||
var hoursToTest = new[] { 0, 6, 12, 18 };
|
||||
|
||||
// Fix for some cultures on Windows 10 where both designators for some reason
|
||||
// are empty strings. A 24-hour time cannot possibly be round-tripped without any
|
||||
// way to distinguish AM from PM, so for these cases test only 12-hour time.
|
||||
if (culture.DateTimeFormat.AMDesignator == culture.DateTimeFormat.PMDesignator)
|
||||
hoursToTest = new[] { 1, 6, 9, 12 };
|
||||
|
||||
foreach (var dateTimeFormat in formats.AllDateTimeFormats) { // All date and time formats supported by the culture.
|
||||
foreach (var hour in new[] { 0, 6, 12, 18 }) { // Enough hours to cover all code paths (AM/PM, 12<->00, etc).
|
||||
foreach (var hour in hoursToTest) { // Enough hours to cover all code paths (AM/PM, 12<->00, etc).
|
||||
|
||||
DateTime dateTime = new DateTime(1998, 1, 1, hour, 30, 30, DateTimeKind.Utc);
|
||||
|
||||
|
@@ -6,6 +6,7 @@ using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Orchard.FileSystems.Media;
|
||||
using Orchard.Azure.MediaServices.Helpers;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata {
|
||||
public class AssetFile {
|
||||
@@ -120,6 +121,7 @@ namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata {
|
||||
/// <summary>
|
||||
/// A direct URL to download the asset file using a private locator.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public string PrivateUrl {
|
||||
get {
|
||||
if (!String.IsNullOrEmpty(_parentMetadata.PrivateLocatorUrl)) {
|
||||
|
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Orchard.FileSystems.Media;
|
||||
using Orchard.Azure.MediaServices.Helpers;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata {
|
||||
public class Metadata {
|
||||
@@ -46,6 +45,7 @@ namespace Orchard.Azure.MediaServices.Models.Assets.EncoderMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string PrivateLocatorUrl {
|
||||
get {
|
||||
return _privateLocatorUrl;
|
||||
|
@@ -238,8 +238,17 @@ namespace Orchard.Localization.Services {
|
||||
if (!m.Groups["amPm"].Success) {
|
||||
throw new FormatException("The string was not recognized as a valid time. The hour is in 12-hour notation but no AM/PM designator was found.");
|
||||
}
|
||||
var isPm = m.Groups["amPm"].Value.Equals(_dateTimeFormatProvider.AmPmDesignators[1], StringComparison.InvariantCultureIgnoreCase);
|
||||
hour = ConvertToHour24(Int32.Parse(m.Groups["hour12"].Value), isPm);
|
||||
|
||||
var hour12 = Int32.Parse(m.Groups["hour12"].Value);
|
||||
var isPm = false;
|
||||
|
||||
// Fix for some cultures on Windows 10 where both designators for some reason are empty strings.
|
||||
if (_dateTimeFormatProvider.AmPmDesignators[0] == _dateTimeFormatProvider.AmPmDesignators[1])
|
||||
isPm = hour12 >= 12;
|
||||
else
|
||||
isPm = m.Groups["amPm"].Value.Equals(_dateTimeFormatProvider.AmPmDesignators[1], StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
hour = ConvertToHour24(hour12, isPm);
|
||||
}
|
||||
|
||||
if (m.Groups["minute"].Success) {
|
||||
|
Reference in New Issue
Block a user