Exemplo n.º 1
0
 public override string ToString()
 {
     if (ConType == null)
     {
         return("<Добавить сборку>");
     }
     return(ConType.ToString());
 }
Exemplo n.º 2
0
 /// <summary>
 /// 取得設定檔數據
 /// </summary>
 /// <param name="type">服務分類</param>
 /// <returns>後台連線字串</returns>
 public static string GetSetting(ConType type)
 {
     if (backEndStringSettingDic.ContainsKey(type))
     {
         return(backEndStringSettingDic[type]);
     }
     return(null);
 }
Exemplo n.º 3
0
 public CreateItemTemplate(ConType controlType, string colname, DataTable DT, DataTable Attributes, Int32 FieldLength)
 {
     columnName     = colname;
     theControl     = controlType;
     theDataTable   = DT;
     theAttributes  = Attributes;
     theFieldLength = FieldLength;
 }
Exemplo n.º 4
0
 public Mapper_NodeConnector Initialize(Mapper_Node node, ConType conType)
 {
     childLines   = new List <Mapper_NodeConnectionLine>();
     parentLines  = new List <Mapper_NodeConnectionLine>();
     this.node    = node;
     this.conType = conType;
     return(this);
 }
 public KoitanButton(ConType conType, KeyCode keyCode)
 {
     this.conType = conType;
     switch (conType)
     {
     case ConType.Key:
         this.keyCode = keyCode;
         break;
     }
 }
Exemplo n.º 6
0
        //反射执行方法
        public static object ExecuteMethod(ConType conType, string functionName, object[] obj)
        {
            var className = DBConfig.GetClassName(conType);

            //获取程序集 所有类型
            var exeNames = Application.ExecutablePath.Replace(Application.StartupPath, "").Replace(@"\", "");
            var ass      = Assembly.LoadFrom(exeNames);
            var t        = ass.GetType(className);

            return(ExecuteMethod(t, functionName, obj));
        }
Exemplo n.º 7
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="conType">
    /// Define which connection string is returned.
    /// </param>
    /// <returns></returns>
    public static string ConnectionString(ConType conType)
    {
        // Reference the database connection string, sourced from the web.config file.
        string conn = ConfigurationManager.ConnectionStrings["localDB"].ConnectionString;

        if (conType == ConType.Two)
        {
            conn = ConfigurationManager.ConnectionStrings["userDB"].ConnectionString;
        }

        return(conn);
    }
 public KoitanButton(ConType conType, int orderNum, int buttonNum)
 {
     this.conType = conType;
     switch (conType)
     {
     case ConType.JoyButton:
         this.orderNum  = orderNum;
         this.buttonNum = buttonNum;
         this.name      = "joystick " + orderNum.ToString() + " button " + buttonNum.ToString();
         break;
     }
 }
 public KoitanButton(ConType conType, int orderNum, int axisNum, bool isInvert, float deadline)
 {
     this.conType = conType;
     switch (conType)
     {
     case ConType.JoyAxis:
         this.orderNum = orderNum;
         this.axisNum  = axisNum;
         this.isInvert = isInvert;
         this.deadline = deadline;
         this.name     = "joystick " + orderNum.ToString() + " analog " + axisNum.ToString();
         break;
     }
 }
Exemplo n.º 10
0
        public SF_NodeConnector Initialize(SF_Node node, string strID, string label, ConType conType, ValueType valueType, bool outerLabel = false, string unconnectedEvaluationValue = null)
        {
            this.node    = node;
            this.strID   = strID;
            this.label   = label;
            this.conType = conType;

            if (conType == ConType.cInput)
            {
                conLine = ScriptableObject.CreateInstance <SF_NodeConnectionLine>().Initialize(node.editor, this);
            }

            this.valueType  = this.valueTypeDefault = valueType;
            this.outerLabel = outerLabel;
            this.unconnectedEvaluationValue = unconnectedEvaluationValue;
            outputCons = new List <SF_NodeConnector>();
            return(this);
        }
Exemplo n.º 11
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (Cihaz == null)
            {
                return;
            }
            if (MessageBox.Show(string.Format("{0}\nGüncellemek istediğinize eminmisiniz?", Cihaz.DeviceName), "Güncelle", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                ConType Tipi = (ConType)cmbConType.SelectedItem;

                Cihaz.ConType    = Tipi;
                Cihaz.Baudrate   = Tipi == ConType.Serial ? (int)cmbBaudRate.SelectedItem : 0;
                Cihaz.DeviceName = txtDeviceName.Text;
                Cihaz.Parity     = Tipi == ConType.Serial ? (System.IO.Ports.Parity)cmbParity.SelectedItem : 0;
                Cihaz.SerialPort = Tipi == ConType.Serial ? cmbPort.Text : "none";
                Cihaz.Stopbits   = Tipi == ConType.Serial ? (System.IO.Ports.StopBits)cmbStopBits.SelectedItem : 0;
                Cihaz.DeviceAddr = Tipi == ConType.Serial ? Convert.ToInt32(cmbAdress.SelectedItem) : 0;
                Cihaz.Timeout    = (int)nmTimeout.Value;
                Cihaz.IP         = Tipi == ConType.TCP ? txtIP.Text.Trim() : "none";
                Cihaz.Port       = Tipi == ConType.TCP ? (int)nmPort.Value : 0;
                DB.Save();
            }
        }
Exemplo n.º 12
0
        private void button1_Click(object sender, EventArgs e)
        {
            if ((ConType)cmbConType.SelectedItem == ConType.Serial & DB.Cihazlar.Any(x => x.ConType == ConType.Serial & x.SerialPort == cmbPort.Text))
            {
                MessageBox.Show("Aynı Kayıttan zaten var! ");
                return;
            }
            if ((ConType)cmbConType.SelectedItem == ConType.Serial & cmbPort.Items.Count == 0)
            {
                MessageBox.Show("Seri Port Yok!");
                return;
            }
            if ((ConType)cmbConType.SelectedItem == ConType.TCP & DB.Cihazlar.Any(x => x.ConType == ConType.TCP & x.IP == txtIP.Text.Trim()))
            {
                MessageBox.Show("Aynı Kayıttan zaten var! ");
                return;
            }
            ConType Tipi = (ConType)cmbConType.SelectedItem;

            DB.Cihazlar.Add(new Database.Device()
            {
                id         = DB.Cihazlar.Count + 1,
                ConType    = Tipi,
                Baudrate   = Tipi == ConType.Serial ? (int)cmbBaudRate.SelectedItem : 0,
                DeviceName = txtDeviceName.Text,
                Parity     = Tipi == ConType.Serial ? (System.IO.Ports.Parity)cmbParity.SelectedItem : 0,
                SerialPort = Tipi == ConType.Serial ? cmbPort.Text : "none",
                Stopbits   = Tipi == ConType.Serial ? (System.IO.Ports.StopBits)cmbStopBits.SelectedItem : 0,
                DeviceAddr = Tipi == ConType.Serial ? Convert.ToInt32(cmbAdress.SelectedItem) : 0,
                Timeout    = (int)nmTimeout.Value,
                IP         = Tipi == ConType.TCP ? txtIP.Text.Trim() : "none",
                Port       = Tipi == ConType.TCP ? (int)nmPort.Value : 0,
                Interval   = (int)nmbInterval.Value
            });
            DB.Save();
        }
Exemplo n.º 13
0
 /// <summary>
 /// 取得設定檔數據
 /// </summary>
 /// <param name="type">服務分類</param>
 /// <returns>後台連線字串</returns>
 public static string GetSetting(ConType type)
 {
     if (backEndStringSettingDic.ContainsKey(type))
     {
         return backEndStringSettingDic[type];
     }
     return null;
 }
Exemplo n.º 14
0
        public void SendData(byte[] myData, ConType channelType)
        {
            switch(channelType)
            {
                case ConType.UDP:
                    if (UdpChannel != null)
                    {
                        UdpChannel.SendTo(myData, UDPEndPoint);
                    }
                    break;

                case ConType.TCP_CONTROL:
                    CtrlChannel.SendData(myData);
                    break;

                case ConType.TCP_DATA:
                    DataChannel.SendData(myData);
                    break;

                default:
                    break;
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 读取xml自定义的链接字符串
        /// </summary>
        /// <param name="path">xml文件的名称</param>
        /// <returns></returns>
        void ReadConString(string path)
        {
            XmlDocument xmlDoc = new XmlDocument();

            //判断是否存在此xml
            if (!File.Exists(path))
            {
                throw new Exception("不能找到IoRyClass类的XML配置文件!");
            }
            xmlDoc.Load(path);
            //判断连接字符的类型
            XmlNode contype = xmlDoc.SelectSingleNode("constring/type");

            if (contype.InnerText.Trim() != "MSSQL" && contype.InnerText.Trim() != "ACCESS" && contype.InnerText.Trim() != "Oracle" && contype.InnerText.Trim() != "Excel")
            {
                throw new Exception("数据连接类型没填写,或者填写错误,只能填写MSSQL;Oracle;MySQL;ACCESS;Excel并且区分大小写!");
            }

            if (contype.InnerText.Trim() == "MSSQL")//sql
            {
                this._Contype = ConType.MSSQL;
                //判断是否用简单的直接写字符串的方式
                XmlNode mynode = xmlDoc.SelectSingleNode("constring/sqlserver/simple");
                if (mynode.InnerText.Trim() != "")
                {
                    this.ConString = mynode.FirstChild.Value;
                }
                else
                {
                    mynode = xmlDoc.SelectSingleNode("constring/sqlserver/ip");
                    string ip = mynode.FirstChild.Value;
                    mynode = xmlDoc.SelectSingleNode("constring/sqlserver/databasename");
                    string databasename = mynode.FirstChild.Value;
                    mynode = xmlDoc.SelectSingleNode("constring/sqlserver/username");
                    string username = mynode.FirstChild.Value;
                    string password = null;
                    mynode = xmlDoc.SelectSingleNode("constring/sqlserver/passwordencryption");
                    //判断数据库字符串是否加密
                    if (mynode.InnerText.Trim() != "")
                    {
                        XmlNode key = xmlDoc.SelectSingleNode("constring/sqlserver/encryptKey");
                        password = YezhanbafangCore.DecryptDES(mynode.FirstChild.Value, key.FirstChild.Value);
                    }
                    else
                    {
                        mynode   = xmlDoc.SelectSingleNode("constring/sqlserver/password");
                        password = mynode.FirstChild.Value;
                    }
                    string con = string.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}", ip, databasename, username, password);
                    this.ConString = con;
                }
            }
            else if (contype.InnerText.Trim() == "ACCESS") //access
            {
                this._Contype = ConType.Access;
                //判断是否用简单的直接写字符串的方式
                XmlNode mynode = xmlDoc.SelectSingleNode("constring/access/simple");
                if (mynode.InnerText.Trim() != "")
                {
                    this.ConString = mynode.FirstChild.Value;
                }
                else
                {
                    mynode = xmlDoc.SelectSingleNode("constring/access/path");
                    string accpath = mynode.FirstChild.Value;
                    if (File.Exists(accpath))
                    {
                        string password = null;
                        mynode = xmlDoc.SelectSingleNode("constring/access/passwordencryption");
                        //判断数据库字符串是否加密
                        if (mynode.InnerText.Trim() != "")
                        {
                            XmlNode key = xmlDoc.SelectSingleNode("constring/access/encryptKey");
                            password = YezhanbafangCore.DecryptDES(mynode.FirstChild.Value, key.FirstChild.Value);
                        }
                        else
                        {
                            mynode   = xmlDoc.SelectSingleNode("constring/access/password");
                            password = mynode.FirstChild.Value;
                        }
                        string con = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Jet OLEDB:Database Password={1}", accpath, password);
                        this.ConString = con;
                    }
                    else
                    {
                        throw new Exception("找不到文件:" + accpath);
                    }
                }
            }
            else if (contype.InnerText.Trim() == "Oracle") //Oracle
            {
                this._Contype = ConType.Oracle;
                //判断是否用简单的直接写字符串的方式
                XmlNode mynode = xmlDoc.SelectSingleNode("constring/Oracle/simple");
                if (mynode.InnerText.Trim() != "")
                {
                    this.ConString = mynode.FirstChild.Value;
                }
                else
                {
                    mynode = xmlDoc.SelectSingleNode("constring/Oracle/DataSource");
                    string DBServer = mynode.FirstChild.Value;
                    mynode = xmlDoc.SelectSingleNode("constring/Oracle/username");
                    string username = mynode.FirstChild.Value;
                    string password = null;
                    mynode = xmlDoc.SelectSingleNode("constring/Oracle/passwordencryption");
                    //判断数据库字符串是否加密
                    if (mynode.InnerText.Trim() != "")
                    {
                        XmlNode key = xmlDoc.SelectSingleNode("constring/Oracle/encryptKey");
                        password = YezhanbafangCore.DecryptDES(mynode.FirstChild.Value, key.FirstChild.Value);
                    }
                    else
                    {
                        mynode   = xmlDoc.SelectSingleNode("constring/Oracle/password");
                        password = mynode.FirstChild.Value;
                    }
                    mynode = xmlDoc.SelectSingleNode("constring/Oracle/Provider");
                    string con;
                    con            = string.Format("Data Source={0};User ID={1};Password={2}", DBServer, username, password);
                    this.ConString = con;
                }
            }
            else if (contype.InnerText.Trim() == "Excel")
            {
                this.Contype = ConType.Excel;
                XmlNode mynode    = xmlDoc.SelectSingleNode("constring/Excel/path");
                string  Excelpath = mynode.FirstChild.Value;
                if (File.Exists(Excelpath))
                {
                    this.ConString = this.GetExcelReadonlyConnStr(Excelpath);
                }
                else
                {
                    throw new Exception("找不到文件:" + Excelpath);
                }
            }
            else if (contype.InnerText.Trim() == "MySQL") //Oracle
            {
                this._Contype = ConType.MySQL;
                //判断是否用简单的直接写字符串的方式
                XmlNode mynode = xmlDoc.SelectSingleNode("constring/MySQL/simple");
                if (mynode.InnerText.Trim() != "")
                {
                    this.ConString = mynode.FirstChild.Value;
                }
                else
                {
                    mynode = xmlDoc.SelectSingleNode("constring/MySQL/databasename");
                    string databasename = mynode.FirstChild.Value;
                    mynode = xmlDoc.SelectSingleNode("constring/MySQL/ip");
                    string IP = mynode.FirstChild.Value;
                    mynode = xmlDoc.SelectSingleNode("constring/MySQL/port");
                    string PORT = mynode.FirstChild.Value;
                    mynode = xmlDoc.SelectSingleNode("constring/MySQL/username");
                    string username = mynode.FirstChild.Value;
                    string password = null;
                    mynode = xmlDoc.SelectSingleNode("constring/MySQL/passwordencryption");
                    //判断数据库字符串是否加密
                    if (mynode.InnerText.Trim() != "")
                    {
                        XmlNode key = xmlDoc.SelectSingleNode("constring/MySQL/encryptKey");
                        password = YezhanbafangCore.DecryptDES(mynode.FirstChild.Value, key.FirstChild.Value);
                    }
                    else
                    {
                        mynode   = xmlDoc.SelectSingleNode("constring/MySQL/password");
                        password = mynode.FirstChild.Value;
                    }
                    string con = string.Format("Database={0};Data Source={1};User Id={3};Password={4};pooling=false;CharSet=utf8;port={2}", databasename, IP, PORT, username, password);
                    this.ConString = con;
                }
            }
            else
            {
                this.ConString = null;
            }
        }
Exemplo n.º 16
0
		private void Load()
		{
			// Collaps everything before deciding what to show
			gridCred.Visibility = Visibility.Collapsed;
			gridCertPassword.Visibility = Visibility.Collapsed;
			gridCertBrowser.Visibility = Visibility.Collapsed;
			stpTime.Visibility = Visibility.Collapsed;

			mainWindow.btnNext.IsEnabled = false;
			mainWindow.btnNext.Content = "Connect";

			// create dispatcherTimer used for counting up cerst if not active yet
			dispatcherTimer = new DispatcherTimer();
			dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
			dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
			// Case where eapconfig needs username+passwprd
			if (providedEapConfig.NeedsLoginCredentials)
			{
				conType = ConType.Credentials;
				grpRules.Visibility = Visibility.Hidden;
				gridCred.Visibility = Visibility.Visible;
				tbRules.Visibility = Visibility.Visible;
				(realm, hint) = providedEapConfig.GetClientInnerIdentityRestrictions();
				tbRealm.Text = '@' + realm;
				SetRealmHintVisibility(!string.IsNullOrEmpty(realm) && hint ? Visibility.Visible : Visibility.Hidden);
				if (!string.IsNullOrEmpty(mainWindow.PresetUsername))
				{
					// take username@realm in its entirety
					tbUsername.Text = mainWindow.PresetUsername;
					// if no subrealms allowed so login screen will always have @realm added to whatever is written in username textbox
					if (hint)
					{
						if (mainWindow.PresetUsername.EndsWith(realm, StringComparison.InvariantCulture) && mainWindow.PresetUsername.Contains('@'))
						{
							//take username before realm and put in textbox
							tbUsername.Text = mainWindow.PresetUsername.Split('@').FirstOrDefault() ?? "";
						}
					}
					pbCredPassword.Focus();
				}
				else
				{
					tbUsername.Focus();
				}

				EnableConnectBtnBasedOnCredentials();
			}
			// case where eapconfig needs a certificate and password
			else if (providedEapConfig.NeedsClientCertificate)
			{
				gridCertBrowser.Visibility = Visibility.Visible;
				conType = ConType.CertAndCertPass;

			}
			// case where eapconfig needs only cert password
			else if (providedEapConfig.NeedsClientCertificatePassphrase)
			{
				conType = ConType.CertPass;
				gridCertPassword.Visibility = Visibility.Visible;
				mainWindow.btnNext.IsEnabled = true;
			}
			// case where no extra info is needed to connect
			else
			{
				// just connnect
				conType = ConType.Nothing;
				ConnectClick();
			}
		}
Exemplo n.º 17
0
 protected void Trim(SimNode other, ConType t) {
   _con_table.Remove(other.LocalAddress, t);
 }
Exemplo n.º 18
0
 public static string GetClassName(ConType key)
 {
     return(GetClassDic()[key]);
 }
Exemplo n.º 19
0
    public bool AddConnection(SimNode other, ConType t) {
      if (other == this) {
	Console.WriteLine("Cannot add myself.");
	Environment.Exit(1);
      }
      if (_con_table.Add(other.LocalAddress, t)) {
	other.AddConnection(this, t);
	EstimateSize();
	return true;
      } else {
	return false;
      }
    }
Exemplo n.º 20
0
    public ArrayList GetConnections(ConType t) {
      if (_ht.ContainsKey(t)) {
	return (ArrayList) ((ArrayList) _ht[t]).Clone();
      } else {
	return new ArrayList();
      }
    }
Exemplo n.º 21
0
    public int GetCount(ConType t) {
      if (_ht.ContainsKey(t)) {
	return ((ArrayList) _ht[t]).Count;
      } else {
	return 0;
      }
    }
Exemplo n.º 22
0
    public void Remove(ConType t) {
//       //remove all connections of a type
//       if (!_ht.ContainsKey(t)) {
// 	return;
//       }
//       ArrayList con_list = (ArrayList) _ht[t];
//       _ht.Remove(t);
//       foreach(AHAddress tt in tr) {
	
//       }
    }
Exemplo n.º 23
0
    public bool Add(AHAddress address, ConType t) {
      int idx = _con_list.BinarySearch(address);
      if (idx < 0) {
	idx = ~idx;
	_con_list.Insert(idx, address);
	if (!_ht.ContainsKey(t)) {
	  _ht[t] = new ArrayList();
	}
	((ArrayList) _ht[t]).Add(address);
	return true;
      } else {
	return false;
      }
    }
Exemplo n.º 24
0
 public static SF_NodeConnector Create(SF_Node node, string strID, string label, ConType conType, ValueType valueType, bool outerLabel = false, string unconnectedEvaluationValue = null)
 {
     return(ScriptableObject.CreateInstance <SF_NodeConnector>().Initialize(node, strID, label, conType, valueType, outerLabel, unconnectedEvaluationValue));
 }
Exemplo n.º 25
0
 public void RemoveConnection(SimNode other, ConType t) {
   Trim(other, t);
   other.Trim(this, t);
 }
Exemplo n.º 26
0
    public void Remove(AHAddress address, ConType t) {
      _con_list.Remove(address);
      if (_ht.ContainsKey(t)) {
	((ArrayList) _ht[t]).Remove(address);
      }
    }
Exemplo n.º 27
0
 public DBHelper(ConType _conType)
 {
     conType = _conType;
 }