예제 #1
0
        private static CHDKPTPDevice CheckSupported(PTPDevice ptpdev)
        {
            CHDKPTPDevice dev = ptpdev as CHDKPTPDevice;

            if (!dev.PTPSupported)
            {
                return(dev);
            }

            try
            {
                if (!dev.Open())
                {
                    return(dev);
                }

                CHDKPTPSession sess = new CHDKPTPSession(dev);
                sess.OpenSession();
                if (sess.CHDK_Version(out dev.CHDKVersionMajor, out dev.CHDKVersionMinor))
                {
                    if (dev.CHDKVersionMajor == CHDK_VERSION_MAJOR && dev.CHDKVersionMinor >= CHDK_VERSION_MINOR)
                    {
                        CHDK_ScriptSupport flags;
                        sess.CHDK_ScriptSupport(out flags);
                        if (flags.HasFlag(CHDK_ScriptSupport.PTP_CHDK_SCRIPT_SUPPORT_LUA))
                        {
                            dev.CHDKSupported = true;
                        }
                    }

                    sess.CloseSession();
                }
            }
            catch (PTPException)
            {
                // make sure CHDKSupported has not already been set
                dev.CHDKSupported = false;
            }
            finally
            {
                if (dev.IsOpen)
                {
                    dev.Close();
                }
            }

            return(dev);
        }
예제 #2
0
 public PTPSession(PTPDevice dev)
 {
     this.device = dev;
     this.ptp = new PTPCommunication(this.device);
     this.IsOpen = false;
 }
예제 #3
0
 public PTPSession(PTPDevice dev)
 {
     _device = dev;
     ptp = new PTPCommunication(_device);
     _IsOpen = false;
 }
예제 #4
0
 public PTPSession(PTPDevice dev)
 {
     _device = dev;
     ptp     = new PTPCommunication(_device);
     _IsOpen = false;
 }