Burathar
5 years ago
1 changed files with 48 additions and 49 deletions
@ -1,50 +1,49 @@ |
|||||||
using Colore; |
using Colore; |
||||||
using Colore.Data; |
using Colore.Data; |
||||||
using Colore.Effects.Keyboard; |
using Colore.Effects.Keyboard; |
||||||
using System; |
using System; |
||||||
using System.Threading; |
using System.Threading; |
||||||
|
|
||||||
namespace ChromaEffectsImporter |
namespace ChromaEffectsImporter |
||||||
{ |
{ |
||||||
internal class ColoreOutput |
internal class ColoreOutput |
||||||
{ |
{ |
||||||
private IChroma chroma; |
private IChroma chroma; |
||||||
|
|
||||||
private string ChromaEffectPath; |
private string ChromaEffectPath; |
||||||
|
|
||||||
public ColoreOutput(string chromaEffectPath) |
public ColoreOutput(string chromaEffectPath) |
||||||
{ |
{ |
||||||
ChromaEffectPath = chromaEffectPath; |
ChromaEffectPath = chromaEffectPath; |
||||||
} |
} |
||||||
|
|
||||||
public void Start() |
public void Start() |
||||||
{ |
{ |
||||||
Setup(); |
Setup(); |
||||||
LoadChromaEffect(ChromaEffectPath); |
LoadChromaEffect(ChromaEffectPath); |
||||||
Thread.Sleep(1000); |
Thread.Sleep(1000); |
||||||
chroma.Keyboard.SetKeyAsync(Key.End, Color.Red, false); |
Loop(); |
||||||
Loop(); |
} |
||||||
} |
|
||||||
|
private void LoadChromaEffect(string path) |
||||||
private void LoadChromaEffect(string path) |
{ |
||||||
{ |
ChromaEffectsReader reader = new ChromaEffectsReader(); |
||||||
ChromaEffectsReader reader = new ChromaEffectsReader(); |
EffectRegion[] regions = reader.ReadFirstStatic(path); |
||||||
EffectRegion[] regions = reader.ReadFirstStatic(path); |
Array.ForEach(regions, x => x.Show(chroma)); |
||||||
Array.ForEach(regions, x => x.Show(chroma)); |
} |
||||||
} |
|
||||||
|
private async void Setup() |
||||||
private async void Setup() |
{ |
||||||
{ |
chroma = await ColoreProvider.CreateNativeAsync(); |
||||||
chroma = await ColoreProvider.CreateNativeAsync(); |
} |
||||||
} |
|
||||||
|
private void Loop() |
||||||
private void Loop() |
{ |
||||||
{ |
while (true) |
||||||
while (true) |
{ |
||||||
{ |
Thread.Sleep(100); |
||||||
Thread.Sleep(100); |
} |
||||||
} |
chroma.UninitializeAsync(); |
||||||
chroma.UninitializeAsync(); |
} |
||||||
} |
} |
||||||
} |
|
||||||
} |
} |
Loading…
Reference in new issue