public InstructionSetRequested(string branchIP, Guid instructionSetID, string deploymentControllerID)
 {
     BranchIP               = branchIP;
     InstructionSet         = null;
     InstructionSetID       = instructionSetID;
     DeploymentControllerID = deploymentControllerID;
 }
 public InstructionSetRequested(_InstructionSet iSet, string branchIP)
 {
     BranchIP               = branchIP;
     InstructionSet         = iSet;
     InstructionSetID       = iSet.ID;
     DeploymentControllerID = iSet.DeploymentControllerID;
 }
예제 #3
0
 public InstructionMessage(_InstructionSet iSet)
     : base()
 {
     if (iSet != null)
     {
         InstructionSetID       = iSet.ID;
         DeploymentControllerID = iSet.DeploymentControllerID;
     }
 }
예제 #4
0
        public ExecutionCompleted(_InstructionSet iSet)
            : base(iSet)
        {
            if (iSet == null)
            {
                throw new ArgumentNullException(nameof(iSet));
            }

            ProcessName      = iSet.ProcessName;
            InitiationSource = iSet.InitiationSource;
            TimeCompleted    = iSet.Completed;

            Exceptions = new List <Exception>();

            foreach (Instruction i in iSet.Instructions)
            {
                Exceptions.AddRange(i.Exceptions);
            }

            _InstructionSet = iSet;
            CachePostMortem = iSet.CachePostMortem;
        }
예제 #5
0
        public override void CustomizeInstructionSet(_InstructionSet iSetTemplate, Dictionary <string, string> map, string branchIP, string initiationSource, bool cloneMap = true)
        {
            System.Collections.Generic.Dictionary <string, string> kvp = map;

            if (cloneMap)
            {
                kvp = map.ToDictionary(i => i.Key, i => i.Value);
            }

            string dest = null;

            string destPathMacro = kvp["[DestinationPath]"].Trim();

            if (destPathMacro.Length > 0)
            {
                destPathMacro = base.ApplyKVP(destPathMacro, kvp, branchIP, initiationSource, false);
            }

            if (destPathMacro.Length > 0)
            {
                List <string> validDestPaths = STEM.Sys.IO.Path.ExpandRangedPath(destPathMacro);

                if (validDestPaths.Count == 1)
                {
                    dest = destPathMacro;

                    if (!_LastUsed.Exists(i => i.Path.Equals(dest, StringComparison.InvariantCultureIgnoreCase)))
                    {
                        _LastUsed.Add(new Used {
                            IP = STEM.Sys.IO.Path.IPFromPath(dest), Path = dest, LastUsed = DateTime.UtcNow
                        });
                    }

                    if (!GoodDirectory(dest))
                    {
                        dest = null;
                    }
                }
                else
                {
                    foreach (string s in validDestPaths)
                    {
                        if (!_LastUsed.Exists(i => i.Path.Equals(s, StringComparison.InvariantCultureIgnoreCase)))
                        {
                            _LastUsed.Add(new Used {
                                IP = STEM.Sys.IO.Path.IPFromPath(s), Path = s, LastUsed = DateTime.UtcNow
                            });
                        }
                    }

                    string first3 = STEM.Sys.IO.Path.GetFileNameWithoutExtension(branchIP);

                    foreach (Used u in _LastUsed.Where(i => validDestPaths.Exists(x => x.Equals(i.Path, StringComparison.InvariantCultureIgnoreCase)) && i.IP.StartsWith(first3)).OrderBy(i => i.LastUsed))
                    {
                        if (GoodDirectory(u.Path))
                        {
                            dest       = u.Path;
                            u.LastUsed = DateTime.UtcNow;
                            break;
                        }
                    }

                    if (dest == null)
                    {
                        first3 = STEM.Sys.IO.Path.GetFileNameWithoutExtension(STEM.Sys.IO.Path.IPFromPath(initiationSource));

                        foreach (Used u in _LastUsed.Where(i => validDestPaths.Exists(x => x.Equals(i.Path, StringComparison.InvariantCultureIgnoreCase)) && i.IP.StartsWith(first3)).OrderBy(i => i.LastUsed))
                        {
                            if (GoodDirectory(u.Path))
                            {
                                dest       = u.Path;
                                u.LastUsed = DateTime.UtcNow;
                                break;
                            }
                        }

                        if (dest == null)
                        {
                            string first2 = STEM.Sys.IO.Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(branchIP));

                            foreach (Used u in _LastUsed.Where(i => validDestPaths.Exists(x => x.Equals(i.Path, StringComparison.InvariantCultureIgnoreCase)) && i.IP.StartsWith(first2)).OrderBy(i => i.LastUsed))
                            {
                                if (GoodDirectory(u.Path))
                                {
                                    dest       = u.Path;
                                    u.LastUsed = DateTime.UtcNow;
                                    break;
                                }
                            }

                            if (dest == null)
                            {
                                first2 = STEM.Sys.IO.Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(STEM.Sys.IO.Path.IPFromPath(initiationSource)));

                                foreach (Used u in _LastUsed.Where(i => validDestPaths.Exists(x => x.Equals(i.Path, StringComparison.InvariantCultureIgnoreCase)) && i.IP.StartsWith(first2)).OrderBy(i => i.LastUsed))
                                {
                                    if (GoodDirectory(u.Path))
                                    {
                                        dest       = u.Path;
                                        u.LastUsed = DateTime.UtcNow;
                                        break;
                                    }
                                }
                            }

                            if (dest == null)
                            {
                                foreach (Used u in _LastUsed.Where(i => validDestPaths.Exists(x => x.Equals(i.Path, StringComparison.InvariantCultureIgnoreCase))).OrderBy(i => i.LastUsed))
                                {
                                    if (GoodDirectory(u.Path))
                                    {
                                        dest       = u.Path;
                                        u.LastUsed = DateTime.UtcNow;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (dest == null && (iSetTemplate.InstructionsXml.ToString().ToUpper().Contains("[DestinationPath]".ToUpper()) || iSetTemplate.InstructionsXml.ToString().ToUpper().Contains("[DestinationAddress]".ToUpper())))
            {
                throw new Exception("No destination path was found to be acceptable. (" + TemplateKVP["[DestinationPath]"] + ")");
            }

            if (dest != null)
            {
                kvp["[DestinationPath]"]    = dest;
                kvp["[DestinationAddress]"] = STEM.Sys.IO.Path.IPFromPath(dest);
                LastDestinationSelected     = dest;
            }
            else
            {
                kvp["[DestinationPath]"]    = "";
                kvp["[DestinationAddress]"] = "";
                LastDestinationSelected     = "";
            }

            base.CustomizeInstructionSet(iSetTemplate, kvp, branchIP, initiationSource, false);
        }
예제 #6
0
 public ExecutionStarted(_InstructionSet iSet)
     : base(iSet)
 {
     TimeStarted = iSet.Started;
 }