示例#1
0
        public Message Decipher(Message msg)
        {
            DAO dao = new DAO();

            dao.CreateNewDecipherRequest(msg.tokenUser);

            ResultContainer.userAndNamesOfFilesToDecipherDic.Add(msg.tokenUser, new List <string>());
            ResultContainer.userAndContentOfFilesToDecipherDic.Add(msg.tokenUser, new List <string>());

            msg.info             = "Demande de déchiffrage reçue";
            msg.appVersion       = "1";
            msg.operationVersion = "1";
            for (int index = 0; index < msg.data.Length; index++)
            {
                if (index % 2 == 0)
                {
                    ResultContainer.userAndNamesOfFilesToDecipherDic[msg.tokenUser].Add(msg.data[index].ToString());
                }
                else
                {
                    ResultContainer.userAndContentOfFilesToDecipherDic[msg.tokenUser].Add(msg.data[index].ToString());
                }
            }
            //namesOfFilesToDecipher.Add(msg.data[index].ToString());
            //textsToDecipher.Add(msg.data[index].ToString());


            List <string> listTest = new List <string>();

            listTest.Add("FileName");
            listTest.Add("Content");
            listTest.Add("Key");
            msg.data = listTest.ToArray();
            CreateKey(0, 26);

            //var options = new ParallelOptions() { MaxDegreeOfParallelism = 4 };

            //Parallel.ForEach(listkey, str =>
            //{


            //    List<string> filesDeciphered = new List<string>();
            //    List<string> textsDeciphered = new List<string>();
            //    foreach (string strfile in textsToDecipher)
            //    {
            //        textsDeciphered.Add(ToValidXmlCharactersString(Dechiffrer(str.ToCharArray(), strfile)));
            //    }

            //    for (int index = 0; index < textsDeciphered.Count; index++)
            //    {
            //        filesDeciphered.Add(ResultContainer.userAndNamesOfFilesToDecipherDic[msg.tokenUser].ElementAt(index));
            //        filesDeciphered.Add(textsDeciphered.ElementAt(index));
            //    }
            //    Console.WriteLine(filesDeciphered.ElementAt(1));
            //    filesDeciphered.Add(str);

            //    FacadeEndpoint.FacadeEndpointClient facadeEndpointClient = new FacadeEndpoint.FacadeEndpointClient();
            //    FacadeEndpoint.soapMessage soapMessage = CreateSoapMessageFromMessage(msg, listTest);

            //    msg = CreateMessageFromSoapMessage(facadeEndpointClient.receiveDecipherOrder(soapMessage));
            //});

            FacadeEndpoint.FacadeEndpointClient facadeEndpointClient = new FacadeEndpoint.FacadeEndpointClient();
            FacadeEndpoint.soapMessage          soapMessage          = CreateSoapMessageFromMessage(msg, listTest);

            msg = CreateMessageFromSoapMessage(facadeEndpointClient.receiveDecipherOrder(soapMessage));



            return(msg);
        }
示例#2
0
        public string Authenticate(string login, string password)
        {
            DAO dao = new DAO();

            return(dao.CheckLoginInfos(login, password));
        }