public bool Remove(Guid appid, Guid clsid)
        {
            SvcFile svcFile = null;

            if (this.svcFiles.TryGetValue(clsid, out svcFile))
            {
                // we found an existing SVC file

                // We should never be adding and deleting SVC files at the same time..
                Debug.Assert(svcFile.State != SvcFileState.Added, "svcFile.State != SvcFileState.Added");

                if (svcFile.State == SvcFileState.Deleted)
                {
                    // already marked for deletion
                    return(true);
                }
                else
                {
                    Debug.Assert(svcFile.State == SvcFileState.Existing, "svcFile.State == SvcFileState.Existing");
                    svcFile.Delete();
                    return(true);
                }
            }
            else
            {
                // didn't find any SVC file to remove
                return(false);
            }
        }
        public void Add(Guid appid, Guid clsid)
        {
            SvcFile svcFile = null;

            if (this.svcFiles.TryGetValue(clsid, out svcFile))
            {
                // we found an existing SVC file, all is good
                // We should never be adding and deleting SVC files at the same time..
                Debug.Assert(svcFile.State != SvcFileState.Deleted, "svcFile.State != SvcFileState.Deleted");
            }
            else
            {
                svcFile = SvcFile.CreateNew(this.webDirectoryPath, appid, clsid);
                this.svcFiles.Add(clsid, svcFile);
            }
        }
        public SvcFileManager(string webDirectoryPath)
        {
            this.webDirectoryPath = webDirectoryPath;
            this.svcFiles         = new Dictionary <Guid, SvcFile>();

            string[] fileNames = Directory.GetFiles(webDirectoryPath, "*.svc");

            foreach (string fileName in fileNames)
            {
                SvcFile svcFile = SvcFile.OpenExisting(fileName);
                if (svcFile != null)
                {
                    this.svcFiles.Add(svcFile.Clsid, svcFile);
                }
            }
        }