Beispiel #1
0
        public static IWebHost BuildWebHost() =>
        WebHost.CreateDefaultBuilder()
        .UseKestrel(
            options =>
        {
#if DEBUG
            options.Listen(IPAddress.Loopback, 5000);
            backendServerPort = 5000;
#else
            // Get free TCP port and write it to STDOUT where the Electron frontend can catch it.
            backendServerPort = FindFreeTcpPort();
            options.Listen(IPAddress.Loopback, backendServerPort, listenOptions =>
            {
                var httpsOptions =
                    new HttpsConnectionAdapterOptions
                {
                    ServerCertificate =
                        CertificateGenerator
                        .GenerateCertificate(
                            $"CN={DigestUtils.GetDigestFromAssembly(typeof(Program).Assembly).ToLowerInvariant()}")
                };

                listenOptions.UseHttps(httpsOptions);
            });
#endif
        })
        .UseStartup <Startup>()
        .Build();
Beispiel #2
0
        /// <summary>
        /// Calculates the digest values.
        /// </summary>
        public void Calculate()
        {
            var items = new List <DigestItem>();

            this.Items = items;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                items.Add(new DigestItem("../../../../../TRuDI.exe"));
                items.Add(new DigestItem("../../../../app.asar"));
            }
            else
            {
                items.Add(new DigestItem("../../../../../trudi"));
                items.Add(new DigestItem("../../../../app.asar"));
            }

            Task.Run(() =>
            {
                foreach (var item in items)
                {
                    this.GetDigest(item);
                }
            });

            Task.Run(() =>
            {
                foreach (var hanAdapter in HanAdapterRepository.AvailableAdapters)
                {
                    hanAdapter.Hash = DigestUtils.GetDigestFromAssembly(hanAdapter.Assembly).AddSpace(4).Value;
                }

                foreach (var tafAdapter in TafAdapterRepository.AvailableAdapters)
                {
                    tafAdapter.Hash = DigestUtils.GetDigestFromAssembly(tafAdapter.Assembly).AddSpace(4).Value;
                }
            });
        }