forked from dota2tools/RTSSSharedMemoryPythonNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
59 lines (50 loc) · 1.99 KB
/
Program.cs
File metadata and controls
59 lines (50 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Linq;
using RTSSSharedMemoryNET;
namespace RTSSDemo
{
class Program
{
static void Main(string[] args)
{
//enforces a nice cleanup
//just hitting X or Ctrl+C normally won't actually dispose the using() below
ExitHandler.Init(ctrlType => {
Console.WriteLine("\nCleaning up and exiting...");
return true; //cancel event
});
///////////////////////////////////////////////////////////////////
Console.WriteLine("Current OSD entries:");
var osdEntries = OSD.GetOSDEntries();
foreach( var osd in osdEntries )
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine(osd.Owner);
Console.ResetColor();
Console.WriteLine("{0}\n", osd.Text);
}
///////////////////////////////////////////////////////////////////
Console.WriteLine("Current app entries with GPU contexts:");
var appEntries = OSD.GetAppEntries().Where( x => (x.Flags & AppFlags.MASK) != AppFlags.None ).ToArray();
foreach( var app in appEntries )
{
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("{0}:{1}", app.ProcessId, app.Name);
Console.ResetColor();
Console.WriteLine("{0}, {1}FPS", app.Flags, app.InstantaneousFrames);
}
Console.WriteLine();
///////////////////////////////////////////////////////////////////
using( var osd = new OSD("RTSSDemo") )
while( true )
{
Console.WriteLine("Enter some text:");
var text = Console.ReadLine();
//if we hit Ctrl+C while waiting for ReadLine, it returns null
if( text == null )
break;
osd.Update(text);
}
}
}
}