private void signUpButton_Click(object sender, EventArgs e)
        {
            try
            {
                PasswordHashing passwordHashing = new PasswordHashing();
                UsersRepository usersRepository = new UsersRepository();
                FileCreation    fileCreation    = new FileCreation();
                Validations();
                User user = new User(usernameBox.Text,
                                     passwordHashing.creatingHashedPassword(passwordBox.Text),
                                     fileCreation.createFile(usernameBox.Text));
                user.fileLocation = fileCreation.EncryptWithAES(user.fileLocation);
                usersRepository.AddNewUserToDB(user);
                usersRepository.ChangeFileName(user);



                DialogResult dialog = MessageBox.Show("You signed up successfully!", "OK", MessageBoxButtons.OK);
                if (dialog == DialogResult.OK)
                {
                    MainWindow.loggedInUser = user;
                    LoggedIn loggedIn = new LoggedIn();
                    loggedIn.ShowDialog();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Exemple #2
0
 private void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     Dispatcher.Invoke(() =>
     {
         Information.Text = string.Empty;
     });
     if (Decrypt.Decrypter(filenames))
     {
         // Success!
         string message = "Message was successfully decrypted! The mail is : " + Decrypt.retour.Email +
                          " and it was decrypted with the following key : " + Decrypt.retour.Key + ". The confidence rate is : " + Decrypt.retour.Confidence;
         FileCreation.CreatePDF(REPORT_FILE_PATH, message);
         Dispatcher.Invoke(() =>
         {
             PdfFile.Visibility     = Visibility.Visible;
             PdfFile.IsEnabled      = true;
             Information.Foreground = Brushes.Green;
         });
     }
     Dispatcher.Invoke(() =>
     {
         Information.Text   = Decrypt.InformationMessage;
         SendFile.IsEnabled = true;
         Loading.Visibility = Visibility.Hidden;
     });
 }
Exemple #3
0
        private void createButton_Click(object sender, EventArgs e)
        {
            PasswordHashing passwordHashing = new PasswordHashing();
            FileCreation    fileCreation    = new FileCreation();

            try
            {
                Validation();
                List <string> info = new List <string>();
                info.Add(loginNameBox.Text);
                info.Add(passwordHashing.
                         EncryptingAndDecryptingPasswordWithDES(passwordBox.Text, true));
                if (urlBox.Text != "")
                {
                    info.Add(urlBox.Text);
                }
                if (moreInfoBox.Text != "")
                {
                    info.Add(moreInfoBox.Text);
                }
                fileCreation.WriteToFile(MainWindow.loggedInUser.fileLocation, info);

                MessageBox.Show("New password is successfully added!");

                loginNameBox.Text = "";
                passwordBox.Text  = "";
                urlBox.Text       = "";
                moreInfoBox.Text  = "";
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Exemple #4
0
        public void CommandAnalyseAndFileCreationTest()
        {
            // Arrange
            string input          = "convert https://s3.amazonaws.com/uux-itaas-static/minha-cdn-logs/input-01.txt ./output/minhaCdn1.txt";
            string expectedOutput = "success";
            // Act
            var actualOutput = FileCreation.CommandAnalyse(input);

            // Assert
            Assert.AreEqual(expectedOutput, actualOutput);
        }
        /// <summary>
        /// Aktualisiert die Eigenschaften der Klassen und erzeugt ein neues FileLineWriterObject
        /// </summary>
        /// <param name="filePath">Der Dateipfad</param>
        /// <param name="fileName">Der Dateiname</param>
        /// <param name="fileEncoding">Die zu verwendene Kodierung</param>
        /// <param name="fileCreation">Festlegung ob die Datei neu erzeugt oder erweitert wird</param>
        /// <param name="lineContent">Der Ausgabetext</param>
        /// <returns>Eine Instanz von IFileLineWriter</returns>
        private IFileLineWriter AktualisiereEigenschafte(string filePath, string fileName, FileEncoding fileEncoding,
                                                         FileCreation fileCreation, string lineContent)
        {
            this.FilePath     = filePath;
            this.FileName     = fileName;
            this.FileEncoding = fileEncoding;
            this.FileCreation = fileCreation;
            this.LineContent  = lineContent;

            this.CurrentFileLineWriterObject =
                new FileLineWriterObject(FilePath, FileName, FileEncoding, FileCreation, LineContent);

            return(this);
        }
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            FileCreation fc  = new FileCreation();
            var          asy = new AsynLibo();

            fc.ReadWrite("Main Thread Started");
            Response.Write("Main Thread Started");
            Maker mk = new Maker();
            Func <string, Task> webre = mk.MakeWebCallAsync;
            var s = asy.GenericAsyncCall <string, Task>(webre, "Chandu");


            Func <string, string> func = new Maker().Greetings;

            var             t     = asy.GenericAsyncCall <string, string>(func, "Chandu");
            Func <int, int> func2 = new Maker().GreetingsMoring;
            var             t2    = asy.GenericAsyncCall <int, int>(func2, 786445);

            fc.ReadWrite("Main Thread Ended");
            Response.Write("Main Thread Ended");

            Thread.Sleep(2000);
            Response.Redirect("ProcessingMessage.aspx", false);
        }
 public ActionResult Index(OpenWeatherMap openWeatherMap, string cities)
 {
     openWeatherMap = weatherBehaviour.GetDataFromOpenWeatherApi(cities);
     FileCreation.CreateFileByCityName(openWeatherMap.ApiResponse, cities);
     return(View(openWeatherMap));
 }
 // Constructor type Dependency Injection can be applied, so that you have to create objects here
 public OpenWeatherMapMvcController()
 {
     weatherBehaviour = new WeatherBehaviour();
     FileCreation     = new FileCreation();
 }
Exemple #9
0
 public static extern IntPtr CreateFile(string path, FileAccess access, FileSharing sharing, IntPtr security, FileCreation creation, FileFlagsAttributes flagsAndAttributes, IntPtr templateFile);
Exemple #10
0
        //MAIN FUNCTION
        public void Compute(double[,] array, int counterStart, int kForNodes)
        {
            //model.stampAngle = array[i, 0];
            //model.stampAngle = Math.Round(model.stampAngle);

            model.stampAngle = model.startAngle;

            model.blankRadius = array[counterStart, 0];
            model.blankRadius = Math.Round(model.blankRadius, 2);

            model.friction = array[counterStart, 1];
            model.friction = Math.Round(model.friction, 2);

            model.dieRadius = (Math.Tan(model.stampAngle * Math.PI / 180) * 60) + 10;
            model.dieRadius = Math.Round(model.dieRadius, 1);
            //объём усеченного конуса (верхний радиус 10, нижний может меняться) 60 - высота усеченного конуса
            model.dieVolume = (Math.PI * 60 * (Math.Pow(model.dieRadius, 2) + model.dieRadius * 10 + Math.Pow(10, 2))) / 3;

            #region необходимо для вычесления облоя

            //3 - радиус скругления, 90 - градус
            double filletLength = Math.Tan((180 - (((90 + model.stampAngle) / 2) + 90)) * Math.PI / 180) * 3;

            double upperRadius = model.dieRadius + filletLength + 10;

            double angle30X = upperRadius - 5;

            double lowerVolume = Math.Pow((angle30X - 5), 2) * Math.PI * 1;

            model.dieVolume += lowerVolume;

            double shave = Math.Pow(angle30X, 2) * Math.PI * 1;

            shave -= lowerVolume;

            model.dieVolume = Math.Round(model.dieVolume, 1);

            #endregion

            model.blankUpperRadius = model.blankRadius - (Math.Tan(model.stampAngle * Math.PI / 180) * 2);
            model.blankPosition    = (Math.PI * 2 * (Math.Pow(model.blankRadius, 2) + model.blankRadius * (model.blankUpperRadius) + Math.Pow((model.blankUpperRadius), 2))) / 3;
            model.blankPosition    = Math.Round(model.blankPosition, 2);

            //объем цилиндра, не считая фаску (как будто её нет,а заготовка имеет форму просто цилиндра)
            double abstractRadiusVolume = Math.PI * Math.Pow(model.blankRadius, 2) * 2;
            double blankVolume          = model.dieVolume + (abstractRadiusVolume - model.blankPosition);

            //объём зазора между матрицей и площадкой
            blankVolume += shave;

            model.blankHeight = blankVolume / (Math.PI * Math.Pow(model.blankRadius, 2));
            model.blankHeight = Math.Round(model.blankHeight, 2);

            double radiusAfterLowerFillet = angle30X - 5;

            double radiusHeightInStamp;

            radiusHeightInStamp = 60 * ((radiusAfterLowerFillet - model.blankRadius) / (radiusAfterLowerFillet - 10));

            //необходимо для вычесления объёма от пуансона до конца матрицы
            model.lowerFilletRadius = radiusAfterLowerFillet;

            if (model.blankRadius > 10)
            {
                model.blankPosition  = model.blankHeight - radiusHeightInStamp;
                model.blankPosition  = Math.Round(model.blankPosition, 1);
                model.blankPosition += 5;
            }
            else
            {
                double tempHeight = model.blankHeight - 60;

                model.blankPosition = tempHeight * ((model.dieRadius - 10) / (model.dieRadius - 10));
                model.blankPosition = Math.Round(model.blankPosition, 1);
                //допуск +2мм на всякий пожарный случай
                model.blankPosition += 2;
            }

            model.stampDisplacement = model.blankPosition;
            //оставляем зазор 1мм
            model.stampDisplacement -= 1;

            #region Создание общей папки с название радиуса заготовки

            genReport.folderName = Convert.ToString(model.blankRadius);

            if (!Directory.Exists(genReport.folderName))
            {
                Directory.CreateDirectory(genReport.folderName);
            }

            #endregion

            string abaqusOutputFolder = Convert.ToString(model.blankRadius)
                                        + "r" + Convert.ToString(model.friction) + "f";

            file.outputFolder = Path.Combine(genReport.folderName, abaqusOutputFolder);

            if (!Directory.Exists(file.outputFolder))
            {
                Directory.CreateDirectory(file.outputFolder);
            }

            #region Пути для солида

            file.caeFolder      = Path.Combine(Environment.CurrentDirectory, file.outputFolder, add.jobName + ".cae");
            file.caeFolder      = file.caeFolder.Replace(@"\", "/");
            file.stampFolder    = Path.Combine(Environment.CurrentDirectory, file.outputFolder, file.stampName);
            file.stampFolder    = file.stampFolder.Replace(@"\", "/");
            file.blankFolder    = Path.Combine(Environment.CurrentDirectory, file.outputFolder, file.blankName);
            file.blankFolder    = file.blankFolder.Replace(@"\", "/");
            file.platformFolder = Path.Combine(Environment.CurrentDirectory, file.outputFolder, file.platformName);
            file.platformFolder = file.platformFolder.Replace(@"\", "/");

            #endregion

            var solid = new CAD();

            solid.UseSolid(file, model);

            rout.pathIn           = "abaqusMacros.py";
            rout.workingDirectory = file.outputFolder;
            rout.pathOut          = rout.workingDirectory + @"\abaqusMacros.py";

            var change = new Change();

            change.Output(rout, model, material, add, file);

            var abaqus = new CAE();

            abaqus.runAbaqus(rout, cmd);

            var processData = new ProcessData(rout, cmd);

            processData.Processing(model, file, filesForVolume, genReport);

            finalReport.AddData(model);

            genReport.AddFrictionToChart(model);

            genReport.AddRadiusToChart(model);

            #region проверка симплекса

            string fileName = "SimplexNodes";

            var str = new StringBuilder();
            str.Append(kForNodes);
            str.Append(";");
            str.Append(model.blankRadius);
            str.Append(";");
            str.Append(model.friction);
            str.Append(";");
            str.Append(model.pctOfDieFilling);
            str.Append(";");
            str.Append((model.reactionForceToBlank * Math.Pow(10, -6)));
            str.Append(";");
            str.Append(Environment.NewLine);

            var fileCreate = new FileCreation();

            fileCreate.CreateFile("", fileName, ".csv", str.ToString());

            #endregion
        }
 /// <summary>
 /// Legt die Art der Ausgabe fest. Mögliche Arten sind Anhängen (und ggf Erzeugen) oder Überschreiben
 /// </summary>
 /// <param name="auswahl">Gibt an, ob die Ausgabe in eine neue Datei ausgegeben werden soll, oder in eine vorhandene</param>
 /// <returns>Eine Instanz von IFileLineWriter</returns>
 public IFileLineWriter AusgabeDurch(FileCreation auswahl)
 {
     FileCreation = auswahl;
     return(AktualisiereEigenschafte(FilePath, FileName, FileEncoding, FileCreation, LineContent));
 }