internal static string BuildMethodParameterList(MethodReference interopMethod, MethodReference interfaceMethod, Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver, MarshalType marshalType, bool includeTypeNames) { List<string> elements = new List<string>(); int num = 0; foreach (ParameterDefinition definition in interopMethod.Parameters) { MarshalInfo marshalInfo = interfaceMethod.Parameters[num].MarshalInfo; DefaultMarshalInfoWriter writer = MarshalDataCollector.MarshalInfoWriterFor(typeResolver.Resolve(definition.ParameterType), marshalType, marshalInfo, true, false, false, null); foreach (MarshaledType type in writer.MarshaledTypes) { elements.Add(string.Format(!includeTypeNames ? "{1}" : "{0} {1}", type.DecoratedName, Naming.ForParameterName(definition) + type.VariableName)); } num++; } TypeReference reference2 = typeResolver.Resolve(interopMethod.ReturnType); if (reference2.MetadataType != MetadataType.Void) { MarshalInfo info2 = interfaceMethod.MethodReturnType.MarshalInfo; MarshaledType[] marshaledTypes = MarshalDataCollector.MarshalInfoWriterFor(reference2, marshalType, info2, true, false, false, null).MarshaledTypes; for (int i = 0; i < (marshaledTypes.Length - 1); i++) { elements.Add(string.Format(!includeTypeNames ? "{1}" : "{0}* {1}", marshaledTypes[i].DecoratedName, Naming.ForComInterfaceReturnParameterName() + marshaledTypes[i].VariableName)); } elements.Add(string.Format(!includeTypeNames ? "{1}" : "{0}* {1}", marshaledTypes[marshaledTypes.Length - 1].DecoratedName, Naming.ForComInterfaceReturnParameterName())); } return EnumerableExtensions.AggregateWithComma(elements); }
public static void AddTaskToPriorityList(Unity uni) { if (uni == null) return; if (uni.task == null) return; Unity last = null; try { last = PriorityTaskList[PriorityTaskList.Count]; } catch (Exception) { try { last = ClosedTaskList[ClosedTaskList.Count]; } catch (Exception) { } } PriorityTaskList.Add(uni); NormalTaskList.Remove(uni); lock (CentralContainer.RunningTaskLock) { Monitor.Wait(CentralContainer.RunningTaskLock); } }
protected override void Visit(FieldDefinition fieldDefinition, Unity.Cecil.Visitor.Context context) { if (!GenericsUtilities.CheckForMaximumRecursion(this._genericContext.Type)) { base.Visit(fieldDefinition, context); } }
public UseAction(Unity.DbConn dbc, string servername, string playername, int maxprematch, int searchdeep) { dbconn = dbc; _servername = servername; _playername = playername; _maxprematch = maxprematch; _searchdeep = searchdeep; }
public static bool ExistUser(Unity.DbConn dbconn, string server, string playername) { int i = dbconn.ExecScaner<int>("select count(1) from lolplayer where servername=@servername and playername=@playername", new { playername = playername, servername = server }); return i > 0; }
protected override void Visit(TypeDefinition type, Unity.Cecil.Visitor.Context context) { if (Unity.IL2CPP.Extensions.IsComOrWindowsRuntimeType(type) && !type.IsInterface) { InjectBaseTypeIfNeeded(type); InjectFinalizer(type); } base.Visit(type, context); }
public static List<Models.Player> GetListByPage(Unity.DbConn dbconn, string server, int searchdeep, int pno, int pagesize, out int total) { total = dbconn.ExecScaner<int>("select count(1) from lolplayer where servername=@servername and [searchdeep]=@searchdeep", new { servername = server, searchdeep = searchdeep }); string pagesql = string.Format("select * from (select ROW_NUMBER() over (order by playername asc) as rownum,* from lolplayer where servername=@servername and [searchdeep]=@searchdeep) A where A.rownum between {0} and {1}", (pno - 1) * pagesize + 1, pno * pagesize); var model = dbconn.ExecModel<Models.Player>(pagesql, new { servername = server, searchdeep = searchdeep }); return model; }
protected override void Visit(MethodDefinition methodDefinition, Unity.Cecil.Visitor.Context context) { if ((!methodDefinition.HasGenericParameters || ((this._genericContext.Method != null) && (this._genericContext.Method.Resolve() == methodDefinition))) && !GenericsUtilities.CheckForMaximumRecursion(this._genericContext.Type)) { base.VisitTypeReference(methodDefinition.ReturnType, context.ReturnType(methodDefinition)); foreach (ParameterDefinition definition in methodDefinition.Parameters) { this.Visit(definition, context.Parameter(methodDefinition)); } } }
public static Models.Player Get(Unity.DbConn dbconn, string server, string playername) { var model = dbconn.ExecModel<Models.Player>("select * from lolplayer where servername=@servername and playername=@playername", new { playername = playername, servername = server }); if (model.Count == 0) return null; return model[0]; }
protected override void Visit(GenericInstanceType genericInstanceType, Unity.Cecil.Visitor.Context context) { if (Unity.IL2CPP.Extensions.IsEnum(genericInstanceType)) { ModuleDefinition module = genericInstanceType.Module; for (int i = 0; i < genericInstanceType.GenericArguments.Count; i++) { GenericParameter parameter = genericInstanceType.GenericArguments[i] as GenericParameter; if ((parameter != null) && (parameter.Owner == null)) { genericInstanceType.GenericArguments[i] = module.ImportReference(module.TypeSystem.Object); } } } base.Visit(genericInstanceType, context); }
protected override void Visit(TypeReference typeReference, Unity.Cecil.Visitor.Context context) { if (typeReference.Module == this._module) { AssemblyNameReference scope = typeReference.Scope as AssemblyNameReference; if (scope != null) { TypeDefinition definition = typeReference.Resolve(); if (definition == null) { throw new InvalidProgramException(string.Format("Failed to resolve [{0}]{1}.", scope.Name, typeReference.FullName)); } this._resolvedAssemblies.Add(definition.Module.Assembly); } base.Visit(typeReference, context); } }
public static string GetSignature(MethodReference method, MethodReference interfaceMethod, Unity.IL2CPP.ILPreProcessor.TypeResolver typeResolver, [Optional, DefaultParameterValue(null)] string typeName) { StringBuilder builder = new StringBuilder(); MarshalType marshalType = !interfaceMethod.DeclaringType.Resolve().IsWindowsRuntime ? MarshalType.COM : MarshalType.WindowsRuntime; if (string.IsNullOrEmpty(typeName)) { builder.Append("virtual il2cpp_hresult_t STDCALL "); } else { builder.Append("il2cpp_hresult_t "); builder.Append(typeName); builder.Append("::"); } builder.Append(Naming.ForMethodNameOnly(interfaceMethod)); builder.Append('('); builder.Append(BuildMethodParameterList(method, interfaceMethod, typeResolver, marshalType, true)); builder.Append(')'); return builder.ToString(); }
void Update() { if (cameraOutput != null) { //memory leak fix if (openCVView.outputTexture.texture != null) { Destroy(openCVView.outputTexture.texture); } Mat cameraOutputMat = Unity.TextureToMat(cameraOutput.cameraTexture); Mat scaledCameraOutputMat = scaleCameraOutput(cameraOutputMat); if (Input.GetKeyDown("space") || Input.touches.Length > 0) { calibrate(cameraOutputMat); } if (calibrated) { openCVView.outputTexture.texture = Unity.MatToTexture(histMasking(scaledCameraOutputMat)); } } }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { string path = imgTempPath; if (!bll.update_03(out string message)) { MessageBox.Show(message); return; } if (!bll.update_031(out message)) { MessageBox.Show(message); return; } tb1.Text = $"通过视吸水指数、吸水剖面和含水等因素综合分析," + $"选定调剖井{Unity.ToDecimal(bll.Tags["调剖井数"]).ToString("0.##")}口," + $"占总注入井数{Unity.ToDecimal(bll.Tags["占总注入井数"]).ToString("0.##")}%。"; tb2.Text = $"经统计," + $"选定调剖井平均日注水{Unity.ToDecimal(bll.Tags["选定调剖井平均日注水"]).ToString("0.##")}m3/d," + $"平均注水压力{Unity.ToDecimal(bll.Tags["平均注水压力"]).ToString("0.##")}MPa," + $"平均视吸水指数{Unity.ToDecimal(bll.Tags["平均视吸水指数"]).ToString("0.##")}m3/d.MPa," + $"平均综合含水{Unity.ToDecimal(bll.Tags["平均综合含水"]).ToString("0.##")}%。"; //BitmapImage bi = new BitmapImage(new Uri(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "img.png"))); //img.Source = bi; //todo:井位图,路径修改在工程目录下 //todo:井位图,初始化读取工程目录下,是否有历史图片 Canvas canvas = WellMapGeneration.CreatMap(out Point size); utils.SaveCanvas(size, canvas, 96, path); Uri uri = new Uri(path, UriKind.RelativeOrAbsolute); img.Source = new BitmapImage(uri); }
public ApiResult Register(RegisterUser model) { var service = Unity.GetService <IUserService>(); if (service.Exist(model.UserName)) { return(new ApiResult(ApiStatus.Fail, "user is existed")); } User newuser = new User() { UserName = model.UserName, NickName = model.NickName, Password = CryptoHelper.MD5_Encrypt(model.Password), UserStatus = 1 }; if (!service.Create(newuser)) { return(new ApiResult(ApiStatus.Fail, "save fail")); } return(new ApiResult()); }
public ExplorerGridContainer() { InitializeComponent(); Unity.ApplyResource(this); UIHelper.ProcessDataGridView(this.dataGridView); if (DesignMode) { return; } //初始化命令 InitCommands(); //初始化菜单 InitContextMenu(); //初始化 DataGridView 控制器 InitController(); SubscribeEvent(); }
/// <summary> /// 初始化小层数据 /// </summary> private void init_oc_xcsj() { oc_xcsj.Clear(); StringBuilder sql = new StringBuilder(); sql.AppendFormat("select * from oil_well_c where jh = \"{0}\" and skqk<>''", tpjing.jh); DataTable dt = DbHelperOleDb.Query(sql.ToString()).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { ccwx_xcsj_model model = new ccwx_xcsj_model(); model.JH = Unity.ToString(dt.Rows[i]["jh"]); model.YCZ = Unity.ToString(dt.Rows[i]["ycz"]); model.XCH = Unity.ToString(dt.Rows[i]["xch"]); model.XCXH = dt.Rows[i]["xcxh"].ToString(); model.YXHD = Unity.ToDecimal(dt.Rows[i]["yxhd"]); model.STL = Unity.ToDecimal(dt.Rows[i]["stl"]); model.zrfs = 0; model.fdd = false; model.zzd = false; oc_xcsj.Add(model); } }
/// <summary> /// Per-frame video capture processor /// </summary> protected override bool ProcessTexture(WebCamTexture input, ref Texture2D output) { // detect everything we're interested in processor.ProcessTexture(input, TextureParameters); // mark detected objects processor.MarkDetected(false); foreach (DetectedFace face in processor.Faces) { foreach (DetectedObject sub in face.Elements) { if (sub.Marks != null) { UnityEngine.Debug.Log(sub.Name); } } } // processor.Image now holds data we'd like to visualize output = Unity.MatToTexture(processor.Image, output); // if output is valid texture it's buffer will be re-used, otherwise it will be re-created return(true); }
public async Task LevelAsync() { try { using (var unitOfWork = Unity.Resolve <IUnitOfWork>()) { var user = await unitOfWork.Users.GetUserAsync(Context.Guild.Id, Context.User.Id).ConfigureAwait(false); if (user == null) { _embed.WithDescription("No account found!\n" + "Pls ude **?level** again."); await ReplyAsync("", false, _embed.Build()).ConfigureAwait(false); return; } var position = await unitOfWork.Users.FindPosition(Context.Guild.Id, Context.User.Id).ConfigureAwait(false); _embed.WithTitle($"Info for {Context.User.Username}"); _embed.AddField("Level", $"{user.Level}", true); _embed.AddField("Xp", $"{user.Xp}", true); _embed.AddField("Next level", $"next level in {user.Level * 25 - user.Xp}Xp", true); _embed.AddField("Total time connected", $"{user.TimeConnected}", true); _embed.AddField("Activity score", ".......", true); _embed.AddField("Position", $"{position + 1}", true); await ReplyAsync("", false, _embed.Build()).ConfigureAwait(false); _logger.Log($"Server: {Context.Guild}, Id: {Context.Guild.Id} || ShardId: {Context.Client.ShardId} || Channel: {Context.Channel} || User: {Context.User} || Used: level"); } } catch (Exception e) { Console.WriteLine(e); throw; } }
private async Task ReactionAddedAsync(SocketReaction reaction) { if (!(reaction.Channel is SocketGuildChannel guildChannel)) { return; } if (reaction.User.Value.IsBot) { return; } using (var unitOfWork = Unity.Resolve <IUnitOfWork>()) { var user = await unitOfWork.Users.GetOrAddUserInfoAsync(guildChannel.Guild.Id, reaction.UserId, reaction.User.Value.Username).ConfigureAwait(false); if (!(DateTime.Now.Subtract(user.LastEmoteAdded).TotalSeconds > 15)) { return; } user.LastEmoteAdded = DateTime.Now; await _expService.GiveXp(1, user, guildChannel.Guild, reaction.User.Value, unitOfWork).ConfigureAwait(false); await unitOfWork.SaveAsync().ConfigureAwait(false); } }
protected override void Visit(MethodDefinition methodDefinition, Unity.Cecil.Visitor.Context context) { if (methodDefinition.DeclaringType.IsInterface && (this._processGenerics == methodDefinition.HasGenericParameters)) { this._collection.Add(new InvokerData(methodDefinition.ReturnType.MetadataType == MetadataType.Void, methodDefinition.Parameters.Count, Unity.IL2CPP.Extensions.IsComOrWindowsRuntimeMethod(methodDefinition))); } }
protected override void Visit(GenericInstanceType genericInstanceType, Unity.Cecil.Visitor.Context context) { GenericInstanceType inflatedType = Inflater.InflateType(this._genericContext, genericInstanceType); this.ProcessGenericType(inflatedType); base.Visit(genericInstanceType, context); }
public PrefixCommands() { _botConfiguration = Unity.Resolve <BotConfiguration>(); }
public GetButtonUp(Unity self) { this.self = self; }
public GetAxis(Unity self) { this.self = self; }
public LoadGameObjectAt(Unity self) { this.self = self; }
public void StatusLogger_LogToConsole_LogNullTest() { var logger = Unity.Resolve <StatusLogger>(); Assert.Throws <System.ArgumentNullException>(() => logger.LogToConsole(null)); }
public override CppToolChain MakeCppToolChain(Unity.IL2CPP.Building.Architecture architecture, BuildConfiguration buildConfiguration, bool treatWarningsAsErrors) { return new GccToolChain(architecture, buildConfiguration); }
private static async Task<EmailMessage> CreateAttachmentObject(IStorageFile attachmentTempFile, Unity.Core.AttachmentData attachment, EmailMessage mail) { await (FileIO.WriteBytesAsync(attachmentTempFile, attachment.Data).AsTask()); var properties = await attachmentTempFile.GetBasicPropertiesAsync(); if (properties.Size < (ulong)(attachment.DataSize)) { mail.Attachments.Add(new EmailAttachment(attachment.FileName, RandomAccessStreamReference.CreateFromFile(attachmentTempFile))); } return mail; }
public static void RemoveTaskFromPriorityList(Unity uni) { if (uni != null) PriorityTaskList.Remove(uni); }
public WindowsRuntimeAwareMetadataResolver(Unity.IL2CPP.Common.IAssemblyResolver assemblyResolver) : base(assemblyResolver) { this._loadedWinmdPaths = new HashSet<NPath>(); this._loadedWinmds = new HashSet<AssemblyDefinition>(); this._assemblyResolver = assemblyResolver; }
public RegistrationHandler() { _botConfiguration = Unity.Resolve <BotConfiguration>(); _statusLogger = Unity.Resolve <StatusLogger>(); }
public FetchGameObject(Unity self) { this.self = self; }
public void StatusLogger_NotNullTest() { var logger = Unity.Resolve <StatusLogger>(); Assert.NotNull(logger); }
public IsSameGameObject(Unity self) { this.self = self; }
public OpenCvSharp.Rect DrawRect(RectTransform imageTransform, Mat image, Mat downscaled, Unity.TextureConversionParams TextureParameters, ref Texture2D output) { // screen space -> image space Vector2 sp = ConvertToImageSpace(imageTransform, startPoint, image.Size(), TextureParameters); Vector2 ep = ConvertToImageSpace(imageTransform, endPoint, image.Size(), TextureParameters); Point location = new Point(Math.Min(sp.x, ep.x), Math.Min(sp.y, ep.y)); Size size = new Size(Math.Abs(ep.x - sp.x), Math.Abs(ep.y - sp.y)); var areaRect = new OpenCvSharp.Rect(location, size); Rect2d obj = Rect2d.Empty; // If not dragged - show the tracking data if (!isDragging) { // drop tracker if the frame's size has changed, this one is necessary as tracker doesn't hold it well if (frameSize.Height != 0 && frameSize.Width != 0 && downscaled.Size() != frameSize) { DropTracking(); } // we have to tracker - let's initialize one if (null == tracker) { // but only if we have big enough "area of interest", this one is added to avoid "tracking" some 1x2 pixels areas if ((ep - sp).magnitude >= minimumAreaDiagonal) { obj = new Rect2d(areaRect.X, areaRect.Y, areaRect.Width, areaRect.Height); // initial tracker with current image and the given rect, one can play with tracker types here tracker = Tracker.Create(TrackerTypes.MIL); tracker.Init(downscaled, obj); frameSize = downscaled.Size(); } } // if we already have an active tracker - just to to update with the new frame and check whether it still tracks object else { if (!tracker.Update(downscaled, ref obj)) { obj = Rect2d.Empty; } } // save tracked object location if (0 != obj.Width && 0 != obj.Height) { areaRect = new OpenCvSharp.Rect((int)obj.X, (int)obj.Y, (int)obj.Width, (int)obj.Height); } } // render rect we've tracker or one is being drawn by the user if (isDragging || (null != tracker && obj.Width != 0)) { Cv2.Rectangle((InputOutputArray)image, areaRect * (1.0 / downScale), isDragging ? Scalar.Red : Scalar.Blue, 4); } // result, passing output texture as parameter allows to re-use it's buffer // should output texture be null a new texture will be created if (!isTracking) { output = Unity.MatToTexture(image, output); } return(areaRect); }
public GetButtonDown(Unity self) { this.self = self; }
private void btn_close_Click(object sender, RoutedEventArgs e) { var mainWindow = Unity.GetAncestor <MainWindow>(this); mainWindow.Skip(" "); }
public LoadScene(Unity self) { this.self = self; }
public static void RemoveTaskFromNormalList(Unity uni) { if (uni != null) NormalTaskList.Remove(uni); }
protected override void Visit(TypeDefinition typeDefinition, Unity.Cecil.Visitor.Context context) { if (context.Role != Role.NestedType) { if (typeDefinition.BaseType != null) { base.VisitTypeReference(typeDefinition.BaseType, context.BaseType(typeDefinition)); } foreach (FieldDefinition definition in typeDefinition.Fields) { this.Visit(definition, context.Member(typeDefinition)); } if (this._mode != CollectionMode.Types) { foreach (MethodDefinition definition2 in typeDefinition.Methods) { this.Visit(definition2, context.Member(typeDefinition)); } } } }
public override CppToolChain MakeCppToolChain(Unity.IL2CPP.Building.Architecture architecture, BuildConfiguration buildConfiguration, bool treatWarningsAsErrors) { return new AndroidToolChain(architecture, buildConfiguration, treatWarningsAsErrors, new NPath("")); }
protected override void Visit(ArrayType arrayType, Unity.Cecil.Visitor.Context context) { this.ProcessArray(arrayType.ElementType, arrayType.Rank); base.Visit(arrayType, context); }
public RecipeModule() { _recipeService = Unity.Resolve <RecipeService>(); }
private void outContainer_Loaded(object sender, RoutedEventArgs e) { outContainer.Background = Unity.NetGridBg(Colors.LightGray, Colors.DarkGray); }
public static void AddUser(Unity.DbConn dbconn, Models.Player usermodel) { int i = dbconn.ExecSql("insert into lolplayer(servername,playername,parentplayer,[level],fighting,searchdeep,lastplaytime) values(@servername,@playername,@parentplayer,@level,@fighting,@searchdeep,@lastplaytime)", usermodel); }
public void ProcessCamera() { Texture visualTexture; var rawImage = gameObject.GetComponent <RawImage>(); rawImage.texture = null; Texture2D inputTexture = new Texture2D(webcamTexture.width, webcamTexture.height); inputTexture.SetPixels(webcamTexture.GetPixels()); inputTexture.Apply(); // first of all, we set up scan parameters // // scanner.Settings has more values than we use // (like Settings.Decolorization that defines // whether b&w filter should be applied), but // default values are quite fine and some of // them are by default in "smart" mode that // uses heuristic to find best choice. so, // we change only those that matter for us scanner.Settings.NoiseReduction = 0.7; // real-world images are quite noisy, this value proved to be reasonable scanner.Settings.EdgesTight = 0.9; // higher value cuts off "noise" as well, this time smaller and weaker edges scanner.Settings.ExpectedArea = 0.2; // we expect document to be at least 20% of the total image area scanner.Settings.GrayMode = PaperScanner.ScannerSettings.ColorMode.Grayscale; // color -> grayscale conversion mode // process input with PaperScanner Mat result = null; scanner.Input = Unity.TextureToMat(inputTexture); // should we fail, there is second try - HSV might help to detect paper by color difference if (!scanner.Success) { // this will drop current result and re-fetch it next time we query for 'Success' flag or actual data scanner.Settings.GrayMode = PaperScanner.ScannerSettings.ColorMode.HueGrayscale; } // now can combine Original/Scanner image result = CombineMats(scanner.Input, scanner.Output, scanner.PaperShape); Mat resultContoured = null; resultContoured = JustImageContour(scanner.Input, scanner.PaperShape); // apply result or source (late for a failed scan) rawImage.texture = Unity.MatToTexture(result); visualTexture = Unity.MatToTexture(resultContoured); visualPlane.GetComponent <Renderer>().material.mainTexture = visualTexture; //(float)resultContoured.Height / (float)resultContoured.Width visualPlane.transform.localScale = new Vector3((float)resultContoured.Width / (float)resultContoured.Height, 1, 1); var transform = gameObject.GetComponent <RectTransform>(); transform.sizeDelta = new Vector2(result.Width, result.Height); Debug.Log(resultContoured.Width + " " + resultContoured.Height); }
public abstract CppToolChain MakeCppToolChain(Unity.IL2CPP.Building.Architecture architecture, BuildConfiguration buildConfiguration, bool treatWarningsAsErrors);
public void StatusLogger_LogToConsole_LogWhitespaceTest() { var logger = Unity.Resolve <StatusLogger>(); Assert.Throws <System.ArgumentException>(() => logger.LogToConsole(" ")); }
public override void LaunchApplication(Unity.Core.System.Launch.App application, string query) { throw new NotImplementedException(); }
public CreateProjectView() { InitializeComponent(); _container = ServiceUnity.Container; Unity.ApplyResource(this); }
public DataBaseCreateWizard_Confirm() { InitializeComponent(); Unity.ApplyResource(this); this.BackSkip = true; }
private void btn_next_Click(object sender, RoutedEventArgs e) { var mainWindow = Unity.GetAncestor <MainWindow>(this); mainWindow.Skip(this.GetType().Namespace + ".TPYLYH"); }
public DataBaseCreateWizard_Account() { InitializeComponent(); Unity.ApplyResource(this); ApplyLanguageResource(); }
private async Task AttemptWrongConnect() { var conn = Unity.Resolve <Connection>(); await conn.ConnectAsync(new TutorialBotConfig { Token = "FAKE-TOKEN" }); }
protected override void Visit(MethodDefinition methodDefinition, Unity.Cecil.Visitor.Context context) { if (methodDefinition.IsVirtual && (this._processGenerics == methodDefinition.HasGenericParameters)) { this._collection.Add(new InvokerData(methodDefinition.ReturnType.MetadataType == MetadataType.Void, methodDefinition.Parameters.Count, false)); } }