コード例 #1
0
        public QuickDeployment(ConnectionManagerBase connectionManager, IResultObject collectionObject)
            : this()
        {
            this.connectionManager = connectionManager;
            Collection             = collectionObject;

            Match match = Regex.Match(collectionObject["Name"].StringValue, @"(?<=\[)([ANSIR]*)\s?(.*)(?=\])");

            IsPhased = match.Success ? true : false;

            if (match.Groups[1].Success)
            {
                string key = match.Groups[1].Value;

                if (Regex.IsMatch(key, @"[A]"))
                {
                    IsRequired = false;
                }
                if (Regex.IsMatch(key, @"[N]"))
                {
                    UserUIExperience = true;
                    NotifyUser       = false;
                }
                if (Regex.IsMatch(key, @"[I]"))
                {
                    OverrideServiceWindows = true;
                }
                if (Regex.IsMatch(key, @"[R]"))
                {
                    RebootOutsideOfServiceWindows = true;
                }
                if (Regex.IsMatch(key, @"[S]"))
                {
                    SuppressReboot = 3;
                }
            }

            if (match.Groups[2].Success)
            {
                string[] values = match.Groups[2].Value.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

                if (0 < values.Length && Regex.IsMatch(values[0], @"(\+[0-9]+)"))
                {
                    StartTime    = StartTime.AddDays(Convert.ToDouble(values[0].TrimStart('+')));
                    DeadLineTime = DeadLineTime.AddDays(Convert.ToDouble(values[0].TrimStart('+')));
                }

                if (1 < values.Length && Regex.IsMatch(values[1], @"(([01]\d|2[0-3]):?[0-5]\d)"))
                {
                    string[] time = values[1].Split(':');
                    StartTime    = StartTime.ChangeTime(Convert.ToInt16(time[0]), Convert.ToInt16(time[1]), 0, 0);
                    DeadLineTime = DeadLineTime.ChangeTime(Convert.ToInt16(time[0]), Convert.ToInt16(time[1]), 0, 0);
                }

                if (2 < values.Length && Regex.IsMatch(values[2], @"(\+[0-9]+)"))
                {
                    DeadLineTime = DeadLineTime.AddDays(Convert.ToDouble(values[2].TrimStart('+')));
                }

                if (3 < values.Length && Regex.IsMatch(values[3], @"(([01]\d|2[0-3]):?[0-5]\d)"))
                {
                    string[] time = values[3].Split(':');
                    DeadLineTime = DeadLineTime.ChangeTime(Convert.ToInt16(time[0]), Convert.ToInt16(time[1]), 0, 0);
                }
            }
        }