public HuntHandler(string id, HunterProfile profile, string targetPath) { // Assign parameters _cachedProfile = profile; ID = id; // Default properties Log = new ConcurrentBag <string>(); HunterSessionOptions sessionOptions = 0; // Establish default set of options sessionOptions |= HunterSessionOptions.Events; sessionOptions |= HunterSessionOptions.Logging; sessionOptions |= HunterSessionOptions.Progress; sessionOptions |= HunterSessionOptions.Threaded; sessionOptions |= HunterSessionOptions.Analytics; // Create new session _session = new HunterSession(profile, ID, targetPath, Settings.DefaultConfig, sessionOptions); // Subscribe to events _session.OnComplete += OnComplete; _session.OnProcess += OnProcess; _session.Log.AddLogEventHandler(OnLogEvent); }
/// <summary> /// Return the long format of the client version information. /// </summary> /// <returns>A long format version string.</returns> /// <param name="session">A HunterProfile with a defined client version.</param> public static string ClientVersionString(HunterProfile session) { #if __MACOS__ return("Galileo.Client.Mac-" + session.ClientVersion); #elif __WINDOWS__ return("Galileo.Client.Win-" + session.ClientVersion); #elif __LINUX__ return("Galileo.Client.Linux-" + session.ClientVersion); #else return("Galileo.Client.Platform-" + session.ClientVersion); #endif }
/// <summary> /// The entry point of the program, where the program control starts and ends /// </summary> /// <param name="args">The command-line arguments</param> static void Main(string[] args) { // Start up Galileo Instance.Initialize(HunterProfile.Create("2019.1.0", Assembly.GetAssembly(typeof(Settings)).GetName().Version, Settings.Localization)); // Handle client command line arguments Client.CommandLineOptions commandLine = new Client.CommandLineOptions(args); // Handle server specific command lines arguments CommandLineOptions serverCommandLine = new CommandLineOptions(args); if (commandLine.HelpRequested || commandLine.ShouldQuit) { return; } // Point it in the right direction HuntHandler handler = null; if (!string.IsNullOrEmpty(serverCommandLine.TargetFolder)) { handler = new HuntHandler(HuntHandler.CreateID(), Instance.Profile, serverCommandLine.TargetFolder); } else { handler = HuntHandler.Create(HuntHandler.CreateID(), Instance.Profile); } // Create our loop stopper handler.OnProcessComplete += delegate { _isProcessing = false; }; handler.OnProcessLogEvent += (string id, string line) => { Console.WriteLine(line); }; // Point it in the right direction if (!string.IsNullOrEmpty(serverCommandLine.TargetFolder)) { // Setup data directory? handler.PreProcess(); // Go! handler.Process(); } else { Console.WriteLine("CLI.Process.NoTarget".Translate()); return; } // Loop while (_isProcessing) { } }
public static HuntHandler Create(string id, HunterProfile profile) { return(new HuntHandler(id, profile, Settings.DefaultFolder)); }
/// <summary> /// Return the long format of the core version information. /// </summary> /// <returns>The long format version string.</returns> /// <param name="session">A HunterProfile with a defined core version.</param> public static string CoreLibraryVersionString(HunterProfile session) { return("Galileo.Core-" + session.CoreLibraryVersion); }