public void CreateHandlers() { // goes through all directories in the list and if it exists than creates a new handler and handles the directory. foreach (string directory in pathsToListen) { if (Directory.Exists(directory)) { IDirectoryHandler handler = new DirectoyHandler(directory, this.m_controller, this.m_logging); // create handler handlersList.Add(handler); // adds to the list handler.StartHandleDirectory(); // starting handle the directory this.m_logging.Log("Add a handler", Logging.Modal.MessageTypeEnum.INFO); // sending message to the log file CloseServer += delegate { handler.OnCommandRecieved(new CloseCommand(this.handlersList)); }; } else { Console.WriteLine("dir " + directory + "does not exists !!!!!!!!!!!!!!!!!!"); } } }