Exemple #1
0
 private void OnBrowshDescrFilePathCommand()
 {
     System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
     if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         this.DescrFilePath  = openFileDialog.FileName;
         this.OutputPathName = Path.GetFullPath(FilePathManager.getInstance().getPathName(DataType.Ri, this.DescrFilePath));
     }
 }
Exemple #2
0
        protected override void OnBrowshDataPathCommand()
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.DataFilePath   = openFileDialog.FileName;
                this.OutputPathName = Path.GetFullPath(FilePathManager.getInstance().getPathName(DataType.Individu, this.DataFilePath));
            }
        }
        protected override void OnBrowshDataPathCommand()
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.DataFilePath   = openFileDialog.FileName;
                this.OutputPathName = Path.GetFullPath(FilePathManager.getInstance().getPathName(DataType.Support, DataFilePath));
            }

            /*FolderBrowserDialog dialog = new FolderBrowserDialog();
             * if (dialog.ShowDialog() == DialogResult.OK)
             *  this.InputPathName = String.Format("{0}\\", dialog.SelectedPath);
             */
        }
        public override void ExportFile()
        {
            if (String.IsNullOrEmpty(this._fileName))
            {
                throw new Exception("File Name is vide");;
            }

            this._OutputPathName = FilePathManager.getInstance().getPathName(DataType.Individu, this._fileName);

            if (!Directory.Exists(this._OutputPathName))
            {
                Directory.CreateDirectory(this._OutputPathName);
            }
            //this._OutputFileName = @"C:\yu\project\Navigation_UserControl\Navigation_UserControl\bin\Debug\individu\Individu";
            this._OutputFileName = _OutputPathName + "\\Individus";
            using (var writer = new StreamWriter(_OutputFileName + ".csv"))
            {
                foreach (String data in Individus)
                {
                    _Worker.ReportProgress(1, new DataLogs(LogType.None, String.Format("{0} a été ajouté ...", data)));
                    writer.WriteLine(data);
                }
            }

            /*int count = 0;
             * for (int i = 0; i < _Individus.Count(); ++i)
             * {
             *  File.WriteAllText(this._OutputFileName + ".csv", _Individus[i]);
             *  reportProgress(count++);
             * }*/
            //File.WriteAllLines(outPath, l_line.ToArray());


            /*string[] l_line = File.ReadAllLines(this.FilePath);
             * List<string> res = new List<string>();
             * foreach(string l in l_line)
             * {
             *  res.Add(l.Substring(Int32.Parse(this.Begin),Int32.Parse(this.End)).Trim());
             * }
             * string outPath = @"C:\yu\project\ExportId\ExportId\bin\Debug\indidivu\" + "individu.csv";
             *
             * File.WriteAllLines(outPath, res.ToArray());*/
        }
Exemple #5
0
        public override void ExportFile()
        {
            if (String.IsNullOrEmpty(this._fileName))
            {
                throw new Exception("File Name is vide");;
            }

            this._OutputPathName = FilePathManager.getInstance().getPathName(DataType.Support, this._fileName);
            this._OutputFileName = FilePathManager.getInstance().getFileName(DataType.Support, this._fileName);
            if (!Directory.Exists(this._OutputPathName))
            {
                Directory.CreateDirectory(this._OutputPathName);
            }

            foreach (KeyValuePair <string, string[]> item in Supports)
            {
                _Worker.ReportProgress(1, new DataLogs(LogType.None, String.Format("{0}.csv est en cours de générer ...", this._OutputFileName + item.Key)));
                File.WriteAllLines(this._OutputFileName + item.Key + ".csv", item.Value);
                _Worker.ReportProgress(1, new DataLogs(LogType.Success, String.Format("{0}.csv est généré ...", this._OutputFileName + item.Key)));
            }
        }
        public override void ExportFile()
        {
            if (RiIndividu.Count == 0)
            {
                return;
            }

            //string InputFileName = Path.GetFileName(this._dataFilePath);

            //this.OutPath += InputFileName.Split('.')[0] + "_supp_";
            this._OutputPathName = FilePathManager.getInstance().getPathName(DataType.Ri, this.DescrFilePath);
            this._OutputFileName = FilePathManager.getInstance().getFileName(DataType.Ri, this.DescrFilePath);

            if (!Directory.Exists(this._OutputPathName))
            {
                Directory.CreateDirectory(this._OutputPathName);
            }
            //String OutPath = @"./OutFile/ONE NEXT 2020_support_";

            foreach (KeyValuePair <int, RiIndividu> item in RiIndividu)
            {
                try
                {
                    using (var writer = new StreamWriter(_OutputFileName + item.Key + ".csv"))
                    {
                        _Worker.ReportProgress(1, new DataLogs(LogType.None, String.Format("{0}.csv est généré ...", _OutputFileName + item.Key)));
                        foreach (KeyValuePair <string, double> data in item.Value.GetRiIndividu())
                        {
                            writer.WriteLine(item.Key + ";" + data.Key + ";" + data.Value);
                        }
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }