-
Notifications
You must be signed in to change notification settings - Fork 8
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
14 changed files
with
190 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace com.tvd12.ezyfoxserver.client.binding | ||
{ | ||
[AttributeUsage(AttributeTargets.Class)] | ||
public class EzyObjectBinding : System.Attribute | ||
{ | ||
} | ||
} |
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 |
---|---|---|
@@ -1,27 +1,47 @@ | ||
using System; | ||
using System.Globalization; | ||
|
||
namespace com.tvd12.ezyfoxserver.client.binding | ||
{ | ||
public class EzyDateTimeConverter : IEzyConverter | ||
public class EzyDateTimeConverter : EzyDataConverter<DateTime> | ||
{ | ||
public object read(object input, EzyUnmarshaller unmarshaller) | ||
protected override DateTime valueToData( | ||
object value, | ||
EzyUnmarshaller unmarshaller) | ||
{ | ||
return new DateTime(1970, 1, 1).AddMilliseconds((long)input); | ||
if (value is Int64) | ||
{ | ||
return new DateTime(1970, 1, 1).AddMilliseconds((long)value); | ||
} | ||
if (value is Int32) | ||
{ | ||
return new DateTime(1970, 1, 1).AddMilliseconds((Int32)value); | ||
} | ||
if (value is string) | ||
{ | ||
try | ||
{ | ||
return DateTime.ParseExact( | ||
(string)value, | ||
"yyyy-MM-dd'T'HH:mm:ss:fff", | ||
CultureInfo.InvariantCulture); | ||
} | ||
catch (Exception e) | ||
{ | ||
return DateTime.ParseExact( | ||
(string)value, | ||
"yyyy-MM-dd'T'HH:mm:ss.fff", | ||
CultureInfo.InvariantCulture); | ||
} | ||
} | ||
return (DateTime)value; | ||
} | ||
|
||
public object write(object input, Ezymarshaller marshaller) | ||
protected override object dataToValue( | ||
DateTime data, | ||
EzyMarshaller marshaller) | ||
{ | ||
return ((DateTime)input).Millisecond; | ||
} | ||
|
||
public Type getInType() | ||
{ | ||
return typeof(DateTime); | ||
} | ||
|
||
public Type getOutType() | ||
{ | ||
return typeof(DateTime); | ||
return data.Millisecond; | ||
} | ||
} | ||
} |
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,9 @@ | ||
using System; | ||
|
||
namespace com.tvd12.ezyfoxserver.client.binding | ||
{ | ||
[AttributeUsage(AttributeTargets.Class)] | ||
public class EzyArrayBinding : System.Attribute | ||
{ | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System; | ||
|
||
namespace com.tvd12.ezyfoxserver.client.binding | ||
{ | ||
[AttributeUsage(AttributeTargets.Property)] | ||
|
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
Oops, something went wrong.