public ImageListenerManager(ILogger logger_, string outputDir, string sourceName, string logName, int thumbSize)
        {
            // create controller
            // and check that output dirctory successfully creates
            Logger      = logger_;
            PhotoUpdate = new PhotoUpdater();

            settings = Settings.Instance;
            settings.SetSettings(outputDir, sourceName, logName, thumbSize, 0);

            ImageServiceFile = new ImageServiceFileHandler(out ExitCode status);
            Controller       = new ImageController(ImageServiceFile);
            if (status == ExitCode.F_Create_Dir)
            {
                Logger.Log("Cannot create output image folder.\nFatal error cannot recover, exiting",
                           MessageTypeEnum.L_FAIL);
                Environment.Exit(1);
            }

            int       port      = 6145;
            LogBackup logBackup = LogBackup.Instance;

            Logger.MessageRecieved += logBackup.WriteMessage;
            directories             = new Dictionary <string, IDirectoryListener>();
            server = new Server(port, new ClientHandler(), this);
        }
Example #2
0
 public ImageController(ImageServiceFileHandler imageFileHandler_)
 {
     imageFileHandler = imageFileHandler_;                    // Storing the Modal Of The System
     commands         = new Dictionary <Command, ICommand>()
     {
         { Command.BackupFile, new BackupImageCommand(imageFileHandler) }
     };
 }
        public ImageListenerManager(ILoggingService logger_, string outputDir, int thumbSize)
        {
            // create controller
            // and check that output dirctory successfully creates
            ExitCode status;
            ImageServiceFileHandler imageServiceFile = new ImageServiceFileHandler(outputDir, thumbSize, out status);

            logger     = logger_;
            controller = new ImageController(imageServiceFile);
            if (status == ExitCode.F_Create_Dir)
            {
                logger.Log("Cannot create output image folder.\nFatal error cannot recover, exiting",
                           Logger.Message.MessageTypeEnum.FAIL);
                Environment.Exit(1);
            }
        }
 /// <summary>
 /// backup image command
 /// </summary>
 /// <param name="imageFileHandler_">need image file handler</param>
 public BackupImageCommand(ImageServiceFileHandler imageFileHandler_)
 {
     imageFileHandler = imageFileHandler_;
 }