Ejemplo n.º 1
0
        public static void ClassInitialize(TestContext value)
        {
            PlatformUtilities.RegisterImplementations();
            PlatformUtilities.GetImplementation <IPlatformInitialization>().Initialize();
            UnitRegistry.InitializeTypes();
            UnitRegistry.ScanDefaultDirectories();

            File.WriteAllText(path, contents);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Log.Info("SharpInit starting");

            PlatformUtilities.RegisterImplementations();
            PlatformUtilities.GetImplementation <IPlatformInitialization>().Initialize();

            Log.Info("Platform initialization complete");

            UnitRegistry.InitializeTypes();
            UnitRegistry.ScanDefaultDirectories();

            Log.Info($"Loaded {UnitRegistry.Units.Count} units");

            UnitRegistry.UnitStateChange += StateChangeHandler;

            Log.Info("Registering IPC context...");

            var context = new ServerIpcContext();

            IpcFunctionRegistry.AddFunction(DynamicIpcFunction.FromContext(context));

            Log.Info("Starting IPC listener...");

            var ipc_listener = new IpcListener();

            ipc_listener.StartListening();

            Log.Info($"Listening on {ipc_listener.SocketEndPoint}");

            if (UnitRegistry.GetUnit("default.target") != null)
            {
                Log.Info("Activating default.target...");
                var result = UnitRegistry.CreateActivationTransaction("default.target").Execute();

                if (result.Type == Tasks.ResultType.Success)
                {
                    Log.Info("Successfully activated default.target.");
                }
                else
                {
                    Log.Info($"Error while activating default.target: {result.Type}, {result.Message}");
                }
            }

            Console.CancelKeyPress += (s, e) =>
            {
                ipc_listener.StopListening();
            };

            Thread.Sleep(-1);
        }
Ejemplo n.º 3
0
        public static void ClassInitialize(TestContext value)
        {
            PlatformUtilities.RegisterImplementations();
            PlatformUtilities.GetImplementation <IPlatformInitialization>().Initialize();
            UnitRegistry.InitializeTypes();

            Random rnd           = new Random();
            var    random_buffer = new byte[8];

            rnd.NextBytes(random_buffer);
            DirectoryName = BitConverter.ToString(random_buffer).Replace("-", "").ToLower();
            Directory.CreateDirectory(DirectoryName);

            File.WriteAllText(TestUnitPath, TestUnitContents);
        }
Ejemplo n.º 4
0
 public void Initialize()
 {
     UnitRegistry.InitializeTypes();
     UnitRegistry.CreateBaseUnits();
 }