starting finaly

This commit is contained in:
Madpeter 2022-03-16 14:15:42 +00:00
parent 94d236fa50
commit 2477e4bb88
6 changed files with 159 additions and 54 deletions

View file

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Secondbot", "Secondbot", "{4388BA41-F3FC-4A0E-AA00-50E9ED45A027}"
EndProject
@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibreMetaverse.StructuredDa
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibreMetaverse.Types", "LibreMetaverse.Types\LibreMetaverse.Types.csproj", "{B37B02AD-0000-0000-0000-000000000000}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecondBotEvents", "SecondBotEvents\SecondBotEvents.csproj", "{571AB1AF-4C74-4C37-AC5B-9B63383AC791}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
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|x86.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -159,6 +179,7 @@ Global
{27C70F3A-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}
{571AB1AF-4C74-4C37-AC5B-9B63383AC791} = {4388BA41-F3FC-4A0E-AA00-50E9ED45A027}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EC43F382-FAF2-49CC-8E23-5DDF87592DFA}

View file

@ -5,12 +5,12 @@ using BetterSecondBotShared.Static;
using BetterSecondBot.bottypes;
using System.Threading;
using static BetterSecondBot.Program;
using BetterSecondbot.BetterAtHome;
using BetterSecondbot.DataStorage;
using BetterSecondbot.Tracking;
using BetterSecondbot.Adverts;
using BetterSecondbot.OnEvents;
using BetterSecondbot.BetterAtHome;
using BetterSecondbot.DataStorage;
using BetterSecondbot.Tracking;
using BetterSecondbot.Adverts;
using BetterSecondbot.OnEvents;
namespace BetterSecondBot
{
public class Cli
@ -25,39 +25,39 @@ namespace BetterSecondBot
protected onevent Events;
protected Datastorage datastorage;
public SecondBot getBot()
{
return Bot;
public SecondBot getBot()
{
return Bot;
}
public bool BotReady()
{
if (getBot() == null)
{
return false;
}
else if (getBot().GetClient == null)
{
return false;
}
else if (getBot().GetClient.Network == null)
{
return false;
}
else if (getBot().GetClient.Network.Connected == false)
{
return false;
}
else if (getBot().GetClient.Network.CurrentSim == null)
{
return false;
}
return getBot()._AllowActions;
public bool BotReady()
{
if (getBot() == null)
{
return false;
}
else if (getBot().GetClient == null)
{
return false;
}
else if (getBot().GetClient.Network == null)
{
return false;
}
else if (getBot().GetClient.Network.Connected == false)
{
return false;
}
else if (getBot().GetClient.Network.CurrentSim == null)
{
return false;
}
return getBot()._AllowActions;
}
public string getFolderUsed()
{
return use_folder;
public string getFolderUsed()
{
return use_folder;
}
protected void keep_alive()
@ -85,21 +85,21 @@ namespace BetterSecondBot
exitBot = true;
}
public void attachEventListenerObjects(JsonConfig Config, bool as_docker)
{
LogFormater.Info("HTTP service requested:" + Config.Http_Enable.ToString());
if (Config.Http_Enable == true)
{
new Thread(() =>
{
new HttpAsService(Bot, Config, as_docker);
}).Start();
}
Adverts = new advertsService(this, as_docker);
Events = new onevent(this, as_docker);
betterAtHomeService = new BetterAtHome(this, Config);
betterTracking = new BetterTracking(this);
datastorage = new Datastorage(this);
public void attachEventListenerObjects(JsonConfig Config, bool as_docker)
{
LogFormater.Info("HTTP service requested:" + Config.Http_Enable.ToString());
if (Config.Http_Enable == true)
{
new Thread(() =>
{
new HttpAsService(Bot, Config, as_docker);
}).Start();
}
Adverts = new advertsService(this, as_docker);
Events = new onevent(this, as_docker);
betterAtHomeService = new BetterAtHome(this, Config);
betterTracking = new BetterTracking(this);
datastorage = new Datastorage(this);
}
public Cli(JsonConfig Config, bool as_docker, bool use_self_keep_alive, string loadingFromFolder)
{
@ -110,13 +110,13 @@ namespace BetterSecondBot
{
Bot = new SecondBot();
Bot.setFolder(use_folder);
Bot.Setup(Config, AssemblyInfo.GetGitHash());
Bot.Setup(Config, AssemblyInfo.GetGitHash());
if (as_docker == true)
{
Bot.AsDocker();
}
Bot.Start(false);
attachEventListenerObjects(Config, as_docker);

View 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;
}
}
}

View file

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<StartupObject>SecondBotEvents.Startup</StartupObject>
</PropertyGroup>
</Project>

View 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");
}
}
}

View 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;
}
}