| 1 |
using System; |
| 2 |
using System.Collections.Generic; |
| 3 |
using System.Linq; |
| 4 |
using System.Text; |
| 5 |
|
| 6 |
namespace SchoolIdolFestivalSimulator.Main { |
| 7 |
public class RssItem { |
| 8 |
internal string _pubDate = string.Empty; |
| 9 |
internal string _title = string.Empty; |
| 10 |
internal string _link = string.Empty; |
| 11 |
internal string _guid = string.Empty; |
| 12 |
internal string _creator = string.Empty; |
| 13 |
internal string _description = string.Empty; |
| 14 |
private string _versionString = string.Empty; |
| 15 |
private int _verMajor = 0; |
| 16 |
private int _verMinor = 0; |
| 17 |
private int _verRelease = 0; |
| 18 |
private int _verBuild = 0; |
| 19 |
private readonly string VersionPrefix = "scfes-simulator - "; |
| 20 |
public int VerMajor { |
| 21 |
get{ |
| 22 |
return _verMajor; |
| 23 |
} |
| 24 |
} |
| 25 |
public int VerMinor { |
| 26 |
get { |
| 27 |
return _verMinor; |
| 28 |
} |
| 29 |
} |
| 30 |
public int VerRelease { |
| 31 |
get { |
| 32 |
return _verRelease; |
| 33 |
} |
| 34 |
} |
| 35 |
public int VerBuild { |
| 36 |
get { |
| 37 |
return _verBuild; |
| 38 |
} |
| 39 |
} |
| 40 |
public string VersionString { |
| 41 |
get { |
| 42 |
return _versionString; |
| 43 |
} |
| 44 |
} |
| 45 |
public string Title { |
| 46 |
get { |
| 47 |
return _title; |
| 48 |
} |
| 49 |
set { |
| 50 |
_title = value; |
| 51 |
|
| 52 |
_versionString = value.Replace(VersionPrefix, string.Empty); |
| 53 |
string[] s = _versionString.Split('.'); |
| 54 |
try { |
| 55 |
_verMajor = Convert.ToInt32(s[0]); |
| 56 |
_verMinor = Convert.ToInt32(s[1]); |
| 57 |
_verRelease = Convert.ToInt32(s[2]); |
| 58 |
_verBuild = Convert.ToInt32(s[3]); |
| 59 |
} catch { |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
public string ReleaseNo { |
| 64 |
get { |
| 65 |
string[] s = _link.Split('/'); |
| 66 |
return s[s.Length - 1]; |
| 67 |
} |
| 68 |
} |
| 69 |
public string Link { |
| 70 |
get { |
| 71 |
return _link; |
| 72 |
} |
| 73 |
} |
| 74 |
public string Guid { |
| 75 |
get { |
| 76 |
return _guid; |
| 77 |
} |
| 78 |
} |
| 79 |
public string Creator { |
| 80 |
get { |
| 81 |
return _creator; |
| 82 |
} |
| 83 |
} |
| 84 |
public string Description { |
| 85 |
get { |
| 86 |
return _description; |
| 87 |
} |
| 88 |
} |
| 89 |
private int GetMonth(string s){ |
| 90 |
switch(s.ToLower()){ |
| 91 |
case "jan": |
| 92 |
return 1; |
| 93 |
case "feb": |
| 94 |
return 2; |
| 95 |
case "mar": |
| 96 |
return 3; |
| 97 |
case "apr": |
| 98 |
return 4; |
| 99 |
case "may": |
| 100 |
return 5; |
| 101 |
case "jun": |
| 102 |
return 6; |
| 103 |
case "jul": |
| 104 |
return 7; |
| 105 |
case "aug": |
| 106 |
return 8; |
| 107 |
case "sep": |
| 108 |
return 9; |
| 109 |
case "oct": |
| 110 |
return 10; |
| 111 |
case "nov": |
| 112 |
return 11; |
| 113 |
case "dec": |
| 114 |
return 12; |
| 115 |
default: |
| 116 |
return 1; |
| 117 |
} |
| 118 |
} |
| 119 |
private DateTime GetDateTime(string s){ |
| 120 |
string d = s.Substring(5,2); |
| 121 |
string m = GetMonth(s.Substring(8,3)).ToString("00"); |
| 122 |
string y = s.Substring(12,4); |
| 123 |
string hour= s.Substring(17,2); |
| 124 |
string min=s.Substring(20,2); |
| 125 |
string sec=s.Substring(23,2); |
| 126 |
return DateTime.ParseExact(y + m + d + " " + hour + min + sec,"yyyyMMdd HHmmss",null); |
| 127 |
} |
| 128 |
|
| 129 |
public DateTime PubDate { |
| 130 |
get { |
| 131 |
//すみません、めんどくさがりで。。 |
| 132 |
return GetDateTime(_pubDate).AddHours(9); |
| 133 |
} |
| 134 |
} |
| 135 |
} |
| 136 |
} |