Esempio n. 1
0
            private Scheme[] GetAllSchemes()
            {
                var           str     = PPProcess.PowerPlanExec("/L");
                List <Scheme> schemes = new List <Scheme>();

                using (MemoryStream mem = new MemoryStream(Encoding.GetEncoding(850).GetBytes(str)))
                {
                    using (StreamReader reader = new StreamReader(mem, Encoding.GetEncoding(850)))
                    {
                        string line = null;
                        while ((line = reader.ReadLine()) != null)
                        {
                            if (line.Contains("GUID"))
                            {
                                schemes.Add(new Scheme()
                                {
                                    name = line.Split('(')[1].Split(')')[0].Trim(),
                                    guid = line.Split(':')[1].Split('(')[0].Trim()
                                });
                            }
                        }
                    }
                }
                return(schemes.ToArray());
            }
Esempio n. 2
0
            private static Scheme GetActiveScheme()   // GET SCHEME GUID
            {
                var line = PPProcess.PowerPlanExec("-getactivescheme");

                return(new Scheme()
                {
                    name = line.Split('(')[1].Split(')')[0].Trim(),
                    guid = line.Split(':')[1].Split('(')[0].Trim()
                });
            }
Esempio n. 3
0
 private void SetScheme(Scheme scheme)
 {
     PPProcess.PowerPlanExec(" -s " + scheme.guid);
     NotifyTrayIcon.Icon = GenerateIcon(scheme.name, Color.Transparent);
     SetIconText(scheme.name);
 }