internal virtual void Reload(RM.API rm, ref double maxValue)
        {
            MeasureSkin = rm.GetSkin();
            MeasureName = rm.GetMeasureName();

            _xpath = rm.ReadString("XPath", null);
            RM.API.Log(RM.API.LogType.Debug, GetLogString("XPath=[{0}]", _xpath));
        }
Exemplo n.º 2
0
        internal override void Reload(Rainmeter.API api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            string parentName = api.ReadString("ParentName", "");
            IntPtr skin = api.GetSkin();

            // Find parent using name AND the skin handle to be sure that it's the right one.
            ParentMeasure = null;
            foreach(ParentMeasure parentMeasure in ParentMeasure.ParentMeasures)
            {
                if(parentMeasure.Skin.Equals(skin) && parentMeasure.Name.Equals(parentName))
                {
                    ParentMeasure = parentMeasure;
                }
            }

            if(ParentMeasure == null)
            {
                API.Log(API.LogType.Error, "ParentChild.dll: ParentName=" + parentName + " is not valid");
            }
        }
Exemplo n.º 3
0
        internal override void Reload(Rainmeter.API api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            Name = api.GetMeasureName();
            Skin = api.GetSkin();

            Path = api.ReadString("Path", "");
            Server = api.ReadString("Server", "");
            Format = api.ReadString("Format", "");
        }
Exemplo n.º 4
0
        internal void Reload(Rainmeter.API rm, ref double maxValue)
        {
            SkinHandle = rm.GetSkin();
            FinishAction = rm.ReadString("FinishAction", "");
            ConnectionType = rm.ReadString("ConnectionType", "INTERNET").ToUpperInvariant();
            if (ConnectionType != "NETWORK" && ConnectionType != "INTERNET")
            {
                API.Log(API.LogType.Error, "CheckNet.dll: ConnectionType=" + ConnectionType + " not valid");
            }

            UpdateRate = rm.ReadInt("UpdateRate", 20);
            if (UpdateRate <= 0)
            {
                UpdateRate = 20;
            }
        }
Exemplo n.º 5
0
 internal virtual void Initialize(Rainmeter.API api)
 {
     Name = api.GetMeasureName();
     Skin = api.GetSkin();
 }
        internal override void Reload(Rainmeter.API api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            Name = api.GetMeasureName();
            Skin = api.GetSkin();

            ValueA = api.ReadInt("ValueA", 0);
            ValueB = api.ReadInt("ValueB", 0);
            ValueC = api.ReadInt("ValueC", 0);
        }
        internal override void Reload(Rainmeter.API api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            string parentName = api.ReadString("ParentName", "");
            IntPtr skin = api.GetSkin();

            // Find parent using name AND the skin handle to be sure that it's the right one
            RuntimeTypeHandle parentType = typeof(ParentMeasure).TypeHandle;
            foreach (KeyValuePair<uint, Measure> pair in Plugin.Measures)
            {
                if (System.Type.GetTypeHandle(pair.Value).Equals(parentType))
                {
                    ParentMeasure parentMeasure = (ParentMeasure)pair.Value;
                    if (parentMeasure.Name.Equals(parentName) &&
                        parentMeasure.Skin.Equals(skin))
                    {
                        HasParent = true;
                        ParentID = pair.Key;
                        return;
                    }
                }
            }

            HasParent = false;
            API.Log(API.LogType.Error, "ParentChild.dll: ParentName=" + parentName + " not valid");
        }
        internal void Reload(Rainmeter.API api, ref double maxValue)
        {
            // Pointers / name
            this.Name = api.GetMeasureName();
            this.Skin = api.GetSkin();

            // Measure does the data refresh
            string reQuery = api.ReadString("ReQuery", string.Empty);
            if (reQuery.Equals("1") || reQuery.Equals("true", StringComparison.InvariantCultureIgnoreCase))
            {
                this.ReQuery = true;
            }

            // Metric Type
            string type = api.ReadString("MetricType", string.Empty);
            switch (type.ToLowerInvariant())
            {
                case "memory":
                case "mem":
                    this.Type = MetricType.TopMemory;
                    break;

                default:
                    this.Type = MetricType.TopCPU;
                    break;
            }

            // If provides data
            if (this.ReQuery)
            {
                this.QueryString = "SELECT * FROM Win32_PerfRawData_PerfProc_Process";

                // Apply globally ignored processes to query
                string globalIgnoredProcesses = api.ReadString("GlobalIgnoredProcesses", string.Empty);
                if (!string.IsNullOrEmpty(globalIgnoredProcesses))
                {
                    bool firstTime = true;
                    foreach (string procName in globalIgnoredProcesses.Split(new char[] { '|' }))
                    {
                        if (firstTime)
                        {
                            this.QueryString += " WHERE";
                            firstTime = false;
                        }
                        else
                        {
                            this.QueryString += " AND";
                        }
                        this.QueryString += " NOT Name LIKE '" + procName.Replace("*", "%").Replace("'", "''") + "'";
                    }
                }

                // Create lists only if data provider
                this._cpuList = new List<Performance>();
                this._memList = new List<Performance>();
            }

            // Find the measure in this skin with ReQuery=1
            foreach (KeyValuePair<IntPtr, Measure> current in Plugin.Measures)
            {
                Measure value = current.Value;
                if (value.Skin.Equals(this.Skin) && value.ReQuery)
                {
                    this.DataProvider = current.Key;
                    this.HasData = true;
                    break;
                }
            }

            // Set ignored processes for this measure
            this.SpecificIgnoredProcesses = api.ReadString("SpecificIgnoredProcesses", string.Empty);

            // Set format for this measure
            this.Format = api.ReadString("Format", string.Empty);

            // Set range or specific process number to display
            string procNum = api.ReadString("ProcNums", string.Empty);
            if (!string.IsNullOrEmpty(procNum))
            {
                string[] procNums = procNum.Split(new char[] { '-' });
                if (procNums.Length == 1)
                {
                    int num = Convert.ToInt32(procNums[0]);
                    this.StartProcNum = num;
                    this.EndProcNum = num;
                }
                else if (procNums.Length == 2)
                {
                    this.StartProcNum = Convert.ToInt32(procNums[0]);
                    this.EndProcNum = Convert.ToInt32(procNums[1]);
                }
            }
        }