-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
139 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
MailRuCloud/MailRuCloudApi/Common/SharedVideoResolution.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace YaR.MailRuCloud.Api.Common | ||
{ | ||
public enum SharedVideoResolution | ||
{ | ||
[EnumMember(Value = "0p")] | ||
All, | ||
[EnumMember(Value = "240p")] | ||
R240, | ||
[EnumMember(Value = "360p")] | ||
R360, | ||
[EnumMember(Value = "480p")] | ||
R480, | ||
[EnumMember(Value = "720p")] | ||
R720, | ||
[EnumMember(Value = "1080p")] | ||
R1080 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.Serialization; | ||
|
||
namespace YaR.MailRuCloud.Api.Extensions | ||
{ | ||
public static class EnumExtensions | ||
{ | ||
public static T ParseEnumMemberValue<T>(string stringValue, bool ignoreCase = true) | ||
where T: Enum | ||
{ | ||
T output = default; | ||
string enumStringValue = null; | ||
|
||
var type = typeof(T); | ||
foreach (FieldInfo fi in type.GetFields()) | ||
{ | ||
if (fi.GetCustomAttributes(typeof (EnumMemberAttribute), false) is EnumMemberAttribute[] attrs && attrs.Length > 0) | ||
enumStringValue = attrs[0].Value; | ||
|
||
if (string.Compare(enumStringValue, stringValue, ignoreCase) == 0) | ||
{ | ||
output = (T)Enum.Parse(type, fi.Name); | ||
break; | ||
} | ||
} | ||
|
||
return output; | ||
} | ||
|
||
public static string ToEnumMemberValue(this Enum @enum) | ||
{ | ||
var attr = @enum.GetType() | ||
.GetMember(@enum.ToString()).FirstOrDefault()? | ||
.GetCustomAttributes(false) | ||
.OfType<EnumMemberAttribute>(). | ||
FirstOrDefault(); | ||
if (attr == null) | ||
return @enum.ToString(); | ||
return attr.Value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ | |
<Copyright>[email protected]</Copyright> | ||
<Description>WebDAV emulator for Cloud.mail.ru</Description> | ||
<PackageId>WebDAVCloudMailRu</PackageId> | ||
<AssemblyVersion>1.10.6.0</AssemblyVersion> | ||
<FileVersion>1.10.6.0</FileVersion> | ||
<AssemblyVersion>1.10.7.0</AssemblyVersion> | ||
<FileVersion>1.10.7.0</FileVersion> | ||
<AssemblyName>wdmrc</AssemblyName> | ||
<RootNamespace>YaR.CloudMailRu.Console</RootNamespace> | ||
<StartupObject></StartupObject> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters