public void GenerateUniqueRemoteSpaceUriTest()
        {
            var generatedName = NameHashingTool.GenerateUniqueRemoteSpaceUri("127.0.0.1:5002", "Kartoffel");

            Debug.Assert(generatedName ==
                         "127.0.0.1:5002/ConferenceSUSTSWVVSX?CONN");
        }
示例#2
0
 public Chat(string name, string uri, string conferenceName, ObservableCollection<string> dataSource)
 {
     //For client
     LoggedInUser = name;
     DataSource = dataSource;
     string remoteName = NameHashingTool.GenerateUniqueRemoteSpaceUri(uri, conferenceName);
     ChatSpace = new RemoteSpace(remoteName);
 }
示例#3
0
        public Chat(string name, string uri, string conferenceName, IRepository chatRepo, ObservableCollection<string> dataSource)
        {
            //For host
            LoggedInUser = name;

            chatRepo.AddSpace(NameHashingTool.GenerateUniqueSequentialSpaceName(conferenceName), new SequentialSpace());
            string remoteName = NameHashingTool.GenerateUniqueRemoteSpaceUri(uri, conferenceName);
            ChatSpace = new RemoteSpace(remoteName);

            DataSource = dataSource;
        }
示例#4
0
        public void UpgradePrivileges(string passwd)
        {
            var tuple = Space.QueryP("ConcealedIdentifier", typeof(string));
            var token = tuple?.Get <string>(1);
            var hash  = NameHashingTool.GetSHA256String(passwd);

            if (!string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(passwd) && token == hash)
            {
                var id = NameHashingTool.GetSHA256String(passwd + token);
                ConcealedSpace   = new RemoteSpace(string.Format(UriFormat, id));
                _controlProducer = new ControlProducer(ConcealedSpace, SlideShower, Username);
            }
        }
 public void CreateSequentialSpaceWithSequentialSpaceNameGeneratorTest()
 {
     using (var spaceRepo = new SpaceRepository())
     {
         string uri       = "tcp://127.0.0.1:5005";
         string testName  = NameHashingTool.GenerateUniqueSequentialSpaceName("ThisNameDoesNotActuallyMatter");
         ISpace testSpace = new SequentialSpace();
         spaceRepo.AddSpace(testName, testSpace);
         spaceRepo.AddGate(uri + "?CONN");
         var testElement = "This string is a test";
         testSpace.Put(testElement);
         testSpace.Get(testElement);
         Debug.Assert(!testSpace.GetAll().Any());
         // putting and getting the element should leave us with an empty space
     }
 }
        public void CreateRemoteSpaceWithRemoteSpaceNameGeneratorTest()
        {
            using (var spaceRepo = new SpaceRepository())
            {
                string uri            = "tcp://127.0.0.1:5002";
                string testRemoteName = "ThisNameDoesNotActuallyMatter";
                string testSeqName    = NameHashingTool.GenerateUniqueSequentialSpaceName(testRemoteName);
                Console.WriteLine(testSeqName);
                var testSeqSpace = new SequentialSpace();
                spaceRepo.AddSpace(testSeqName, testSeqSpace);
                spaceRepo.AddGate(uri);

                var remoteHash = NameHashingTool.GenerateUniqueRemoteSpaceUri(uri, testRemoteName);
                Console.WriteLine(remoteHash);
                var testRemoteSpace = new RemoteSpace(remoteHash);
            }
        }
 public void GenerateUniqueSequentialSpaceNameTest()
 {
     Debug.Assert(NameHashingTool.GenerateUniqueSequentialSpaceName("Kartoffel") ==
                  "ConferenceSUSTSWVVSX");
 }