private void login(ConnectType type) { if (socket != null && socket.IsAlive) { return; } dynamic d = JsonConvert.DeserializeObject(RestApiClient.GETNOAUTH("gateway").Content); gateway = Convert.ToString(d.url); ConnectionStatus = Connection.LOGGING_IN; socket = new WebSocket($"{gateway}/?v={api_version}&encoding={encoding}&client_id=430746509714259989"); CarrotcordLogger.log(CarrotcordLogger.LogSource.WEBSOCKET, $"[CONNECTING] {gateway}, version: {api_version}, encoding: {encoding}"); socket.ConnectAsync(); if (type == ConnectType.NORMAL) { socket.OnOpen += Socket_OnOpenNormal; } else if (type == ConnectType.RESUME) { ConnectionStatus = Connection.RESUMING; retryTimer.Enabled = false; socket.OnOpen += Socket_OnOpenResume; } socket.OnClose += Socket_OnClose; socket.OnMessage += Socket_OnMessage; }
public override int GetHashCode() { int hash = 1; if (tag_ != null) { hash ^= Tag.GetHashCode(); } if (info_ != null) { hash ^= Info.GetHashCode(); } if (ConnectType != 0) { hash ^= ConnectType.GetHashCode(); } if (ConnectType1 != 0) { hash ^= ConnectType1.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// 接続するメソッド /// </summary> public void Connect(ConnectType connectType) { displayLoadingView(); nowConnectType = connectType; PhotonNetwork.ConnectUsingSettings("1.0.0"); PhotonNetwork.playerName = PlayerDataManager.Instance.UserName; }
public static NetElementLinkBase CreateLink(ConnectType ct) { NetElementLinkBase link = null; switch (ct) { case ConnectType.ATP_DIRECT_LINK: link = new AtpDirectLink(); break; case ConnectType.ATP_REMOTE_LOG: link = new AtpRemoteLogLink(); break; case ConnectType.ATP_REMOTE_MSG: link = new AtpRemoteMsgLink(); break; case ConnectType.OSP: break; case ConnectType.LMT: break; default: throw new ArgumentOutOfRangeException(nameof(ct), ct, null); } return(link); }
/// <summary> /// 指定IDのオブジェクトを取得を行います。<br/> /// 通信結果を受け取るために必ずコールバックを設定を行います。 /// </summary> /// <param name="objectId"> オブジェクトID</param> /// <param name="callback"> コールバック</param> public void GetAsync(string objectId, NCMBGetCallback <T> callback) { if (callback == null) { throw new ArgumentException("It is necessary to always set a callback."); } new AsyncDelegate(delegate { string url = _getSearchUrl(this._className); //クラス毎のURL作成 //オブジェクト取得API url += "/" + objectId; ConnectType type = ConnectType.GET; //メソッドタイプの設定 //通信処理 NCMBConnection con = new NCMBConnection(url, type, null, NCMBUser._getCurrentSessionToken()); con.Connect(delegate(int statusCode, string responseData, NCMBException error) { Dictionary <string, object> resultObj; NCMBObject objectData = null; try { if (error == null) { resultObj = MiniJSON.Json.Deserialize(responseData) as Dictionary <string, object>; objectData = _convertGetResponse(resultObj); } } catch (Exception e) { error = new NCMBException(e); } //引数はリスト(中身NCMBObject)とエラーをユーザーに返す Platform.RunOnMainThread(delegate { callback((T)objectData, error); }); return; }); }).BeginInvoke((IAsyncResult r) => { }, null); }
public static void ExecuteCommand(string sql, ConnectType ConnectType) { lock (LockO) { DBHelper.SetConnectType(ConnectType); DBHelper.ExecuteCommand(sql); } }
public Device(ConnectType _type) { ConnectType = _type; IsEnable = false; Time = 12; Speed = 0; }
public int maxCOM; //最大端口频道数 ////预置方法定义(提供常用的连接方式,简化参数的设置) public void setA2defaultTCP() //A2雷达TCP连接 { this.connectType = ConnectType.DRIVER_TYPE_TCP; this.serialPort = "192.168.0.7"; this.serialBaudrate = 20108; this.maxCOM = 16; }
public Req(ConnectType connectType, int port, string ip = "") : base(SocketType.REQ, connectType, port, ip) { m_Timer = new System.Timers.Timer(100); m_Timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed); m_Timer.Start(); }
private void connectReader(ConnectType connectType, string addr) { if (reader != null) { //연결해지 처리를 합니다. if (reader.IsHandling) //연결되어 있는 지를 확인하고 { reader.Close(CloseType.Close); //연결을 해지합니다. return; } } //리더를 생성하고 초기화 합니다. //리더에서 발생되는 이벤트을 처리하기 위한 핸들러를 추가해 줍니다. reader = new Reader(); reader.ReaderEvent += new ReaderEventHandler(OnReaderEvent); reader.ModelType = ModelType; reader.ConnectType = connectType; reader.TagType = TagType; if (connectType == ConnectType.Tcp) { reader.Open(addr, 5578); } else { reader.Open(addr, 115200); } }
public NetworkEventArgs(ConnectType connectType, string url, string query) { Type = connectType; Url = url; Query = query; Data = new Dictionary <string, object>(); }
internal static void _logOut(NCMBCallback callback) { string url = _getLogOutUrl(); //URL作成 ConnectType type = ConnectType.GET; string content = null; //ログを確認(通信前) NCMBDebug.Log("【url】:" + url + Environment.NewLine + "【type】:" + type + Environment.NewLine + "【content】:" + content); //通信処理 NCMBConnection con = new NCMBConnection(url, type, content, NCMBUser._getCurrentSessionToken()); con.Connect(delegate(int statusCode, string responseData, NCMBException error) { try { NCMBDebug.Log("【StatusCode】:" + statusCode + Environment.NewLine + "【Error】:" + error + Environment.NewLine + "【ResponseData】:" + responseData); if (error != null) { NCMBDebug.Log("[DEBUG AFTER CONNECT] Error: " + error.ErrorMessage); } else { _logOutEvent(); } } catch (Exception e) { error = new NCMBException(e); } if (callback != null) { Platform.RunOnMainThread(delegate { callback(error); }); } return; }); }
public ConnectInfoType(ConnectType ConnectType, string IpAddressOrComPortName, int IpPortOrComPortBaudRate) { this.ConnectType = ConnectType; switch (ConnectType) { case ConnectType.DIRECT: this.ComPortInfo = new ComPortInfo(IpAddressOrComPortName, IpPortOrComPortBaudRate); this.NetWorkInfo = new NetWorkInfo(); this.TimeInfo = new TimeInfo(); break; case ConnectType.TCPIP: this.ComPortInfo = new ComPortInfo(); this.NetWorkInfo = new NetWorkInfo(IpAddressOrComPortName, IpPortOrComPortBaudRate); this.TimeInfo = new TimeInfo(); break; default: this.ComPortInfo = new ComPortInfo(); this.NetWorkInfo = new NetWorkInfo(); this.TimeInfo = new TimeInfo(); break; } }
/// <summary> /// 执行命令 :返回执行结果 /// </summary> /// <param name="connectType"></param> /// <param name="sql"></param> /// <returns></returns> private static MySqlEntity Get(ConnectType connectType, string sql) { MySqlEntity mysqlEntity = Connect(connectType); //先获取实体 实体里面包含了链接的对象 mysqlEntity.CreateCMD(sql); //通过实体的创建命令的方法 进行确定命令的sql语句 打开连接 return(mysqlEntity); }
/// <summary> /// 非同期処理で指定したメールアドレスに対して、<br/> /// 会員登録を行うためのメールを送信するよう要求します。<br/> /// 通信結果が必要な場合はコールバックを指定するこちらを使用します。 /// </summary> /// <param name="email">メールアドレス</param> /// <param name="callback">コールバック</param> public static void RequestAuthenticationMailAsync(string email, NCMBCallback callback) { //URL string url = _getmailAddressUserEntryUrl(); //URL //コンテント NCMBUser user = new NCMBUser(); user.Email = email; string content = user._toJSONObjectForSaving(user.StartSave()); //Type ConnectType type = ConnectType.POST; NCMBConnection con = new NCMBConnection(url, type, content, NCMBUser._getCurrentSessionToken()); NCMBDebug.Log("【url】:" + url + Environment.NewLine + "【type】:" + type + Environment.NewLine + "【content】:" + content); con.Connect(delegate(int statusCode, string responseData, NCMBException error) { NCMBDebug.Log("【StatusCode】:" + statusCode + Environment.NewLine + "【Error】:" + error + Environment.NewLine + "【ResponseData】:" + responseData); if (callback != null) { callback(error); } return; }); }
public void setG4defaultSerial() //G4雷达端口连接 { this.connectType = ConnectType.DRIVER_TYPE_SERIALPORT; this.serialPort = "COM3"; this.serialBaudrate = 230400; this.maxCOM = 16; }
private static void _ncmbLogIn(string name, string password, string email, NCMBCallback callback) { string url = _getLogInUrl(); ConnectType type = ConnectType.GET; Dictionary <string, object> paramDic = new Dictionary <string, object>(); paramDic["password"] = password; //nameがあればLogInAsync経由 無ければLogInWithMailAddressAsync経由、どちらも無ければエラー if (name != null) { paramDic["userName"] = name; } else if (email != null) { paramDic["mailAddress"] = email; } else { throw new NCMBException(new ArgumentException("UserName or Email can not be null.")); } url = _makeParamUrl(url + "?", paramDic); //ログを確認(通信前) NCMBDebug.Log("【url】:" + url + Environment.NewLine + "【type】:" + type); //通信処理 NCMBConnection con = new NCMBConnection(url, type, null, null); con.Connect(delegate(int statusCode, string responseData, NCMBException error) { try { NCMBDebug.Log("【StatusCode】:" + statusCode + Environment.NewLine + "【Error】:" + error + Environment.NewLine + "【ResponseData】:" + responseData); if (error != null) { NCMBDebug.Log("[DEBUG AFTER CONNECT] Error: " + error.ErrorMessage); } else { Dictionary <string, object> responseDic = MiniJSON.Json.Deserialize(responseData) as Dictionary <string, object>; //save Current user NCMBUser logInUser = new NCMBUser(); logInUser._handleFetchResult(true, responseDic); _saveCurrentUser(logInUser); } } catch (Exception e) { error = new NCMBException(e); } if (callback != null) { callback(error); } return; }); }
/// <summary> /// 根据XML加载范围查找项 /// </summary> /// <param name="xml">XML</param> /// <param name="lstScope">范围集合</param> internal static void LoadScopeItems(Stream stm, ScopeList lstScope) { XmlDocument doc = new XmlDocument(); doc.Load(stm); XmlNodeList nodeList = doc.GetElementsByTagName("item"); foreach (XmlNode node in nodeList) { string propertyName = null; ScopeType stype = ScopeType.Between; ConnectType ctype = ConnectType.And; object value1 = null; object value2 = null; XmlAttribute attPropertyName = node.Attributes["propertyname"]; if (attPropertyName != null) { propertyName = attPropertyName.InnerText; } XmlAttribute attScopeType = node.Attributes["scopetype"]; if (attScopeType != null) { stype = (ScopeType)Convert.ToInt32(attScopeType.InnerText); } XmlAttribute attConnectType = node.Attributes["connecttype"]; if (attConnectType != null) { ctype = (ConnectType)Convert.ToInt32(attConnectType.InnerText); } foreach (XmlNode itemNode in node.ChildNodes) { object value = null; Type objType = null; XmlAttribute attType = itemNode.Attributes["datatype"]; if (attType != null) { objType = Type.GetType(attType.InnerText); } else { objType = typeof(string); } value = ListXMLExtends.StringToValue(itemNode.InnerText, objType); if (itemNode.Name == "value1") { value1 = value; } else if (itemNode.Name == "value2") { value2 = value; } } Scope objScope = new Scope(propertyName, value1, value2, stype, ctype); lstScope.Add(objScope); } }
public static object GetScalar(string sql, ConnectType ConnectType) { lock (LockO) { DBHelper.SetConnectType(ConnectType); return(DBHelper.GetScalar(sql)); } }
public static DataSet GetDataSet(string sql, ConnectType ConnectType) { lock (LockO) { DBHelper.SetConnectType(ConnectType); return(DBHelper.GetDataSet(sql)); } }
/// <summary> /// 条件 /// </summary> /// <param name="propertyName">属性名</param> /// <param name="value1">值1</param> /// <param name="value2">值2</param> /// <param name="scopeType">条件类型</param> /// <param name="connectType">连接类型</param> public Scope(string propertyName, object value1, object value2, ScopeType scopeType, ConnectType connectType) { this.propertyName = propertyName; this.value1 = value1; this.value2 = value2; this.scopeType = scopeType; this.connectType = connectType; }
public static DataTable GetDataTable(string sql, ConnectType ConnectType) { lock (LockO) { New_DbHelper.SetConnectType(ConnectType); return(DBHelper.GetDataTable(sql)); } }
public ConnectInfoType(ConnectInfoType ConnectInfo) { this.ConnectType = ConnectInfo.ConnectType; this.ComPortInfo = new ComPortInfo(ConnectInfo.ComPortInfo); this.NetWorkInfo = new NetWorkInfo(ConnectInfo.NetWorkInfo); this.TimeInfo = new TimeInfo(ConnectInfo.TimeInfo); }
public ConnectInfoType() { this.ConnectType = ConnectType.DISABLED; this.ComPortInfo = new ComPortInfo(); this.NetWorkInfo = new NetWorkInfo(); this.TimeInfo = new TimeInfo(); }
public void Init(string ip, int port, ConnectType type) { _ip = ip; _port = port; _currentConnectType = type; StartCoroutine(Connect()); StartCoroutine(OnSendMessage()); }
public void Init(Connection connection) { Type = connection.connectType; Source = connection.sourceNode.ID; SourcePort = connection.sourcePort.name; Target = connection.targetNode.ID; TargetPort = connection.targetPort.name; }
private static void _ncmbLogIn(string name, string password, string email, NCMBCallback callback) { string url = _getLogInUrl(); //URL作成 ConnectType type = ConnectType.GET; //set username, password NCMBUser logInUser = new NCMBUser(); logInUser.Password = password; //nameがあればLogInAsync経由 無ければLogInWithMailAddressAsync経由、どちらも無ければエラー if (name != null) { logInUser.UserName = name; } else if (email != null) { logInUser.Email = email; } else { throw new NCMBException(new ArgumentException("UserName or Email can not be null.")); } string content = logInUser._toJSONObjectForSaving(logInUser.StartSave()); Dictionary <string, object> paramDic = (Dictionary <string, object>)MiniJSON.Json.Deserialize(content); url = _makeParamUrl(url + "?", paramDic); //ログを確認(通信前) NCMBDebug.Log("【url】:" + url + Environment.NewLine + "【type】:" + type + Environment.NewLine + "【content】:" + content); //通信処理 NCMBConnection con = new NCMBConnection(url, type, content, NCMBUser._getCurrentSessionToken()); con.Connect(delegate(int statusCode, string responseData, NCMBException error) { try { NCMBDebug.Log("【StatusCode】:" + statusCode + Environment.NewLine + "【Error】:" + error + Environment.NewLine + "【ResponseData】:" + responseData); if (error != null) { NCMBDebug.Log("[DEBUG AFTER CONNECT] Error: " + error.ErrorMessage); } else { Dictionary <string, object> responseDic = MiniJSON.Json.Deserialize(responseData) as Dictionary <string, object>; logInUser._handleFetchResult(true, responseDic); //save Current user _saveCurrentUser(logInUser); } } catch (Exception e) { error = new NCMBException(e); } if (callback != null) { Platform.RunOnMainThread(delegate { callback(error); }); } return; }); }
public CubeManager(ConnectType type = ConnectType.Auto) { this.scanner = new CubeScanner(type); this.connecter = new CubeConnecter(type); this.cubes = new List <Cube>(); this.handles = new List <CubeHandle>(); this.navigators = new List <CubeNavigator>(); this.cubeTable = new Dictionary <string, Cube>(); }
//コンストラクタ internal NCMBConnection(String url, ConnectType method, string content, string sessionToken) { this._method = method; this._content = content; this._url = url; this._sessionToken = sessionToken; this._applicationKey = NCMBSettings.ApplicationKey; this._clientKey = NCMBSettings.ClientKey; }
private string _url = ""; //リクエスト先URL #endregion Fields #region Constructors //コンストラクタ internal NCMBConnection(String url, ConnectType method, string content, string sessionToken) { this._method = method; this._content = content; this._url = url; this._sessionToken = sessionToken; this._applicationKey = NCMBSettings.ApplicationKey; this._clientKey = NCMBSettings.ClientKey; }
/// <summary> /// 构造函数 /// </summary> /// <param name="connectString">连接字符串</param> /// <param name="type">数据库类型</param> public DBAccessor(string connectString, ConnectType type) { if (connectString == string.Empty) { throw new Exception("数据库连接字符串未指定"); } this.connectionString = connectString; this.connectType = type; }
public SqlStorProcExecCode(List<StoreProcedure> storeProcedures, bool? IsSqlConnection, bool? needTransaction, string namespaceName, string className, string functionAuthority, string execSqlClassName) { if (storeProcedures == null) throw new ArgumentNullException("StoreProcedures"); this.storeProcedures = storeProcedures; if (IsSqlConnection != null) { if (!(bool)IsSqlConnection) this.connectType = ConnectType.ConnectionString; } if (needTransaction != null) { this.needTransaction = (bool)needTransaction; } if (namespaceName != null && namespaceName.Length > 0) { this.namespaceName = namespaceName; } if (className != null && className.Length > 0) { this.className = className; } if (functionAuthority != null && functionAuthority.Length > 0) { this.functionAuthority = functionAuthority; } if (execSqlClassName != null && execSqlClassName.Length > 0) { this.execSqlClassName = execSqlClassName; } }
protected PacketMessage ParsePacketMessage(string clientAddress, string paramString, ConnectType connectType) { ParamGeter paramGeter = new ParamGeter(paramString); PacketHead head = new PacketHead(connectType, PacketMsgType.Request); head.Address = clientAddress; head.MsgId = paramGeter.GetInt("msgid"); head.Uid = paramGeter.GetInt("uid"); head.ActionId = paramGeter.GetInt("actionId"); string[] sidArray = paramGeter.GetString("sid").Split('|'); if (sidArray.Length > 2) { head.GameId = sidArray[1].ToInt(); head.ServerId = sidArray[2].ToInt(); } else { head.GameId = paramGeter.GetInt("gametype"); head.ServerId = paramGeter.GetInt("serverid"); } head.EnableGzip = false; PacketMessage packet = new PacketMessage(); packet.Head = head; packet.Content = BufferUtils.GetBytes(paramString); return packet; }
private ConnectionBase ConnectionFactory(ConnectType type) { switch (type) { case ConnectType.Ethernet: return new NetConnect(); case ConnectType.USB: return new ComConnect(); default: throw new Exception("No interface selected"); } }
/// <summary> /// Enable mcu connection /// </summary> /// <param name="to"> Ipadress or portname </param> /// <param name="type">Either net or com</param> /// <param name="mode"></param> public void CreateConnection(string to, ConnectType type, ConnectMode mode) { if (string.IsNullOrWhiteSpace(to)) return; _desiredMode = mode; _mcucomm.Fire(Cevts.Connect, Tuple.Create(to, type)); }