public string GetString(Rainmeter.Settings.InstanceSettings Instance)
        {
            WriteDebug("ConfigName", Instance.ConfigName);
            WriteDebug("Variable:BatchFile", Instance.INI_Value("BatchFile") );

            var now = DateTime.Now;
            var lastAccess = Instance.GetVariable("LastAccess");
            var updateSpan = Convert.ToInt32(Instance.INI_Value("Update"));
            var wait = Convert.ToInt32(Instance.INI_Value("Update"));
            if (string.IsNullOrEmpty(lastAccess))
                wait = 1;
            else
            {
                TimeSpan span = now - Convert.ToDateTime(lastAccess);
                if (span.TotalMilliseconds > updateSpan)
                {
                    wait = 1;
                }
            }

            var file = Instance.INI_Value("BatchFile");
            System.Threading.Thread.Sleep(wait);
            Instance.SetVariable("LastAccess", DateTime.Now);
            return GetBatchString(file);
        }
 public static int ConfigHeight(Rainmeter.Settings.InstanceSettings Instance)
 {
     IntPtr hwnd = (IntPtr)(UInt32.Parse(Rainmeter.PluginBridge("GetWindow", Rainmeter.PluginBridge("GetConfig", Instance.INI_File))));
     RECT rct;
     GetWindowRect(hwnd, out rct);
     return rct.Bottom - rct.Top;
 }
 public double Update2(Rainmeter.Settings.InstanceSettings Instance)
 {
     return 7.0;
 }
 // 'Update', 'Update2', and 'GetString' all return data back to Rainmeter, depending on
 // if the Rainmeter measure wants a numeric value or a string/text data.
 //
 // The 'Instance' member contains all of the data necessary to read the INI file
 // passed to your plugin when this instance was first initialized.  Remember: your plugin
 // may be initialized multiple times.  For example, a plugin that reads the free space
 // of a hard drive may be called multiple times -- once for each installed hard drive.
 public UInt32 Update(Rainmeter.Settings.InstanceSettings Instance)
 {
     return 7;
 }
 // 'ExecuteBang' is a way of Rainmeter telling your plugin to do something *right now*.
 // What it wants to do can be defined by the 'Command' parameter.
 public void ExecuteBang(Rainmeter.Settings.InstanceSettings Instance, string Command)
 {
     return;
 }
 public GetStringThread(Rainmeter.Settings.InstanceSettings _Instance)
 {
     this.Instance = _Instance;
 }
 public UpdateThread(Rainmeter.Settings.InstanceSettings _Instance)
 {
     this.Instance = _Instance;
 }
        public double Update2(Rainmeter.Settings Plugin, UInt32 id)
        {
            bool bAlreadyRunning = (bool)Plugin.Instances[id].GetTempValue("__RMT_U2_AlreadyRunning", false);
            if (!bAlreadyRunning)
            {
                Update2Thread thread_details = new Update2Thread(Plugin.Instances[id]);
                Thread thread = new Thread(new ThreadStart(thread_details.Go));
                thread.Start();
            }

            try
            {
                return (double)Plugin.Instances[id].GetTempValue("__RMT_U2_LastValue", 0.0);
            }
            catch
            {
                return 0.0;
            }
        }
 public ExecuteBangThread(Rainmeter.Settings.InstanceSettings _Instance, string _Command)
 {
     this.Instance = _Instance;
     this.Command = _Command;
 }
        public string GetString(Rainmeter.Settings Plugin, UInt32 id)
        {
            bool bAlreadyRunning = (bool)Plugin.Instances[id].GetTempValue("__RMT_GS_AlreadyRunning", false);
            if (!bAlreadyRunning)
            {
                GetStringThread thread_details = new GetStringThread(Plugin.Instances[id]);
                Thread thread = new Thread(new ThreadStart(thread_details.Go));
                thread.Start();
            }

            try
            {
                return (string)Plugin.Instances[id].GetTempValue("__RMT_GS_LastValue", string.Empty);
            }
            catch
            {
                return string.Empty;
            }
        }
 public void ExecuteBang(Rainmeter.Settings Plugin, UInt32 id, string sArguments)
 {
     bool bAlreadyRunning = (bool)Plugin.Instances[id].GetTempValue("__RMT_EB_AlreadyRunning", false);
     if (!bAlreadyRunning)
     {
         ExecuteBangThread thread_details = new ExecuteBangThread(Plugin.Instances[id], sArguments);
         Thread thread = new Thread(new ThreadStart(thread_details.Go));
         thread.Start();
     }
     return;
 }
        public static string SkinName(Rainmeter.Settings.InstanceSettings Instance)
        {
            try
            {
                return Instance.ConfigName;
                /*
                if (Instance.GetTempValue("_internal_SkinPath", string.Empty).ToString() == string.Empty)
                {
                    string sAppDataPath = System.Environment.GetEnvironmentVariable("AppData").Trim();
                    string sRainmeterINIText = System.IO.File.ReadAllText(sAppDataPath + "\\Rainmeter\\Rainmeter.ini");
                    string sSkinPath = Chopper(sRainmeterINIText.Replace('\n', '\r'), "SkinPath=", "\r").Trim().TrimEnd(new char[] { '\\' });
                    Instance.SetTempValue("_internal_SkinPath", sSkinPath);
                }

                System.IO.FileInfo fi = new System.IO.FileInfo(Instance.INI_File);
                return fi.DirectoryName.Replace(Instance.GetTempValue("_internal_SkinPath", string.Empty).ToString(), string.Empty).TrimEnd(new char[] { '\\' }).TrimStart(new char[] { '\\' });
                */
            }
            catch { }

            return string.Empty;
        }
 // Call this function to determine if the parent skin is topmost
 public static bool ParentIsTopmost(Rainmeter.Settings.InstanceSettings Instance)
 {
     IntPtr hwnd = (IntPtr)(UInt32.Parse(Rainmeter.PluginBridge("GetWindow", Rainmeter.PluginBridge("GetConfig", Instance.INI_File))));
     WINDOWINFO info = new WINDOWINFO(true);
     GetWindowInfo(hwnd, ref info);
     return ((info.dwExStyle & 0x00000008L) > 0);
 }
 public static IntPtr GetConfigWindow(Rainmeter.Settings.InstanceSettings Instance)
 {
     return (IntPtr)(UInt32.Parse(Rainmeter.PluginBridge("GetWindow", Rainmeter.PluginBridge("GetConfig", Instance.INI_File))));
 }