Exemple #1
0
        public static void Initialize(ref IntPtr measurePtr, IntPtr apiPtr)
        {
            RainmeterAPI         api         = new RainmeterAPI(apiPtr);
            RainmeterSkinHandler skinHandler = RainmeterSkinHandler.GetSkinHandler(api);

            skinHandler.M_Initialize(ref measurePtr, api);
            RainmeterSkinHandler.AddMeasurePtr(measurePtr, skinHandler);
        }
Exemple #2
0
        internal static void AddMeasurePtr(IntPtr measurePtr, RainmeterSkinHandler skinHandler)
        {
            if (measurePtr == IntPtr.Zero)
            {
                return;
            }

            SkinHandlerByMeasurePtr.Add(measurePtr, skinHandler);
        }
Exemple #3
0
        public PluginSkin(RainmeterSkinHandler skinHandler, RainmeterAPI api)
        {
            SkinHandler = skinHandler;

            // -- We need to remove the last directory from path.
            var path = api.ReadPath(RainmeterSkinHandler.PluginMeasureName, string.Empty);
            var dir  = Directory.GetParent(path.EndsWith("\\") ? path : string.Concat(path, "\\"));

            Path = dir.Parent.FullName;
        }
Exemple #4
0
        internal static RainmeterSkinHandler GetSkinHandler(RainmeterAPI api)
        {
            IntPtr skinPtr = api.GetSkin();

            RainmeterSkinHandler skinHandler;

            if (!SkinHandlerBySkinPtr.TryGetValue(skinPtr, out skinHandler))
            {
                SkinHandlerBySkinPtr.Add(skinPtr, (skinHandler = new RainmeterSkinHandler(skinPtr, api.GetSkinName(), api.GetSkinWindow())));
            }
            return(skinHandler);
        }
Exemple #5
0
        public static void Finalize(IntPtr measurePtr)
        {
            RainmeterSkinHandler skinHandler = RainmeterSkinHandler.GetSkinHandlerByMeasurePtr(measurePtr);

            skinHandler.M_Finalize(measurePtr);

            if (measurePtr != IntPtr.Zero)
            {
                GCHandle.FromIntPtr(measurePtr).Free();
            }

            RainmeterSkinHandler.RemoveMeasurePtr(measurePtr);

            if (StringBuffer != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(StringBuffer);
                StringBuffer = IntPtr.Zero;
            }
        }
Exemple #6
0
        public static IntPtr GetString(IntPtr measurePtr)
        {
            RainmeterSkinHandler skinHandler = RainmeterSkinHandler.GetSkinHandlerByMeasurePtr(measurePtr);

            if (StringBuffer != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(StringBuffer);
                StringBuffer = IntPtr.Zero;
            }

            string stringValue = skinHandler.M_GetString(measurePtr);

            if (stringValue != null)
            {
                StringBuffer = Marshal.StringToHGlobalUni(stringValue);
            }

            return(StringBuffer);
        }
Exemple #7
0
        public static void ExecuteBang(IntPtr measurePtr, IntPtr argsPtr)
        {
            RainmeterSkinHandler skinHandler = RainmeterSkinHandler.GetSkinHandlerByMeasurePtr(measurePtr);

            skinHandler.M_ExecuteBang(measurePtr, Marshal.PtrToStringUni(argsPtr));
        }
Exemple #8
0
        public static double Update(IntPtr measurePtr)
        {
            RainmeterSkinHandler skinHandler = RainmeterSkinHandler.GetSkinHandlerByMeasurePtr(measurePtr);

            return(skinHandler.M_GetNumeric(measurePtr));
        }
Exemple #9
0
        public static void Reload(IntPtr measurePtr, IntPtr apiPtr, ref double maxValue)
        {
            RainmeterSkinHandler skinHandler = RainmeterSkinHandler.GetSkinHandlerByMeasurePtr(measurePtr);

            skinHandler.M_Reload(measurePtr, new RainmeterAPI(apiPtr), ref maxValue);
        }
Exemple #10
0
 // -- Add Base-Derived class support.
 private static PluginSkin CreatePluginSkin(Assembly assembly, string measureType, RainmeterSkinHandler skinHandler, RainmeterAPI api) =>
 (PluginSkin)Activator.CreateInstance(GetPluginSkinType(assembly, measureType), new object[] { skinHandler, api });