Skip to content

Commit

Permalink
Merge DumpMindForDiscord with DumpMind
Browse files Browse the repository at this point in the history
  • Loading branch information
aronson committed Aug 23, 2023
1 parent 095060f commit ffbca3a
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 169 deletions.
7 changes: 0 additions & 7 deletions WalkMind.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "DumpMind", "src\DumpMind\Du
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LearnMind", "src\LearnMind\LearnMind.csproj", "{0EE9EC5B-21E8-445D-8AB3-B87E48803E14}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "DumpMindForDiscord", "src\DumpMindForDiscord\DumpMindForDiscord.fsproj", "{006E769F-34D5-4A7C-BC3C-B901962E952E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -43,10 +41,6 @@ Global
{0EE9EC5B-21E8-445D-8AB3-B87E48803E14}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EE9EC5B-21E8-445D-8AB3-B87E48803E14}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EE9EC5B-21E8-445D-8AB3-B87E48803E14}.Release|Any CPU.Build.0 = Release|Any CPU
{006E769F-34D5-4A7C-BC3C-B901962E952E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{006E769F-34D5-4A7C-BC3C-B901962E952E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{006E769F-34D5-4A7C-BC3C-B901962E952E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{006E769F-34D5-4A7C-BC3C-B901962E952E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -57,7 +51,6 @@ Global
{313C98F3-0E4E-43D4-8127-378D3D7B2EDA} = {D2A74C4C-1E22-48DA-9220-121D34648266}
{5D857919-0ED8-4D55-A31A-ED8DC4F39315} = {D2A74C4C-1E22-48DA-9220-121D34648266}
{0EE9EC5B-21E8-445D-8AB3-B87E48803E14} = {D2A74C4C-1E22-48DA-9220-121D34648266}
{006E769F-34D5-4A7C-BC3C-B901962E952E} = {D2A74C4C-1E22-48DA-9220-121D34648266}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0F767407-253D-46E3-9B26-6A9A0595AD61}
Expand Down
4 changes: 2 additions & 2 deletions src/DumpMind/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0"/>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
7 changes: 7 additions & 0 deletions src/DumpMind/DumpMind.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@
<OtherFlags>--warnon:1182</OtherFlags>
</PropertyGroup>
<ItemGroup>
<Reference Include="DiscordRPC, Version=1.2.1.24, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\DiscordRichPresence.1.2.1.24\lib\net45\DiscordRPC.dll</HintPath>
</Reference>
<Reference Include="FSharp.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\FSharp.Core.7.0.300\lib\netstandard2.0\FSharp.Core.dll</HintPath>
</Reference>
<Reference Include="FSharp.Json, Version=0.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\FSharp.Json.0.4.1\lib\netstandard2.0\FSharp.Json.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NHotkey, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a76ffb086700b11c, processorArchitecture=MSIL">
<HintPath>..\..\packages\NHotkey.2.1.1\lib\net45\NHotkey.dll</HintPath>
</Reference>
Expand All @@ -54,6 +60,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="Status.fs" />
<Compile Include="Program.fs" />
<Content Include="packages.config" />
</ItemGroup>
Expand Down
35 changes: 34 additions & 1 deletion src/DumpMind/Program.fs
Original file line number Diff line number Diff line change
@@ -1,15 +1,48 @@
open System
open System.Threading
open System.Threading.Tasks
open DiscordRPC
open DiscordRPC.Logging
open FSharp.Json
open NHotkey.WindowsForms
open System.Windows.Forms
open WalkMind.Memory
open DumpMind.Status


let discord () =
Task.Run(fun () ->
use client = new DiscordRpcClient("914720093701832724")
client.Logger <- ConsoleLogger(Level = LogLevel.Warning)
client.OnReady.Add(fun message -> printfn "Received Ready from user %s" message.User.Username)
client.OnPresenceUpdate.Add(fun message -> printfn "Received Update! %s" message.Presence.Details)
client.Initialize() |> ignore

let memory = Memory()

let rec loop actionReady =
Thread.Sleep(5000)

if actionReady <> memory.actionReadyValue then
client.SetPresence(getPresence ())
loop memory.actionReadyValue
else
loop actionReady

let handleCtrlC (args: ConsoleCancelEventArgs) = args.Cancel <- true

Console.CancelKeyPress.Add(handleCtrlC)
loop -1)

[<EntryPoint>]
[<STAThread>]
let main _ =
let main args =
try
let memory = Memory()

// Discord integration can be disabled with any argument
if args.Length = 0 then discord () |> ignore else ()

let getPlayerString () =
Option.get memory.player.entity |> Json.serialize

Expand Down
28 changes: 2 additions & 26 deletions src/DumpMindForDiscord/Program.fs → src/DumpMind/Status.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
open System
open System.Threading
module DumpMind.Status

open DiscordRPC
open DiscordRPC.Logging
open WalkMind.Domain
open WalkMind.Memory
open WalkMind.Model
Expand Down Expand Up @@ -115,26 +114,3 @@ let getPresence () =
Assets =
Assets(LargeImageKey = "cogmind_logo", LargeImageText = "Cogmind b13 X1", SmallImageKey = getPropType ())
)

[<EntryPoint>]
let main _ =
use client = new DiscordRpcClient("914720093701832724")
client.Logger <- ConsoleLogger(Level = LogLevel.Warning)
client.OnReady.Add(fun message -> printfn "Received Ready from user %s" message.User.Username)
client.OnPresenceUpdate.Add(fun message -> printfn "Received Update! %s" message.Presence.Details)
client.Initialize() |> ignore

let rec loop actionReady =
Thread.Sleep(5000)
if actionReady <> memory.actionReadyValue then
client.SetPresence(getPresence ())
loop memory.actionReadyValue
else
loop actionReady

let handleCtrlC (args: ConsoleCancelEventArgs) =
args.Cancel <- true

Console.CancelKeyPress.Add(handleCtrlC)
loop -1
0 // return an integer exit code
12 changes: 7 additions & 5 deletions src/DumpMind/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FSharp.Core" version="7.0.300" targetFramework="net481"/>
<package id="FSharp.Compiler.Tools" version="10.2.3" targetFramework="net481"/>
<package id="FSharp.Json" version="0.4.1" targetFramework="net481"/>
<package id="NHotkey" version="2.1.1" targetFramework="net481"/>
<package id="NHotkey.WindowsForms" version="2.1.1" targetFramework="net481"/>
<package id="DiscordRichPresence" version="1.2.1.24" targetFramework="net481" />
<package id="FSharp.Core" version="7.0.300" targetFramework="net481" />
<package id="FSharp.Compiler.Tools" version="10.2.3" targetFramework="net481" />
<package id="FSharp.Json" version="0.4.1" targetFramework="net481" />
<package id="NHotkey" version="2.1.1" targetFramework="net481" />
<package id="NHotkey.WindowsForms" version="2.1.1" targetFramework="net481" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net481" />
</packages>
10 changes: 0 additions & 10 deletions src/DumpMindForDiscord/App.config

This file was deleted.

41 changes: 0 additions & 41 deletions src/DumpMindForDiscord/AssemblyInfo.fs

This file was deleted.

70 changes: 0 additions & 70 deletions src/DumpMindForDiscord/DumpMindForDiscord.fsproj

This file was deleted.

7 changes: 0 additions & 7 deletions src/DumpMindForDiscord/packages.config

This file was deleted.

0 comments on commit ffbca3a

Please sign in to comment.