- Thread starter
- Moderator
- #11
Initital Atmolight Atmolight plugin .
Start code, if AtmowinA.exe is not detected !
@tourettes , you see an error in code ?
Code:
using System;
using System.Collections.Generic;
using System.Text;
using MediaPortal.GUI.Library;
using MediaPortal.Profile;
using MediaPortal.Player;
using System.Diagnostics;
using System.Threading;
using System.Runtime.InteropServices;
using AtmoWinRemoteControl;
using System.Drawing;
using System.IO;
using Microsoft.DirectX.Direct3D;
using MediaPortal.Dialogs;
namespace MediaPortal.ProcessPlugins.Atmolight
{
public class AtmolightPlugin: ISetupForm, IPlugin
{
#region Variables
private IAtmoRemoteControl2 atmoCtrl=null;
private IAtmoLiveViewControl atmoLiveViewCtrl = null;
private int captureWidth = 0;
private int captureHeight = 0;
private Surface rgbSurface = null;
private ContentEffect currentEffect = ContentEffect.LEDs_disabled;
#endregion
[DllImport("AtmoDXUtil.dll", PreserveSig = false, CharSet = CharSet.Auto)]
private static extern void VideoSurfaceToRGBSurfaceExt(IntPtr src,int srcWidth,int srcHeight, IntPtr dst,int dstWidth,int dstHeight);
public AtmolightPlugin()
{
AtmolightSettings.LoadSettings();
Log.Info("atmolight: Trying to connect to atmowina.exe...");
if (!ConnectToAtmoWinA())
{
Log.Warn("atmolight: AtmoWinA.exe not started. Trying to launch...");
if (!StartAtmoWinA())
{
Log.Error("atmolight: Can't start atmowin.exe. Atmolight control won't work :(");
return;
}
if (!ConnectToAtmoWinA())
{
Log.Error("atmolight: AtmoWinA started but still can't connect. Atmolight control won't work :(");
return;
}
}
}
Start code, if AtmowinA.exe is not detected !
Code:
private bool StartAtmoWinA()
{
if (!System.IO.File.Exists(AtmolightSettings.atmowinExe))
{
Log.Error("atmolight: atmowina.exe not found.");
return false;
}
Process app = new Process();
app.StartInfo.FileName = AtmolightSettings.atmowinExe;
app.StartInfo.UseShellExecute = true;
app.StartInfo.Verb = "open";
bool ret = true;
try
{
ret = app.Start();
}
catch (Exception)
{
return false;
}
System.Threading.Thread.Sleep(1000);
return ret;
@tourettes , you see an error in code ?