private void MapImg_Click(object sender, EventArgs e) { MouseEventArgs me = (MouseEventArgs)e; Point coordinates = me.Location; OutPut.AppendText(Environment.NewLine + "[Click] x:" + coordinates.X + " y:" + coordinates.Y); }
private void WriteLog(object sendingProcess, DataReceivedEventArgs outLine) { if (!string.IsNullOrEmpty(outLine.Data)) { OutPut.Dispatcher.Invoke(new Action(delegate { OutPut.AppendText(outLine.Data + "\r\n"); })); } }
public static void GenDBStructProto() { sb.Clear(); sb.Append(@"syntax = ""proto3""; package PDB_Base; "); foreach (KeyValuePair <String, List <DBField> > table in DownDatas.tables) { sb.Append(@" message " + table.Key + @" { "); for (int i = 0; i < table.Value.Count; i++) { sb.Append(@" " + Common.TypesChange.dbtoProto(table.Value[i].type) + " " + Common.TypesChange.dbtoProtohead(table.Value[i].type) + table.Value[i].name + " = " + (i + 1) + ";"); } sb.Append(@" } "); } OutPut.Out(GlobalData.ProtoPath + "\\DB_Base.proto", sb.ToString()); //------------------------------------------------------------------------------------------------ }
public IActionResult Get() { var po = new OutPut(); po.Message = _env.WebRootPath; return(Ok(po)); }
public OutPut GetDataList() { OutPut op = new OutPut(); using (IDbConnection conn = Connection) { try { conn.Open(); op.Data = conn.Query <PosApi>("SELECT * FROM \"option_db\" LIMIT 10").ToList <PosApi>(); } catch (Exception ex) { op = Helper.Error(ex); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } } } return(op); }
public EventItem(string eventName, OutPut master) { this.eventName = eventName; this.master = master; addCount = new Dictionary <string, int>(); removeCount = new Dictionary <string, int>(); }
public static void Dump <T>(this IBuffer <T> buffer, OutPut <T> output) { foreach (var item in buffer) { output(item); } }
public OutPut SignUpStep3(SignUpModel dataSigup) { OutPut op = new OutPut(); try { string sParameter = string.Format(" \"NoHp\" = '{0}' ", dataSigup._a); var DataLogin = AuthRepo.GetDataUserBy(sParameter);//Convert.ToInt32(fn.SelectScalar(Enums.SQL.Function.Aggregate.Count, "Donatur", "*", sParameter)); if (DataLogin.Count > 0) { throw new Exception("Account Sudah terdaftar"); } if (dataSigup._p != dataSigup._cp) { throw new Exception("Password and ConfirmPassword Must be same."); } //verify._a = fn.Base64Decode(verify._a); // Insert to signup dataSigup._p = Helper.md5(Helper.md5(dataSigup._p)).ToLower(); var dtObjt = AuthRepo.SaveSignUp(dataSigup); op.Message = "Please Login"; } catch (Exception ex) { op.Message = ex.Message; op.Error = true; fn.InsetErrorLog("Error Login", ex.Message + " " + ex.StackTrace); } return(op); }
public static void Main() { /* * Allax.IEngine E= new Engine(); * var OUT = new OutPut(); * var SBDB = E.GetSBlockDBInstance(); * var Settings = new Allax.SPNetSettings(16, 4, SBDB); * var Net = E.GetSPNetInstance(Settings); * AddFullRound(Net); * AddFullRound(Net); * AddLastRound(Net); * List<byte> SBlockInit = new List<byte>{ 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 }; * var PBlockInit = new List<byte> { 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16 }; * InitSLayer(1, SBlockInit, Net); * InitSLayer(4, SBlockInit, Net); * InitPLayer(2, PBlockInit, Net); * InitPLayer(5, PBlockInit, Net); * var R1 = new Rule(AvailableSolverTypes.BaseSolver); * var R2 = new Rule(AvailableSolverTypes.HeuristicSolver); * var F = new Allax.CallbackAddSolution(OUT.MyAddSolution); * var AP = new AnalisysParams(new Algorithm(new List<Rule> { / *R1,* / R2 }, AnalisysType.Linear), F, 1); * //Net.PerformAnalisys(AP);*/ output = new OutPut(); E = new Engine(); Menu1(); }
//架构性代码和协议生成 public static void GenStructs() { sb.Clear(); sb = GenCommon.GenHeader(sb, "DBTypes.h", vesion, "生成所有的数据表结构类,一张表对应一个类。"); sb.Append(@"#pragma once #include <string> namespace DBProduce { "); foreach (KeyValuePair <String, List <DBField> > table in DownDatas.tables) { sb.Append(@" struct "+ table.Key + @" {" ); foreach (DBField field in table.Value) { sb.Append(@" " + TypesChange.dbtocpp(field.type) + @" " + field.name + @";"); } sb.Append(@" }; "); } sb.Append(@"}"); OutPut.Out(GlobalData.SavePath + "\\DBTypes.h", sb.ToString()); }
public OutPut getAccessAPI(AuthorizationFilterContext context) { OutPut op = new OutPut(); try { string IpAddress = context.HttpContext.Connection.RemoteIpAddress.ToString(); var Headers = context.HttpContext.Request.Headers; foreach (var key in Headers.Keys) { if (key.ToLower() == "token") { if (!isAuthorize(Headers[key], IpAddress)) { op.Error = true; op.Message = _Message; } return(op); } else { op.Error = true; op.Message = "Invalid Token"; return(op); } } } catch (Exception ex) { op.Error = true; op.Message = ex.Message; } return(op); }
private void OutPut_TextChanged(object sender, EventArgs e) { // set the current caret position to the end OutPut.SelectionStart = OutPut.Text.Length; // scroll it automatically OutPut.ScrollToCaret(); }
public IActionResult Login([FromBody] AuthLogin JObj) { var OutResult = new OutPut(); OutResult = AuthService.Login(JObj, iHttpContextAccessor); return(Ok(OutResult)); }
public static OutPut Error(Exception ex) { OutPut op = new OutPut(); op.Message = ex.Message; op.Status = 500; op.Error = true; return(op); }
public static OutPut Error(string ex) { OutPut op = new OutPut(); op.Message = ex; op.Status = 500; op.Error = true; return(op); }
public OutPut Login(AuthLogin dataLogin, IHttpContextAccessor iHttpContextAccessor) { OutPut op = new OutPut(); Dictionary <string, object> ObjOutput = new Dictionary <string, object>(); List <Donatur> don = new List <Donatur>(); UserLogs uslog = new UserLogs(); try { var IpAddress = iHttpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString(); int TokenExpire = Convert.ToInt32(config.GetValue <string>("appSetting:TokenExpire")); dataLogin.Psswd = Helper.md5(Helper.md5(dataLogin.Psswd)).ToLower(); don = AuthRepo.getDataAuth(dataLogin); if (don.Count > 0) { DateTime ExpireOn = DateTime.Now.AddMinutes(TokenExpire); string Token = fn.GenerateToken(dataLogin, ExpireOn, IpAddress); //save session uslog.UserLog = dataLogin.Account; uslog.Token = Token; uslog.ExpireOn = ExpireOn; uslog.IpAddress = IpAddress; uslog.Device = dataLogin.Device; uslog.UserInput = don[0].Nama; uslog.UserEdit = don[0].Nama; userlogRepo.Save(uslog); Dictionary <string, string> OutData = new Dictionary <string, string>(); OutData.Add(dataLogin.Device, dataLogin.Account); ObjOutput.Add("Akun", OutData); ObjOutput.Add("Token", Token); ObjOutput.Add("Email", don[0].Email); ObjOutput.Add("ExpireOn", ExpireOn); op.Data = ObjOutput; } else { op.Status = 401; op.Error = true; op.Message = "User name or password is incorrect."; return(op); } //validasi } catch (Exception ex) { op.Error = true; op.Message = ex.Message; fn.InsetErrorLog("Error Login", ex.Message + " " + ex.StackTrace); } return(op); }
public void PrintCodedData() { string pattern = @"[x|o]{5}"; MatchCollection matchCollection = Regex.Matches(CodedLevelData, pattern); foreach (Match match in matchCollection) { OutPut.Print(match.Value); } }
public static void GenDBHandler() { sb.Clear(); sb = GenCommon.GenHeader(sb, "DBHandler.h", vesion, "数据库处理接口,任何调用车可以继承这个接口实现数据库的处理方法实现。"); sb.Append(@"#pragma once #include <memory> #include ""DBTypes.h"" namespace DBProduce { class DBHandler { public: DBHandler(); virtual ~DBHandler();" ); foreach (KeyValuePair <String, List <DBField> > table in DownDatas.tables) { sb.Append(@" virtual void read" + table.Key + @"(std::shared_ptr <DBProduce::" + table.Key + @"> _" + table.Key + @")=0;"); } sb.Append(@" }; } "); OutPut.Out(GlobalData.SavePath + "\\DBHandler.h", sb.ToString()); //cpp文件------------------------------------------------------------ sb.Clear(); sb = GenCommon.GenHeader(sb, "DBHandler.cpp", vesion, "数据库处理接口,任何调用车可以继承这个接口实现数据库的处理方法实现。"); sb.Append(@"#include ""DBHandler.h"" namespace DBProduce { DBHandler::DBHandler() { } DBHandler::~DBHandler() { }" ); foreach (KeyValuePair <String, List <DBField> > table in DownDatas.tables) { sb.Append(@" void DBHandler::read" + table.Key + @"(std::shared_ptr <DBProduce::" + table.Key + @"> _" + table.Key + @") { } "); } sb.Append(@" } "); OutPut.Out(GlobalData.SavePath + "\\DBHandler.cpp", sb.ToString()); }
public void remove(OutPut outPut) { using (ISession session = OutPutDaoSession.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { session.Delete(outPut); transaction.Commit(); session.Close(); session.Dispose(); } }
private void DeleteTempFolder(string tempFolder) { try { OutPut.Insert(0, "Removing temporary folder .."); Directory.Delete(tempFolder, true); } catch (Exception ex) { OutPut.Insert(0, "Error :" + ex.Message); } }
/* This method will do a Give out of products * this method contain the client business and */ public ActionResult DarSaida(OutPut outPut) { OutPutDao dao = OutPutDao.getInstance(); bool able = false; if (outPut != null) { dao.add(outPut); able = true; } return(Json(able)); }
static void Main(string[] args) { OutPut.Welcome(); Controller.StartMenu(); Map.Create(); Player.Create(); Bonus.CreateBonus(); Points.Create(); Trap.Create(); Mine.Create(); StartGame.Start(); }
//public IActionResult Upload() public async Task <JsonResult> Upload() { var op = new OutPut(); //var ss = new JsonResult(op); //var taks = Request.Form.f try { Helper.GetipAddress(); var aa = _env.WebRootFileProvider; if (string.IsNullOrWhiteSpace(_env.WebRootPath)) { _env.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); } var dd = _env; //var file = Request.Form.Files[0]; var folderName = Path.Combine("Resources", "Images"); string path2 = $"{Directory.GetCurrentDirectory()}{@"\wwwroot\Resources\Images"}"; //var pathToSave = Path.Combine(Directory.GetCurrentDirectory(), folderName); var pathToSave = Path.Combine(_env.WebRootPath, folderName); if (!Directory.Exists(pathToSave)) { Directory.CreateDirectory(pathToSave); } var Name = Request.HttpContext.Request.Form["Name"]; var ddd = Request.Form["Name"]; Dictionary <string, string> data = new Dictionary <string, string>(); foreach (var file in Request.Form.Files) { var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"'); var fullPath = Path.Combine(pathToSave, fileName); var dbPath = Path.Combine(folderName, fileName); using (var stream = new FileStream(fullPath, FileMode.Create)) { file.CopyTo(stream); } data.Add(file.Name, fullPath); } var path = Path.Combine(_env.WebRootPath, "Resources"); op.Data = data; } catch (Exception ex) { op.Status = 500; op.Message = ex.Message; //return StatusCode(500, op); } //return Ok(op); return(new JsonResult(op)); }
private void GenerateMp4(string tempFolder) { try { string ffmpegPath = Path.Combine(Settings.ApplicationFolder, "ffmpeg.exe"); if (!File.Exists(ffmpegPath)) { MessageBox.Show("ffmpeg not found! Please reinstall the application."); return; } string parameters = @"-r {0} -i {1}\img00%04d.jpg -c:v libx264 -vf fps=25 -pix_fmt yuv420p"; if (VideoType.Name.StartsWith("4K")) { parameters = @"-r {0} -i {1}\img00%04d.jpg -c:v libx265 -vf fps=25"; } // parameters += string.Format("-s {0}x{1}", Width, Height); if (Preview) { parameters += " -vf scale=400:264"; } else { parameters += string.Format(" -vf scale={0}:{1}", Width, Height); } parameters += " {2}"; OutPut.Insert(0, "Generating video ..... "); Process newprocess = new Process(); Progress = 0; ProgressMax = (MaxValue - MinValue) * 25 / Fps; newprocess.StartInfo = new ProcessStartInfo() { FileName = ffmpegPath, Arguments = string.Format(parameters, Fps, tempFolder, OutPutFile), UseShellExecute = false, WindowStyle = ProcessWindowStyle.Minimized, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true }; newprocess.Start(); newprocess.OutputDataReceived += newprocess_OutputDataReceived; newprocess.ErrorDataReceived += newprocess_OutputDataReceived; newprocess.BeginOutputReadLine(); newprocess.BeginErrorReadLine(); newprocess.WaitForExit(); } catch (Exception exception) { OutPut.Insert(0, "Converting error :" + exception.Message); } }
public IActionResult VerifikasiCode([FromBody] VerifyCode verify) { var OutResult = new OutPut(); OutResult = AuthService.SignUpStep2(verify); //if (OutResult.Error) //{ // OutResult.Status = 500; // return StatusCode(500, OutResult); //} return(Ok(OutResult)); }
public void run() { var watch = new Stopwatch(); watch.Start(); for (int i = 0; i < 10000; i++) { EmWxAccountType value = EmWxAccountType.Service; var field = value.GetType().GetField("Service"); var attr = field?.GetCustomAttribute <DisplayAttribute>(); } watch.Stop(); OutPut.WriteLine($"used {watch.ElapsedMilliseconds} ms."); }
public async Task <OutPut> FileUp() { var ret = new OutPut(); //不能用FromBody var dto = Newtonsoft.Json.JsonConvert.DeserializeObject <HouseCollectModel>(Request.Form["ImageModelInfo"]); //文件类实体参数 var files = Request.Form.Files; //接收上传的文件,可能多个 看前台 if (files.Count > 0) { var path = @"C:\Users\Administrator\Desktop\二月项目\WebHouseApi\WebHouseMVC\WebHouseMVC\wwwroot\WybImages"; //绝对路径 //Imgpath = path; string dirPath = Path.Combine(path + "/"); //绝对径路 储存文件路径的文件夹 if (!Directory.Exists(dirPath)) //查看文件夹是否存在 { Directory.CreateDirectory(dirPath); } var file = files.Where(x => true).FirstOrDefault(); //只取多文件的一个 var fileNam = $"{Guid.NewGuid():N}_{file.FileName}"; //新文件名 ImgUrl = fileNam; //添加时字段赋值 string snPath = $"{dirPath + fileNam}"; //储存文件路径 using var stream = new FileStream(snPath, FileMode.Create); await file.CopyToAsync(stream); Imgpath = snPath; //调用添加方法 AddHouse(dto); //次出还可以进行数据库操作 保存到数据库 ret = new OutPut { Code = 200, Msg = "上传成功", Success = true }; } else //没有图片 { ret = new OutPut { Code = 400, Msg = "请上传图片", Success = false }; } return(ret); }
public OutPut getOutPutByDate(DateTime Date) { OutPut outPut = new OutPut(); using (ISession session = OutPutDaoSession.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { IQuery query = session.CreateQuery("Select o from OutPut o where o.Date=?").SetDateTime(0, Date); outPut = query.UniqueResult <OutPut>(); session.Close(); session.Dispose(); } return(outPut); }
public OutPut getById(Double id) { OutPut outPut = new OutPut(); using (ISession session = OutPutDaoSession.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { outPut = session.Get <OutPut>(id); transaction.Commit(); session.Close(); session.Dispose(); } return(outPut); }
public OutPut SaveRecentSearch(JObject Model) { OutPut op = new OutPut(); DynamicParameters spParam = new DynamicParameters(); using (IDbConnection conn = Connection) { try { //validasi if (Model["s"] == null) { op.Message = "Param s can't be null"; op.Error = true; return(op); } if (Model["_a"] == null) { op.Message = "Param _a can't be null"; op.Error = true; return(op); } string ipAddress = Helper.GetipAddress(); //var remoteIpAddress = Req.HttpContext.Connection.RemoteIpAddress; conn.Open(); string SpName = "fn_recentsearch_i"; spParam.Add("@p_ipaddress", ipAddress, dbType: DbType.String); spParam.Add("@p_search", Model["s"].ToString(), dbType: DbType.String); spParam.Add("@p_account", Model["_a"].ToString(), dbType: DbType.String); op.Data = conn.Query(SpName, spParam, commandType: CommandType.StoredProcedure); op.Message = "Data Berhasil di Simpan"; } catch (Exception ex) { fn.InsetErrorLog("Error ", ex.Message + ex.StackTrace); op.Error = true; op.Message = ex.Message; } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } } } return(op); }