Exemplo n.º 1
0
        public void DS_StartForms(UIApplication uiapp)
        {
            DS_Form newForm = new DS_Form
            {
                TopLevel = true
            };

            SPFPath = newForm.DS_OpenFileDialogForm_txt("", "Select shared parameter file for loading.").ToString();
            if (SPFPath == "")
            {
                newForm.Close();
                return;
            }

            ParametersNamesPath = newForm.DS_OpenFileDialogForm_txt("", "Select file with parameters names.").ToString();
            if (ParametersNamesPath == "")
            {
                newForm.Close();
                return;
            }

            AddParametersToSFPOptions addParametersToSFPOptions = new AddParametersToSFPOptions(uiapp);

            addParametersToSFPOptions.Show();
        }
Exemplo n.º 2
0
        public void AddParametersToProject()
        {
            FilesPathes.Clear();
            SelectesParameters.Clear();

            bool    FileError = false;
            DS_Form newForm   = new DS_Form
            {
                TopLevel = true
            };

            FileWithProjectsPathes = newForm.DS_OpenFileDialogForm_txt("", "Select file with pathes to *.rvt projects.").ToString();
            if (FileWithProjectsPathes == "")
            {
                newForm.Close();
                return;
            }
            CreateFilesPathesList(ref FileError);

            if (FileError == true)
            {
                return;
            }

            SPFPath = newForm.DS_OpenFileDialogForm_txt("", "Select shared parameter file for loading.").ToString();
            if (SPFPath == "")
            {
                newForm.Close();
                return;
            }

            MyApplication.thisApp.ShowForm(App);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            DS_Form newForm = new DS_Form
            {
                TopLevel = true
            };

            string InputFilePath = newForm.DS_OpenFileDialogForm_txt().ToString();

            if (InputFilePath == "")
            {
                return;
            }

            string InputFolderPath = newForm.DS_OpenInputFolderDialogForm("Chose folder for renaming").ToString();

            if (InputFolderPath == "")
            {
                return;
            }

            //Name of input file
            //string textFile = "DS_Names.txt";

            if (File.Exists(InputFilePath))
            {
                DirectoryInfo   Dir    = new DirectoryInfo(InputFolderPath);
                DirectoryInfo[] DirArr = Dir.GetDirectories();
                //DirectoryInfo d = new DirectoryInfo(@Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));//Assuming Test is your Folder
                //FileInfo[] Files = d.GetFiles("*.*"); //Getting files
                ArrayList list = new ArrayList();
                int       ai   = 0;



                NewNamesList(DirArr, InputFilePath, list);

                int directoryCount = DirArr.Length;

                //Dirs renaming
                string[] lines = File.ReadAllLines(InputFilePath);
                try
                {
                    for (int i = 0; i <= directoryCount - 1; i++)
                    {
                        if (DirArr[i].Name != InputFilePath)                        //Exceptions
                        {
                            Directory.Move(InputFolderPath + "/" + DirArr[i].Name, InputFolderPath + "/" + lines[i - ai]);
                        }
                        else
                        {
                            ai += 1;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An error occured: " + ex.Message);
                }

                //Output for existing files
                Console.WriteLine("Existing folders:\n");

                list = new ArrayList();
                NewNamesList(DirArr, InputFilePath, list);
                foreach (string namelist in list)
                {
                    Console.WriteLine(namelist);
                }

                Console.WriteLine("\n in the folder: '" + InputFolderPath + "'\n are renamed to: \n");

                //Output for renames files
                Dir    = new DirectoryInfo(InputFolderPath);
                DirArr = Dir.GetDirectories();
                list   = new ArrayList();
                NewNamesList(DirArr, InputFilePath, list);

                foreach (string namelist in list)
                {
                    Console.WriteLine(namelist);
                }
            }
            else
            {
                Console.WriteLine("File '" + InputFilePath + "' is absent.");
            }
            Console.ReadKey();
        }