using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel; using AR; using System.Drawing.Design; namespace Project { public class CSetting : AR.Setting { public System.Drawing.Rectangle ROI_ReelDetect_L { get; set; } public System.Drawing.Rectangle ROI_ReelDetect_R { get; set; } public System.Drawing.Rectangle ROI_ConvDetect_L { get; set; } public System.Drawing.Rectangle ROI_ConvDetect_R { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public int ConvDetectValueL { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public int ConvDetectValueR { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public string cameraname { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public int GrabDelayFast { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public int GrabDelaySlow { get; set; } [Description("Unit(seconds)"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public int TriggerTimeout { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public int AutoDeleteSeconds { get; set; } public Boolean SendRawData { get; set; } public Boolean DisableStreamData { get; set; } public Boolean EnableDupRun { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public string ImageSavePath { get; set; } public Boolean Log_AllBarcode { get; set; } public Boolean Log_Ping { get; set; } public Boolean Log_BarcodeTx { get; set; } public Boolean Log_BarcodeRx { get; set; } [Category("Developer Setting"), DisplayName("Listening Port(Left)"), Description("Listening port for server communication(TCP) - Default: 7979")] public int listenPortL { get; set; } [Category("Developer Setting"), DisplayName("Listening Port(Right)"), Description("Listening port for server communication(TCP) - Default: 7980")] public int listenPortR { get; set; } [Category("Save Data Path"), DisplayName("Data Save Path")] public string Path_Data { get; set; } [Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public int processCount { get; set; } [Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public string erodevaluestr { get; set; } [Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public uint blob_area_min { get; set; } [Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public uint blob_area_max { get; set; } [Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public float blob_sigmaxy { get; set; } [Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public float blob_sigmayy { get; set; } [Category("Vision"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public float blob_sigmaxx { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public float blob_rosscaleX { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public float blob_rosscaleY { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public float blob_minw { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public float blob_maxw { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public float blob_minh { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))] public float blob_maxh { get; set; } [Category("Vision")] public Boolean SaveErrorImage { get; set; } [Category("Vision")] public string GainOffsetListStr { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor)), Description("Enter -1 if not used")] public int CameraIndexL { get; set; } [Editor(typeof(MyUITypeEditor), typeof(UITypeEditor)), Description("Enter -1 if not used")] public int CameraIndexR { get; set; } [Category("General Setting"), Browsable(false)] public string Password_Setup { get; set; } [Category("General Setting"), DisplayName("Full Screen Window State"), Description("Use full screen mode.")] public Boolean FullScreen { get; set; } [Category("General Setting")] public Boolean EnableDebugMode { get; set; } public override void AfterLoad() { if (blob_minh == 0 && blob_maxh == 0) { blob_minh = 70; blob_maxh = 190; } if (blob_minw == 0 && blob_maxw == 0) { blob_minw = 70; blob_maxw = 190; } //if (TriggerTimeout == 0) TriggerTimeout = 30; if (GrabDelayFast == 0) GrabDelayFast = 250; if (GrabDelaySlow == 0) GrabDelaySlow = 500; if (ImageSavePath.isEmpty()) ImageSavePath = Util.CurrentPath; if (AutoDeleteSeconds == 0) AutoDeleteSeconds = 10; if (blob_rosscaleX == 0) blob_rosscaleX = 1.5f; if (blob_rosscaleY == 0) blob_rosscaleY = 1.5f; if (processCount == 0 && blob_area_min == 0) { processCount = 6; erodevaluestr = "3,1"; blob_area_min = 5000; blob_area_max = 50000; blob_sigmaxy = 500f; blob_sigmaxx = 5000f; blob_sigmayy = 500f; } if (GainOffsetListStr.isEmpty()) { GainOffsetListStr = "1,0;1.3,0;1,50;1,-50;3,50;0.5,-20;2.5,150;2,0"; } if (listenPortL == 0) listenPortL = 7979; if (listenPortR == 0) listenPortR = 7980; if (Password_Setup.isEmpty()) Password_Setup = "0000"; if (Path_Data == "") Path_Data = System.IO.Path.Combine(Util.CurrentPath, "SaveData"); try { if (System.IO.Directory.Exists(Path_Data) == false) System.IO.Directory.CreateDirectory(Path_Data); } catch { } //if (Password_User.isEmpty()) Password_User = "9999"; } public override void AfterSave() { //throw new NotImplementedException(); } public void CopyTo(CSetting dest) { //이곳의 모든 쓰기가능한 속성값을 대상에 써준다. Type thClass = this.GetType(); foreach (var method in thClass.GetMethods()) { var parameters = method.GetParameters(); if (!method.Name.StartsWith("get_")) continue; string keyname = method.Name.Substring(4); string methodName = method.Name; object odata = GetType().GetMethod(methodName).Invoke(this, null); var wMethod = dest.GetType().GetMethod(Convert.ToString("set_") + keyname); if (wMethod != null) wMethod.Invoke(dest, new object[] { odata }); } } } }