public void DS_StartForms(UIApplication uiapp) { DS_Form newForm = new DS_Form { TopLevel = true }; SourcePath = newForm.DS_OpenInputFolderDialogForm("Set folder for checking '*.rvt' files").ToString(); if (SourcePath == "") { newForm.Close(); return; } DestinationPath = newForm.DS_OpenOutputFolderDialogForm("Set output folder for '*.nwc' files").ToString(); if (DestinationPath == "") { newForm.Close(); return; } DS_Filter filter = new DS_Filter(uiapp) { TopLevel = true, sourcePath = SourcePath, destinationPath = DestinationPath }; filter.Show(); }
static void Main(string[] args) { DS_Form newForm = new DS_Form { TopLevel = true }; string InputFolderPath = newForm.DS_OpenInputFolderDialogForm("Chose folder for checking").ToString(); if (InputFolderPath == "") { return; } string OutputFolderPath = newForm.DS_OpenOutputFolderDialogForm("Chose folder for result").ToString(); if (OutputFolderPath == "") { return; } DirectoryInfo Dir = new DirectoryInfo(InputFolderPath); //DirectoryInfo[] Files = d.Get("*.*"); //Getting files names string str = ""; string FileNameOut = "DS_Names.txt"; string writePath = ""; foreach (DirectoryInfo d in Dir.EnumerateDirectories()) { if (d.Name != FileNameOut) { str = str + d.Name + "\n"; Console.WriteLine(d.Name); writePath = OutputFolderPath + "\\" + FileNameOut; try { using (StreamWriter sw = new StreamWriter(writePath, false, System.Text.Encoding.UTF8)) { sw.WriteLine(str + "\n"); } } catch (Exception) { } } } if (str == "") { Console.WriteLine("No files in the folder."); } else { Console.WriteLine("\n Names of files are recorded to " + writePath); } Console.ReadLine(); }