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));
        }
        internal override void Reload(RM.API rm, ref double maxValue)
        {
            base.Reload(rm, ref maxValue);

            _updateRate = rm.ReadInt("UpdateRate", 3600);
            RM.API.Log(RM.API.LogType.Debug, GetLogString("UpdateRate=[{0}]", _updateRate));

            _uri = rm.ReadString("Uri", null);
            RM.API.Log(RM.API.LogType.Debug, GetLogString("Uri=[{0}]", _uri));
        }
 internal override void Initialize(Rainmeter.API api)
 {
     base.Initialize(api);
     string parentname = api.ReadString("ParentName", "");
     foreach (ParentMeasure item in ParentMeasure.ParentMeasures)
     {
         if (item.Name == parentname && item.Skin == Skin)
         {
             _parentmeasure = item;
         }
     }
     if (_parentmeasure == null)
         LogHelper.Error("[" + Name + "]" + " Can't find Parent (" + parentname + ")");
     else
         _parentmeasure._yahooweather.WeatherArrive += OnSourceUpdate;
 }
        internal async void Log(API.LogType type, String message)
        {
            if (ParentMeasures.Contains(this) &&
                ParentRainmeterApis.Contains(Rainmeter))
            {
                try
                {
                    await Task.Run(() => Rainmeter.Log(type, message));

                    //Rainmeter.Log(API.LogType.Debug, message);
                }
                catch
                {
                    DebugLevel += 0;    // breakpoint
                }
            }
        }
Esempio n. 5
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");
            }
        }
        internal override void Reload(RM.API rm, ref double maxValue)
        {
            base.Reload(rm, ref maxValue);

            string parentName = rm.ReadString("Parent", null);
            RM.API.Log(RM.API.LogType.Debug, GetLogString("Parent=[{0}]", parentName));

            RuntimeTypeHandle parentHandle = typeof(XmlParserParent).TypeHandle;
            foreach (var measure in Plugin.Measures.Values)
            {
                if (Type.GetTypeHandle(measure).Equals(parentHandle))
                {
                    XmlParserParent parent = (XmlParserParent)measure;
                    if (parent.MeasureName.Equals(parentName)
                        && parent.MeasureSkin.Equals(MeasureSkin))
                    {
                        _parent = parent;
                        return;
                    }
                }
            }

            RM.API.Log(RM.API.LogType.Error, GetLogString("Parent [{0}] not found.", parentName));
        }
Esempio n. 7
0
 internal override void Reload(Rainmeter.API api, ref double maxValue)
 {
     _optionname = api.ReadString("Option", "sk_tempcurr");
 }
Esempio n. 8
0
 internal override void Initialize(Rainmeter.API api)
 {
     base.Initialize(api);
     string parentname = api.ReadString("ParentName", "");
     if (string.IsNullOrEmpty(parentname) == false)
     {
         foreach (ParentMeasure measure in ParentMeasure.ParentMeasures)
         {
             if (measure.Name == parentname && measure.Skin == Skin)
             {
                 _parentmeasure = measure;
                 return;
             }
         }
     }
     if (_parentmeasure == null)
     {
         LogHelper.Error("ParentName= " + parentname + " 没找到");
     }
 }
Esempio n. 9
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;
            }
        }
Esempio n. 10
0
 internal virtual void Reload(Rainmeter.API api, ref double maxValue)
 {
 }
        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");
        }
Esempio n. 12
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", "");
        }
        internal void Reload(Rainmeter.API rm, ref double maxValue)
        {
            string type = rm.ReadString("Type", "");
            switch (type.ToLowerInvariant())
            {
                case "major":
                    Type = MeasureType.Major;
                    break;

                case "minor":
                    Type = MeasureType.Minor;
                    break;

                case "number":
                    Type = MeasureType.Number;
                    break;

                case "string":
                    Type = MeasureType.String;
                    break;

                default:
                    API.Log(API.LogType.Error, "SystemVersion.dll: Type=" + type + " not valid");
                    break;
            }
        }
Esempio n. 14
0
 internal override void Reload(Rainmeter.API api, ref double maxValue)
 {
     base.Reload(api, ref maxValue);
     OptionName = api.ReadString("Option", "sk_temp").ToLower();
 }
Esempio n. 15
0
 internal override void Reload(Rainmeter.API api, ref double maxValue)
 {
     string cityid = api.ReadString("CityCode", "");
     OptionName = api.ReadString("Option", "sk_tp").ToLower();
     _data.Cityid = string.IsNullOrEmpty(cityid) ? "01010101" : cityid;
 }
Esempio n. 16
0
        internal override void Reload(Rainmeter.API api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            string cityid = api.ReadString("CityCode", "");
            if (string.IsNullOrEmpty(cityid)) LogHelper.Error("[" + Name + "]" + " CityCode is invalid");
            _yahooweather.Cityid = cityid;

            OptionName = api.ReadString("Option", "sk_temp").ToLower();
        }
Esempio n. 17
0
 internal override void Initialize(Rainmeter.API api)
 {
     base.Initialize(api);
     _yahooweather.WeatherArrive += OnSourceUpdate;
     ParentMeasures.Add(this);
 }
        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 virtual void Reload(Rainmeter.API api, ref double maxValue)
        {
            string type = api.ReadString("Type", "");
            switch (type.ToLowerInvariant())
            {
                case "a":
                    Type = MeasureType.A;
                    break;

                case "b":
                    Type = MeasureType.B;
                    break;

                case "c":
                    Type = MeasureType.C;
                    break;

                default:
                    API.Log(API.LogType.Error, "ParentChild.dll: Type=" + type + " not valid");
                    break;
            }
        }
Esempio n. 20
0
 internal override void Initialize(Rainmeter.API api)
 {
     base.Initialize(api);
     ParentMeasures.Add(this);
 }
Esempio n. 21
0
 internal override void Reload(Rainmeter.API api, ref double maxValue)
 {
     _option = api.ReadString("Option", "sk_tempcurr").ToLower();
     string appkey = api.ReadString("AppKey", "");
     string sign = api.ReadString("Sign", "");
     string cityid = api.ReadString("CityCode", "shenzhen").ToLower();
     _data.CityId = string.IsNullOrEmpty(cityid) ? "shenzhen" : cityid;
     _data.AppKey = string.IsNullOrEmpty(appkey) ? _data.AppKey : appkey;
     _data.Sign = string.IsNullOrEmpty(sign) ? _data.Sign : sign;
 }
Esempio n. 22
0
 internal override void Initialize(Rainmeter.API api)
 {
     base.Initialize(api);
     _data = new TencentWeather();
     _data.WeatherArrive += OnSourceUpdate;
 }
Esempio n. 23
0
 // this is for initial "parent" type,
 // sent down inheritenace chain, overidden though?
 internal virtual void Reload(Rainmeter.API api, ref double maxValue)
 {
     string type = api.ReadString("Type", "");
     switch(type.ToLowerInvariant())
     {
     case "rank":
         Type = MeasureType.Rank;
         break;
     case "won":
         Type = MeasureType.Won;
         break;
     case "lost":
         Type = MeasureType.Lost;
         break;
     case "wontoday":
         Type = MeasureType.WonToday;
         break;
     case "losttoday":
         Type = MeasureType.LostToday;
         break;
     case "highestrank":
         Type = MeasureType.HighestRank;
         break;
     default:
         API.Log(API.LogType.Error, "Type=" + type + " is not valid");
         break;
     }
 }
Esempio n. 24
0
        internal override void Initialize(Rainmeter.API api)
        {
            base.Initialize(api);

            string parentname = api.ReadString("ParentName", "");
            if (string.IsNullOrEmpty(parentname) == false)
            {
                foreach (ParentMeasure item in ParentMeasure.ParentMeasures)
                {
                    if (item.Name.Equals(parentname) && Skin == item.Skin)
                        _patentmeasure = item;
                }
            }
            if (_patentmeasure == null)
            {
                LogHelper.Error("ParentName= " + parentname + " 没找到");
                return;
            }

            _patentmeasure.Data.WeatherArrive += OnSourceUpdate;
        }
        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]);
                }
            }
        }
Esempio n. 26
0
 internal virtual void Initialize(Rainmeter.API api)
 {
     Name = api.GetMeasureName();
     Skin = api.GetSkin();
 }