public DestinationManager(FillInfoParameters imgInfoParams
     , IDataManager dm, IFIleManager fm, ConfigurationData cnf)
 {
     _imgInfoParams = imgInfoParams;
     _dm = dm;
     _fm = fm;
     _cnf = cnf;
 }
Beispiel #2
0
        public MainPresenter(IMainForm view, IFIleManager managere)
        {
            _view    = view;
            _manager = managere;

            _view.SetSembolCount(0);

            _view.ContentChanged += _view_ContentChanged;
        }
        /// <summary>
        /// Создать запись об изображении
        /// </summary>
        /// <param name="imagePath">Путь к изопражению</param>
        /// <param name="targetDir">Путь назначение</param>
        /// <returns>Ключ рисунка</returns>
        private Model.Image CreateImage(string imagePath, string targetDir, IConfiguration cnf, ILogger lg, IFIleManager fm)
        {
            var    imgInfo    = new FileInfo(imagePath);
            var    imgDirPath = imgInfo.Directory.FullName;
            string newImgPath = "";

            byte[] imageData = null;
            try
            {
                newImgPath = fm.CopyImg(imagePath, targetDir);
            }
            catch (IOException copyError)
            {
                lg.Add(copyError.Message);
            }

            Bitmap bmp       = fm.GetThumb(imagePath);
            string thumbPath = fm.SaveThumb(targetDir, cnf.GetThumbDirName(), bmp, imgInfo.Name);

            imageData = fm.GetImageData(bmp);


            var im = new Model.Image()
            {
                HashCode = imgInfo.GetHashCode()
                ,
                ImagePath = newImgPath
                ,
                ImageTitle = imgInfo.Name
                ,
                ThumbnailPath = thumbPath
                ,
                Thumbnail = imageData
            };

            return(im);
        }