生成日期时间

 1  public static bool smethod_0(ref string string_0)
 2         {
 3             string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "LvCha.S3.dll";
 4             if (File.Exists(path))
 5             {
 6                // ab ab = new ab();
 7                 if (/*ab.a()*/true)
 8                 {
 9                     string_0 = File.ReadAllLines(path)[0];
10                     DateTime time = DateTime.Parse(smethod_1(string_0, "lvchaqq754404640"));
11                     DateTime time2 = smethod_0();
12                     if (DateTime.Compare(time, time2) > 0)
13                     {
14                         string_0 = time.ToString();
15                         return true;
16                     }
17                 }
18               
19             }
20             return false;
21         }
22 
23         public static string smethod_1(string string_0, string string_1)
24         {
25             byte[] bytes = Encoding.UTF8.GetBytes(string_1.Substring(0, 8));
26             byte[] rgbIV = bytes;
27             byte[] buffer = Convert.FromBase64String(string_0);
28             DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
29             MemoryStream stream = new MemoryStream();
30             CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(bytes, rgbIV), 
31 
32 CryptoStreamMode.Write);
33             stream2.Write(buffer, 0, buffer.Length);
34             stream2.FlushFinalBlock();
35             return Encoding.UTF8.GetString(stream.ToArray());
36         }
37 
38 
39 
40 
41         public static DateTime smethod_0()
42         {
43             WebRequest request = null;
44             WebResponse response = null;
45             DateTime time;
46             try
47             {
48                 request = WebRequest.Create("http://www.beijing-time.org/time.asp");
49                 response = request.GetResponse();
50                 string str = string.Empty;
51                 using (Stream stream = response.GetResponseStream())
52                 {
53                     using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
54                     {
55                         str = reader.ReadToEnd();
56                     }
57                 }
58                 string[] strArray = str.Split(new char[] { ';' });
59                 for (int i = 0; i < strArray.Length; i++)
60                 {
61                     strArray[i] = strArray[i].Replace("\r\n", "");
62                 }
63                 string str2 = strArray[1].Split(new char[] { '=' })[1];
64                 string str3 = strArray[2].Split(new char[] { '=' })[1];
65                 string str4 = strArray[3].Split(new char[] { '=' })[1];
66                 string str5 = strArray[5].Split(new char[] { '=' })[1];
67                 string str6 = strArray[6].Split(new char[] { '=' })[1];
68                 string str7 = strArray[7].Split(new char[] { '=' })[1];
69                 time = DateTime.Parse(str2 + "-" + str3 + "-" + str4 + " " + str5 + ":" + str6 + ":" + 
70 
71 str7);
72             }
73             catch (WebException)
74             {
75                 return DateTime.Parse("2011-1-1");
76             }
77             catch (Exception)
78             {
79                 return DateTime.Parse("2011-1-1");
80             }
81             finally
82             {
83                 if (response != null)
84                 {
85                     response.Close();
86                 }
87                 if (request != null)
88                 {
89                     request.Abort();
90                 }
91             }
92             return time;
93         }

 

posted @ 2014-03-04 14:07  ^懒洋洋^  阅读(163)  评论(0)    收藏  举报