Пример #1
0
        private void ReplaceFile(CreationFichier FileCreation, string path, ref List <Entree> data)
        {
            string TmpPath = System.IO.Path.GetTempFileName();

            FileCreation(TmpPath, ref data);
            if (System.IO.File.Exists(path))
            {
                System.IO.File.Delete(path);
            }
            System.IO.File.Move(TmpPath, path);
        }
Пример #2
0
        private void Create(string S_path, ref List <Entree> data)
        {
            CreationFichier Typef;

            if (Xls.Checked)
            {
                if (!System.IO.File.Exists(S_path + ".xlsx"))
                {
                    CreateXLS(S_path + ".xlsx", ref data);
                }
                else
                {
                    Typef = new CreationFichier(CreateXLS);
                    ReplaceFile(Typef, S_path + ".xlsx", ref data);
                }
            }
            else
            {
                if (System.IO.File.Exists(S_path + ".xlsx"))
                {
                    System.IO.File.Delete(S_path + ".xlsx");
                }
            }
            if (Txt.Checked)
            {
                if (!System.IO.File.Exists(S_path + ".txt"))
                {
                    CreateTxt(S_path + ".txt", ref data);
                }
                else
                {
                    Typef = new CreationFichier(CreateTxt);
                    ReplaceFile(Typef, S_path + ".txt", ref data);
                }
            }
            else
            {
                if (System.IO.File.Exists(S_path + ".txt"))
                {
                    System.IO.File.Delete(S_path + ".txt");
                }
            }
            if (Bin.Checked)
            {
                if (!System.IO.File.Exists(S_path + ".bin"))
                {
                    CreateBin(S_path + ".bin", ref data);
                }
                else
                {
                    Typef = new CreationFichier(CreateBin);
                    ReplaceFile(Typef, S_path + ".bin", ref data);
                }
            }
            else
            {
                if (System.IO.File.Exists(S_path + ".bin"))
                {
                    System.IO.File.Delete(S_path + ".bin");
                }
            }
        }