Beispiel #1
0
        public void Main(ServerContext context)
        {
            var ctx = new IpfsInstanceContext(context, GetPlatformBase());

            IpfsInstance = new IpfsInstance(ctx);
            IpfsInstance.Start();
        }
Beispiel #2
0
        public IpfsInstance(IpfsInstanceContext context)
        {
            Context = context;

            ExecutingDirectory = new FileInfo(GetType().Assembly.Location).Directory;

            WorkspaceDirectory = context.WorkspaceDirectory;
            Platform           = context.Platform;

            if (!context.WorkspaceDirectory.Exists)
            {
                context.WorkspaceDirectory.Create();
            }

            if (!IsInstalled())
            {
                context.Platform.Install(this);
            }

            Messenger = new IpfsMessenger(this);

            Daemon.StateChangedAction = m =>
            {
                Messenger.SendIpfsStatus();
            };
        }
Beispiel #3
0
        public void Main(ServerContext context)
        {
            var ctx  = new IpfsInstanceContext(context, GetPlatformBase());
            var ipfs = new IpfsInstance(ctx);

            Messenger = new IpfsMessenger(context, ipfs);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            var logger = new ConsoleLogger();

            var dir = new DirectoryInfo("c://tmp//ipfs-ext");

            var pc = new ServerContext("..//..//..//..//..//..//instance/prime-server.config");

            var ctx = new IpfsInstanceContext(pc, new IpfsWin64(new IpfsWin64Extension()))
            {
                Logger = logger
            };

            var ipfs = new IpfsInstance(ctx);

            ipfs.Daemon.Start();

            /* cleanup */
            bool ConsoleEventCallback(int eventType)
            {
                if (eventType == 2)
                {
                    Stop(ipfs);
                }
                return(false);
            }

            handler = new ConsoleEventDelegate(ConsoleEventCallback);
            SetConsoleCtrlHandler(handler, true);
            /* cleanup */

            Console.ReadLine();
            Stop(ipfs);
        }
Beispiel #5
0
        public IpfsInstance(IpfsInstanceContext context)
        {
            Context        = context;
            Context.Logger = Context.Logger ?? new NullLogger();

            ExecutingDirectory = new FileInfo(GetType().Assembly.Location).Directory;

            WorkspaceDirectory = context.WorkspaceDirectory;
            Platform           = context.Platform;

            if (!context.WorkspaceDirectory.Exists)
            {
                context.WorkspaceDirectory.Create();
            }

            if (!IsInstalled())
            {
                context.Platform.Install(this);
            }
        }