starting finaly
This commit is contained in:
parent
94d236fa50
commit
2477e4bb88
6 changed files with 159 additions and 54 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.30907.101
|
VisualStudioVersion = 17.1.32228.430
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Secondbot", "Secondbot", "{4388BA41-F3FC-4A0E-AA00-50E9ED45A027}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Secondbot", "Secondbot", "{4388BA41-F3FC-4A0E-AA00-50E9ED45A027}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibreMetaverse.StructuredDa
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibreMetaverse.Types", "LibreMetaverse.Types\LibreMetaverse.Types.csproj", "{B37B02AD-0000-0000-0000-000000000000}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibreMetaverse.Types", "LibreMetaverse.Types\LibreMetaverse.Types.csproj", "{B37B02AD-0000-0000-0000-000000000000}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecondBotEvents", "SecondBotEvents\SecondBotEvents.csproj", "{571AB1AF-4C74-4C37-AC5B-9B63383AC791}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -148,6 +150,24 @@ Global
|
||||||
{B37B02AD-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64
|
{B37B02AD-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64
|
||||||
{B37B02AD-0000-0000-0000-000000000000}.Release|x86.ActiveCfg = Release|x86
|
{B37B02AD-0000-0000-0000-000000000000}.Release|x86.ActiveCfg = Release|x86
|
||||||
{B37B02AD-0000-0000-0000-000000000000}.Release|x86.Build.0 = Release|x86
|
{B37B02AD-0000-0000-0000-000000000000}.Release|x86.Build.0 = Release|x86
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.DockerBuild|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.DockerBuild|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.DockerBuild|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.DockerBuild|x64.Build.0 = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.DockerBuild|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.DockerBuild|x86.Build.0 = Debug|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -159,6 +179,7 @@ Global
|
||||||
{27C70F3A-0000-0000-0000-000000000000} = {E9B97D05-D5FB-4CA9-99C3-839248621C21}
|
{27C70F3A-0000-0000-0000-000000000000} = {E9B97D05-D5FB-4CA9-99C3-839248621C21}
|
||||||
{89D7A3E5-0000-0000-0000-000000000000} = {E9B97D05-D5FB-4CA9-99C3-839248621C21}
|
{89D7A3E5-0000-0000-0000-000000000000} = {E9B97D05-D5FB-4CA9-99C3-839248621C21}
|
||||||
{B37B02AD-0000-0000-0000-000000000000} = {E9B97D05-D5FB-4CA9-99C3-839248621C21}
|
{B37B02AD-0000-0000-0000-000000000000} = {E9B97D05-D5FB-4CA9-99C3-839248621C21}
|
||||||
|
{571AB1AF-4C74-4C37-AC5B-9B63383AC791} = {4388BA41-F3FC-4A0E-AA00-50E9ED45A027}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {EC43F382-FAF2-49CC-8E23-5DDF87592DFA}
|
SolutionGuid = {EC43F382-FAF2-49CC-8E23-5DDF87592DFA}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ using BetterSecondBotShared.Static;
|
||||||
using BetterSecondBot.bottypes;
|
using BetterSecondBot.bottypes;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using static BetterSecondBot.Program;
|
using static BetterSecondBot.Program;
|
||||||
using BetterSecondbot.BetterAtHome;
|
using BetterSecondbot.BetterAtHome;
|
||||||
using BetterSecondbot.DataStorage;
|
using BetterSecondbot.DataStorage;
|
||||||
using BetterSecondbot.Tracking;
|
using BetterSecondbot.Tracking;
|
||||||
using BetterSecondbot.Adverts;
|
using BetterSecondbot.Adverts;
|
||||||
using BetterSecondbot.OnEvents;
|
using BetterSecondbot.OnEvents;
|
||||||
|
|
||||||
namespace BetterSecondBot
|
namespace BetterSecondBot
|
||||||
{
|
{
|
||||||
public class Cli
|
public class Cli
|
||||||
|
|
@ -25,39 +25,39 @@ namespace BetterSecondBot
|
||||||
protected onevent Events;
|
protected onevent Events;
|
||||||
protected Datastorage datastorage;
|
protected Datastorage datastorage;
|
||||||
|
|
||||||
public SecondBot getBot()
|
public SecondBot getBot()
|
||||||
{
|
{
|
||||||
return Bot;
|
return Bot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool BotReady()
|
public bool BotReady()
|
||||||
{
|
{
|
||||||
if (getBot() == null)
|
if (getBot() == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (getBot().GetClient == null)
|
else if (getBot().GetClient == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (getBot().GetClient.Network == null)
|
else if (getBot().GetClient.Network == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (getBot().GetClient.Network.Connected == false)
|
else if (getBot().GetClient.Network.Connected == false)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (getBot().GetClient.Network.CurrentSim == null)
|
else if (getBot().GetClient.Network.CurrentSim == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return getBot()._AllowActions;
|
return getBot()._AllowActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string getFolderUsed()
|
public string getFolderUsed()
|
||||||
{
|
{
|
||||||
return use_folder;
|
return use_folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void keep_alive()
|
protected void keep_alive()
|
||||||
|
|
@ -85,21 +85,21 @@ namespace BetterSecondBot
|
||||||
exitBot = true;
|
exitBot = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void attachEventListenerObjects(JsonConfig Config, bool as_docker)
|
public void attachEventListenerObjects(JsonConfig Config, bool as_docker)
|
||||||
{
|
{
|
||||||
LogFormater.Info("HTTP service requested:" + Config.Http_Enable.ToString());
|
LogFormater.Info("HTTP service requested:" + Config.Http_Enable.ToString());
|
||||||
if (Config.Http_Enable == true)
|
if (Config.Http_Enable == true)
|
||||||
{
|
{
|
||||||
new Thread(() =>
|
new Thread(() =>
|
||||||
{
|
{
|
||||||
new HttpAsService(Bot, Config, as_docker);
|
new HttpAsService(Bot, Config, as_docker);
|
||||||
}).Start();
|
}).Start();
|
||||||
}
|
}
|
||||||
Adverts = new advertsService(this, as_docker);
|
Adverts = new advertsService(this, as_docker);
|
||||||
Events = new onevent(this, as_docker);
|
Events = new onevent(this, as_docker);
|
||||||
betterAtHomeService = new BetterAtHome(this, Config);
|
betterAtHomeService = new BetterAtHome(this, Config);
|
||||||
betterTracking = new BetterTracking(this);
|
betterTracking = new BetterTracking(this);
|
||||||
datastorage = new Datastorage(this);
|
datastorage = new Datastorage(this);
|
||||||
}
|
}
|
||||||
public Cli(JsonConfig Config, bool as_docker, bool use_self_keep_alive, string loadingFromFolder)
|
public Cli(JsonConfig Config, bool as_docker, bool use_self_keep_alive, string loadingFromFolder)
|
||||||
{
|
{
|
||||||
|
|
@ -110,13 +110,13 @@ namespace BetterSecondBot
|
||||||
{
|
{
|
||||||
Bot = new SecondBot();
|
Bot = new SecondBot();
|
||||||
Bot.setFolder(use_folder);
|
Bot.setFolder(use_folder);
|
||||||
Bot.Setup(Config, AssemblyInfo.GetGitHash());
|
Bot.Setup(Config, AssemblyInfo.GetGitHash());
|
||||||
|
|
||||||
if (as_docker == true)
|
if (as_docker == true)
|
||||||
{
|
{
|
||||||
Bot.AsDocker();
|
Bot.AsDocker();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bot.Start(false);
|
Bot.Start(false);
|
||||||
|
|
||||||
attachEventListenerObjects(Config, as_docker);
|
attachEventListenerObjects(Config, as_docker);
|
||||||
|
|
|
||||||
47
SecondBotEvents/EventsSecondBot.cs
Normal file
47
SecondBotEvents/EventsSecondBot.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
using SecondBotEvents.Services;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace SecondBotEvents
|
||||||
|
{
|
||||||
|
internal class Startup
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Welcome to Secondbot [Events build] version: " + AssemblyInfo.GetGitHash());
|
||||||
|
EventsSecondBot worker = new EventsSecondBot();
|
||||||
|
|
||||||
|
while(worker.exit() == false)
|
||||||
|
{
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class EventsSecondBot
|
||||||
|
{
|
||||||
|
protected http HttpService = null;
|
||||||
|
public EventsSecondBot()
|
||||||
|
{
|
||||||
|
HttpService = new http(this);
|
||||||
|
}
|
||||||
|
public bool exit()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AssemblyInfo
|
||||||
|
{
|
||||||
|
/// <summary> Gets the git hash value from the assembly
|
||||||
|
/// or null if it cannot be found. </summary>
|
||||||
|
public static string GetGitHash()
|
||||||
|
{
|
||||||
|
var asm = typeof(AssemblyInfo).Assembly;
|
||||||
|
var attrs = asm.GetCustomAttributes<AssemblyMetadataAttribute>();
|
||||||
|
return attrs.FirstOrDefault(a => a.Key == "GitHash")?.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
SecondBotEvents/SecondBotEvents.csproj
Normal file
9
SecondBotEvents/SecondBotEvents.csproj
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
<StartupObject>SecondBotEvents.Startup</StartupObject>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
16
SecondBotEvents/Services/HTTP/http.cs
Normal file
16
SecondBotEvents/Services/HTTP/http.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SecondBotEvents.Services
|
||||||
|
{
|
||||||
|
internal class http
|
||||||
|
{
|
||||||
|
protected EventsSecondBot master;
|
||||||
|
public http(EventsSecondBot setMaster)
|
||||||
|
{
|
||||||
|
master = setMaster;
|
||||||
|
Console.WriteLine("Starting HTTP service");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
SecondBotEvents/Services/HTTP/http_config.cs
Normal file
12
SecondBotEvents/Services/HTTP/http_config.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SecondBotEvents.Services.HTTP
|
||||||
|
{
|
||||||
|
public class http_config
|
||||||
|
{
|
||||||
|
public int port = 8080;
|
||||||
|
public bool enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue