public void GetInitilizationData()
        {
            List <NLPDataModel> rawTrainingData = new List <NLPDataModel>();
            FileProcessing      fileProcessing  = new FileProcessing();

            tokenizer = new Tokenizer();
            trainingData.Clear();
            rawTrainingData    = fileProcessing.ReadCSVLines <NLPDataModel>("NLPBagofWords.csv", true).ToList();
            tokenizer.Keywords = fileProcessing.Headings;

            foreach (NLPDataModel data in rawTrainingData)
            {
                NLPFeatureDataModel feature = new NLPFeatureDataModel();


                var properties = typeof(NLPDataModel).GetProperties();
                feature.PhraseFeatures = new double[properties.Length];
                for (int i = 0; i < properties.Length; i++)
                {
                    NLPDataModel d = new NLPDataModel();
                    double       f = -999;
                    properties[i].GetValue(d);
                    string token = (string)properties[i].GetValue(data);
                    Double.TryParse(token, out f);
                    feature.PhraseFeatures[i] = f;
                }

                int phaseType = -999;
                int.TryParse(data.PhraseType, out phaseType);
                feature.PhaseType = phaseType;
                trainingData.Add(feature);
            }
        }
Beispiel #2
0
        public MainViewModel()
        {
            Logger.Log.Info("Data saved");
            Logger.InitLogger();
            if (String.IsNullOrWhiteSpace(Notepad.Properties.Settings.Default.DataConnection))
            {
                throw new ArgumentNullException("Data connection not found!");
            }
            if (String.IsNullOrWhiteSpace(Notepad.Properties.Settings.Default.DALAssembly))
            {
                throw new ArgumentNullException("DALAssembly setting not found!");
            }
            if (String.IsNullOrWhiteSpace(Notepad.Properties.Settings.Default.ReaderType))
            {
                throw new ArgumentNullException("ReaderType setting not found!");
            }

            Environment.CurrentDirectory = Path.GetDirectoryName(
                Assembly.GetExecutingAssembly().Location);

            Config cfg = new Config();

            cfg.DataPath           = Path.GetFullPath(Notepad.Properties.Settings.Default.DataConnection);
            cfg.DataReaderAssembly = Path.GetFullPath(Notepad.Properties.Settings.Default.DALAssembly);
            cfg.DataReader         = Path.GetFullPath(Notepad.Properties.Settings.Default.ReaderType);

            fp           = new FileProcessing(cfg);
            TextRichText = fp.GetData();
            Weather      = fp.GetTemperature();
        }
Beispiel #3
0
        public void Execute(object parameter)
        {
            if (String.IsNullOrWhiteSpace(_8Ball.Properties.Settings.Default.DataConnection))
            {
                Logger.Log.Error("Data connection is not found");
                throw new ArgumentNullException("DataConnection is not found");
            }

            Config config = new Config();

            config.DataPath           = Path.GetFullPath(_8Ball.Properties.Settings.Default.DataConnection);
            config.DataReaderAssembly = Path.GetFullPath(_8Ball.Properties.Settings.Default.DALAssembly);
            config.DataReader         = Path.GetFullPath(_8Ball.Properties.Settings.Default.ReaderType);

            FileProcessing fp = new FileProcessing(config);

            var vm = parameter as ViewModel;

            if (vm == null)
            {
                Logger.Log.Error("ViewModel can't be null");
                throw new ArgumentNullException("Модель представления не можеть быть null");
            }
            vm.answer = fp.Shake(fp.Answers);
        }
        public Window5ViewModel()
        {
            if (string.IsNullOrWhiteSpace(kurs1.Properties.Settings.Default.DataConnection5))
            {
                throw new ArgumentNullException("Data connection not found ");
            }
            try
            {
                Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                Config cfg = new Config();
                cfg.DataPath           = Path.GetFullPath(kurs1.Properties.Settings.Default.DataConnection5);
                cfg.DataReaderAssembly = Path.GetFullPath(kurs1.Properties.Settings.Default.DALAssembly);
                cfg.DataReader         = Path.GetFullPath(kurs1.Properties.Settings.Default.ReaderType);
                FileProcessing fp = new FileProcessing(cfg);
                Items5 = new ObservableCollection <KeyValuePair <int, string> >();

                foreach (var i in fp.Items)
                {
                    Items5.Add(new KeyValuePair <int, string>(i.Key, i.Value));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("NO results found");
            }
        }
        static void Main(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            var path    = @"C:\obj\Model3D+0.0-08pi_4.obj";
            var objFile = FileProcessing.ReadFile(path);

            FigureProcessing.ConnectionOfLayers(objFile);

            var objList = FigureProcessing.ColorSeperation(objFile);


            FileProcessing.WriteFile(@"C:\obj\Color obj\", objList);
            Console.WriteLine("Файл прочитан.");

            stopWatch.Stop();
            // Get the elapsed time as a TimeSpan value.
            TimeSpan ts = stopWatch.Elapsed;

            // Format and display the TimeSpan value.
            string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                               ts.Hours, ts.Minutes, ts.Seconds,
                                               ts.Milliseconds / 10);

            Console.WriteLine("RunTime " + elapsedTime);
        }
Beispiel #6
0
        public async Task <IActionResult> FileDelete(int id)
        {
            FileModel file = db.Files.FirstOrDefault(x => x.Id == id);

            if (file == null)
            {
                HttpContext.Items["ErrorMessage"] = "Файл не найден.";
                _logger.LogDebug("Not found file with id = {id}", id);
                return(RedirectToAction("Index"));
            }

            bool success = FileProcessing.RemoveFile(file.Path, appEnvironment.WebRootPath);

            if (success)
            {
                db.Files.Remove(file);
                await db.SaveChangesAsync();

                HttpContext.Items["SuccessMessage"] = "Файл успешно удалён.";
            }
            else
            {
                HttpContext.Items["ErrorMessage"] = "Не удалось удалить файл";
                _logger.LogError("Failed to remove file from server with id = {id}", id);
                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("Index"));
        }
Beispiel #7
0
        public IActionResult RemoveGalleryImg(Guid id, int imageIndex)
        {
            var item = _achievementRepo.Read(id);

            if (item == null)
            {
                Response.StatusCode  = 404;
                ViewBag.ErrorTitle   = "Wrong ID";
                ViewBag.ErrorMessage = "Can't find portfolio item";
                return(View("PageNotFound"));
            }

            var userInfo = _userInfoRepo.Read(_userManager.GetUserId(User));

            if (string.IsNullOrEmpty(item.ItemGalleryImageFilePaths[imageIndex].GalleryImageFilePath)) // We don't want to do anything if we dont have an image to remove
            {
                ModelState.AddModelError("", "Can't find an image to remove");
                return(RedirectToAction("EditItem", new { id }));
            }

            FileProcessing.DeleteGalleryImage(userInfo.ApplicationUser.UserName, id, imageIndex, _config, _webHostEnvironment);
            item.ItemGalleryImageFilePaths[imageIndex].GalleryImageFilePath = null;

            _achievementRepo.Update(item);
            return(RedirectToAction("EditItem", new { id }));
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            List <FECTransaction> transObjListFEC = new List <FECTransaction>();
            List <FECTransaction> transObjListCSV = new List <FECTransaction>();
            string path       = string.Empty;
            string tempathFEC = string.Empty;
            string tempathCSV = string.Empty;

            SaveFileDialog saveDialog1 = new SaveFileDialog();

            saveDialog1.Filter = "comma separated values (*.csv)|*.csv";

            Console.WriteLine("Select .fec file...");
            FECFileService.OpenFilePath(args, ref tempathFEC);
            transObjListFEC = FECFileService.ParseFECFileToList(tempathFEC);

            Console.WriteLine("Select .csv file to compare to...");
            CSVFileService.OpenFilePath(args, ref tempathCSV);
            transObjListCSV = CSVFileService.ParseCSVFileToList(tempathCSV);

            Console.WriteLine();

            Console.WriteLine("Discrepancies: ");

            FileProcessing.GetDiscrepancyList(transObjListFEC, transObjListCSV);
            Console.WriteLine();

            FileProcessing.FindDuplicates(transObjListFEC, transObjListCSV);

            Console.WriteLine("Press enter to exit");
            Console.ReadLine();
        }
Beispiel #9
0
        private void GhostInspectorButton_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            try
            {
                resultsTextBox.Text = "";
                DataRow selectedRow = ((DataRowView)(FolderList.SelectedItem)).Row;
                foreach (var currentLine in FileProcessing.GetGhostInspectorSuites(state, selectedRow[0].ToString()))
                {
                    FileProcessing.RunGhostInspector(state, currentLine);
                }


                MessageBox.Show(this, FILE_COPY_COMPLETE, FILE_COPY_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception eError)
            {
                MessageBox.Show(this, string.Format(FILE_COPY_ERROR_FORMAT, eError.Message), FILE_COPY_CAPTION, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Beispiel #10
0
        private void ImportOderClick()
        {
            string OrderListPath  = @"Order/order_2020_05_16_09_52_57.csv";
            string MemberListPath = @"MemberList/方氏果乾會員.csv";

#if (DEBUG)
            OrderListPath  = Path.Combine(PathFunction.GetExecuteLevelPath(System.Environment.CurrentDirectory, 2), @"DummyFile\order_2020_05_16_09_52_57.csv");
            MemberListPath = Path.Combine(PathFunction.GetExecuteLevelPath(System.Environment.CurrentDirectory, 2), @"DummyFile\mm.csv");
#endif
            FileProcessing.CsvTrans2Json <BaseTitle>(OrderListPath, out loadOrderViewList);
            FileProcessing.CsvTrans2Json <MemberListTitle>(MemberListPath, out List <MemberListTitle> MemberList);

            OrderViewList.Clear();

            //整理格式
            loadOrderViewList.ForEach(Order =>
            {
                MemberList.ForEach(s =>
                {
                    if (Order.CustomerName == s.RealName && Order.CustomerEmail == s.Email)
                    {
                        Order.Membership = "V";
                    }
                });
                Order.OwnerName   = "方氏果乾";
                Order.OwnerNumber = "F00001";

                if (Order.DateCreate != null)
                {
                    CultureInfo CultureInfoDateCulture = new CultureInfo("ja-JP"); //日期文化格式
                    DateTime d       = DateTime.ParseExact(Order.DateCreate, "yyyy-MM-dd hh:mm:ss", CultureInfoDateCulture);
                    Order.DateCreate = d.ToString("yyyy/MM/dd");
                }
            });

            //篩選統計欄位
            for (int i = 0; i < loadOrderViewList.Count; i++)
            {
                bool IsValidOrderNumber = true;

                loadOrderViewList[i].OrderNumber.ToList().ForEach(ch =>
                {
                    if (!char.IsDigit(ch) && !char.IsLetter(ch))//是否为数字//是否为字母
                    {
                        IsValidOrderNumber = false;
                    }
                });
                if (!IsValidOrderNumber)
                {
                    loadOrderViewList.Remove(loadOrderViewList[i]);
                    i--;
                }
                else
                {
                    OrderViewList.Add(new OrderView(loadOrderViewList[i]));
                }
            }
        }
        static void Main(string[] args)
        {
            var path    = @"G:\University\Множества достижимости\Color obj\Model3D-6.0pi.obj";
            var objFile = FileProcessing.ReadFile(path);
            var objList = FigureProcessing.ColorSeperation(objFile);

            FileProcessing.WriteFile(@"G:\University\Множества достижимости\Color obj\", objList);
            Console.WriteLine("Файл прочитан.");
        }
Beispiel #12
0
        public async Task ParsesNumbersProperly()
        {
            var(error, list) =
                await FileProcessing.GetPointsFromFile("C:/dotnet/KiTPO/App.UnitTest/dataNumberParsing.txt");

            Assert.Null(error);
            Assert.Equal(list, new List <(double, double)> {
                (-0.4, 1.1), (2, 3)
            });
Beispiel #13
0
        private void ButtonClick_CopyFiles(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(state.OutputDirectory))
            {
                MessageBox.Show(this, VALIDATION_ERROR_OUTPUT_NOT_SELECTED, VALIDATION_ERROR_CAPTION, MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            Cursor = Cursors.WaitCursor;
            try
            {
                var outputDirectory = new DirectoryInfo(state.OutputDirectory);

                if (outputDirectory.Exists && outputDirectory.GetFiles()
                    .Any())
                {
                    DialogResult prompt = MessageBox.Show(this, VALIDATION_ERROR_FOLDER_NOT_EMPTY, FILE_COPY_CAPTION,
                                                          MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);

                    if (prompt == DialogResult.Yes)
                    {
                        foreach (FileInfo fileInfo in outputDirectory.GetFiles())
                        {
                            try
                            {
                                File.Delete(fileInfo.FullName);
                            }
                            catch (Exception eError)
                            {
                                MessageBox.Show(this, string.Format(FILE_DELETE_ERROR_FORMAT, fileInfo.Name, eError.Message), FILE_COPY_CAPTION,
                                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                FileProcessing.CopyApplicationProcessFiles(state);

                MessageBox.Show(this, FILE_COPY_COMPLETE, FILE_COPY_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception eError)
            {
                MessageBox.Show(this, string.Format(FILE_COPY_ERROR_FORMAT, eError.Message), FILE_COPY_CAPTION, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Beispiel #14
0
        /// <summary>
        /// Sends a notification email with snapshot attachments after applying any required
        /// throttle settings. Also moves any snapshots to storage.
        /// </summary>
        public static void ProcessNotifications(string detectionTimestamp)
        {
            if (!ShouldSend())
            {
                // If we aren't sending a message, move the snapshots to storage
                FileProcessing.MoveSnapshotsToStorage();
                return;
            }

            _ = Task.Run(async() =>
            {
                var cfg   = AppConfig.Get;
                var email = AppConfig.Get.Email;
                try
                {
                    var snapshots = Directory.GetFiles(cfg.LocalPath, "*.jpg");

                    // Even though Microsoft recommends against using the framework SmtpClient class,
                    // it's adequate for our use hitting a simple unsecured purely-local SMTP relay
                    // to a more secure public-Internet mail server such as GMail.

                    // Prep the basic message
                    using var smtp  = new SmtpClient(email.Server, email.Port);
                    var from        = new MailAddress(email.From, email.From);
                    var to          = new MailAddress(email.To, email.To);
                    var message     = new MailMessage(from, to);
                    message.Subject = $"Motion: {cfg.Name}";
                    message.Body    = $"Motion detected by spicam {cfg.Name} at {detectionTimestamp}.";

                    // Add any snapshot attachments
                    foreach (var snapshot in snapshots)
                    {
                        var attachment = new Attachment(snapshot, MediaTypeNames.Image.Jpeg);
                        attachment.ContentDisposition.CreationDate = new FileInfo(snapshot).CreationTime;
                        message.Attachments.Add(attachment);
                    }

                    // Send the email
                    await smtp.SendMailAsync(message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"\nException of type {ex.GetType().Name} sending notification email\n{ex.Message}");
                    if (ex.InnerException != null)
                    {
                        Console.Write(ex.InnerException.Message);
                    }
                    Console.WriteLine($"\n{ex.StackTrace}");
                }
                finally
                {
                    // Move the snapshots to storage after the message is sent
                    FileProcessing.MoveSnapshotsToStorage();
                }
            });
        }
Beispiel #15
0
        public void Execute(object parameter)
        {
            if (String.IsNullOrWhiteSpace(_8Ball.Properties.Settings.Default.DataConnection))
            {
                Logger.Log.Error("Data connection is not found!");
                throw new ArgumentNullException("DataConnection is not found");
            }

            Config config = new Config();

            config.DataPath           = Path.GetFullPath(_8Ball.Properties.Settings.Default.DataConnection);
            config.DataReaderAssembly = Path.GetFullPath(_8Ball.Properties.Settings.Default.DALAssembly);
            config.DataReader         = Path.GetFullPath(_8Ball.Properties.Settings.Default.ReaderType);

            FileProcessing fp = new FileProcessing(config);

            var vm = parameter as ViewModel;

            if (vm == null)
            {
                Logger.Log.Error("ViewModel can't be null");
                throw new ArgumentNullException("Модель представления не можеть быть null");
            }
            ;
            if (String.IsNullOrWhiteSpace(vm.email))
            {
                Logger.Log.Error("Email is empty");
                vm.email = "Email is empty";
            }
            if (String.IsNullOrWhiteSpace(vm.answer))
            {
                Logger.Log.Error("Shake it first");
                vm.email = "Shake it first";
            }
            bool wrongEmail;

            try
            {
                MailAddress from = new MailAddress(vm.email);
                wrongEmail = true;
            }
            catch
            {
                Logger.Log.Error("Email is wrong");
                wrongEmail = false;
            }
            if (wrongEmail == true)
            {
                fp.SendEmail(vm.email, vm.answer);
                vm.email = null;
            }
            else
            {
                vm.email = " wrong email or empty answer";
            }
        }
        private void Run_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ExceptionLabel.Foreground = Brushes.DarkRed;
                if (AccuracyComboBox.SelectedItem == null)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelAccuracyNOTChosen);
                }

                var random               = new Random();
                var solver               = new ClassLibrary.Logic.Solver();
                var accuracy             = double.Parse(AccuracyComboBox.Text);
                var parametersForDefined = FileProcessing.ReadSolutionForPersistenceTest(_filename);

                if (parametersForDefined == null)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelIncorrectFileFormat);
                }

                (double, double)cParameters  = PercentFinder.GetCsRange(parametersForDefined);
                (double, double)abParameters = PercentFinder.GetABRange(parametersForDefined);
                (double, double)lParameters  = PercentFinder.GetLRange(parametersForDefined);

                DistributionParametersService distributionParameters = new DistributionParametersService();
                var distributionParametersIds = distributionParameters.GetAppropriateIds(
                    cParameters, abParameters, lParameters);

                if (distributionParametersIds.Count < 5)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelNOTEnoughData);
                }

                PercentageService percentageService = new PercentageService();
                var percentages = percentageService.GetAppropriate(parametersForDefined.A.Length, distributionParametersIds, parametersForDefined.Alpha.Length);

                if (percentages.Count < 5)
                {
                    throw new Exception(Properties.Resources.ExceptionLabelNOTEnoughDataForParameters);
                }

                var valueFromDB = percentages.Average();

                //var percent = PercentFinder.FindPercentOfChange(parametersForDefined, solver, random);
                parametersForDefined.Clear();
                var percent = PercentFinder.SearchMeanPercent(PercentFinder.FindPercentOfChange, parametersForDefined, accuracy, solver, random);

                ExceptionLabel.Content = "";
                var window = new Result(valueFromDB, percent, percentages);
                window.Show();
            }
            catch (Exception ex)
            {
                ExceptionLabel.Content = ex.Message;
            }
        }
Beispiel #17
0
 public FilesController(ApplicationContext context,
                        FileProcessing fileProcessing,
                        IHostingEnvironment environment,
                        ILogger <FilesController> logger)
 {
     db = context;
     _fileProcessing = fileProcessing;
     appEnvironment  = environment;
     _logger         = logger;
 }
Beispiel #18
0
 private void Save_Button_Click(object sender, RoutedEventArgs e)
 {
     try{
         FileProcessing.SaveInFile(ResultText.Text);
     }
     catch (Exception noArg)
     {
         MessageBox.Show(noArg.Message);
     }
 }
Beispiel #19
0
        public async Task ReturnsAwaitedResult(string path, GetPointsFromFileAwaitedResult awaitedResult)
        {
            var(error, list) = await FileProcessing.GetPointsFromFile(path);

            Assert.Equal(error, awaitedResult.FileReadError);
            if (error == null)
            {
                Assert.Equal(list.Count, awaitedResult.ListCount);
            }
        }
Beispiel #20
0
 private void Choose_Key_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         KeyText.Text = WordProcessing.GetFileInfo(FileProcessing.ChooseFile());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #21
0
 public void Configure(IApplicationBuilder app, IHostingEnvironment env, FileProcessing fileProcessing)
 {
     if (env.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
     }
     app.UseHttpsRedirection();
     app.UseStaticFiles();
     app.UseCookiePolicy();
     app.UseMvc();
 }
Beispiel #22
0
 public AccountController(UserManager <User> userManager,
                          ApplicationContext context,
                          FileProcessing fileProcessing,
                          IHostingEnvironment environment,
                          ILogger <AccountController> logger)
 {
     _userManager    = userManager;
     _db             = context;
     _fileProcessing = fileProcessing;
     _appEnvironment = environment;
     _logger         = logger;
 }
Beispiel #23
0
        protected override void OnStart(string[] args)
        {
            // TODO: Add code here to start your service.
            FileProcessing.ImportSettting();
            GameDataObject gameDataObject = new GameDataObject();

            Connector.EstablishConnection(gameDataObject);
            DayActiveController.RegisterGameMetaData(gameDataObject);
            DayActiveController.BindGameEvent(gameDataObject);
            DayActiveController.StartGameHeartBeatTimer();
            DayActiveController.StartMonitoringTimer(gameDataObject);
        }
        private IEnumerable <FileInfo> BuildFileInfoListToProcess()
        {
            RequestQuery.RefreshMergeTemplateData();
            IEnumerable <FileInfo> mergeTemplateInfo = FileProcessing.BuildMergeTemplateFileInfo(RequestQuery.MergeTemplateData, state.BaseDirectory);

            RequestQuery.RefreshCustomPrintPacketData();
            IEnumerable <FileInfo> customPrintPacketInfo = FileProcessing.BuildCustomPrintPacketInfo(RequestQuery.CustomPrintPacketData, state.BaseDirectory);

            var fileProcessingList = mergeTemplateInfo.Where(fileInfo => fileInfo.Exists).ToList();

            fileProcessingList.AddRange(customPrintPacketInfo.Where(fileInfo => fileInfo.Exists));

            return(fileProcessingList);
        }
        private void copyFilesButton_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            try
            {
                var outputDirectory = new DirectoryInfo(sourceLocationText.Text + "\\..\\" + state.FoundationUrlKey + "_Extract");
                state.OutputDirectory = outputDirectory.ToString();

                if (outputDirectory.Exists && outputDirectory.GetFiles()
                    .Any())
                {
                    DialogResult prompt = MessageBox.Show(this, VALIDATION_ERROR_FOLDER_NOT_EMPTY, FILE_COPY_CAPTION,
                                                          MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);

                    if (prompt == DialogResult.Yes)
                    {
                        foreach (FileInfo fileInfo in outputDirectory.GetFiles())
                        {
                            try
                            {
                                File.Delete(fileInfo.FullName);
                            }
                            catch (Exception eError)
                            {
                                MessageBox.Show(this, string.Format(FILE_DELETE_ERROR_FORMAT, fileInfo.Name, eError.Message), FILE_COPY_CAPTION,
                                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                FileProcessing.CopyApplicationProcessFiles(state);

                MessageBox.Show(this, FILE_COPY_COMPLETE, FILE_COPY_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception eError)
            {
                MessageBox.Show(this, string.Format(FILE_COPY_ERROR_FORMAT, eError.Message), FILE_COPY_CAPTION, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Beispiel #26
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please input the path of the file to be processed.");


            //Reads the path of the file
            string fPath = Console.ReadLine();

            //Process the file from the give file path
            string strResult = FileProcessing.ProcessDataAndGenerateFiles(fPath);

            Console.WriteLine(strResult);
            Console.Read();
        }
Beispiel #27
0
    public void ReadInCSVFile()
    {
        string         InputFile     = "";
        string         OutputFile    = "";
        string         Round         = "";
        DataTable      output        = InstantiateTable();
        FileProcessing fp            = new FileProcessing();
        string         currentHole   = "";
        int            currentPlayer = 1;
        DataRow        currentRow    = output.NewRow();

        do
        {
            Console.Write("Input File: ");
            InputFile = Console.ReadLine();    //@"C:\Users\michaelm\Documents\SRO\ScoreBoard2.csv";// Console.ReadLine();
        } while (!System.IO.File.Exists(InputFile));

        Console.Write("Output File: ");
        OutputFile = Console.ReadLine();    //@"C:\Users\michaelm\Documents\SRO\test.txt";//Console.ReadLine();

        Console.Write("Round Number: ");
        Round = Console.ReadLine();

        foreach (DataRow r in fp.ReadFile(InputFile).Rows)
        {
            if (r["Tee " + Round].ToString() == currentHole)
            {
                currentPlayer++;
                currentRow["Player" + currentPlayer.ToString()] = r["First Name"].ToString().Trim() + " " + r["Last Name"].ToString().Trim();
            }
            else
            {
                if (currentRow["HoleNum"].ToString() != "")
                {
                    output.Rows.Add(currentRow);
                }
                currentRow    = output.NewRow();
                currentPlayer = 1;
                currentHole   = r["Tee " + Round].ToString();

                currentRow["Round"]    = Round;
                currentRow["HoleNum"]  = r["Tee " + Round].ToString();
                currentRow["Division"] = GetDivision(r["Div"].ToString());
                currentRow["Player" + currentPlayer.ToString()] = r["First Name"].ToString().Trim() + " " + r["Last Name"].ToString().Trim();
            }
        }
        output.Rows.Add(currentRow);
        fp.WriteFile(output, OutputFile);
    }
Beispiel #28
0
        static void Main(string[] args)
        {
            var fileName = "/Users/paul/Desktop/Files/ж1_1.wav";
            var dataFile = "/Users/paul/Desktop/freqs.txt";

            FileProcessing.PutFreqStatToFile(fileName, dataFile);

            var result = DataProcessing.GetSpectrumFromDataFile(dataFile);

            foreach (var pair in result)
            {
                Console.WriteLine(pair.Key + " " + pair.Value);
            }

            var octaveBands = OctaveBandsProcessing.GetOctaveBandsData(result,
                                                                       DefaultParameters.StartFreq,
                                                                       DefaultParameters.HighFreqs,
                                                                       DefaultParameters.RootFreqs,
                                                                       DefaultParameters.NormalizeLevel);

            var speech = new double[octaveBands.Count];

            Console.WriteLine("");
            Console.WriteLine("Нормализованные уровни для речи:");
            for (int i = 0; i < speech.Length; i++)
            {
                Console.WriteLine(octaveBands[i].NormalizedLevel);
                speech[i] = octaveBands[i].NormalizedLevel;
            }

            Console.WriteLine("");
            Console.WriteLine("Разборчивость:");

            var testW = Intelligibility.GetWRange(speech,
                                                  DefaultParameters.WhiteNoiseLevels,
                                                  DefaultParameters.k,
                                                  DefaultParameters.deltaA,
                                                  -30,
                                                  30);

            foreach (var w in testW)
            {
                Console.WriteLine(w);
            }


            Console.WriteLine("");
            Console.WriteLine("Разборчивость напрямую:");
        }
Beispiel #29
0
        public StaticViewsController(ApplicationContext context,
                                     IHostingEnvironment environment,
                                     IConfiguration configuration,
                                     ILogger <StaticViewsController> logger,
                                     FileProcessing fileProcessing)
        {
            db             = context;
            _environment   = environment;
            _configuration = configuration;
            _logger        = logger;

            if (!Directory.Exists(_environment.ContentRootPath + $"/Generic/"))
            {
                Directory.CreateDirectory(_environment.ContentRootPath + $"/Generic/");
            }
        }
        private void RunFromFile_Click(object sender, RoutedEventArgs e)
        {
            var problem = FileProcessing.ReadProblemFromFile(_filename);

            if (problem == null)
            {
                ExceptionLabel.Foreground = Brushes.DarkRed;
                ExceptionLabel.Content    = Properties.Resources.ExceptionLabelIncorrectFileFormat;
                return;
            }
            ExceptionLabel.Content = "";
            var solution = problem.Run();
            var window   = new SolutionWindow(solution, problem);

            window.Show();
        }
Beispiel #31
0
        public Stream Encrypt(Stream message, Key key)
        {
            DES DESkey1 = new DES();
            FileProcessing fp = new FileProcessing();
            MemoryStream ms = new MemoryStream();

            fp.EnCryptFile(message, ms, cm1k, DESkey1.KeyList, null, null, 0, false);

            return ms;
        }