Search code examples
c#visual-studio-2012gopro

How to get files by GoPro3+ using GoPro.Hero library?


this is my scenario: I'm trying to use GoPro.Hero library(downloaded by R1pper Page on Github) in c#, but I cannot understand in which way download photos from GoProCamera..

var camera = Camera.Create<Hero3Camera>("10.5.5.9");
PowerUp(camera);

Isn't there a camera.Photos.Get(id) or similar thing?

Thank you in advance


Solution

  • Looking at some of the source code. I found this:

    public void CheckDownloadImage()
        {
            var camera = GetCamera();
            var image=camera.Contents().ImagesAsync().Result.FirstOrDefault();
            if (image == null)
                Assert.Inconclusive("no image found");
    
            var response=image.DownloadAsync().Result.GetResponseStream();
    
            var memory = ReadToMemory(response);
    
            Assert.AreEqual(memory.Length, image.Size);
        }
    

    This downloads the first image if there is one and checks if its download size is the same as the memory it uses.

    And you can use something like this:

    var images = camera.Contents().ImagesAsync().Result.ToList();
    

    to get a list of all the images and download the ones you want accordingly.