Exemplo n.º 1
0
        public void Parse()
        {
            logStream.Seek(-1, SeekOrigin.Current);
            var reader = new StreamReader(logStream);
            var line   = reader.ReadLine();

            while (line != null)
            {
                if (line.Contains("GPUs power:"))
                {
                    var split = line.Split(' ');
                    try
                    {
                        var amount = float.Parse(split[2], CultureInfo.InvariantCulture);
                        if (amount >= settings.MaxAllowedPower)
                        {
                            suspiciousCount++;
                        }

                        if (amount < settings.MaxAllowedPower)
                        {
                            suspiciousCount = 0;
                        }

                        if (suspiciousCount >= settings.Threshold)
                        {
                            suspiciousCount = 0;
                            voltageFixRunner.Run();
                        }
                    }
                    catch (Exception) { }
                }
                line = reader.ReadLine();
            }
        }
Exemplo n.º 2
0
 public void Run()
 {
     wrappee.Run();
     eventLog.WriteEntry("Executed voltage fix bat");
 }