예제 #1
0
        protected void SetPropertyStringData(uint propertyId, string data, int maxByteLength)
        {
            this.ExecuteSetter(() =>
            {
                var bytes = Util.ConvertStringToBytesWithNullByteAtEnd(data);
                if (bytes.Length > maxByteLength)
                {
                    throw new ArgumentException(string.Format("'{0}' converted to bytes is longer than {1}.", data, maxByteLength), "data");
                }

                Util.Assert(Edsdk.EdsSetPropertyData(this.Handle, propertyId, 0, bytes.Length, bytes),
                            string.Format("Failed to set property string data: propertyId {0}, data {1}", propertyId, data),
                            propertyId, data);
            });
        }
예제 #2
0
 internal void SetPropertyStruct <T>(uint propertyId, T data) where T : struct
 {
     this.ExecuteSetter(() =>
     {
         try
         {
             Util.Assert(Edsdk.EdsSetPropertyData(this.Handle, propertyId, 0, Marshal.SizeOf((object)data), (object)data),
                         string.Format("Failed to set property string data: propertyId {0}, data {1}", propertyId, data),
                         propertyId, data);
         }
         finally
         {
         }
     });
 }
예제 #3
0
        private void ChangePicturesSaveLocation(SaveLocation saveLocation)
        {
            this.CheckDisposed();

            this.EnsureOpenSession();

            Util.Assert(Edsdk.EdsSetPropertyData(this.Handle, Edsdk.PropID_SaveTo, 0, Marshal.SizeOf(typeof(int)),
                                                 (int)saveLocation), "Failed to set SaveTo location.");

            if (!this.IsLegacy)
            {
                this.LockAndExceute(() =>
                {
                    var capacity = new Edsdk.EdsCapacity {
                        NumberOfFreeClusters = 0x7FFFFFFF, BytesPerSector = 0x1000, Reset = 1
                    };
                    Util.Assert(Edsdk.EdsSetCapacity(this.Handle, capacity), "Failed to set capacity.");
                });
            }
        }
예제 #4
0
 public void SetPropertyIntegerArrayData(uint propertyId, uint[] data)
 {
     this.ExecuteSetter(() => Util.Assert(Edsdk.EdsSetPropertyData(this.Handle, propertyId, 0, Marshal.SizeOf(typeof(uint)) * data.Length, data),
                                          string.Format("Failed to set property integer array data: propertyId {0}, data {1}", propertyId, data),
                                          propertyId, data));
 }
예제 #5
0
 protected void SetPropertyIntegerData(uint propertyId, long data)
 {
     this.ExecuteSetter(() => Util.Assert(Edsdk.EdsSetPropertyData(this.Handle, propertyId, 0, Marshal.SizeOf(typeof(uint)), (uint)data),
                                          string.Format("Failed to set property integer data: propertyId {0}, data {1}", propertyId, data),
                                          propertyId, data));
 }