public IHttpActionResult GetFileList( string url, bool useSsh, string username, string password, ConnectMode connectMode, string subFolder = "") { var settings = new FtpSettings(); settings.Url = url; settings.UseSsh = useSsh; settings.Username = username; settings.Password = password; settings.SubFolder = subFolder; settings.ConnectMode = connectMode; var client = new Client(); var result = client.FolderList(settings); if (client.ErrorMessage != string.Empty) { return(InternalServerError(new System.Exception(client.ErrorMessage))); } return(Ok(result)); }
public DataAccessTools() { this.oracleDA = null; this.currentCredentials = new Credentials(); this.connectionMode = ConnectMode.MULTIPLE; //this.loggerMode = LogMode.OFF; }
public void StartConnection(GraphNode node, Vector2 position) { NextMouseMode = new ConnectMode(this, node, position); // IsConnecting = true; // CurrentConnectionStart = position; // SelectedNode = node; }
public ACSStageController(ConnectMode mode, string address) { Ch = new AsyncChannel(); Axis = new Dictionary <string, int>() .Append("Y", 0) .Append("X", 1) .Append("Z", 2); Address = address; }
/// <summary> /// Request a data socket be created on the /// server, connect to it and return our /// connected socket. /// </summary> /// <param name="connectMode"> /// connection mode to connect with, either active or passive /// </param> /// <returns> /// connected data socket /// </returns> internal Socket CreateDataSocket(ConnectMode connectMode) { // active mode ( PORT ) if (connectMode == ConnectMode.Active) { return(CreateDataSocketActive()); } else // PASV { return(CreateDataSocketPASV()); } }
public static Stage_Shape Connect <T>( this Stage_Shape src , string path , ConnectMode mode , [CallerFilePath] string callerpath = null , [CallerLineNumber] int line = 0 , [CallerMemberName] string name = null) where T : struct { return(src.ChkNullResult(src.ChknullClass(callerpath, line, name) .Connect(path, mode))); }
public override bool?Connect(string path, ConnectMode mode) { switch (mode) { case ConnectMode.IP: Ch.CloseComm(); Ch.OpenCommEthernetTCP(path, Ch.ACSC_SOCKET_STREAM_PORT); return(true); case ConnectMode.Com: Ch.CloseComm(); Ch.OpenCommSerial(Convert.ToInt32(path), -1); return(null); } return(null); }
public Action Connect(string path, ConnectMode mode) { return(act(() => { switch (mode) { case ConnectMode.IP: Ch.CloseComm(); Ch.OpenCommEthernetTCP(path, Ch.ACSC_SOCKET_STREAM_PORT); System.Threading.Thread.Sleep(80); break; case ConnectMode.Com: Ch.CloseComm(); Ch.OpenCommSerial(Convert.ToInt32(path), -1); System.Threading.Thread.Sleep(80); break; } ; })); }
public IHttpActionResult PostFile( string url, bool useSsh, string username, string password, string subFolder, bool checkForFile, bool renameAfterUpload, ConnectMode connectMode, TransferType transferType, string localFilePath) { var settings = new FtpSettings(); settings.Url = url; settings.UseSsh = useSsh; settings.Username = username; settings.Password = password; settings.SubFolder = subFolder; settings.CheckForFile = checkForFile; settings.RenameAfterUpload = renameAfterUpload; settings.ConnectMode = connectMode; settings.TransferType = transferType; var client = new Client(); client.StatusChanged += Client_StatusChanged; client.ProgressChanged += Client_ProgressChanged; var result = client.Upload(settings, localFilePath); if (client.ErrorMessage != null && client.ErrorMessage != string.Empty) { return(InternalServerError(new System.Exception(client.ErrorMessage))); } return(Ok(result)); }
/// <summary> /// 获取指定条件的数据列表 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段,{f:属性名} asc</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public List <MSystemLog> GetDataList(MSystemLog query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetDataList(query, orderBy, mmode, cmode)); }
/// <summary> /// 获取单条数据 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public MSystemLog GetSingleData(MSystemLog query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetSingleData(query, orderBy, mmode, cmode)); }
/// <summary> /// 获取指定条件的记录总数 /// </summary> /// <param name="query">查询条件</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public int GetCount(MDailyAccountSnapshot query, MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetCount(query, mmode, cmode)); }
/// <summary> /// 获取单条数据 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public MDownChannel GetSingleData(MDownChannel query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetSingleData(query, orderBy, mmode, cmode)); }
/// <summary> /// 获取指定条件的记录总数 /// </summary> /// <param name="query">查询条件</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public int GetCount(MUpChannelConfig query, MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetCount(query, mmode, cmode)); }
// parses connectmode attribute values, ensures that they are valid, // and returns the corresponding edtFTPnet enum value that can be // passed directly to the edtFTPnet FTPClient. public static FTPConnectMode ParseConnectMode(ConnectMode amode) { FTPConnectMode theMode; switch (amode) { case ConnectMode.ACTIVE: theMode = FTPConnectMode.ACTIVE; break; case ConnectMode.PASSIVE: theMode = FTPConnectMode.PASV; break; default: throw new FTPTaskException(String.Format("Cannot parse ConnectionMode '{0}'.\nMust be either '{1}' or '{2}'.", amode, ConnectMode.ACTIVE, ConnectMode.PASSIVE)); } return theMode; }
private void CreateOrConnect(ConnectMode mode) { bool result = true; try { switch (mode) { case ConnectMode.Create: if (!CheckPathExists()) { return; } if (File.Exists(this.Database)) { if (MessageBoxEx.Show("The file already exists. Are you sure you want to overwrite it?", "Create Error", MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.No) { return; } File.Delete(this.Database); } var sql = new SqliteDatabase() { DatabasePath = this.Database, Password = this.Password }; sql.Create(); result = true; break; case ConnectMode.Connect: if (File.Exists(this.Database) == false) { MessageBoxEx.Show("The file doesn't exist. In order to open a database you must specify a SQL Lite database file that exists", "Restore Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } break; case ConnectMode.Restore: if (File.Exists(this.Database) == false) { MessageBoxEx.Show("The file doesn't exist. In order to restore the database you must specify a SQL Lite backup file that exists", "Restore Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } break; } } catch (OperationCanceledException) { result = false; } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "Error Creating Database", MessageBoxButton.OK, MessageBoxImage.Error); result = false; } this.Cursor = Cursors.Arrow; if (result) { this.DialogResult = result; } }
/// <summary> /// 获取指定条件的记录总数 /// </summary> /// <param name="query">查询条件</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public int GetCount(MZdCouponUsed query, MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetCount(query, mmode, cmode)); }
public static async Task <Result> Login(string username, string password, ConnectMode connectMode) { HttpClient client = new HttpClient(); client.Timeout = TimeSpan.FromSeconds(10); HttpRequestMessage request = null; HttpResponseMessage response = null; Result re = new Result(); try { string ipv6 = ""; Dictionary <string, string> dic = new Dictionary <string, string>(); StringBuilder bodyString = new StringBuilder(); if (connectMode == ConnectMode.IPv4v6) { request = new HttpRequestMessage(HttpMethod.Post, new Uri("https://lgn6.bjut.edu.cn/V6?https://lgn.bjut.edu.cn")); request.Headers.Add("ContentType", "application/x-www-form-urlencoded"); dic.Add("DDDDD", username); dic.Add("upass", password); for (int i = 0; i < dic.Count; i++) { var key = dic.Keys.ToArray()[i]; if (i > 0) { bodyString.Append($"&{key}={dic[key]}"); } else { bodyString.Append($"{key}={dic[key]}"); } } StringContent t = new StringContent(bodyString.ToString()); request.Content = t; response = await client.SendAsync(request); var stream = await response.Content.ReadAsStreamAsync(); string str; using (StreamReader sr = new StreamReader(stream)) { str = sr.ReadToEnd(); } //获取IPV6地址 int index = str.LastIndexOf("value"); for (int i = index + 7; str[i] != '\''; i++) { ipv6 += str[i]; } request.Dispose(); response.Dispose(); } request = new HttpRequestMessage(HttpMethod.Post, new Uri("https://lgn.bjut.edu.cn/")); dic.Clear(); dic.Add("0MKKey", ""); dic.Add("DDDDD", username); dic.Add("upass", password); dic.Add("v6ip", ipv6); request.Headers.Add("ContentType", "application/x-www-form-urlencoded"); bodyString.Clear(); for (int i = 0; i < dic.Count; i++) { var key = dic.Keys.ToArray()[i]; if (i > 0) { bodyString.Append($"&{key}={dic[key]}"); } else { bodyString.Append($"{key}={dic[key]}"); } } StringContent requestContent = new StringContent(bodyString.ToString()); request.Content = requestContent; response = await client.SendAsync(request); string stringRespones = await response.Content.ReadAsStringAsync(); if (response.StatusCode == System.Net.HttpStatusCode.OK) //一下检测登录是否成功标志值需要重新抓取 { if (stringRespones.Contains("Msg=01")) { re.CodeResult = CodeResult.Fail; re.Msg = "密码错误"; } else if (stringRespones.Contains("Msg=06")) { re.CodeResult = CodeResult.Fail; re.Msg = "喜闻乐见的system buffer full"; } else if (stringRespones.Contains("Msg=05")) { re.CodeResult = CodeResult.Fail; re.Msg = "本账号暂停使用"; } else if (stringRespones.Contains("Msg=04")) { re.CodeResult = CodeResult.Fail; re.Msg = "本账号费用超支或时长流量超过限制"; } else if (stringRespones.Contains("UID='")) { re.CodeResult = CodeResult.Success; re.Msg = "登陆成功"; } } else { re.CodeResult = CodeResult.Fail; re.Msg = "网络异常"; } } catch (Exception ex) { re.CodeResult = CodeResult.Fail; re.Msg = ex.Message; } finally { request?.Dispose(); response?.Dispose(); client?.Dispose(); } return(re); }
// if Fail => return null public virtual bool?Connect(string path, ConnectMode mode) { Console.WriteLine("Not Implemented"); return(null); }
/// <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)); }
/// <summary> /// 获取指定条件的数据集 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段,{f:属性名} asc</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public DataSet GetDataSet(MDailyAccountSnapshot query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetDataSet(query, orderBy, mmode, cmode)); }
/// <summary> /// 获取指定条件的数据列表 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段,{f:属性名} asc</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public List <MDownChannel> GetDataList(MDownChannel query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetDataList(query, orderBy, mmode, cmode)); }
protected internal bool Initialize(Credentials cred, ConnectMode cMode, string key) { //Set properties this.currentCredentials = cred; this.connectionMode = cMode; //this.loggerMode = logMode; var pT = new PerfTimer(this, "Initialize"); if (cMode == ConnectMode.SINGLE) { if (GlobalDataAccessor.Instance == null || GlobalDataAccessor.Instance.OracleDA == null || GlobalDataAccessor.Instance.OracleDA.Initialized == false) { //Initialize data accessor this.oracleDA = new OracleDataAccessor( this.currentCredentials.UserName, this.currentCredentials.PassWord, this.currentCredentials.DBHost, this.currentCredentials.DBPort, this.currentCredentials.DBService, this.currentCredentials.DBSchema, 65535, cMode == ConnectMode.MULTIPLE, !string.IsNullOrEmpty(key), key); GlobalDataAccessor.Instance.OracleDA = this.oracleDA; } else { this.oracleDA = GlobalDataAccessor.Instance.OracleDA; } } else if (cMode == ConnectMode.MULTIPLE) { if (this.oracleDA == null) { this.oracleDA = new OracleDataAccessor( this.currentCredentials.UserName, this.currentCredentials.PassWord, this.currentCredentials.DBHost, this.currentCredentials.DBPort, this.currentCredentials.DBService, this.currentCredentials.DBSchema, 65535, cMode == ConnectMode.MULTIPLE, !string.IsNullOrEmpty(key), key); if (GlobalDataAccessor.Instance == null || GlobalDataAccessor.Instance.OracleDA == null || GlobalDataAccessor.Instance.OracleDA.Initialized == false) { GlobalDataAccessor.Instance.OracleDA = this.oracleDA; } } } if (this.isloglevel(LogLevel.DEBUG)) { this.log(LogLevel.DEBUG, pT.ToString()); } return(true); }
/// <summary> /// 获取指定条件的数据集 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段,{f:属性名} asc</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public DataSet GetDataSet(MZdCouponUsed query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetDataSet(query, orderBy, mmode, cmode)); }
/// <summary> /// 获取指定条件的数据列表 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段,{f:属性名} asc</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public List <MReceiptFundRecord> GetDataList(MReceiptFundRecord query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetDataList(query, orderBy, mmode, cmode)); }
/// <summary> /// 获取指定条件的数据集 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段,{f:属性名} asc</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public DataSet GetDataSet(MReceiptAccountInfo query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetDataSet(query, orderBy, mmode, cmode)); }
/// <summary> /// 获取分页数据集 /// </summary> /// <param name="query">查询条件</param> /// <param name="pageSize">分页</param> /// <param name="pageIndex">页索引从1开始</param> /// <param name="totalCount">总条数</param> /// <param name="orderBy">排序字段</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public DataSet GetPagerDataSet(MUpChannelConfig query, int pageSize, int pageIndex, out int totalCount, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { totalCount = dbAccess.GetCount(query, mmode, cmode); return(dbAccess.GetPagerData(query, pageSize, pageIndex, orderBy, mmode, cmode)); }
/// <summary> /// 获取分页数据列表 /// </summary> /// <param name="query">查询条件</param> /// <param name="pageSize">分页</param> /// <param name="pageIndex">页索引从1开始</param> /// <param name="totalCount">总条数</param> /// <param name="orderBy">排序字段</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public List <MSystemLog> GetPagerDataList(MSystemLog query, int pageSize, int pageIndex, out int totalCount, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { totalCount = dbAccess.GetCount(query, mmode, cmode); return(dbAccess.GetPagerDataList(query, pageSize, pageIndex, orderBy, mmode, cmode)); }
/// <summary> /// 获取指定条件的数据集 /// </summary> /// <param name="query">查询条件</param> /// <param name="orderBy">排序字段,{f:属性名} asc</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public DataSet GetDataSet(MUpChannelConfig query, string orderBy = "", MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetDataSet(query, orderBy, mmode, cmode)); }
/// <summary> /// 获取指定条件的记录总数 /// </summary> /// <param name="query">查询条件</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public int GetCount(MSystemLog query, MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetCount(query, mmode, cmode)); }
/// <summary> /// 获取指定条件的记录总数 /// </summary> /// <param name="query">查询条件</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public int GetCount(MReceiptAccountInfo query, MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetCount(query, mmode, cmode)); }
/// <summary> /// 获取指定条件的记录总数 /// </summary> /// <param name="query">查询条件</param> /// <param name="mmode">字符串匹配模式 Exact:精确匹配 Vague:模糊匹配</param> /// <param name="cmode">条件连接字符串 And 或 OR</param> /// <returns></returns> public int GetCount(MOrderRefund query, MatchMode mmode = MatchMode.Exact, ConnectMode cmode = ConnectMode.And) { return(dbAccess.GetCount(query, mmode, cmode)); }