コード例 #1
0
ファイル: MdsCfgForm.cs プロジェクト: mrddos/planisphere
 protected override object BuildSettings(DeviceEntry entry)
 {
     MdsSettings settings = new MdsSettings();
     settings.Factor = (StringValue)entry["factor1"];
     settings.Frequence = (StringValue)entry[DeviceEntry.RecordInterval];
     return settings;
 }
コード例 #2
0
ファイル: WebFileDevice.cs プロジェクト: oisy/scada
		// Initialize the device
		private void Initialize(DeviceEntry entry)
		{
			this.Name = entry[DeviceEntry.Name].ToString();
			this.DeviceConfigPath = entry[DeviceEntry.Path].ToString();
			this.Version = entry[DeviceEntry.Version].ToString();
            this.Id = entry[DeviceEntry.Identity].ToString();

			string deviceSn = entry[DeviceEntry.DeviceSn].ToString();
			if (string.IsNullOrEmpty(deviceSn))
			{
				throw new Exception("Config Error: No Device SN");
			}
			this.deviceSn = deviceSn.Trim();

			this.addr = (StringValue)entry[DeviceEntry.IPAddress];

			this.minuteAdjust = (StringValue)entry["MinuteAdjust"];


            string tableName = (StringValue)entry[DeviceEntry.TableName];
            string tableFields = (StringValue)entry[DeviceEntry.TableFields];
            this.InitializeNaITable(tableName, tableFields, out this.insertIntoCommand);

            string tableName2 = (StringValue)entry["TableName2"];
            string tableFields2 = (StringValue)entry["TableFields2"];
            this.InitializeNaITable(tableName2, tableFields2, out this.insertIntoCommand2);


            // Virtual On
            string isVirtual = (StringValue)entry[DeviceEntry.Virtual];
            if (isVirtual != null && isVirtual.ToLower() == "true")
            {
                this.isVirtual = true;
            }
		}
コード例 #3
0
        private static DeviceEntry LoadFromConfig(string deviceName, string configFile)
        {
            if (!File.Exists(configFile))
            {
                return(null);
            }

            using (ScadaReader sr = new ScadaReader(configFile))
            {
                SectionType    secType = SectionType.None;
                string         line    = null;
                string         key     = null;
                IValue         value   = null;
                ReadLineResult result  = sr.ReadLine(out secType, out line, out key, out value);
                // Dictionary<string, string> config = new Dictionary<string, string>();
                DeviceEntry entry = new DeviceEntry();
                while (result == ReadLineResult.OK)
                {
                    result = sr.ReadLine(out secType, out line, out key, out value);

                    if (secType == SectionType.KeyWithStringValue)
                    {
                        entry[key] = value;
                    }
                }
                DirectoryInfo di         = Directory.GetParent(configFile);
                string        devicePath = di.FullName;
                // Path
                entry[DeviceEntry.Path]     = new StringValue(devicePath);
                entry[DeviceEntry.Identity] = new StringValue(deviceName);


                return(entry);
            }
        }
コード例 #4
0
ファイル: EnvCfgForm.cs プロジェクト: mrddos/planisphere
 protected override object BuildSettings(DeviceEntry entry)
 {
     ShelterSettings settings = new ShelterSettings();
     settings.SerialPort = (StringValue)entry[DeviceEntry.SerialPort];
     settings.Frequence = (StringValue)entry[DeviceEntry.RecordInterval];
     return settings;
 }
コード例 #5
0
ファイル: OpcDevice.cs プロジェクト: oisy/scada
        private void Initialize(DeviceEntry entry)
        {
            this.Name = entry[DeviceEntry.Name].ToString();
            this.Id = entry[DeviceEntry.Identity].ToString();
            this.DeviceConfigPath = entry[DeviceEntry.Path].ToString();
            this.Version = entry[DeviceEntry.Version].ToString();

            this.ipAddr = entry["IPADDR"].ToString();

            this.Flow = entry["Flow"].ToString();
            this.Hours = entry["Hours"].ToString();

            this.tableName = (StringValue)entry[DeviceEntry.TableName];
            if (!string.IsNullOrEmpty(tableName))
            {
                string tableFields = (StringValue)entry[DeviceEntry.TableFields];
                this.insertSQL = this.MakeInsertSQL(this.tableName, tableFields);
            }
            
            IValue v = entry["TSAP"];
            if (v != null)
            {
                this.tsap = v.ToString();
            }

        }
コード例 #6
0
ファイル: WeatherDevice.cs プロジェクト: oisy/scada
		public WeatherDevice(DeviceEntry entry)
		{
            this.entry = entry;
			if (!this.Initialize(entry))
			{
				string initFailedEvent = string.Format("Device '{0}' initialized failed. Error is {1}.", entry[DeviceEntry.Identity], error);
				RecordManager.DoSystemEventRecord(this, initFailedEvent);
			}
		}
コード例 #7
0
ファイル: NaICfgForm.cs プロジェクト: oisy/scada
 protected override object BuildSettings(DeviceEntry entry)
 {
     NaISettings settings = new NaISettings();
     settings.DeviceSn = (StringValue)entry[DeviceEntry.DeviceSn];
     settings.Frequence = (StringValue)entry[DeviceEntry.RecordInterval];
     settings.MinuteAdjust = (StringValue)entry["MinuteAdjust"];
     settings.IPAddress = (StringValue)entry[DeviceEntry.IPAddress];
     return settings;
 }
コード例 #8
0
ファイル: HpicCfgForm.cs プロジェクト: oisy/scada
 protected override object BuildSettings(DeviceEntry entry)
 {
     HpicSettings settings = new HpicSettings();
     settings.SerialPort = (StringValue)entry[DeviceEntry.SerialPort];
     settings.Frequence = (StringValue)entry[DeviceEntry.RecordInterval];
     settings.Factor = (StringValue)entry["factor1"];
     settings.AlarmValue = (StringValue)entry[DeviceEntry.Alarm1];
     return settings;
 }
コード例 #9
0
ファイル: DeviceForm.cs プロジェクト: oisy/scada
        private void btnConnAIS_Click(object sender, EventArgs e)
        {
            DeviceEntry entry = new DeviceEntry();
            entry[DeviceEntry.Name] = new StringValue("AIS");
            entry[DeviceEntry.Identity] = new StringValue("Scada.AIS");
            entry[DeviceEntry.Path] = new StringValue("");
            entry[DeviceEntry.Version] = new StringValue("0.9");

            entry["IPADDR"] = new StringValue("192.168.0.6");
            this.aisDevice = new AISDevice(entry);
            this.aisDevice.Start("S7200.OPCServer");

            this.aisDevice.Send(Encoding.ASCII.GetBytes("connect"), default(DateTime));
        }
コード例 #10
0
ファイル: HPGEFileDevice.cs プロジェクト: oisy/scada
        // Initialize the device
        private void Initialize(DeviceEntry entry)
        {
            this.Name = entry[DeviceEntry.Name].ToString();
            this.DeviceConfigPath = entry[DeviceEntry.Path].ToString();
            this.Version = entry[DeviceEntry.Version].ToString();
            this.Id = entry[DeviceEntry.Identity].ToString();

            this.strFileMonitoringPath = (StringValue)entry["FileMonitoringPath"];
            this.strFileCopy2Path = (StringValue)entry["FileCopy2Path"];
            this.strSidPath = (StringValue)entry["SIDPath"];
            this.strActionInterval = (StringValue)entry[DeviceEntry.ActionInterval];

            string tableName = (StringValue)entry[DeviceEntry.TableName];
            string tableFields = (StringValue)entry[DeviceEntry.TableFields];
            this.InitializeHPGeTable(tableName, tableFields, out this.insertIntoCommand);
        }
コード例 #11
0
ファイル: SettingFormBase.cs プロジェクト: mrddos/planisphere
 protected virtual object BuildSettings(DeviceEntry entry)
 {
     return null;
 }
コード例 #12
0
ファイル: HPGEFileDevice.cs プロジェクト: oisy/scada
 public HPGEFileDevice(DeviceEntry entry)
 {
     this.entry = entry;
     this.Initialize(entry);
 }
コード例 #13
0
ファイル: DeviceManager.cs プロジェクト: mrddos/planisphere
        private Device Load(DeviceEntry entry)
        {
            if (entry == null)
                return null;

            StringValue className = (StringValue)entry[DeviceEntry.ClassName];
            if (typeof(StandardDevice).ToString() == className)
            {
                return new StandardDevice(entry);
            }
            else if (typeof(WebFileDevice).ToString() == className)
            {
                return new WebFileDevice(entry);
            }
            else if (typeof(FormProxyDevice).ToString() == className)
            {
                return new FormProxyDevice(entry);
            }

            // Other Device defined in some Assemblies.
            if (entry[DeviceEntry.Assembly] != null)
            {
                Assembly assembly = Assembly.Load((StringValue)entry[DeviceEntry.Assembly]);
                Type deviceClass = assembly.GetType((StringValue)entry[DeviceEntry.ClassName]);
                if (deviceClass != null)
                {
                    object device = Activator.CreateInstance(deviceClass, new object[] { });
                    return device as Device;
                }
            }

            return (Device)null;
        }
コード例 #14
0
ファイル: DeviceManager.cs プロジェクト: mrddos/planisphere
 private string GetCOMPort(DeviceEntry entry)
 {
     if (entry.Contains(DeviceEntry.SerialPort))
     {
         return (StringValue)entry[DeviceEntry.SerialPort];
     }
     return string.Empty;
 }
コード例 #15
0
ファイル: FormProxyDevice.cs プロジェクト: oisy/scada
		private bool Initialize(DeviceEntry entry)
		{
            this.Name = entry[DeviceEntry.Name].ToString();
            this.Id = entry[DeviceEntry.Identity].ToString();
            this.DeviceConfigPath = entry[DeviceEntry.Path].ToString();
            this.Version = entry[DeviceEntry.Version].ToString();

            this.processName = (StringValue)entry[ProcessName];

            for (int i = 1; i < 50; i++)
            {
                string elemId = string.Format("ElemId{0}", i);
                if (!entry.Contains(elemId))
                {
                    break;
                }
                string controlIdStr = (StringValue)entry[elemId];
                int controlId = 0;
                if (controlIdStr.StartsWith("0x"))
                {
                    controlIdStr = controlIdStr.Substring(2);
                    controlId = int.Parse(controlIdStr, NumberStyles.AllowHexSpecifier);
                    this.elemIdList.Add(controlId);
                }
                else
                {
                    if (int.TryParse(controlIdStr, out controlId))
                    {
                        this.elemIdList.Add(controlId);
                    }
                }
            }

            string tableName = (StringValue)entry[DeviceEntry.TableName];
            string tableFields = (StringValue)entry[DeviceEntry.TableFields];


            if (!Device.GetFactor(entry, 1, out this.factor1))
            {
                // Debug.Assert(false);
            }

            string[] fields = tableFields.Split(',');
            string atList = string.Empty;
            for (int i = 0; i < fields.Length; ++i)
            {
                string at = string.Format("@{0}, ", i + 1);
                atList += at;
            }
            atList = atList.TrimEnd(',', ' ');

            this.tableName = tableName;
            string cmd = string.Format("insert into {0}({1}) values({2})", tableName, tableFields, atList);
            this.insertIntoCommand = cmd;


            string fieldsConfigStr = (StringValue)entry[DeviceEntry.FieldsConfig];
            List<FieldConfig> fieldConfigList = ParseDataFieldConfig(fieldsConfigStr);
            this.fieldsConfig = fieldConfigList.ToArray<FieldConfig>();

            this.GenCurrentSid();
			return true;
		}
コード例 #16
0
ファイル: ShelterDevice.cs プロジェクト: oisy/scada
 /// <summary>
 /// 
 /// </summary>
 /// <param name="entry"></param>
 public ShelterDevice(DeviceEntry entry)
     :base(entry)
 {
 }
コード例 #17
0
ファイル: CinderlDataDevice.cs プロジェクト: oisy/scada
 /// <summary>
 /// 
 /// </summary>
 /// <param name="entry"></param>
 public CinderlDataDevice(DeviceEntry entry)
     :base(entry)
 {
 }
コード例 #18
0
ファイル: Declare.cs プロジェクト: mrddos/planisphere
 protected void SetDataParserFactors(DataParser dataParser, DeviceEntry entry)
 {
     int i = 0;
     double v = 0.0;
     while (Device.GetFactor(entry, ++i, out v))
     {
         dataParser.Factors.Add(v);
     }
 }
コード例 #19
0
ファイル: Declare.cs プロジェクト: mrddos/planisphere
 protected string GetValue(DeviceEntry entry, string entryName, string defaultValue)
 {
     IValue v = entry[entryName];
     if (v != null)
     {
         return (StringValue)v;
     }
     return defaultValue;
 }
コード例 #20
0
ファイル: Declare.cs プロジェクト: mrddos/planisphere
 public static bool GetFactor(DeviceEntry entry, int i, out double v)
 {
     v = 0.0;
     string factor = string.Format("factor{0}", i);
     string s = (StringValue)entry[factor];
     if (s != null && s.Length > 0)
     {
         if (double.TryParse(s, out v))
         {
             return true;
         }
     }
     return false;
 }
コード例 #21
0
ファイル: StandardDevice.cs プロジェクト: mrddos/planisphere
        private bool Initialize(DeviceEntry entry)
        {
            this.Name = entry[DeviceEntry.Name].ToString();
            this.Id = entry[DeviceEntry.Identity].ToString();
            this.Path = entry[DeviceEntry.Path].ToString();
            this.Version = entry[DeviceEntry.Version].ToString();

            this.baudRate = this.GetValue(entry, DeviceEntry.BaudRate, 9600);
            this.readTimeout = this.GetValue(entry, DeviceEntry.ReadTimeout, 12000);
            this.dataBits = this.GetValue(entry, DeviceEntry.DataBits, ComDataBits);
            this.stopBits = (StopBits)this.GetValue(entry, DeviceEntry.StopBits, (int)StopBits.One);

            StringValue parity = (StringValue)entry[DeviceEntry.Parity];
            this.parity = SerialPorts.ParseParity(parity);

            // Virtual On
            string isVirtual = (StringValue)entry[DeviceEntry.Virtual];
            if (isVirtual != null && isVirtual.ToLower() == "true")
            {
                this.isVirtual = true;
            }

            this.actionCondition = (StringValue)entry[DeviceEntry.ActionCondition];
            string actionSendInHex = (StringValue)entry[DeviceEntry.ActionSendInHex];
            if (actionSendInHex != "true")
            {
                string actionSend = (StringValue)entry[DeviceEntry.ActionSend];
                if (actionSend != null)
                {
                    actionSend = actionSend.Replace("\\r", "\r");
                    this.actionSend = Encoding.ASCII.GetBytes(actionSend);
                }
            }
            else
            {
                this.actionSendInHex = true;
                string hexes = (StringValue)entry[DeviceEntry.ActionSend];
                hexes = hexes.Trim();
                this.actionSend = DeviceEntry.ParseHex(hexes);
            }

            this.actionDelay = (StringValue)entry[DeviceEntry.ActionDelay];

            const int DefaultRecordInterval = 30;
            this.actionInterval = this.GetValue(entry, DeviceEntry.ActionInterval, DefaultRecordInterval);
            this.RecordInterval = this.GetValue(entry, DeviceEntry.RecordInterval, DefaultRecordInterval);
            this.recordTimePolicy.Interval = this.RecordInterval;

            var sensitive = this.GetValue(entry, DeviceEntry.Sensitive, "false");
            this.sensitive = (sensitive.ToLower() == "true");

            this.calcDataWithLastData = this.GetValue(entry, "CalcLast", 0) == 1;

            // Set DataParser & factors
            string dataParserClz = (StringValue)entry[DeviceEntry.DataParser];
            this.dataParser = this.GetDataParser(dataParserClz);
            this.SetDataParserFactors(this.dataParser, entry);

            string tableName = (StringValue)entry[DeviceEntry.TableName];
            string tableFields = (StringValue)entry[DeviceEntry.TableFields];

            string[] fields = tableFields.Split(',');
            string atList = string.Empty;
            for (int i = 0; i < fields.Length; ++i)
            {
                string at = string.Format("@{0}, ", i + 1);
                atList += at;
            }
            atList = atList.TrimEnd(',', ' ');

            string cmd = string.Format("insert into {0}({1}) values({2})", tableName, tableFields, atList);
            this.insertIntoCommand = cmd;

            string fieldsConfigStr = (StringValue)entry[DeviceEntry.FieldsConfig];
            List<FieldConfig> fieldConfigList = ParseDataFieldConfig(fieldsConfigStr);
            this.fieldsConfig = fieldConfigList.ToArray<FieldConfig>();

            if (!this.IsRealDevice)
            {
                string el = (StringValue)entry[DeviceEntry.ExampleLine];
                el = el.Replace("\\r", "\r");
                el = el.Replace("\\n", "\n");

                this.exampleLine = el;
            }
            return true;
        }
コード例 #22
0
ファイル: CinderlStatusDevice.cs プロジェクト: oisy/scada
        /// <summary>
        /// 
        /// </summary>
        /// <param name="entry"></param>
        public CinderlStatusDevice(DeviceEntry entry)
            :base(entry)
        {

        }
コード例 #23
0
ファイル: OpcDevice.cs プロジェクト: oisy/scada
 public MDSDevice(DeviceEntry entry)
     :base(entry)
 {
     this.deviceKey = "scada.mds";
 }
コード例 #24
0
ファイル: DeviceEntry.cs プロジェクト: mrddos/planisphere
        private static DeviceEntry LoadFromConfig(string deviceName, string configFile)
        {
            if (!File.Exists(configFile))
                return null;

            using (ScadaReader sr = new ScadaReader(configFile))
            {
                SectionType secType = SectionType.None;
                string line = null;
                string key = null;
                IValue value = null;
                ReadLineResult result = sr.ReadLine(out secType, out line, out key, out value);
                // Dictionary<string, string> config = new Dictionary<string, string>();
                DeviceEntry entry = new DeviceEntry();
                while (result == ReadLineResult.OK)
                {
                    result = sr.ReadLine(out secType, out line, out key, out value);

                    if (secType == SectionType.KeyWithStringValue)
                    {
                        entry[key] = value;
                    }
                }
                DirectoryInfo di = Directory.GetParent(configFile);
                string devicePath = di.FullName;
                // Path
                entry[DeviceEntry.Path] = new StringValue(devicePath);
                entry[DeviceEntry.Identity] = new StringValue(deviceName);

                return entry;
            }
        }
コード例 #25
0
ファイル: OpcDevice.cs プロジェクト: oisy/scada
 public OpcDevice(DeviceEntry entry)
 {
     this.Initialize(entry);
 }
コード例 #26
0
ファイル: WeatherDevice.cs プロジェクト: oisy/scada
		private bool Initialize(DeviceEntry entry)
		{
			this.Name = entry[DeviceEntry.Name].ToString();
            this.Id = entry[DeviceEntry.Identity].ToString();
            this.DeviceConfigPath = entry[DeviceEntry.Path].ToString();
			this.Version = entry[DeviceEntry.Version].ToString();

            this.baudRate = this.GetValue(entry, DeviceEntry.BaudRate, 9600);
            this.readTimeout = this.GetValue(entry, DeviceEntry.ReadTimeout, 12000);        
            this.dataBits = this.GetValue(entry, DeviceEntry.DataBits, ComDataBits);
            this.stopBits = (StopBits)this.GetValue(entry, DeviceEntry.StopBits, (int)StopBits.One);

			StringValue parity = (StringValue)entry[DeviceEntry.Parity];
			this.parity = SerialPorts.ParseParity(parity);

            // 
            this.actionSend1 = Encoding.ASCII.GetBytes((StringValue)entry["ActionSend1"]);
            this.actionSend2 = Encoding.ASCII.GetBytes((StringValue)entry["ActionSend2"]);
			
			// Virtual On
			string isVirtual = (StringValue)entry[DeviceEntry.Virtual];
			if (isVirtual != null && isVirtual.ToLower() == "true")
			{
				this.isVirtual = true;
			}

            string bufferSleepString = (StringValue)entry["BufferSleep"];
            if (bufferSleepString != null)
            {
                this.bufferSleep = int.Parse(bufferSleepString);
            }

			// this.actionDelay = (StringValue)entry[DeviceEntry.ActionDelay];

            const int DefaultRecordInterval = 30;
            this.actionInterval = this.GetValue(entry, DeviceEntry.ActionInterval, DefaultRecordInterval);
            this.RecordInterval = this.GetValue(entry, DeviceEntry.RecordInterval, DefaultRecordInterval);
            this.recordTimePolicy.Interval = this.RecordInterval;

            string tableName = (StringValue)entry[DeviceEntry.TableName];
            if (!string.IsNullOrEmpty(tableName))
            {
                string tableFields = (StringValue)entry[DeviceEntry.TableFields];

                string[] fields = tableFields.Split(',');
                string atList = string.Empty;
                for (int i = 0; i < fields.Length; ++i)
                {
                    string at = string.Format("@{0}, ", i + 1);
                    atList += at;
                }
                atList = atList.TrimEnd(',', ' ');

                // Insert into
                string cmd = string.Format("insert into {0}({1}) values({2})", tableName, tableFields, atList);
                this.insertIntoCommand = cmd;
            }

			string fieldsConfigStr = (StringValue)entry[DeviceEntry.FieldsConfig];
            List<FieldConfig> fieldConfigList = ParseDataFieldConfig(fieldsConfigStr);
			this.fieldsConfig = fieldConfigList.ToArray<FieldConfig>();

			if (!this.IsRealDevice)
			{
				string el = (StringValue)entry[DeviceEntry.ExampleLine];
				el = el.Replace("\\r", "\r");
				el = el.Replace("\\n", "\n");

				this.exampleLine = el;
			}
			return true;
		}
コード例 #27
0
ファイル: FormProxyDevice.cs プロジェクト: oisy/scada
		public FormProxyDevice(DeviceEntry entry)
		{

			this.Initialize(entry);
		}
コード例 #28
0
ファイル: OpcDevice.cs プロジェクト: oisy/scada
 public AISDevice(DeviceEntry entry)
     : base(entry)
 {
     this.deviceKey = "scada.ais";
 }
コード例 #29
0
ファイル: DeviceManager.cs プロジェクト: mrddos/planisphere
        private void CheckVirtualDevice(DeviceEntry entry, string configFile)
        {
            DirectoryInfo di = Directory.GetParent(configFile);
            string virtualDeviceFlagFile = string.Format("{0}\\virtual-device", di.FullName);
            if (!File.Exists(virtualDeviceFlagFile))
            {
                return;
            }

            string deviceDisplayName = (StringValue)entry[DeviceEntry.Name];
            string caption = "连接虚拟设备提示";
            string message = string.Format("是否要连接 '{0}' 的虚拟设备,连接虚拟设备点击‘是’,\n连接真实设备点击‘否’", deviceDisplayName);
            DialogResult dr = MessageBox.Show(message, caption, MessageBoxButtons.YesNo);
            if (dr == DialogResult.Yes)
            {
                entry[DeviceEntry.Virtual] = new StringValue("true");
            }
            else
            {
                entry[DeviceEntry.Virtual] = new StringValue("false");

                string deleteVirtualFileMsg = string.Format("是否要删除 '{0}' 的虚拟设备标志文件?", deviceDisplayName);
                DialogResult del = MessageBox.Show(deleteVirtualFileMsg, caption, MessageBoxButtons.YesNo);
                if (del == DialogResult.Yes)
                {
                    File.Delete(virtualDeviceFlagFile);
                }
            }
        }
コード例 #30
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="deviceName"></param>
 /// <param name="configFile"></param>
 /// <returns></returns>
 public static DeviceEntry GetDeviceEntry(string deviceName, string configFile)
 {
     return(DeviceEntry.LoadFromConfig(deviceName, configFile));
 }
コード例 #31
0
ファイル: DeviceManager.cs プロジェクト: oisy/scada
        private Device Load(DeviceEntry entry)
        {
			if (entry == null)
				return null;


            //实例化设备
            StringValue className = (StringValue)entry[DeviceEntry.ClassName];
            if (typeof(StandardDevice).ToString() == className)
            {
                return new StandardDevice(entry);
            }
			else if (typeof(WebFileDevice).ToString() == className)
			{
				return new WebFileDevice(entry);
			}
            else if (typeof(FormProxyDevice).ToString() == className)
            {
                return new FormProxyDevice(entry);
            }
            else if (typeof(CinderlDataDevice).ToString() == className)
            {
                return new CinderlDataDevice(entry);
            }
            else if (typeof(CinderlStatusDevice).ToString() == className)
            {
                return new CinderlStatusDevice(entry);
            }
            else if (typeof(ShelterDevice).ToString() == className)
            {
                return new ShelterDevice(entry);
            }
            else if (typeof(HPGEFileDevice).ToString() == className)
            {
                return new HPGEFileDevice(entry);
            }
            else if (typeof(WeatherDevice).ToString() == className)
            {
                return new WeatherDevice(entry);
            }

			// Other Device defined in some Assemblies.
            if (entry[DeviceEntry.Assembly] != null)
            {
                string assemblyName = (StringValue)entry[DeviceEntry.Assembly];
                string assemblyFile = LogPath.GetExeFilePath(assemblyName);
                Assembly assembly = Assembly.LoadFile(assemblyFile);
                Type deviceClass = assembly.GetType((StringValue)entry[DeviceEntry.ClassName]);
                if (deviceClass != null)
                {
                    object device = Activator.CreateInstance(deviceClass, new object[] { entry });
                    return device as Device;
                }
            }
            MessageBox.Show("Create Device Failed");
            return (Device)null;
        }