Пример #1
0
 private FacadeEndpoint.soapMessage CreateSoapMessageFromMessage(Message msg, List <string> filesDeciphered)
 {
     FacadeEndpoint.soapMessage soapMessage = new FacadeEndpoint.soapMessage
     {
         appVersion       = msg.appVersion,
         data             = filesDeciphered.ToArray(),
         info             = msg.info,
         operationName    = msg.operationName,
         operationVersion = msg.operationVersion,
         statutOp         = (FacadeEndpoint.statutOp)(int) msg.statusOp,
         tokenApp         = msg.tokenApp,
         tokenUser        = msg.tokenUser
     };
     return(soapMessage);
 }
Пример #2
0
        private Message CreateMessageFromSoapMessage(FacadeEndpoint.soapMessage soapMessage)
        {
            Message msg = new Message
            {
                appVersion       = soapMessage.appVersion,
                data             = soapMessage.data,
                info             = soapMessage.info,
                operationName    = soapMessage.operationName,
                operationVersion = soapMessage.operationVersion,
                statusOp         = (StatusOp)(int)soapMessage.statutOp,
                tokenApp         = soapMessage.tokenApp,
                tokenUser        = soapMessage.tokenUser
            };

            return(msg);
        }
Пример #3
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);
        }