Ejemplo n.º 1
0
 // Her laves først en midlertidig klasse, og så laves eleven, så man kan slette den elev man vælger under listen
 // så ikke den sletter den senest tilføjede. Derfor laves den midlertidige klasse så hvert nyt objekt sin egen værdi
 public void addnyelev()
 {
     Model.klasseinfo TempKlasseinfo = new Model.klasseinfo();
     TempKlasseinfo.ForNavn   = Nyelev.ForNavn;
     TempKlasseinfo.EfterNavn = Nyelev.EfterNavn;
     TempKlasseinfo.Email     = Nyelev.Email;
     TempKlasseinfo.GitNavn   = Nyelev.GitNavn;
     TempKlasseinfo.MobilNr   = Nyelev.MobilNr;
     Listen.Add(TempKlasseinfo);
 }
Ejemplo n.º 2
0
        //public RelayCommand AddElevCommand { get; set; }

        public void AddNyElev()
        {
            Model.KlasseInfo TempKlasseInfo = new Model.KlasseInfo();
            TempKlasseInfo.Fornavn   = nyElev.Fornavn;
            TempKlasseInfo.Efternavn = nyElev.Efternavn;
            TempKlasseInfo.Email     = nyElev.Email;
            TempKlasseInfo.GitNavn   = nyElev.GitNavn;
            TempKlasseInfo.MobilNr   = nyElev.MobilNr;
            Listen.Add(TempKlasseInfo);
        }
Ejemplo n.º 3
0
        public TumblerConfiguration LoadArgs(String[] args)
        {
            ConfigurationFile = args.Where(a => a.StartsWith("-conf=", StringComparison.Ordinal)).Select(a => a.Substring("-conf=".Length).Replace("\"", "")).FirstOrDefault();
            DataDir           = args.Where(a => a.StartsWith("-datadir=", StringComparison.Ordinal)).Select(a => a.Substring("-datadir=".Length).Replace("\"", "")).FirstOrDefault();
            if (DataDir != null && ConfigurationFile != null)
            {
                var isRelativePath = Path.GetFullPath(ConfigurationFile).Length > ConfigurationFile.Length;
                if (isRelativePath)
                {
                    ConfigurationFile = Path.Combine(DataDir, ConfigurationFile);
                }
            }

            Network = args.Contains("-testnet", StringComparer.OrdinalIgnoreCase) ? Network.TestNet :
                      args.Contains("-regtest", StringComparer.OrdinalIgnoreCase) ? Network.RegTest :
                      Network.Main;

            if (ConfigurationFile != null)
            {
                AssetConfigFileExists();
                var configTemp = TextFileConfiguration.Parse(File.ReadAllText(ConfigurationFile));
                Network = configTemp.GetOrDefault <bool>("testnet", false) ? Network.TestNet :
                          configTemp.GetOrDefault <bool>("regtest", false) ? Network.RegTest :
                          Network.Main;
            }
            if (DataDir == null)
            {
                DataDir = DefaultDataDirectory.GetDefaultDirectory("NTumbleBitServer", Network);
            }

            if (ConfigurationFile == null)
            {
                ConfigurationFile = GetDefaultConfigurationFile();
            }
            Logs.Configuration.LogInformation("Network: " + Network);
            if (Network == Network.TestNet)
            {
                var cycle = ClassicTumblerParameters
                            .CycleGenerator.FirstCycle;
                cycle.Start = 0;
                cycle.RegistrationDuration = 3;
                cycle.ClientChannelEstablishmentDuration  = 3;
                cycle.TumblerChannelEstablishmentDuration = 3;
                cycle.SafetyPeriodDuration   = 2;
                cycle.PaymentPhaseDuration   = 3;
                cycle.TumblerCashoutDuration = 4;
                cycle.ClientCashoutDuration  = 3;
            }

            Logs.Configuration.LogInformation("Data directory set to " + DataDir);
            Logs.Configuration.LogInformation("Configuration file set to " + ConfigurationFile);

            if (!Directory.Exists(DataDir))
            {
                throw new ConfigurationException("Data directory does not exists");
            }

            var consoleConfig = new TextFileConfiguration(args);
            var config        = TextFileConfiguration.Parse(File.ReadAllText(ConfigurationFile));

            consoleConfig.MergeInto(config, true);

            if (config.Contains("help"))
            {
                Console.WriteLine("Details on the wiki page :  https://github.com/NTumbleBit/NTumbleBit/wiki/Server-Config");
                OpenBrowser("https://github.com/NTumbleBit/NTumbleBit/wiki/Server-Config");
                Environment.Exit(0);
            }

            var defaultPort = config.GetOrDefault <int>("port", 5000);

            OnlyMonitor = config.GetOrDefault <bool>("onlymonitor", false);
            Listen      = config
                          .GetAll("bind")
                          .Select(p => ConvertToEndpoint(p, defaultPort))
                          .ToList();
            if (Listen.Count == 0)
            {
                Listen.Add(new IPEndPoint(IPAddress.Any, defaultPort));
            }

            RPC = RPCArgs.Parse(config, Network);
            return(this);
        }
Ejemplo n.º 4
0
        public TumblerConfiguration LoadArgs(String[] args)
        {
            ConfigurationFile = args.Where(a => a.StartsWith("-conf=", StringComparison.Ordinal)).Select(a => a.Substring("-conf=".Length).Replace("\"", "")).FirstOrDefault();
            DataDir           = args.Where(a => a.StartsWith("-datadir=", StringComparison.Ordinal)).Select(a => a.Substring("-datadir=".Length).Replace("\"", "")).FirstOrDefault();
            if (DataDir != null && ConfigurationFile != null)
            {
                var isRelativePath = Path.GetFullPath(ConfigurationFile).Length > ConfigurationFile.Length;
                if (isRelativePath)
                {
                    ConfigurationFile = Path.Combine(DataDir, ConfigurationFile);
                }
            }

            Network = args.Contains("-testnet", StringComparer.OrdinalIgnoreCase) ? Network.TestNet :
                      args.Contains("-regtest", StringComparer.OrdinalIgnoreCase) ? Network.RegTest :
                      Network.Main;

            if (ConfigurationFile != null)
            {
                AssetConfigFileExists();
                var configTemp = TextFileConfiguration.Parse(File.ReadAllText(ConfigurationFile));
                Network = configTemp.GetOrDefault <bool>("testnet", false) ? Network.TestNet :
                          configTemp.GetOrDefault <bool>("regtest", false) ? Network.RegTest :
                          Network.Main;
            }
            if (DataDir == null)
            {
                DataDir = DefaultDataDirectory.GetDefaultDirectory("NTumbleBitServer", Network);
            }

            if (ConfigurationFile == null)
            {
                ConfigurationFile = GetDefaultConfigurationFile();
            }
            Logs.Configuration.LogInformation("Network: " + Network);

            Logs.Configuration.LogInformation("Data directory set to " + DataDir);
            Logs.Configuration.LogInformation("Configuration file set to " + ConfigurationFile);

            if (!Directory.Exists(DataDir))
            {
                throw new ConfigurationException("Data directory does not exists");
            }

            var consoleConfig = new TextFileConfiguration(args);
            var config        = TextFileConfiguration.Parse(File.ReadAllText(ConfigurationFile));

            consoleConfig.MergeInto(config, true);

            if (config.Contains("help"))
            {
                Console.WriteLine("Details on the wiki page :  https://github.com/NTumbleBit/NTumbleBit/wiki/Server-Config");
                OpenBrowser("https://github.com/NTumbleBit/NTumbleBit/wiki/Server-Config");
                Environment.Exit(0);
            }

            var standardCycles = new StandardCycles(Network);
            var cycleName      = config.GetOrDefault <string>("cycle", standardCycles.Debug ? "shorty" : "kotori");

            Logs.Configuration.LogInformation($"Using cycle {cycleName}");
            ClassicTumblerParameters.CycleGenerator = standardCycles.GetStandardCycle(cycleName)?.Generator;
            if (ClassicTumblerParameters.CycleGenerator == null)
            {
                throw new ConfigException($"Invalid cycle name, choose among {String.Join(",", standardCycles.ToEnumerable().Select(c => c.FriendlyName).ToArray())}");
            }

            var torEnabled = config.GetOrDefault <bool>("tor.enabled", true);

            if (torEnabled)
            {
                TorSettings = TorConnectionSettings.ParseConnectionSettings("tor", config);
            }

            Cooperative = config.GetOrDefault <bool>("cooperative", true);

            var defaultPort = config.GetOrDefault <int>("port", 37123);

            OnlyMonitor = config.GetOrDefault <bool>("onlymonitor", false);
            Listen      = config
                          .GetAll("bind")
                          .Select(p => ConvertToEndpoint(p, defaultPort))
                          .ToList();
            if (Listen.Count == 0)
            {
                Listen.Add(new IPEndPoint(IPAddress.Any, defaultPort));
            }

            RPC     = RPCArgs.Parse(config, Network);
            TorPath = config.GetOrDefault <string>("torpath", "tor");
            return(this);
        }
        public ExplorerConfiguration LoadArgs(String[] args)
        {
            ConfigurationFile = args.Where(a => a.StartsWith("-conf=", StringComparison.Ordinal)).Select(a => a.Substring("-conf=".Length).Replace("\"", "")).FirstOrDefault();
            DataDir           = args.Where(a => a.StartsWith("-datadir=", StringComparison.Ordinal)).Select(a => a.Substring("-datadir=".Length).Replace("\"", "")).FirstOrDefault();
            if (DataDir != null && ConfigurationFile != null)
            {
                var isRelativePath = Path.GetFullPath(ConfigurationFile).Length > ConfigurationFile.Length;
                if (isRelativePath)
                {
                    ConfigurationFile = Path.Combine(DataDir, ConfigurationFile);
                }
            }

            Network = args.Contains("-testnet", StringComparer.OrdinalIgnoreCase) ? Network.TestNet :
                      args.Contains("-regtest", StringComparer.OrdinalIgnoreCase) ? Network.RegTest :
                      Network.DefaultMain;

            if (ConfigurationFile != null)
            {
                AssetConfigFileExists();
                var configTemp = TextFileConfiguration.Parse(File.ReadAllText(ConfigurationFile));
                Network = configTemp.GetOrDefault <bool>("testnet", false) ? Network.TestNet :
                          configTemp.GetOrDefault <bool>("regtest", false) ? Network.RegTest :
                          Network.DefaultMain;
            }
            if (DataDir == null)
            {
                DataDir = DefaultDataDirectory.GetDefaultDirectory("ElementExplorer", Network);
            }

            if (ConfigurationFile == null)
            {
                ConfigurationFile = GetDefaultConfigurationFile();
            }

            if (!Directory.Exists(DataDir))
            {
                throw new ConfigurationException("Data directory does not exists");
            }

            var consoleConfig = new TextFileConfiguration(args);
            var config        = TextFileConfiguration.Parse(File.ReadAllText(ConfigurationFile));

            consoleConfig.MergeInto(config, true);

            if (Network == Network.DefaultMain || Network == Network.RegTest)
            {
                var rpc = RPCArgs.Parse(config, Network).ConfigureRPCClient(Network);
                Network = CreateNetwork(Network, rpc.GetBlock(0));
                RPCArgs.CheckNetwork(Network, rpc);
            }

            Logs.Configuration.LogInformation("Network: " + Network);
            Logs.Configuration.LogInformation("Data directory set to " + DataDir);
            Logs.Configuration.LogInformation("Configuration file set to " + ConfigurationFile);

            Rescan = config.GetOrDefault <bool>("rescan", false);
            var defaultPort = config.GetOrDefault <int>("port", 37123);

            Listen = config
                     .GetAll("bind")
                     .Select(p => ConvertToEndpoint(p, defaultPort))
                     .ToList();
            if (Listen.Count == 0)
            {
                Listen.Add(new IPEndPoint(IPAddress.Any, defaultPort));
            }

            RPC          = RPCArgs.Parse(config, Network);
            NodeEndpoint = ConvertToEndpoint(config.GetOrDefault <string>("node.endpoint", "127.0.0.1"), Network.DefaultPort);
            CacheChain   = config.GetOrDefault <bool>("cachechain", true);
            StartHeight  = config.GetOrDefault <int>("startheight", 0);
            return(this);
        }
Ejemplo n.º 6
0
 public void addnyelev()
 {
     Listen.Add(Nyelev);
 }