Exemple #1
0
        public override void OnDestroy()
        {
            base.OnDestroy();

            // force our image view to release its references to our bitmaps
            ImageView.SetImageBitmap(null);

            // free the resources we're done with
            if (SourceImage != null)
            {
                SourceImage.Dispose( );
                SourceImage = null;
            }

            if (ScaledCroppedImage != null)
            {
                ScaledCroppedImage.Dispose( );
                ScaledCroppedImage = null;
            }

            if (ScaledSourceImage != null)
            {
                ScaledSourceImage.Dispose( );
                ScaledSourceImage = null;
            }

            // free the cropped image
            if (CroppedImage != null)
            {
                CroppedImage.Dispose( );
                CroppedImage = null;
            }

            SetMode(CropMode.None);
        }
Exemple #2
0
 public CallbackInfo(CroppedImage src, object obj,
                     Action <object, SpriteInfo> callback)
 {
     this.src      = src;
     this.obj      = obj;
     this.callback = callback;
 }
Exemple #3
0
    public static void GetSprite(CroppedImage src,
                                 object obj, Action <object, SpriteInfo> callback)
    {
        var         basename = src.BaseImage.Name;
        TextureInfo ti       = null;

        texture_dict.TryGetValue(basename, out ti);
        if (ti == null)
        {
            var item = new CallbackInfo(src, obj, callback);
            List <CallbackInfo> list = null;
            if (loading_set.TryGetValue(basename, out list))
            {
                list.Add(item);
            }
            else
            {
                list = new List <CallbackInfo> {
                    item
                };
                loading_set.Add(basename, list);
                GenericUtils.StartCoroutine(Loading(src.BaseImage));
            }
        }
        else
        {
            callback(obj, GetSpriteInfo(ti, src));
        }
    }
        /// <summary>
        /// Returns a cropped image
        /// </summary>
        /// <returns></returns>
        public async Task<WriteableBitmap> GetCropppedImageBitmap()
        {
            WriteableBitmap bmp;

            //Saves the cropped image to a stream.
            using (var stream = new Windows.Storage.Streams.InMemoryRandomAccessStream())
            {
                await CroppedImage.SaveAsync(stream, BitmapFileFormat.Bmp);
                stream.Seek(0);

                Windows.Graphics.Imaging.BitmapDecoder decoder = await Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(stream);
                bmp =  BitmapFactory.New((int)decoder.PixelWidth, (int)decoder.PixelHeight);
                bmp.SetSource(stream);
            }
            return bmp;
        }
Exemple #5
0
        internal SpriteInfo GetSprite(CroppedImage src)
        {
            SpriteInfo sprite = null;

            if (!sprites.TryGetValue(src.Name, out sprite))
            {
                sprite = new SpriteInfo(this,
                                        Sprite.Create(texture,
                                                      GenericUtils.ToUnityRect(src.Rectangle, texture.width, texture.height),
                                                      Vector2.zero)
                                        );
                sprites[src.Name] = sprite;
            }
            if (sprite != null)
            {
                refcount += 1;
            }
            return(sprite);
        }
Exemple #6
0
        public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
        {
            if (this.Error)
            {
                return;
            }
            CroppedImage img = cImage;

            if (isSelecting && cImageB != null)
            {
                img = cImageB;
            }
            Rectangle rect = destRect;

            //PointX微調整
            rect.X = destRect.X + PointX + Config.DrawingParam_ShapePositionShift;
            rect.Y = destRect.Y + pointY;

            if (img != null)
            {
                if (ia == null)
                {
                    graph.DrawImage(img.BaseImage.Bitmap, rect, img.Rectangle, GraphicsUnit.Pixel);
                }
                else
                {
                    graph.DrawImage(img.BaseImage.Bitmap, rect, img.Rectangle.X, img.Rectangle.Y, img.Rectangle.Width, img.Rectangle.Height, GraphicsUnit.Pixel, ia);
                }
            }
            else
            {
                if (mode == TextDrawingMode.GRAPHICS)
                {
                    graph.DrawString(Str, Config.Font, new SolidBrush(Config.ForeColor), new Point(PointX, pointY));
                }
                else
                {
                    System.Windows.Forms.TextRenderer.DrawText(graph, Str, Config.Font, new Point(PointX, pointY), Config.ForeColor, System.Windows.Forms.TextFormatFlags.NoPrefix);
                }
            }
        }
Exemple #7
0
        public override void GDIDrawTo(int pointY, bool isSelecting, bool isBackLog)
        {
            if (this.Error)
            {
                return;
            }
            CroppedImage img = cImage;

            if (isSelecting && cImageB != null)
            {
                img = cImageB;
            }
            if (img != null)
            {
                GDI.DrawImage(PointX + destRect.X, pointY + destRect.Y, Width, destRect.Height, img.BaseImage.GDIhDC, img.Rectangle);
            }
            else
            {
                GDI.TabbedTextOutFull(Config.Font, Config.ForeColor, Str, PointX, pointY);
            }
        }
Exemple #8
0
        public async Task <ScreenshotResult> Screenshot(string URL, string DirectoryPath, bool IncludeLogoWatermark, string WatermarkFilePath, Point CropStartPoint, Size CropSize, bool DoCropImage)
        {
            if (LoadedFine)
            {
                try
                {
                    string ImagePath = DirectoryPath + "Screenshot-" + DateTime.UtcNow.Month.ToString() + "-" + DateTime.UtcNow.Day.ToString() + "-" + DateTime.UtcNow.Year.ToString() + "-" + DateTime.UtcNow.Hour.ToString() + "h" + DateTime.UtcNow.Minute.ToString() + "m" + DateTime.UtcNow.Second.ToString() + "s.png";

                    driver.Navigate()
                    .GoToUrl(URL);

                    Thread.Sleep(3000);

                    var bytearray = driver.GetScreenshot().AsByteArray;

                    //driver.Quit();

                    Bitmap bmp;
                    using (var ms = new MemoryStream(bytearray))
                    {
                        bmp = new Bitmap(ms);
                    }

                    Bitmap CroppedImage;
                    if (DoCropImage)
                    {
                        Rectangle section = new Rectangle(CropStartPoint, CropSize);
                        CroppedImage = CropImage(bmp, section);
                    }
                    else
                    {
                        CroppedImage = bmp;
                    }

                    if (IncludeLogoWatermark)
                    {
                        Bitmap Logo;

                        if (WatermarkFilePath != "")
                        {
                            if (File.Exists(WatermarkFilePath))
                            {
                                Logo = new Bitmap(WatermarkFilePath);
                            }
                            else
                            {
                                Logo = Properties.Resources.Watermark;
                            }
                        }
                        else
                        {
                            Logo = Properties.Resources.Watermark;
                        }


                        Bitmap FinalLogo = ResizeBitmap(Logo, Logo.Width / 3, Logo.Height / 3);


                        Graphics gCroppedImage = Graphics.FromImage(CroppedImage);
                        gCroppedImage.DrawImage(FinalLogo, CroppedImage.Width / 2 - FinalLogo.Width / 2, 70, new Rectangle(0, 0, FinalLogo.Width, FinalLogo.Height), GraphicsUnit.Pixel);

                        CroppedImage.Save(ImagePath, ImageFormat.Png);

                        gCroppedImage.Dispose();
                        FinalLogo.Dispose();
                        Logo.Dispose();
                    }
                    else
                    {
                        CroppedImage.Save(ImagePath, ImageFormat.Png);
                    }

                    CroppedImage.Dispose();
                    bmp.Dispose();

                    return(new ScreenshotResult(true, ImagePath));
                }
                catch (Exception ex)
                {
                    return(new ScreenshotResult(false, ""));
                }
            }
            else
            {
                return(new ScreenshotResult(false, ""));
            }
        }
Exemple #9
0
        void SetMode(CropMode mode)
        {
            if (mode == Mode)
            {
                throw new Exception(string.Format("Crop Mode {0} requested, but already in that mode.", mode));
            }

            switch (mode)
            {
            case CropMode.Editing:
            {
                // If we're entering edit mode for the first time
                if (Mode == CropMode.None)
                {
                    // Animate in the mask
                    SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(MaskLayer.Opacity, MaskFadeAmount, MaskFadeTime,
                                                                                  delegate(float percent, object value)
                        {
                            Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                            {
                                MaskLayer.Opacity = (float)value;
                            });
                        },
                                                                                  null);

                    floatAnimator.Start( );


                    // turn on our cropper
                    CropView.Visibility = ViewStates.Visible;

                    // and set the source image to the scaled source.
                    ImageView.SetImageBitmap(ScaledSourceImage);
                }
                // else we're coming FROM Preview Mode, so we need to animate
                else
                {
                    Animating = true;

                    // setup the dimension changes
                    System.Drawing.SizeF startSize = new System.Drawing.SizeF(ImageView.Width, ImageView.Height);
                    System.Drawing.SizeF endSize   = new System.Drawing.SizeF(CropView.Width, CropView.Height);

                    PointF startPos = new PointF(ImageView.GetX( ), ImageView.GetY( ));
                    PointF endPos   = new PointF(CropView.GetX( ), CropView.GetY( ));


                    // now animate the cropped image up to its full size
                    AnimateImageView(ImageView, startPos, endPos, startSize, endSize, ImageAnimationTime,
                                     delegate
                        {
                            ImageView.SetImageBitmap(null);

                            // release any cropped image we had.
                            if (CroppedImage != null)
                            {
                                CroppedImage.Dispose( );
                                CroppedImage = null;
                            }

                            // release the scaled version if we had it
                            if (ScaledCroppedImage != null)
                            {
                                ScaledCroppedImage.Dispose( );
                                ScaledCroppedImage = null;
                            }


                            ImageView.SetImageBitmap(ScaledSourceImage);
                            ImageView.LayoutParameters.Width  = ScaledSourceImage.Width;
                            ImageView.LayoutParameters.Height = ScaledSourceImage.Height;

                            // center the image
                            ImageView.SetX((ScreenSize.Width - ImageView.LayoutParameters.Width) / 2);
                            ImageView.SetY((ScreenSize.Height - ImageView.LayoutParameters.Height) / 2);

                            MaskLayer.Visibility = ViewStates.Visible;
                            CropView.Visibility  = ViewStates.Visible;

                            SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(MaskLayer.Opacity, MaskFadeAmount, MaskFadeTime,
                                                                                          delegate(float percent, object value)
                            {
                                Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                                {
                                    MaskLayer.Opacity = (float)value;
                                    CropView.Alpha    = percent;
                                });
                            },
                                                                                          // FINISHED MASK FADE-OUT
                                                                                          delegate
                            {
                                Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                                {
                                    Animating = false;
                                });
                            });
                            floatAnimator.Start( );
                        });
                }

                break;
            }

            case CropMode.Previewing:
            {
                // don't allow a state change while we're animating
                Animating = true;

                SimpleAnimator_Float floatAnimator = new SimpleAnimator_Float(MaskLayer.Opacity, 1.00f, MaskFadeTime,
                                                                              delegate(float percent, object value)
                    {
                        Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                        {
                            MaskLayer.Opacity = (float)value;
                            CropView.Alpha    = 1.0f - percent;
                        });
                    },
                                                                              // FINISHED MASK FADE-IN
                                                                              delegate
                    {
                        Rock.Mobile.Threading.Util.PerformOnUIThread(delegate
                        {
                            // hide the mask and cropper
                            MaskLayer.Visibility = ViewStates.Gone;
                            CropView.Visibility  = ViewStates.Gone;

                            // create the cropped image
                            CroppedImage = CropImage(SourceImage, new System.Drawing.RectangleF(CropView.GetX( ) - CropViewMinPos.X,
                                                                                                CropView.GetY( ) - CropViewMinPos.Y,
                                                                                                CropView.LayoutParameters.Width,
                                                                                                CropView.LayoutParameters.Height));

                            // create a scaled version of the cropped image
                            float scaledWidth  = (float)CroppedImage.Width * (1.0f / ScreenToImageScalar);
                            float scaledHeight = (float)CroppedImage.Height * (1.0f / ScreenToImageScalar);
                            ScaledCroppedImage = Bitmap.CreateScaledBitmap(CroppedImage, (int)scaledWidth, (int)scaledHeight, false);

                            // set the scaled cropped image
                            ImageView.SetImageBitmap(null);
                            ImageView.SetImageBitmap(ScaledCroppedImage);

                            // start the scaled cropped image scaled down further to match its size within the full image.
                            ImageView.SetX(CropView.GetX( ));
                            ImageView.SetY(CropView.GetY( ));
                            ImageView.LayoutParameters.Width  = CropView.Width;
                            ImageView.LayoutParameters.Height = CropView.Height;


                            // setup the dimension changes
                            System.Drawing.SizeF startSize = new System.Drawing.SizeF(ScaledCroppedImage.Width, ScaledCroppedImage.Height);

                            System.Drawing.SizeF endSize;
                            if (ScreenSize.Width < ScreenSize.Height)
                            {
                                endSize = new System.Drawing.SizeF(ScreenSize.Width, (float)System.Math.Ceiling(ScreenSize.Width * (startSize.Width / startSize.Height)));
                            }
                            else
                            {
                                endSize = new System.Drawing.SizeF((float)System.Math.Ceiling(ScreenSize.Height * (startSize.Height / startSize.Width)), ScreenSize.Height);
                            }

                            PointF startPos = new PointF(CropView.GetX( ), CropView.GetY( ));
                            PointF endPos   = new PointF((ScreenSize.Width - endSize.Width) / 2, (ScreenSize.Height - endSize.Height) / 2);


                            // now animate the cropped image up to its full size
                            AnimateImageView(ImageView, startPos, endPos, startSize, endSize, ImageAnimationTime,
                                             delegate
                            {
                                Animating = false;
                            });
                        });
                    });

                floatAnimator.Start( );
                break;
            }
            }

            Mode = mode;
        }
Exemple #10
0
        public ConsoleImagePart(string resName, string resNameb, int raw_height, int raw_width, int raw_ypos)
        {
            top                = 0;
            Bottom             = Config.FontSize;
            Str                = "";
            ResourceName       = resName ?? "";
            ButtonResourceName = resNameb;
            var sb = new StringBuilder();

            sb.Append("<img src='");
            sb.Append(ResourceName);
            if (ButtonResourceName != null)
            {
                sb.Append("' srcb='");
                sb.Append(ButtonResourceName);
            }
            if (raw_height != 0)
            {
                sb.Append("' height='");
                sb.Append(raw_height.ToString());
            }
            if (raw_width != 0)
            {
                sb.Append("' width='");
                sb.Append(raw_height.ToString());
            }
            if (raw_ypos != 0)
            {
                sb.Append("' ypos='");
                sb.Append(raw_height.ToString());
            }
            sb.Append("'>");
            AltText = sb.ToString();

            cImage = AppContents.GetContent <CroppedImage>(ResourceName);
            if (cImage != null && !cImage.Enabled)
            {
                cImage = null;
            }
            if (cImage == null)
            {
                Str = AltText;
                return;
            }
            var height = 0;

            if (cImage.NoResize)
            {
                height = cImage.Rectangle.Height;
                Width  = cImage.Rectangle.Width;
            }
            else
            {
                if (raw_height == 0)
                {
                    height = Config.FontSize;
                }
                else
                {
                    height = Config.FontSize * raw_height / 100;
                }
                if (raw_width == 0)
                {
                    Width     = cImage.Rectangle.Width * height / cImage.Rectangle.Height;
                    XsubPixel = (float)cImage.Rectangle.Width * height / cImage.Rectangle.Height - Width;
                }
                else
                {
                    Width     = Config.FontSize * raw_width / 100;
                    XsubPixel = (float)Config.FontSize * raw_width / 100f - Width;
                }
            }
            top      = raw_ypos * Config.FontSize / 100;
            destRect = new Rectangle(0, top, Width, height);
            if (destRect.Width < 0)
            {
                destRect.X = -destRect.Width;
                Width      = -destRect.Width;
            }
            if (destRect.Height < 0)
            {
                destRect.Y = destRect.Y - destRect.Height;
                height     = -destRect.Height;
            }
            Bottom = top + height;
            //if(top > 0)
            //	top = 0;
            //if(bottom < Config.FontSize)
            //	bottom = Config.FontSize;
            if (ButtonResourceName != null)
            {
                cImageB = AppContents.GetContent <CroppedImage>(ButtonResourceName);
                if (cImageB != null && !cImageB.Enabled)
                {
                    cImageB = null;
                }
            }
        }
Exemple #11
0
 public void Load(CroppedImage src)
 {
     SpriteManager.GetSprite(src, this, ImageInfo.OnLoadImageCallback);
 }
Exemple #12
0
        /// <summary>
        /// This is testting Face module
        /// </summary>
        public async Task <String> Testpicture(String testImageFile)
        {
            try
            {
                People people = new People();

                List <string>     rslist = new List <string>();
                string[]          HeadRandom;
                StringBuilder     Mount_path    = new StringBuilder();
                FaceServiceClient fc            = new FaceServiceClient(ApiKey, "https://southeastasia.api.cognitive.microsoft.com/face/v1.0");
                string            personGroupId = "test";
                // await fc.CreatePersonGroupAsync(personGroupId,"My Family");
                //using (Stream s = File.OpenRead(testImageFile))
                //{
                //    if (s != null)
                //        return "yes";
                //    else
                //        return "no";
                //}
                using (Stream s = File.OpenRead(testImageFile))
                {
                    var requiredFaceAttributes = new FaceAttributeType[]
                    {
                        FaceAttributeType.Age,
                        FaceAttributeType.Gender,
                        FaceAttributeType.Smile,
                        FaceAttributeType.FacialHair,
                        FaceAttributeType.HeadPose,
                        FaceAttributeType.Glasses,
                        FaceAttributeType.Emotion
                    };
                    var faces = await fc.DetectAsync(s, returnFaceLandmarks : true, returnFaceAttributes : requiredFaceAttributes);

                    var faceIds = faces.Select(face => face.FaceId).ToArray();
                    try
                    {
                        var results = await fc.IdentifyAsync(personGroupId, faceIds);

                        var fspicture = new FileStream(testImageFile, FileMode.Open);

                        Bitmap bmp = new Bitmap(fspicture);

                        Graphics g = Graphics.FromImage(bmp);

                        int isM = 0, isF = 0;
                        // string age = "";
                        string sex = "";
                        int    age;
                        String age_s       = "";
                        String emr         = "";
                        String Top_Emotion = "";
                        Dictionary <string, float> Emotion = new Dictionary <string, float>();
                        foreach (var face in faces)
                        {
                            var      faceRect       = face.FaceRectangle;
                            var      attributes     = face.FaceAttributes;
                            float    Happiness      = attributes.Emotion.Happiness;
                            float    Anger          = attributes.Emotion.Anger;
                            float    Neutral        = attributes.Emotion.Neutral;
                            float    Contempt       = attributes.Emotion.Contempt;
                            float    Disgust        = attributes.Emotion.Disgust;
                            float    Fear           = attributes.Emotion.Fear;
                            float    Sadness        = attributes.Emotion.Sadness;
                            float    Surprise       = attributes.Emotion.Surprise;
                            String[] Emotion_string = { "Anger", "Happiness", "Neutral", "Contempt", "Disgust", "Fear", "Sadness", "Surprise" };
                            float[]  Emotion_array  = { Anger, Happiness, Neutral, Contempt, Disgust, Fear, Sadness, Surprise };

                            // g.DrawEllipse(new Pen(Brushes.Blue, 5), new System.Drawing.Rectangle(faceRect.Left-90, faceRect.Top-90,
                            //   faceRect.Width+150, faceRect.Height+150));

                            /* g.DrawRectangle(
                             * new Pen(Brushes.Red, 3),
                             * new System.Drawing.Rectangle(faceRect.Left, faceRect.Top,
                             *   faceRect.Width, faceRect.Height));*/
                            //g.DrawString(new Font(attributes.Gender.ToString(),));
                            for (int i = 0; i < Emotion_string.Length; i++)
                            {
                                Emotion.Add(Emotion_string[i], Emotion_array[i]);
                            }

                            if (attributes.Gender.StartsWith("male"))
                            {
                                isM += 1;
                            }
                            else
                            {
                                isF += 1;
                            }


                            age   = Convert.ToInt32(attributes.Age);
                            age_s = age.ToString();
                            sex   = attributes.Gender.ToString();

                            Top_Emotion = GetEmotion(attributes.Emotion);
                            Console.WriteLine(Top_Emotion);
                            //Font drawFont = new Font("Arial", 60, FontStyle.Bold);
                            //SolidBrush drawBrush = new SolidBrush(Color.Blue);
                            //PointF drawPoint = new PointF(faceRect.Left - 90, faceRect.Top - 50);
                            //PointF drawPoint2 = new PointF(faceRect.Left - 10, faceRect.Top - 50);
                            //g.DrawString(age_s, drawFont, drawBrush, drawPoint);
                            //g.DrawString(sex, drawFont, drawBrush, drawPoint2);



                            Bitmap CroppedImage = null;

                            if (face.FaceAttributes.HeadPose.Roll >= 10 || face.FaceAttributes.HeadPose.Roll <= -10)

                            {
                                System.Drawing.Rectangle rect = new System.Drawing.Rectangle(Convert.ToInt32(face.FaceRectangle.Left - 200), Convert.ToInt32(face.FaceRectangle.Top - 200), face.FaceRectangle.Width + 200, face.FaceRectangle.Height + 200);

                                CroppedImage = new Bitmap(CropRotatedRect(bmp, rect, Convert.ToSingle(face.FaceAttributes.HeadPose.Roll * -1), true));
                            }

                            else

                            {
                                try
                                {
                                    CroppedImage = new Bitmap(bmp.Clone(new System.Drawing.Rectangle(face.FaceRectangle.Left - 150, face.FaceRectangle.Top - 150, face.FaceRectangle.Width + 300, face.FaceRectangle.Height + 300), bmp.PixelFormat));
                                }
                                catch (Exception e)
                                {
                                }
                            }
                            bmp.Dispose();
                            CroppedImage.Save(@"C:\Users\v-altsai\Pictures\allfix.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                            CroppedImage.Dispose();
                            Console.WriteLine("Age " + age);
                        }
                        Console.WriteLine("Female: " + isF);
                        Console.WriteLine("Male: " + isM);
                        String name = "";
                        foreach (var identifyResult in results)
                        {
                            // Console.WriteLine("Result of face: {0}", identifyResult.FaceId);
                            if (identifyResult.Candidates.Length == 0)
                            {
                                Console.WriteLine("No one identified");
                                name = "none";
                            }
                            else if (identifyResult.Candidates.Length != 0)
                            {
                                var candidateId = identifyResult.Candidates[0].PersonId;
                                var person      = await fc.GetPersonAsync(personGroupId, candidateId);

                                Console.WriteLine("Identified as {0}", person.Name);
                                name = person.Name;

                                Bitmap oribmp = new Bitmap(@"C:\Users\v-altsai\Pictures\allfix.jpg");

                                using (Bitmap tmpBmp = new Bitmap(oribmp))

                                {
                                    Mount_path.Clear();

                                    Mount_path.Append("C:\\Users\\v-altsai\\Pictures\\Family\\");

                                    Mount_path.Append(person.Name);

                                    Mount_path.Append(".jpg");

                                    tmpBmp.Save(Mount_path.ToString(), System.Drawing.Imaging.ImageFormat.Jpeg);

                                    Console.WriteLine("{0}", Mount_path.ToString());
                                }
                            }
                        }



                        // bmp.Save(@"C:\Users\v-altsai\Documents\Visual Studio 2017\Projects\Kinect-FaceRecognition\Images\allfix.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                        people.Name             = name;
                        people.Age              = age_s;
                        people.Gender           = sex;
                        people.Emotion          = Top_Emotion;
                        people.Emotionlistscore = Emotion;
                        JSONHelper helper     = new JSONHelper();
                        String     jsonResult = "";
                        jsonResult = helper.ConvertObjectToJSon(people);
                        fspicture.Close();
                        s.Close();
                        Emotion.Clear();
                        return(jsonResult);
                    }
                    catch (FaceAPIException fs)
                    {
                        Console.WriteLine(fs.ToString());
                        Console.WriteLine("error results");
                        //if (s != null)
                        //    s.Close();
                        return(null);
                    }
                }
            }
            catch (Exception e)
            {
                String msg = "Oops! Something went wrong. Try again later";
                if (e is ClientException && (e as ClientException).Error.Message.ToLowerInvariant().Contains("access denied"))
                {
                    msg += " (access denied - hint: check your APIKEY ).";
                    Console.Write(msg);
                }
                Console.Write(e.ToString());
                return(null);
            }
        }
Exemple #13
0
 static SpriteInfo GetSpriteInfo(TextureInfo textinfo, CroppedImage src)
 {
     return(textinfo.GetSprite(src));
 }