You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.3 KiB
73 lines
2.3 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using iMonitorApp.Properties; |
|
|
|
namespace iMonitorApp.Classes |
|
{ |
|
// Token: 0x02000029 RID: 41 |
|
public class PhoneScheduleCheck |
|
{ |
|
// Token: 0x060001AC RID: 428 RVA: 0x0000D5E8 File Offset: 0x0000B7E8 |
|
public static bool IsPhoneActive() |
|
{ |
|
return PhoneScheduleCheck.IsPhoneActive(DateTime.Now); |
|
} |
|
|
|
// Token: 0x060001AD RID: 429 RVA: 0x0000D604 File Offset: 0x0000B804 |
|
public static bool IsPhoneActive(DateTime currentTime) |
|
{ |
|
string text = Settings.Default["Phone" + currentTime.Date.DayOfWeek.ToString() + "Time"].ToString(); |
|
List<string> list = text.Split(new char[] |
|
{ |
|
',' |
|
}).ToList<string>(); |
|
foreach (string text2 in list) |
|
{ |
|
string text3 = text2.Replace("(", "").Replace(")", ""); |
|
string[] array = text3.Split(new char[] |
|
{ |
|
'-' |
|
}); |
|
DateTime t = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, Convert.ToInt32(array[0].Trim().Substring(0, 2)), Convert.ToInt32(array[0].Trim().Substring(2)), 0); |
|
DateTime t2 = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, Convert.ToInt32(array[1].Trim().Substring(0, 2)), Convert.ToInt32(array[1].Trim().Substring(2)), 59); |
|
bool flag = currentTime >= t && currentTime <= t2; |
|
if (flag) |
|
{ |
|
return true; |
|
} |
|
} |
|
return false; |
|
} |
|
|
|
// Token: 0x060001AE RID: 430 RVA: 0x0000D7A4 File Offset: 0x0000B9A4 |
|
public static bool CheckSyntax(DayOfWeek day) |
|
{ |
|
bool result; |
|
try |
|
{ |
|
string text = Settings.Default["Phone" + day.ToString() + "Time"].ToString(); |
|
List<string> list = text.Split(new char[] |
|
{ |
|
',' |
|
}).ToList<string>(); |
|
foreach (string text2 in list) |
|
{ |
|
string text3 = text2.Trim().Replace("(", "").Replace(")", ""); |
|
string[] array = text3.Trim().Split(new char[] |
|
{ |
|
'-' |
|
}); |
|
DateTime dateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(array[0].Trim().Substring(0, 2)), Convert.ToInt32(array[0].Trim().Substring(2)), 0); |
|
DateTime dateTime2 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(array[1].Trim().Substring(0, 2)), Convert.ToInt32(array[1].Trim().Substring(2)), 59); |
|
} |
|
result = true; |
|
} |
|
catch |
|
{ |
|
result = false; |
|
} |
|
return result; |
|
} |
|
} |
|
}
|
|
|