public void SetCurve(Curve curve) { this.curve = curve; transitionType = Transition.Curve; nativeModule_AlphaModule_SetCurve(SubmodulePtr, NativeUtil.CopyCurveToNativeCurve(curve)); }
public void SetRandomCurve(Curve curve) { this.curve = curve; transitionType = Transition.RandomCurve; RegenerateRandom(); nativeModule_SpeedModule_SetRandomCurve(SubmodulePtr, NativeUtil.CopyCurveToNativeCurve(curve)); }
public static unsafe bool MemCmp(void *ptr1, void *ptr2, long size) { if (ptr1 == ptr2) { return(true); } return(NativeUtil.Compare((byte *)ptr1, (byte *)ptr2, (int)size)); }
private void SettingsAndSingleShapeSuccessfully() { PplFeatures.SetSpotlightProperties(0.25f, 1f, Color.FromArgb(0x00FF00)); DialogUtil.WaitForDialogBox(PplFeatures.OpenSpotlightDialog, null, "Spotlight Properties"); var spotlightDialog = NativeUtil.FindWindow(null, "Spotlight Properties"); Assert.AreNotEqual(IntPtr.Zero, spotlightDialog, "Failed to find Spotlight Dialog."); // In Win7, it's "25 %", but in Win10, it's "25%" var transparencyDialog = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, null, "25 %"); if (transparencyDialog == IntPtr.Zero) { transparencyDialog = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, null, "25%"); } Assert.AreNotEqual(IntPtr.Zero, transparencyDialog, "Failed to find Text Dialog."); // Set text NativeUtil.SendMessage(transparencyDialog, 0x000C /*WM_SETTEXT*/, IntPtr.Zero, "1"); // try to get class's build id var actualContentBuilder = new StringBuilder(1024); NativeUtil.GetClassName(spotlightDialog, actualContentBuilder, 1024); var classBuildId = actualContentBuilder.ToString().Split('.').Last(); var fadeComboBox = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, "WindowsForms10.COMBOBOX.app.0." + classBuildId, null); Assert.AreNotEqual(IntPtr.Zero, fadeComboBox, "Failed to find Fade Dialog."); var sb = new StringBuilder(256, 256); NativeUtil.SendMessage(fadeComboBox, 0x0148 /*CB_GETLBTEXT*/, (IntPtr)2, sb); // Set combo box NativeUtil.SendMessage(fadeComboBox, 0x014E /*CB_SETCURSEL*/, IntPtr.Zero, sb.ToString()); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); DialogUtil.CloseDialogBox(spotlightDialog, "OK"); PpOperations.SelectSlide(4); PpOperations.SelectShape("Spotlight Me"); PplFeatures.Spotlight(); var actualSlide1 = PpOperations.SelectSlide(4); var actualSlide2 = PpOperations.SelectSlide(5); var expSlide1 = PpOperations.SelectSlide(6); var expSlide2 = PpOperations.SelectSlide(7); SlideUtil.IsSameLooking(expSlide1, actualSlide1); SlideUtil.IsSameLooking(expSlide2, actualSlide2); }
void OnDisable() { NativeUtil.DisposeArray(ref normals); NativeUtil.DisposeArray(ref triangles); NativeUtil.DisposeArray(ref samples); NativeUtil.DisposeArray(ref bandDistribution); NativeUtil.DisposeArray(ref vertices); NativeUtil.DisposeArray(ref prevBands); NativeUtil.DisposeArray(ref bandVelocities); }
public static unsafe void *Malloc(long size, int alignment, Allocator allocator) { var remain = size % alignment; if (remain != 0) { size = size + (alignment - remain); } return(NativeUtil.Alloc((int)size).ToPointer()); }
public void SetCurve(Curve h, Curve s, Curve l, Curve a) { curveH = h; curveS = s; curveL = l; curveA = a; transitionType = Transition.Curve; nativeModule_ColorModule_SetCurve(SubmodulePtr, NativeUtil.CopyCurve4ToNativeCurve4(h, s, l, a)); }
public void Donate(Cdb2ConnectionId connectionId, IntPtr handle) { var message = new V0Message { Type = V0MessageType.Donate, TypeString = connectionId.ToString(), Timeout = DefaultTimeout }; var wrapper = new SockPoolMessage { Buffer = BitUtil.ToArray(message), Handle = handle }; NativeUtil.SendMessage(_socket, wrapper); }
// Click Thumbnails Panel to make selectedSlide focused. // When focused, add the agenda beam to the selectedSlide (doesn't have agenda) & sync. // When unfocused, only sync (so selectedSlide (doesn't have agenda) remains the same). private static void ClickOnSlideThumbnailsPanel() { var pptPanel = NativeUtil.FindWindow("PPTFrameClass", null); var mdiPanel = NativeUtil.FindWindowEx(pptPanel, IntPtr.Zero, "MDIClient", null); var mdiPanel2 = NativeUtil.FindWindowEx(mdiPanel, IntPtr.Zero, "mdiClass", null); if (PpOperations.IsOffice2010()) { var thumbnailsPanel = NativeUtil.FindWindowEx(mdiPanel2, IntPtr.Zero, "paneClassDC", "Thumbnails"); NativeUtil.SendMessage(thumbnailsPanel, 0x0201 /*left button down*/, IntPtr.Zero, IntPtr.Zero); } else // Office2013 or Higher { NativeUtil.SendMessage(mdiPanel2, 0x0201 /*left button down*/, IntPtr.Zero, IntPtr.Zero); } }
private void VerifySpotlightSettingsDialogBox() { string spotlightSettingsWindowTitle = "Spotlight Settings"; DialogUtil.WaitForDialogBox(PplFeatures.OpenSpotlightDialog, null, spotlightSettingsWindowTitle); IntPtr spotlightDialog = NativeUtil.FindWindow(null, spotlightSettingsWindowTitle); Assert.AreNotEqual(IntPtr.Zero, spotlightDialog, "Failed to find " + spotlightSettingsWindowTitle + "."); // In Win7, it's "25 %", but in Win10, it's "25%" IntPtr transparencyDialog = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, null, "25 %"); if (transparencyDialog == IntPtr.Zero) { transparencyDialog = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, null, "25%"); } Assert.AreNotEqual(IntPtr.Zero, transparencyDialog, "Failed to find Text Dialog."); // Set text NativeUtil.SendMessage(transparencyDialog, 0x000C /*WM_SETTEXT*/, IntPtr.Zero, "1"); // try to get class's build id StringBuilder actualContentBuilder = new StringBuilder(1024); NativeUtil.GetClassName(spotlightDialog, actualContentBuilder, 1024); string classBuildId = actualContentBuilder.ToString().Split('.').Last(); IntPtr fadeComboBox = NativeUtil.FindWindowEx(spotlightDialog, IntPtr.Zero, "WindowsForms10.COMBOBOX.app.0." + classBuildId, null); Assert.AreNotEqual(IntPtr.Zero, fadeComboBox, "Failed to find Fade Dialog."); StringBuilder sb = new StringBuilder(256, 256); NativeUtil.SendMessage(fadeComboBox, 0x0148 /*CB_GETLBTEXT*/, (IntPtr)2, sb); // Set combo box NativeUtil.SendMessage(fadeComboBox, 0x014E /*CB_SETCURSEL*/, IntPtr.Zero, sb.ToString()); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); NativeUtil.SendMessage(fadeComboBox, 0x100 /*WM_KEYDOWN*/, (IntPtr)Keys.Down, IntPtr.Zero); DialogUtil.CloseDialogBox(spotlightDialog, "OK"); }
public void Load() { try { var jsonData = File.ReadAllBytes(CONFIG_FILENAME); var json = SystemUtil.RemoveUtf8BOM(jsonData); Entries = JsonSerializer.Deserialize <Config>(json); } catch { // Default configurations Entries = new Config { JavaMaxMem = NativeUtil.GetRecommendedMemory(), WindowWidth = 854, WindowHeight = 480, AfterLaunch = AfterLaunchBehavior.Hide, DownloadSource = DownloadSource.Official, }; } Entries.Accounts ??= new List <Account>(4); if (string.IsNullOrWhiteSpace(Entries.GameDir)) { Entries.GameDir = Environment.CurrentDirectory + "\\.minecraft"; } if (!File.Exists(Entries.JreDir + "\\javaw.exe")) { Entries.JreDir = SystemUtil.GetJavaDir(); } if (Entries.JavaMaxMem == 0) { Entries.JavaMaxMem = 2048; } if (Entries.Build < 104) { Entries.Language = null; // Migrate lower version language settings } Entries.Build = AssemblyUtil.Build; }
public IntPtr Request(Cdb2ConnectionId connectionId) { var message = new V0Message { Type = V0MessageType.Request, TypeString = connectionId.ToString() }; var wrapper = new SockPoolMessage { Buffer = BitUtil.ToArray(message) }; NativeUtil.SendMessage(_socket, wrapper); wrapper = NativeUtil.ReceiveMessage(_socket, 60); message = BitUtil.ToMessage <V0Message>(wrapper.Buffer); return(wrapper.Handle); }
/// <summary> /// 从IFS或StreamingAssets目录同步加载资源 /// </summary> public void Load(string pkgPath, bool outside) { if (outside) { Load(FileUtil.GetIFSExtractPath(), pkgPath); } else { // load from StreamingAssets #if UNITY_ANDROID && !UNITY_EDITOR string realPath = FileUtil.CombinePath(pkgPath, OriginPath); byte[] data = NativeUtil.Android_ReadFileInAssets(realPath); if (data != null) { OnBinaryLoaded(data); } #else Load(FileUtil.GetStreamingAssetsPath(), pkgPath); #endif } }
protected override void Configure() { // Apply settings before start var configService = this.Container.Get <ConfigService>(); configService.Load(); var langService = this.Container.Get <LanguageService>(); // Unable to inject the service using IoC, have to make it a static property LocalizedDescriptionAttribute.LanguageService = langService; // Override AccentColors var accentColor = NativeUtil.GetSystemColorByName("ImmersiveStartSelectionBackground"); Application.Current.Resources[AdonisUI.Colors.AccentColor] = accentColor; Application.Current.Resources[AdonisUI.Colors.AccentInteractionColor] = NativeUtil.GetSystemColorByName("ImmersiveStartBackground"); Application.Current.Resources[AdonisUI.Colors.AccentIntenseHighlightColor] = NativeUtil.GetSystemColorByName("ImmersiveStartFolderBackground"); Application.Current.Resources[AdonisUI.Colors.DisabledAccentForegroundColor] = NativeUtil.GetSystemColorByName("ImmersiveStartDisabledText"); Application.Current.Resources[AdonisUI.Colors.AccentHighlightColor] = NativeUtil.GetSystemColorByName("ImmersiveStartSecondaryText"); // Update background image var themeService = this.Container.Get <ThemeService>(); themeService.UpdateBackgroundImage(); // Why load the background icon needs accent color? // Well...you'll see themeService.LoadBackgroundIcon(accentColor); }
public void FT_QuickPropertyTest() { PpOperations.SelectSlide(4); Microsoft.Office.Interop.PowerPoint.Shape shape = PpOperations.SelectShape("ffs")[1]; int x = PpOperations.PointsToScreenPixelsX(shape.Left + shape.Width / 2); int y = PpOperations.PointsToScreenPixelsY(shape.Top + shape.Height / 2); WindowWatcher.AddToWhitelist("Format Shape"); MouseUtil.SendMouseDoubleClick(x, y); ThreadUtil.WaitFor(2000); if (PpOperations.IsOffice2010()) { // AKA property handle IntPtr formatObjHandle = NativeUtil.FindWindow("NUIDialog", "Format Shape"); Assert.AreNotEqual(IntPtr.Zero, formatObjHandle, "Failed to find Property handle."); NativeUtil.SendMessage(formatObjHandle, 0x10 /*WM_CLOSE*/, IntPtr.Zero, IntPtr.Zero); } else // for Office 2013 or higher { // Spy++ helps to look into the handles IntPtr pptHandle = NativeUtil.FindWindow("PPTFrameClass", null); Assert.AreNotEqual(IntPtr.Zero, pptHandle, "Failed to find PowerPoint handle."); IntPtr dockRightHandle = NativeUtil.FindWindowEx(pptHandle, IntPtr.Zero, "MsoCommandBarDock", "MsoDockRight"); Assert.AreNotEqual(IntPtr.Zero, dockRightHandle, "Failed to find Dock Right handle."); // AKA property handle IntPtr formatObjHandle = NativeUtil.FindWindowEx(dockRightHandle, IntPtr.Zero, "MsoCommandBar", "Format Object"); Assert.AreNotEqual(IntPtr.Zero, formatObjHandle, "Failed to find Property handle."); } }
private static void OnWindowLoaded(object sender, RoutedEventArgs e) { var handle = new WindowInteropHelper(sender as Window).Handle; NativeUtil.EnableBlur(handle); }
public static unsafe void MemClear(void *destination, long size) { NativeUtil.Zero((byte *)destination, (int)size); }
public static unsafe void MemMove(void *destination, void *source, long size) { NativeUtil.Copy(destination, source, (int)size); }
public static unsafe void Free(void *memory, Allocator allocator) { NativeUtil.Free(new IntPtr(memory)); }