mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added Skype to x86 wrapper
This commit is contained in:
parent
4743ff5cd3
commit
118d4b2df2
Binary file not shown.
@ -49,6 +49,10 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@ -59,12 +63,16 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Intergrations\IIntergrationManager.cs" />
|
||||
<Compile Include="Intergrations\IIntergrationModel.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SkypeManager.cs" />
|
||||
<Compile Include="Intergrations\Skype\SkypeManager.cs" />
|
||||
<Compile Include="Intergrations\Skype\SkypeModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="SKYPE4COMLib">
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
namespace Artemis86Wrapper.Intergrations
|
||||
{
|
||||
public interface IIntergrationManager
|
||||
{
|
||||
IIntergrationModel IntergrationModel { get; set; }
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
namespace Artemis86Wrapper.Intergrations
|
||||
{
|
||||
public interface IIntergrationModel
|
||||
{
|
||||
}
|
||||
}
|
||||
59
Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeManager.cs
Normal file
59
Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeManager.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Timers;
|
||||
using SKYPE4COMLib;
|
||||
|
||||
namespace Artemis86Wrapper.Intergrations.Skype
|
||||
{
|
||||
public class SkypeManager : IIntergrationManager
|
||||
{
|
||||
public SkypeManager()
|
||||
{
|
||||
IntergrationModel = new SkypeModel();
|
||||
LoopTimer = new Timer(5000);
|
||||
LoopTimer.Elapsed += UpdateSkype;
|
||||
}
|
||||
|
||||
public SKYPE4COMLib.Skype Skype { get; set; }
|
||||
public Timer LoopTimer { get; set; }
|
||||
|
||||
public IIntergrationModel IntergrationModel { get; set; }
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Skype = new SKYPE4COMLib.Skype();
|
||||
Skype.Attach();
|
||||
|
||||
LoopTimer.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
LoopTimer.Stop();
|
||||
Skype = null;
|
||||
}
|
||||
|
||||
private void UpdateSkype(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = (SkypeModel) IntergrationModel;
|
||||
|
||||
model.Name = Skype.CurrentUser.FullName;
|
||||
model.Status = Skype.CurrentUserStatus;
|
||||
model.MissedCalls = Skype.MissedCalls.Count;
|
||||
model.ActiveCalls = Skype.ActiveCalls.Count;
|
||||
model.UnreadMessages = 0;
|
||||
model.MissedCalls = model.MissedCalls = model.ActiveCalls;
|
||||
foreach (ChatMessage skypeMissedMessage in Skype.MissedMessages)
|
||||
if ((skypeMissedMessage.Type == TChatMessageType.cmeSaid) &&
|
||||
(skypeMissedMessage.Status != TChatMessageStatus.cmsRead) &&
|
||||
(skypeMissedMessage.FromHandle != Skype.CurrentUser.Handle))
|
||||
model.UnreadMessages++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// TODO: Log exception to main program
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeModel.cs
Normal file
13
Artemis/Artemis86Wrapper/Intergrations/Skype/SkypeModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using SKYPE4COMLib;
|
||||
|
||||
namespace Artemis86Wrapper.Intergrations.Skype
|
||||
{
|
||||
public class SkypeModel : IIntergrationModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int UnreadMessages { get; set; }
|
||||
public int MissedCalls { get; set; }
|
||||
public int ActiveCalls { get; set; }
|
||||
public TUserStatus Status { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Artemis86Wrapper.Intergrations.Skype;
|
||||
|
||||
namespace Artemis86Wrapper
|
||||
{
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Timers;
|
||||
using SKYPE4COMLib;
|
||||
|
||||
namespace Artemis86Wrapper
|
||||
{
|
||||
public class SkypeManager
|
||||
{
|
||||
private readonly Timer _loopTimer;
|
||||
|
||||
public SkypeManager()
|
||||
{
|
||||
_loopTimer = new Timer(5000);
|
||||
_loopTimer.Elapsed += UpdateSkype;
|
||||
}
|
||||
|
||||
public Skype Skype { get; set; }
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Skype = new Skype();
|
||||
_loopTimer.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_loopTimer.Stop();
|
||||
Skype = null;
|
||||
}
|
||||
|
||||
private void UpdateSkype(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Console.WriteLine("Missed messages: " + Skype.Messages.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
5
Artemis/Artemis86Wrapper/packages.config
Normal file
5
Artemis/Artemis86Wrapper/packages.config
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
|
||||
</packages>
|
||||
Loading…
x
Reference in New Issue
Block a user