예제 #1
0
        public CameraSetting GetSetting(SettingIds id)
        {
            CameraSetting setting;

            cameraSettings.TryGetValue(id, out setting);
            return(setting);
        }
예제 #2
0
        /// <summary>
        /// We return an empty string if there is no global called VS2P4_Version180OrAfter
        ///     and we have not yet done our first load of options.
        /// </summary>
        /// <param name="settingsId"></param>
        /// <returns></returns>
        public static string OptionNameForLoad(SettingIds settingsId)
        {
            switch (settingsId)
            {
            case SettingIds.UseP4Config:
            case SettingIds.Server:
            case SettingIds.User:
            case SettingIds.Password:
            case SettingIds.Workspace:
            case SettingIds.LogLevel:
            case SettingIds.IsCheckoutEnabled:
            case SettingIds.IsAddEnabled:
            case SettingIds.IsRevertIfUnchangedEnabled:
            case SettingIds.IsRevertEnabled:
            case SettingIds.PromptBeforeRevert:
            case SettingIds.IsGetLatestRevisionEnabled:
            case SettingIds.IsViewRevisionHistoryEnabled:
            case SettingIds.IsViewDiffEnabled:
            case SettingIds.IsViewTimeLapseEnabled:
            case SettingIds.AutoCheckoutOnEdit:
            case SettingIds.AutoCheckoutOnSave:
            case SettingIds.AutoAdd:
            case SettingIds.AutoDelete:
            case SettingIds.IgnoreFilesNotUnderP4Root2:
            case SettingIds.Version180OrAfter:
                return(Prefix + settingsId);

            default:
                throw new ArgumentOutOfRangeException("settingsId");
            }
        }
예제 #3
0
        public CameraSetting(SettingIds id)
        {
            Id             = id;
            AcceptedValues = new List <int>();

            switch (id)
            {
            case SettingIds.FocusAreaSpot:
            case SettingIds.FocusMagnifierPosition:
            case SettingIds.ShutterSpeed:
                HasSubValue = true;
                break;
            }
        }
예제 #4
0
        private bool DoSetting(OpCodes opcode, SettingIds id, int value1, int value2, int value1DataSize, int value2DataSize)
        {
            using (Packet request = new Packet(opcode))
            {
                request.WriteHexString("00 00 00 00 00 00 00 00");
                request.WriteUInt16((ushort)id);
                request.WriteHexString("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 04 00 00 00");
                for (int i = 0; i < 2; i++)
                {
                    int dataSize = i == 0 ? value1DataSize : value2DataSize;
                    int data     = i == 0 ? value1 : value2;
                    switch (dataSize)
                    {
                    case 1:
                        request.WriteByte((byte)data);
                        break;

                    case 2:
                        request.WriteInt16((short)data);
                        break;

                    case 4:
                        request.WriteInt32(data);
                        break;
                    }
                }
                byte[] buffer = SendCommand(request.GetBuffer());
                using (Packet response = Packet.Reader(buffer))
                {
                    if (!IsValidResponse(response))
                    {
                        return(false);
                    }
                    return(true);
                }
            }
        }
예제 #5
0
 private bool DoSubSettingU8(SettingIds id, byte value)
 {
     return(DoSettingU8(OpCodes.SubSetting, id, value));
 }
예제 #6
0
 private bool DoSubSettingI16(SettingIds id, short value1, short value2)
 {
     return(DoSettingI16(OpCodes.SubSetting, id, value1, value2));
 }
예제 #7
0
 private bool DoSubSettingI32(SettingIds id, int value)
 {
     return(DoSettingI32(OpCodes.SubSetting, id, value));
 }
예제 #8
0
 private bool DoMainSettingI16(SettingIds id, short value)
 {
     return(DoSettingI16(OpCodes.MainSetting, id, value));
 }
예제 #9
0
 private bool DoSettingI16(OpCodes opcode, SettingIds id, short value1, short value2)
 {
     return(DoSetting(opcode, id, value1, value2, 2, 2));
 }
예제 #10
0
 private bool DoSettingI16(OpCodes opcode, SettingIds id, short value)
 {
     return(DoSetting(opcode, id, value, 0, 2, 0));
 }
예제 #11
0
 private bool DoSettingI32(OpCodes opcode, SettingIds id, int value)
 {
     return(DoSetting(opcode, id, value, 0, 4, 0));
 }
예제 #12
0
 private bool DoSettingU8(OpCodes opcode, SettingIds id, byte value)
 {
     return(DoSetting(opcode, id, value, 0, 1, 0));
 }
예제 #13
0
 public Setting(SettingIds id, object value)
 {
     this.Id    = id;
     this.Value = value;
 }