private void PathHelperOnResolvingAbsolutePath(object sender, ResolvePathEventArgs e)
 {
     if (sender is DebugRGBDevice debugRgbDevice)
     {
         if (debugRgbDevice.LayoutPath.Contains("\\Layouts\\"))
         {
             string rootDirectory = debugRgbDevice.LayoutPath.Split("\\Layouts")[0];
             e.FinalPath = Path.Combine(rootDirectory, e.RelativePath);
         }
     }
 }
Example #2
0
 private void ResolveCorsairPath(object sender, ResolvePathEventArgs e)
 {
     if (sender.GetType().IsGenericType(typeof(CorsairRGBDevice <>)))
     {
         // Start from the plugin directory
         if (e.RelativePart != null && e.FileName != null)
         {
             e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePart, e.FileName);
         }
         else if (e.RelativePath != null)
         {
             e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePath);
         }
     }
 }
Example #3
0
 protected void ResolveAbsolutePath(Type type, object sender, ResolvePathEventArgs e)
 {
     if (sender.GetType().IsGenericType(type))
     {
         Debug.WriteLine(e.RelativePart);
         Debug.WriteLine(e.FileName);
         // Start from the plugin directory
         if (e.RelativePart != null && e.FileName != null)
         {
             e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePart, e.FileName);
         }
         else if (e.RelativePath != null)
         {
             e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePath);
         }
     }
 }
Example #4
0
        /// <summary>
        /// </summary>
        /// <param name="type"></param>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ResolveAbsolutePath(Type type, object sender, ResolvePathEventArgs e)
        {
            if (sender.GetType() == type || sender.GetType().IsGenericType(type))
            {
                // Start from the plugin directory
                if (e.RelativePart != null && e.FileName != null)
                {
                    e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePart, e.FileName);
                }
                else if (e.RelativePath != null)
                {
                    e.FinalPath = Path.Combine(PluginInfo.Directory.FullName, e.RelativePath);
                }

                IRGBDeviceInfo deviceInfo = ((IRGBDevice)sender).DeviceInfo;
                if (e.FileName != null && !File.Exists(e.FinalPath))
                {
                    Logger?.Information("Couldn't find a layout for device {deviceName}, model {deviceModel} at {filePath}",
                                        deviceInfo.DeviceName, deviceInfo.Model, e.FinalPath);
                }
            }
        }