WriteConfig() public méthode

Writres the config to the file system.
public WriteConfig ( ) : bool
Résultat bool
Exemple #1
0
        /**
         * <summary>This method is registered as a delegate to Shutdown.OnExit and
         * will be called when ctrl-c is pressed by the user.  This stops services,
         * prevents the node from reincarnating, and then disconnects the node.
         * </summary>
         */
        public virtual void OnExit()
        {
            _running = false;

            if (_xrm != null)
            {
                _xrm.Stop();
                _xrm = null;
            }

            ApplicationNode appnode = _app_node;

            _app_node = null;

            NCService ncservice = null;

            if (appnode != null)
            {
                ncservice = appnode.NCService;
            }

            if (ncservice != null && _node_config.NCService.Checkpointing)
            {
                string checkpoint = ncservice.GetCheckpoint();
                string prev_cp    = _node_config.NCService.Checkpoint;
                string empty_cp   = (new Point()).ToString();
                if (!checkpoint.Equals(prev_cp) && !checkpoint.Equals(empty_cp))
                {
                    _node_config.NCService.Checkpoint = checkpoint;
                    _node_config.WriteConfig();
                }
            }

            _fe_stop_pem = Brunet.Util.FuzzyTimer.Instance.DoEvery(StopPem, 500, 500);
        }
Exemple #2
0
        public static int Main(String[] args)
        {
            P2PNodeParameters parameters = new P2PNodeParameters();

            if (parameters.Parse(args) != 0)
            {
                Console.WriteLine(parameters.ErrorMessage);
                parameters.ShowHelp();
                return(-1);
            }
            else if (parameters.Help)
            {
                parameters.ShowHelp();
                return(0);
            }

            NodeConfig node_config = parameters.NodeConfig;

            if (node_config.NodeAddress == null)
            {
                node_config.NodeAddress = Utils.GenerateAHAddress().ToString();
                node_config.WriteConfig();
            }

            BasicNode node = null;

            if (parameters.Count == 1)
            {
                node = new BasicNode(node_config);
            }
            else
            {
                node = new MultiNode(node_config, parameters.Count);
            }
            node.Run();

            return(0);
        }