public static bool SignFiles(string [] files, string stageRoot, SignInfo info, Task callingTask)
        {
            m_CallingTask = callingTask;
            m_Info        = info;

            bool retVal = true;

            if (!stageRoot.EndsWith("\\"))
            {
                stageRoot += "\\";
            }

            string[] level1 = { "Unsigned\\" };
            string[] level2 = { "Client", "Server" };

            string unsignedStage = stageRoot + level1[0];

            // Set up staging area
            if (Directory.Exists(stageRoot))
            {
                Directory.Delete(stageRoot, true);
            }

            Directory.CreateDirectory(stageRoot);

            foreach (string level in level1)
            {
                string parent = stageRoot + level;

                if (!Directory.Exists(parent))
                {
                    Directory.CreateDirectory(parent);
                }

                foreach (string nextLevel in level2)
                {
                    string child = parent + nextLevel;

                    if (!Directory.Exists(child))
                    {
                        Directory.CreateDirectory(child);
                    }
                }
            }

            Dictionary <string, string> fileDictionary = new Dictionary <string, string>();

            foreach (string file in files)
            {
                if (!File.Exists(file))
                {
                    callingTask.Log.LogWarning("File not found: {0}", file);
                    continue;
                }

                if ((File.GetAttributes(file) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                {
                    callingTask.Log.LogMessage("File \"{0}\" is read only and will not be signed.", file);
                    continue;
                }

                string directory = Path.GetDirectoryName(file).ToLower();
                bool   client    = directory.Contains("\\client\\");

                string key = (client ? "Client\\" : "Server\\") + Path.GetFileName(file);
                if (!fileDictionary.ContainsKey(key))
                {
                    fileDictionary.Add(key, file);
                    File.Copy(file, unsignedStage + (client ? "Client\\" : "Server\\") + Path.GetFileName(file), true);
                }
            }


            string signedStage = stageRoot + "Signed\\";

            retVal = SubmitJob(unsignedStage, signedStage);

            ReturnFiles(signedStage, fileDictionary, "Client", callingTask);
            ReturnFiles(signedStage, fileDictionary, "Server", callingTask);

            Directory.Delete(unsignedStage, true);

            return(retVal);
        }
        public static bool SignFiles(string [] files, string stageRoot, SignInfo info, Task callingTask)
        {
            m_CallingTask = callingTask;
            m_Info = info;

            bool retVal = true;

            if (!stageRoot.EndsWith("\\"))
            {
                stageRoot += "\\";
            }

            string[] level1 = { "Unsigned\\" };
            string[] level2 = { "Client", "Server" };

            string unsignedStage = stageRoot + level1[0];
            
            // Set up staging area
            if (Directory.Exists(stageRoot))
                Directory.Delete(stageRoot, true);

            Directory.CreateDirectory(stageRoot);

            foreach (string level in level1)
            {
                string parent = stageRoot + level;

                if (!Directory.Exists(parent))
                {
                    Directory.CreateDirectory(parent);
                }

                foreach (string nextLevel in level2)
                {
                    string child = parent + nextLevel;

                    if (!Directory.Exists(child))
                    {
                        Directory.CreateDirectory(child);
                    }
                }
            }

            Dictionary<string, string> fileDictionary = new Dictionary<string, string>();

            foreach (string file in files)
            {
                if (!File.Exists(file))
                {
                    callingTask.Log.LogWarning("File not found: {0}", file);
                    continue;
                }

                if ((File.GetAttributes(file) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                {
                    callingTask.Log.LogMessage("File \"{0}\" is read only and will not be signed.", file);
                    continue;
                }

                string directory = Path.GetDirectoryName(file).ToLower();
                bool client = directory.Contains("\\client\\");

                string key = (client ? "Client\\" : "Server\\") + Path.GetFileName(file);
                if (!fileDictionary.ContainsKey(key))
                {
                    fileDictionary.Add(key, file);
                    File.Copy(file, unsignedStage + (client ? "Client\\" : "Server\\") + Path.GetFileName(file), true);
                }
            }


            string signedStage = stageRoot + "Signed\\";
            retVal = SubmitJob(unsignedStage, signedStage);

            ReturnFiles(signedStage, fileDictionary, "Client", callingTask);
            ReturnFiles(signedStage, fileDictionary, "Server", callingTask);

            Directory.Delete(unsignedStage, true);
            
            return retVal;
        }