Exemple #1
0
    public static bool IsInTimeInterval(this ToolsFacade facade, string timeStr, out bool hasDayCompensation)
    {
        if (string.IsNullOrEmpty(timeStr))
        {
            Debug.LogError("Null Parameter.");
            hasDayCompensation = false;
            return(false);
        }
        if (timeStr.Equals("[]"))
        {
            hasDayCompensation = false;
            return(true);
        }
        string[] array = timeStr.Split(new char[]
        {
            ':',
            ','
        });
        if (array == null || array.Length != 4)
        {
            Debug.LogError("Illegal Parameter.");
            hasDayCompensation = false;
            return(false);
        }
        int      hour     = int.Parse(array[0]);
        int      minute   = int.Parse(array[1]);
        int      hour2    = int.Parse(array[2]);
        int      minute2  = int.Parse(array[3]);
        DateTime fromTime = new DateTime(1, 1, 1, hour, minute, 0);
        DateTime toTime   = new DateTime(1, 1, 1, hour2, minute2, 0);

        return(facade.IsInTimeInterval(fromTime, toTime, out hasDayCompensation));
    }