|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using Microsoft.Win32;
-
- using System;
- using System.Runtime.InteropServices;
-
- namespace Common.system
- {
-
-
-
- public class FreeMemoryHelper
- {
- [DllImport("kernel32.dll")]
- private static extern bool SetProcessWorkingSetSize(IntPtr proc, int min, int max);
-
-
-
-
-
- public static void ReallocateMemory()
- {
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- if (Environment.OSVersion.Platform == PlatformID.Win32NT)
- {
- SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
- }
- }
-
-
-
-
- public static void SetDate()
- {
- CreateKey();
- RegistryKey currentUser = Registry.CurrentUser;
- RegistryKey registryKey = currentUser.OpenSubKey("SOFTWARE\\DevExpress\\Components", writable: true);
- registryKey.GetValue("LastAboutShowedTime");
- string value = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
- registryKey.SetValue("LastAboutShowedTime", value);
- currentUser.Dispose();
- }
-
-
- private static void CreateKey()
- {
- RegistryKey currentUser = Registry.CurrentUser;
- if (currentUser.OpenSubKey("SOFTWARE\\DevExpress\\Components", writable: true) == null)
- {
- RegistryKey registryKey = currentUser.CreateSubKey("SOFTWARE\\DevExpress\\Components");
- registryKey.CreateSubKey("LastAboutShowedTime").SetValue("LastAboutShowedTime", DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"));
- registryKey.CreateSubKey("DisableSmartTag").SetValue("LastAboutShowedTime", false);
- registryKey.CreateSubKey("SmartTagWidth").SetValue("LastAboutShowedTime", 350);
- }
-
- currentUser.Dispose();
- }
- }
- }
|