<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO.Pipes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.PeerToPeer;

namespace RelationUnity
{
    class Program
    {
        static async Task Main(string[] args)
        {
            if (args.Length != 3) return;

            string pipeName = args[0];
            string peerNameClassifier = args[1];
            int portNo = int.Parse(args[2]);

#if DEBUG
            Console.WriteLine($"{nameof(pipeName)}={pipeName},{nameof(peerNameClassifier)}={peerNameClassifier},{nameof(portNo)}={portNo}");
#endif

            var cloud = Cloud.AllLinkLocal;
            var peerName = new PeerName(peerNameClassifier, PeerNameType.Secured);

            server = new NamedPipeServerStream(pipeName);
            try
            {
                await server.WaitForConnectionAsync();

                var peerNameResolver = new PeerNameResolver();
                peerNameResolver.ResolveProgressChanged += PeerNameResolver_ResolveProgressChanged;
                peerNameResolver.ResolveCompleted += PeerNameResolver_ResolveCompleted;

                peerNameResolver.ResolveAsync(peerName, cloud);

                var peerNameRegistration = new PeerNameRegistration(peerName, portNo, cloud);<commit_msg>グローバルに接続出来るよう変更<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO.Pipes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.PeerToPeer;

namespace RelationUnity
{
    class Program
    {
        static async Task Main(string[] args)
        {
            if (args.Length != 4) return;

            string pipeName = args[0];
            string connectionTarget = args[1];
            string portNoStr = args[2];
            string param3 = args[3];

#if DEBUG
            Console.WriteLine($"{nameof(pipeName)}={pipeName},{nameof(connectionTarget)}={connectionTarget},{nameof(portNoStr)}={portNoStr},{nameof(param3)}={param3}");
#endif

            int portNo;
            PeerName peerName;
            Cloud cloud;
            try
            {
                portNo = int.Parse(portNoStr);

                switch (connectionTarget.ToLower())
                {
                    case "global":
                        cloud = Cloud.Global;
                        peerName = PeerName.CreateFromPeerHostName(param3);
                        break;
                    case "local":
                        cloud = Cloud.AllLinkLocal;
                        peerName = new PeerName(param3, PeerNameType.Secured);
                        break;
                    default:
                        throw new ArgumentException("invalid argument", "param 1");
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine(ex);
#endif
                return;
            }

            server = new NamedPipeServerStream(pipeName);
            try
            {
                await server.WaitForConnectionAsync();

                var peerNameResolver = new PeerNameResolver();
                peerNameResolver.ResolveProgressChanged += PeerNameResolver_ResolveProgressChanged;
                peerNameResolver.ResolveCompleted += PeerNameResolver_ResolveCompleted;

                peerNameResolver.ResolveAsync(peerName, cloud);

                var peerNameRegistration = new PeerNameRegistration(peerName, portNo, cloud);
{'fraction_non_alphanumeric': 0.08810826374892024, 'fraction_numerical': 0.004319032536711776, 'mean_word_length': 1.956595744680851, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7115151', 'n_tokens_mistral': 897, 'n_tokens_neox': 852, 'n_words': 176}