add pocket video type
This commit is contained in:
@@ -44,5 +44,15 @@ namespace PocketSharp.Models
|
|||||||
/// </value>
|
/// </value>
|
||||||
[JsonProperty("src")]
|
[JsonProperty("src")]
|
||||||
public Uri Uri { get; set; }
|
public Uri Uri { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the URI.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The URI.
|
||||||
|
/// </value>
|
||||||
|
[JsonProperty("type")]
|
||||||
|
[JsonConverter(typeof(VideoTypeConverter))]
|
||||||
|
public PocketVideoType Type { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace PocketSharp.Models
|
||||||
|
{
|
||||||
|
public enum PocketVideoType
|
||||||
|
{
|
||||||
|
Unknown = 7,
|
||||||
|
YouTube = 1,
|
||||||
|
Vimeo = 2,
|
||||||
|
HTML = 5,
|
||||||
|
Flash = 6
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
<Compile Include="Models\PocketBoolean.cs" />
|
<Compile Include="Models\PocketBoolean.cs" />
|
||||||
<Compile Include="Models\PocketLimits.cs" />
|
<Compile Include="Models\PocketLimits.cs" />
|
||||||
<Compile Include="Models\PocketStatistics.cs" />
|
<Compile Include="Models\PocketStatistics.cs" />
|
||||||
|
<Compile Include="Models\PocketVideoType.cs" />
|
||||||
<Compile Include="Utilities\PocketAuthException.cs" />
|
<Compile Include="Utilities\PocketAuthException.cs" />
|
||||||
<Compile Include="Utilities\PocketException.cs" />
|
<Compile Include="Utilities\PocketException.cs" />
|
||||||
<Compile Include="Components\Add.cs" />
|
<Compile Include="Components\Add.cs" />
|
||||||
|
|||||||
@@ -201,4 +201,48 @@ namespace PocketSharp
|
|||||||
return new PocketItem();
|
return new PocketItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class VideoTypeConverter : JsonConverter
|
||||||
|
{
|
||||||
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
writer.WriteValue(((PocketVideoType)value).ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
if (reader.Value == null)
|
||||||
|
{
|
||||||
|
return PocketVideoType.Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
string nr = reader.Value.ToString();
|
||||||
|
|
||||||
|
if (nr == "1")
|
||||||
|
{
|
||||||
|
return PocketVideoType.YouTube;
|
||||||
|
}
|
||||||
|
if (nr == "2" || nr == "3" || nr == "4")
|
||||||
|
{
|
||||||
|
return PocketVideoType.Vimeo;
|
||||||
|
}
|
||||||
|
if (nr == "5")
|
||||||
|
{
|
||||||
|
return PocketVideoType.HTML;
|
||||||
|
}
|
||||||
|
if (nr == "6")
|
||||||
|
{
|
||||||
|
return PocketVideoType.Flash;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PocketVideoType.Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanConvert(Type objectType)
|
||||||
|
{
|
||||||
|
return objectType == typeof(int) || objectType == typeof(string);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user