forked from ApmeM/Simple-RSS
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from dncuug/update-project
- Loading branch information
Showing
31 changed files
with
1,660 additions
and
1,758 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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
namespace X.Web.RSS.Enumerators | ||
using JetBrains.Annotations; | ||
|
||
namespace X.Web.RSS.Enumerators; | ||
|
||
[PublicAPI] | ||
public enum Day | ||
{ | ||
public enum Day | ||
{ | ||
Monday, | ||
Tuesday, | ||
Wednesday, | ||
Thursday, | ||
Friday, | ||
Saturday, | ||
Sunday | ||
} | ||
Monday, | ||
Tuesday, | ||
Wednesday, | ||
Thursday, | ||
Friday, | ||
Saturday, | ||
Sunday | ||
} |
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,37 +1,33 @@ | ||
using X.Web.RSS.Exceptions; | ||
using System.Xml.Serialization; | ||
|
||
namespace X.Web.RSS.Enumerators | ||
namespace X.Web.RSS.Enumerators; | ||
|
||
public class Hour | ||
{ | ||
public class Hour | ||
{ | ||
private byte _value; | ||
private byte _value; | ||
|
||
public Hour() | ||
{ | ||
} | ||
public Hour() | ||
{ | ||
} | ||
|
||
public Hour(byte newValue) | ||
{ | ||
_value = newValue; | ||
} | ||
public Hour(byte newValue) | ||
{ | ||
_value = newValue; | ||
} | ||
|
||
[XmlText] | ||
public byte Value | ||
[XmlText] | ||
public byte Value | ||
{ | ||
get => _value; | ||
set | ||
{ | ||
get | ||
if (value < 0 || value > 23) | ||
{ | ||
return _value; | ||
throw new RSSParameterException("hour", value); | ||
} | ||
set | ||
{ | ||
if (_value < 0 || _value > 23) | ||
{ | ||
throw new RSSParameterException("hour", value); | ||
} | ||
|
||
_value = value; | ||
} | ||
_value = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
namespace X.Web.RSS.Enumerators | ||
using JetBrains.Annotations; | ||
|
||
namespace X.Web.RSS.Enumerators; | ||
|
||
// ToDo: rename elements and check xml-rpc | ||
[PublicAPI] | ||
public enum Protocol | ||
{ | ||
// ToDo: rename elements and chect xml-rpc | ||
public enum Protocol | ||
{ | ||
soap, // "soap", | ||
xmlrpc // "xml-rpc" | ||
} | ||
soap, // "soap", | ||
xmlrpc // "xml-rpc" | ||
} |
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,8 +1,10 @@ | ||
namespace X.Web.RSS.Enumerators | ||
using JetBrains.Annotations; | ||
|
||
namespace X.Web.RSS.Enumerators; | ||
|
||
[PublicAPI] | ||
public enum Rel | ||
{ | ||
public enum Rel | ||
{ | ||
self, | ||
alternate | ||
} | ||
self, | ||
alternate | ||
} |
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,45 +1,37 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
using JetBrains.Annotations; | ||
|
||
namespace X.Web.RSS.Exceptions | ||
{ | ||
public class RSSParameterException : Exception | ||
{ | ||
private readonly string field; | ||
|
||
private readonly object value; | ||
namespace X.Web.RSS.Exceptions; | ||
|
||
private const string MessageText = "RSSParameterException field '{0}', value '{1}'"; | ||
public class RSSParameterException : Exception | ||
{ | ||
private const string MessageText = "RSSParameterException field '{0}', value '{1}'"; | ||
|
||
public RSSParameterException(string field, object value) | ||
: base(string.Format(MessageText, field, value)) | ||
{ | ||
this.field = field; | ||
this.value = value; | ||
} | ||
public RSSParameterException(string field, object value) | ||
: base(string.Format(MessageText, field, value)) | ||
{ | ||
Field = field; | ||
Value = value; | ||
} | ||
|
||
public RSSParameterException(string field, object value, Exception innerException) | ||
: base(string.Format(MessageText, field, value), innerException) | ||
{ | ||
this.field = field; | ||
this.value = value; | ||
} | ||
public RSSParameterException(string field, object value, Exception innerException) | ||
: base(string.Format(MessageText, field, value), innerException) | ||
{ | ||
Field = field; | ||
Value = value; | ||
} | ||
|
||
protected RSSParameterException(SerializationInfo info, StreamingContext context, string field, object value) | ||
//: base(info, context) | ||
{ | ||
this.field = field; | ||
this.value = value; | ||
} | ||
protected RSSParameterException(SerializationInfo info, StreamingContext context, string field, object value) | ||
: base(info, context) | ||
{ | ||
Field = field; | ||
Value = value; | ||
} | ||
|
||
public string Field | ||
{ | ||
get { return this.field; } | ||
} | ||
[PublicAPI] | ||
public string Field { get; } | ||
|
||
public object Value | ||
{ | ||
get { return this.value; } | ||
} | ||
} | ||
[PublicAPI] | ||
public object Value { get; } | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,39 +1,37 @@ | ||
using System; | ||
using System.Globalization; | ||
|
||
namespace X.Web.RSS.Extensions | ||
namespace X.Web.RSS.Extensions; | ||
|
||
public static class DateTimeExtensions | ||
{ | ||
public static class DateTimeExtensions | ||
///<summary> | ||
/// Converts a regular DateTime to a RFC822 date string. | ||
///</summary> | ||
///<returns>The specified date formatted as a RFC822 date string.</returns> | ||
public static string ToRFC822Date(this DateTime date) | ||
{ | ||
///<summary> | ||
/// Converts a regular DateTime to a RFC822 date string. | ||
///</summary> | ||
///<returns>The specified date formatted as a RFC822 date string.</returns> | ||
public static string ToRFC822Date(this DateTime date) | ||
{ | ||
var timeZone = GetTimeZone(); | ||
var timeZone = GetTimeZone(); | ||
|
||
var result = date.ToString("ddd, dd MMM yyyy HH:mm:ss " + timeZone.PadRight(5, '0')); | ||
return result; | ||
} | ||
|
||
private static string GetTimeZone() | ||
{ | ||
var utcOffset = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now); | ||
var offset = utcOffset.Hours; | ||
var timeZone = "+" + offset.ToString().PadLeft(2, '0'); | ||
var result = date.ToString("ddd, dd MMM yyyy HH:mm:ss " + timeZone.PadRight(5, '0')); | ||
|
||
return result; | ||
} | ||
|
||
if (offset < 0) | ||
{ | ||
int i = offset * -1; | ||
timeZone = "-" + i.ToString().PadLeft(2, '0'); | ||
} | ||
return timeZone; | ||
} | ||
private static string GetTimeZone() | ||
{ | ||
var utcOffset = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now); | ||
var offset = utcOffset.Hours; | ||
var timeZone = "+" + offset.ToString().PadLeft(2, '0'); | ||
|
||
public static DateTime FromRFC822Date(this string date) | ||
if (offset < 0) | ||
{ | ||
return DateTime.Parse(date); | ||
var i = offset * -1; | ||
timeZone = "-" + i.ToString().PadLeft(2, '0'); | ||
} | ||
|
||
return timeZone; | ||
} | ||
|
||
public static DateTime FromRFC822Date(this string date) => DateTime.Parse(date); | ||
} |
Oops, something went wrong.