forked from Gurux/GXDLMSDirector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
943 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
// | ||
// -------------------------------------------------------------------------- | ||
// Gurux Ltd | ||
// | ||
// | ||
// | ||
// | ||
// Version: $Revision: 9442 $, | ||
// $Date: 2017-05-23 15:21:03 +0300 (ti, 23 touko 2017) $ | ||
// $Author: gurux01 $ | ||
// | ||
// Copyright (c) Gurux Ltd | ||
// | ||
//--------------------------------------------------------------------------- | ||
// | ||
// DESCRIPTION | ||
// | ||
// This file is a part of Gurux Device Framework. | ||
// | ||
// Gurux Device Framework is Open Source software; you can redistribute it | ||
// and/or modify it under the terms of the GNU General Public License | ||
// as published by the Free Software Foundation; version 2 of the License. | ||
// Gurux Device Framework is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
// See the GNU General Public License for more details. | ||
// | ||
// More information of Gurux DLMS/COSEM Director: http:https://www.gurux.org/GXDLMSDirector | ||
// | ||
// This code is licensed under the GNU General Public License v2. | ||
// Full text may be retrieved at http:https://www.gnu.org/licenses/gpl-2.0.txt | ||
//--------------------------------------------------------------------------- | ||
|
||
using Gurux.Common; | ||
using System; | ||
using System.Reflection; | ||
using System.Windows.Forms; | ||
|
||
namespace GXDLMSDirector | ||
{ | ||
/// <summary> | ||
/// Search dialog for OBIS code. | ||
/// </summary> | ||
partial class GXFindDlg : Form | ||
{ | ||
public string Target | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
/// <summary> | ||
/// Constructor. | ||
/// </summary> | ||
/// <param name="target">OBIS code to search.</param> | ||
public GXFindDlg(string target) | ||
{ | ||
InitializeComponent(); | ||
FindTb.Text = target; | ||
} | ||
|
||
#region Assembly Attribute Accessors | ||
|
||
public string AssemblyTitle | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); | ||
if (attributes.Length > 0) | ||
{ | ||
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; | ||
if (titleAttribute.Title != "") | ||
{ | ||
return titleAttribute.Title; | ||
} | ||
} | ||
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); | ||
} | ||
} | ||
|
||
public string AssemblyVersion | ||
{ | ||
get | ||
{ | ||
return Assembly.GetExecutingAssembly().GetName().Version.ToString(); | ||
} | ||
} | ||
|
||
public string AssemblyDescription | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); | ||
if (attributes.Length == 0) | ||
{ | ||
return ""; | ||
} | ||
return ((AssemblyDescriptionAttribute)attributes[0]).Description; | ||
} | ||
} | ||
|
||
public string AssemblyProduct | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); | ||
if (attributes.Length == 0) | ||
{ | ||
return ""; | ||
} | ||
return ((AssemblyProductAttribute)attributes[0]).Product; | ||
} | ||
} | ||
|
||
public string AssemblyCopyright | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); | ||
if (attributes.Length == 0) | ||
{ | ||
return ""; | ||
} | ||
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; | ||
} | ||
} | ||
|
||
public string AssemblyCompany | ||
{ | ||
get | ||
{ | ||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); | ||
if (attributes.Length == 0) | ||
{ | ||
return ""; | ||
} | ||
return ((AssemblyCompanyAttribute)attributes[0]).Company; | ||
} | ||
} | ||
#endregion | ||
|
||
private void FindBtn_Click(object sender, EventArgs e) | ||
{ | ||
try | ||
{ | ||
//If OBIS code is given as hex. | ||
if (FindTb.Text.IndexOf('.') == -1) | ||
{ | ||
byte[] tmp = GXCommon.HexToBytes(FindTb.Text); | ||
if (tmp.Length != 6) | ||
{ | ||
throw new Exception("Invalid OBIS code."); | ||
} | ||
Target = tmp[5].ToString() + '.' + tmp[4] + '.' + tmp[3] + '.' + tmp[2] + '.' + tmp[1] + '.' + tmp[0] + '.'; | ||
} | ||
else if (FindTb.Text.Split(new char[] { '.' }).Length != 6) | ||
{ | ||
throw new Exception("Invalid OBIS code."); | ||
} | ||
Target = FindTb.Text.Trim(); | ||
} | ||
catch (Exception Ex) | ||
{ | ||
GXDLMS.Common.Error.ShowError(this, Ex); | ||
DialogResult = DialogResult.None; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.