예제 #1
0
        public static int ConfigHeight(string sSkin)
        {
            IntPtr hwnd = (IntPtr)(UInt32.Parse(Rainmeter.PluginBridge("GetWindow", sSkin)));
            RECT   rct;

            GetWindowRect(hwnd, out rct);
            return(rct.Bottom - rct.Top);
        }
예제 #2
0
        // 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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public static int ConfigWidth(string sSkin)
        {
            IntPtr hwnd = (IntPtr)(UInt32.Parse(Rainmeter.PluginBridge("GetWindow", sSkin)));
            RECT   rct;

            GetWindowRect(hwnd, out rct);
            return(rct.Right - rct.Left);
        }
예제 #5
0
                public unsafe void Initialize(Settings _PluginSettings, char *iniFile, char *section, UInt32 id)
                {
                    this.PluginSettings = _PluginSettings;
                    this._ID            = id;
                    this._INI_File      = new string(iniFile);
                    this._Section       = new string(section);

                    this.ConfigName = Rainmeter.PluginBridge("GetConfig", this.INI_File);
                }
예제 #6
0
        private unsafe static string PluginBridge(string sCommand, string sData)
        {
            try
            {
                return(new string(PluginBridge(Rainmeter.String(sCommand), Rainmeter.String(sData))));
            }
            catch { }

            return(string.Empty);
        }
예제 #7
0
 public double Update2(Rainmeter.Settings.InstanceSettings Instance)
 {
     try
     {
         MeasureResult result = Measure(Instance);
         return(result.AsDouble(Instance));
     }
     catch (Exception e)
     {
         Rainmeter.Log(Rainmeter.LogLevel.Error, "Sorry, " + e.ToString());
         return(double.NaN);
     }
 }
예제 #8
0
 public string GetString(Rainmeter.Settings.InstanceSettings Instance)
 {
     try
     {
         MeasureResult result = Measure(Instance);
         return(result.AsString(Instance));
     }
     catch (Exception e)
     {
         Rainmeter.Log(Rainmeter.LogLevel.Error, "Sorry, " + e.ToString());
         return("Sorry, " + e.ToString());
     }
 }
예제 #9
0
            public void Go()
            {
                this.Instance.SetTempValue("__RMT_EB_AlreadyRunning", true);

                try
                {
                    new OutlookPlugin().ExecuteBang(this.Instance, this.Command);
                }
                catch (Exception ex)
                {
                    Rainmeter.Log(Rainmeter.LogLevel.Error, "C# plugin in GetString(), " + ex.GetType().ToString() + ": " + ex.Message);
                }

                this.Instance.SetTempValue("__RMT_EB_AlreadyRunning", false);
            }
예제 #10
0
            public void Go()
            {
                this.Instance.SetTempValue("__RMT_U2_AlreadyRunning", true);

                try
                {
                    this.Instance.SetTempValue("__RMT_U2_LastValue", new OutlookPlugin().Update2(this.Instance));
                }
                catch (Exception ex)
                {
                    Rainmeter.Log(Rainmeter.LogLevel.Error, "C# plugin in GetString(), " + ex.GetType().ToString() + ": " + ex.Message);
                }

                this.Instance.SetTempValue("__RMT_U2_AlreadyRunning", false);
            }
예제 #11
0
        // If an INI is missing, a blank string will be returned to avoid raising exceptions
        private unsafe static string ReadConfigString(string sSection, string sKey)
        {
            try
            {
                char *szString = ReadConfigString(Rainmeter.String(sSection), Rainmeter.String(sKey), Rainmeter.String(string.Empty));

                if (szString != null)
                {
                    return(new string(szString));
                }
            }
            catch { }

            return(string.Empty);
        }
예제 #12
0
 public unsafe static char *GetPluginAuthor()
 {
     if (!string.IsNullOrEmpty(Plugin.Email) && !string.IsNullOrEmpty(Plugin.Comments))
     {
         return(Rainmeter.String(Plugin.Author + " (" + Plugin.Email + "): " + Plugin.Comments));
     }
     if (!string.IsNullOrEmpty(Plugin.Email))
     {
         return(Rainmeter.String(Plugin.Author + " (" + Plugin.Email + ")"));
     }
     if (!string.IsNullOrEmpty(Plugin.Comments))
     {
         return(Rainmeter.String(Plugin.Author + ": " + Plugin.Comments));
     }
     return(Rainmeter.String(Plugin.Author));
 }
예제 #13
0
 // '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)
 {
     //string[] args = Command.Split(' ');
     //Command = args[0];
     try
     {
         switch (Command)
         {
         case "ClearCache":
             resetId++;
             return;
         }
         MeasureResult mr = Measure(Instance);
         mr.Bang(GetOutlook(), Command);
     }
     catch (Exception e)
     {
         Rainmeter.Log(Rainmeter.LogLevel.Error, e.ToString());
     }
     return;
 }
예제 #14
0
 public static IntPtr GetConfigWindow(Rainmeter.Settings.InstanceSettings Instance)
 {
     return((IntPtr)(UInt32.Parse(Rainmeter.PluginBridge("GetWindow", Rainmeter.PluginBridge("GetConfig", Instance.INI_File)))));
 }
예제 #15
0
 public string SetVariable(string sVariable, object oData)
 {
     return(Rainmeter.PluginBridge("SetVariable", "\"" + this.ConfigName + "\" " + sVariable.Trim() + " \"" + oData.ToString().Trim() + "\""));
 }
예제 #16
0
 public static UInt32 GetPluginVersion()
 {
     return(Rainmeter.Version(Plugin.Version));
 }
예제 #17
0
        // You can call this function directly to log to Rainmeter.log
        //
        // Rainmeter needs to be configured to allow debug logging, of course.

        public static unsafe bool Log(LogLevel level, string sText)
        {
            return(Rainmeter.LSLog((int)level, Rainmeter.String("C# plugin"), Rainmeter.String(sText)) != 0);
        }
예제 #18
0
 public string GetVariable(string sVariable)
 {
     return(Rainmeter.PluginBridge("GetVariable", "\"" + this.ConfigName + "\" " + sVariable.Trim() + ""));
 }
예제 #19
0
 /// <summary>
 /// Rainmeter's request for text data from the plugin.
 /// </summary>
 /// <param name="id">The unique instance ID of this request.</param>
 /// <param name="flags">Unused still as of Dec 2nd, 2010.</param>
 /// <returns></returns>
 public unsafe static char *GetString(UInt32 id, UInt32 flags)
 {
     // Do not modify this member.  Instead, update your code in 'OutlookPlugin.cs'.
     return(Rainmeter.String(new YourPlugin().GetString(Plugin, id)));
 }