Exemplo n.º 1
0
        private static void GetImage(IConfigure cfgIfc, string imageName, string imageSaveToName)
        {
            ILog _log = LogManager.GetCurrentClassLogger();

            try
            {
                _log.Trace(m => m("Start getting image: {0}", imageName));
                NuvoImage img = cfgIfc.GetImage(imageName);
                if (img == null)
                {
                    _log.Error(m => m("Cannot load Image: {0}", imageName));
                }
                else
                {
                    Console.WriteLine("Image details: {0}", img.ToString());
                    _log.Trace(m => m("Image details: {0}", img.ToString()));
                    img.Picture.Save(imageSaveToName);
                    _log.Trace(m => m("Image saved to: {0}", imageSaveToName));
                }
            }
            catch (Exception exc)
            {
                _log.Fatal(m => m("Exception getting image '{0}': {1}", imageName, exc));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// <see cref="IConfigure"/>
        /// </summary>
        /// <param name="picturePath"></param>
        /// <returns></returns>
        public NuvoImage GetImage(string picturePath)
        {
            _log.Trace(m => m("Configuration Service; GetImage( {0} ).", picturePath));
            NuvoImage img = null;

            try
            {
                img = new NuvoImage(picturePath);
                _log.Trace(m => m("Configuration Service; return image {0}.", img.ToString()));
            }
            catch (ArgumentException exc)
            {
                _log.Fatal(m => m("Cannot load image {0}! Exception={1}", picturePath, exc));
            }
            return(img);
        }