Exemplo n.º 1
0
        public InstrumentCameraSetting SetInstrumentCamera(string SettingID, InstrumentCameraSetting CameraSetting)
        {
            if (string.IsNullOrEmpty(SettingID))
            {
                throw new IDNullException("仪器设置ID不可为空!");
            }

            string sqlCommandText = ModuleConfiguration.SQL_CMD_UpdateInstrumentCameraSetting;

            this.dmlOperable.ExeSql(sqlCommandText, new Dictionary <string, object>()
            {
                //{ "@ID", long.Parse(CameraSetting.ID)},
                { "@InstrumentID", CameraSetting.Instrument.ID },
                { "@CameraType", CameraSetting.CameraType },
                { "@ConnectionType", CameraSetting.VideoConnectionType },
                { "@Model", CameraSetting.Model },
                { "@SerialNumber", CameraSetting.SerialNumber },
                { "@Manufacturer", CameraSetting.Manufacturer },
                { "@Brand", CameraSetting.Brand },
                { "@SKU", CameraSetting.SKU },
                { "@IpAddress", CameraSetting.CameraIpAddress },
                { "@PortNumber", CameraSetting.CameraPortNumber },
                { "@LoginName", CameraSetting.CameraLoginName },
                { "@Password", CameraSetting.CameraPassword },
                { "@AssemblyName", CameraSetting.AssemblyName },
                { "@AssemblyPath", CameraSetting.AssemblyFilePath },
                { "@ClassName", CameraSetting.ClassName },
                { "@Version", CameraSetting.Version },
                { "@Index", CameraSetting.Index }
            });

            return(CameraSetting);
        }
Exemplo n.º 2
0
        public IList <InstrumentCameraSetting> LoadCameraSettingMeta(string Repository)
        {
            List <InstrumentCameraSetting> cameraSettings = null;

            var assemblies = CommonUtility.ScanAssemblyFromDirectory <IVideoCamera>(Repository, "Rally.Lib.Camera.*.dll");

            if (assemblies != null && assemblies.Length > 0)
            {
                cameraSettings = new List <InstrumentCameraSetting>();

                InstrumentCameraSetting cameraSetting = null;

                foreach (var assembly in assemblies)
                {
                    cameraSetting = new InstrumentCameraSetting()
                    {
                        AssemblyFilePath = assembly.Location,
                        AssemblyName     = assembly.FullName
                    };

                    var types = assembly.GetExportedTypes();

                    if (types != null && types.Length > 0)
                    {
                        foreach (var type in types)
                        {
                            if (type.GetInterface(typeof(IVideoCamera).FullName) == typeof(IVideoCamera))
                            {
                                cameraSetting.ClassName = type.FullName;
                                break;
                            }
                        }
                    }

                    var instance = CommonUtility.EmitObjectFromFile <IVideoCamera>(cameraSetting.AssemblyFilePath, cameraSetting.ClassName);

                    if (instance != null)
                    {
                        var info = instance.Get();

                        if (info != null)
                        {
                            cameraSetting.Brand        = (string)info["Brand"];
                            cameraSetting.Manufacturer = (string)info["Manufacturer"];
                            cameraSetting.Model        = (string)info["Model"];
                            cameraSetting.SKU          = (string)info["Specification"];
                            cameraSetting.Version      = (string)info["Version"];
                        }
                    }

                    cameraSettings.Add(cameraSetting);
                }
            }

            return(cameraSettings);
        }
Exemplo n.º 3
0
        public T CreateCameraController <T>(InstrumentCameraSetting CameraSetting)
        {
            if (CameraSetting == null)
            {
                return(default(T));
            }

            T instance = CommonUtility.EmitObjectFromFile <T>(CameraSetting.AssemblyFilePath, CameraSetting.ClassName);

            return(instance);
        }