예제 #1
0
        public void GetSvnInfo(Rainmeter.Settings.InstanceSettings Instance)
        {
            path = Instance.INI_Value("LocalRepoPath");
            WriteBatch();

            var alias = Instance.INI_Value("RepoAlias");

            var logLimit = Convert.ToInt16(Instance.INI_Value("LogLimit"));

            var p = new Process
                        {
                            StartInfo =
                                {
                                    CreateNoWindow = true,
                                    UseShellExecute = false,
                                    RedirectStandardOutput = true,
                                    FileName = bat,
                                    Arguments = path,
                                    WindowStyle = ProcessWindowStyle.Hidden
                                }
                            };
            p.StartInfo.UseShellExecute = false;
            p.Start();
            string output = p.StandardOutput.ReadToEnd();
            p.WaitForExit();

            svn = new SvnInfo(alias, output, logLimit);
        }
예제 #2
0
        public string GetString(Rainmeter.Settings.InstanceSettings Instance)
        {
            var counter = 0;
            var updateCounter = 1;
            var retVal = "Error";

            if (!String.IsNullOrEmpty(Instance.GetVariable("counter")))
                counter = Convert.ToInt32(Instance.GetVariable("counter"));

            if (!String.IsNullOrEmpty(Instance.INI_Value("UpdateDivider")))
                updateCounter = Convert.ToInt32(Instance.INI_Value("UpdateDivider"));

            if (!String.IsNullOrEmpty(Instance.GetVariable("retVal")))
                retVal = Instance.GetVariable("retVal");

            if (!String.IsNullOrEmpty(Instance.INI_Value("Width")))
                width = Convert.ToInt16(Instance.INI_Value("Width"));

            if (counter % updateCounter == 0)
            {

                try
                {
                    GetSvnInfo(Instance);
                    retVal = svn.Alias + new string(' ', width - svn.Alias.Length - svn.Updates.Length) + svn.Updates;
                    Instance.SetVariable("retVal", retVal);
                }
                catch (Exception e)
                {
                    Debug.Write("Exception", e.ToString());
                }
                return retVal;
            }
            else
            {
                Instance.SetVariable("counter", counter++);
                return retVal;
            }
        }
예제 #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 UpdateThread(Rainmeter.Settings.InstanceSettings _Instance)
 {
     this.Instance = _Instance;
 }
예제 #5
0
 public GetStringThread(Rainmeter.Settings.InstanceSettings _Instance)
 {
     this.Instance = _Instance;
 }
예제 #6
0
 public ExecuteBangThread(Rainmeter.Settings.InstanceSettings _Instance, string _Command)
 {
     this.Instance = _Instance;
     this.Command = _Command;
 }
예제 #7
0
        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;
            }
        }
예제 #8
0
        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;
            }
        }
예제 #9
0
 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;
 }
예제 #10
0
        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;
        }
예제 #11
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);
 }
예제 #12
0
 public static IntPtr GetConfigWindow(Rainmeter.Settings.InstanceSettings Instance)
 {
     return (IntPtr)(UInt32.Parse(Rainmeter.PluginBridge("GetWindow", Rainmeter.PluginBridge("GetConfig", Instance.INI_File))));
 }
예제 #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)
 {
     return;
 }
예제 #14
0
 public double Update2(Rainmeter.Settings.InstanceSettings Instance)
 {
     return 7.0;
 }
예제 #15
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;
 }