Example #1
0
        public void Savebuildsinfo(string pathFile, string dirFile, pathAndDir dirsAndPaths)     // pathFile - name file to save DIRS // dirFile - name file to save Paths, // disAndPaths - object contain list path and dirs to save
        {
            try
            {
                if (!Directory.Exists(@"C:\Program Files\UltimateChanger\Data\"))
                {
                    if (!Directory.Exists(@"C:\Program Files\UltimateChanger\"))
                    {
                        Directory.CreateDirectory(@"C:\Program Files\UltimateChanger\");
                        Directory.CreateDirectory(@"C:\Program Files\UltimateChanger\Data\");
                    }
                    else
                    {
                        Directory.CreateDirectory(@"C:\Program Files\UltimateChanger\Data\");
                    }
                }
                if (dirsAndPaths != null)
                {
                    using (StreamWriter outputFile = new StreamWriter(@"C:\Program Files\UltimateChanger\Data\" + dirFile))
                    {
                        foreach (string line in dirsAndPaths.dir)
                        {
                            outputFile.WriteLine(line);
                        }

                        outputFile.Close();
                    }

                    using (StreamWriter outputFile = new StreamWriter(@"C:\Program Files\UltimateChanger\Data\" + pathFile))
                    {
                        foreach (string line in dirsAndPaths.path)
                        {
                            outputFile.WriteLine(line);
                        }

                        outputFile.Close();
                    }
                }
                else
                {
                    using (StreamWriter outputFile = new StreamWriter(@"C:\Program Files\UltimateChanger\Data\" + dirFile))
                    {
                        outputFile.WriteLine("");

                        outputFile.Close();
                    }

                    using (StreamWriter outputFile = new StreamWriter(@"C:\Program Files\UltimateChanger\Data\" + pathFile))
                    {
                        outputFile.WriteLine("");

                        outputFile.Close();
                    }
                }
            }
            catch (Exception x)
            {
                //  MessageBox.Show("cannot write to file");
            }
        }
Example #2
0
        private List <pathAndDir> GetListOfFullPaths(string RootPath) // pobieram liste paths do exe
        {
            List <pathAndDir> listallpathsanddir = new List <pathAndDir>();

            List <string> ListOfNightliPaths_Master = new List <string>();
            List <string> ListOfNightliPaths        = new List <string>();

            List <string> IPs_paths         = new List <string>();
            List <string> directoriesFull   = new List <string>();
            List <string> directoriesMedium = new List <string>();

            try
            {
                if (Directory.Exists(RootPath))
                {
                    IPs_paths = Directory.GetDirectories(RootPath).ToList(); // tu zawarte sa paths do IPs


                    //directories = Directory.GetDirectories(RootPath,"setup.exe",SearchOption.AllDirectories).ToList();
                    directoriesFull = Directory.GetFiles(RootPath, "setup.exe", SearchOption.AllDirectories).ToList();
                    var EXEs = Directory.GetFiles(RootPath, "*.exe", SearchOption.AllDirectories).ToList();
                    directoriesMedium = EXEs.FindAll(s => s.Contains("Medium"));
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception x)
            {
                Console.WriteLine(x.ToString() + " \nat: " + RootPath);
                Console.ReadKey();
            }


            directoriesFull.AddRange(directoriesMedium);

            pathAndDir tmpinstance = new pathAndDir();

            tmpinstance.path = IPs_paths;
            tmpinstance.dir  = directoriesFull;

            listallpathsanddir.Add(tmpinstance);



            return(listallpathsanddir);
        }
Example #3
0
        public List <pathAndDir> getAllDirPath(string release) // pobieram wszystkie sciezki i dir z path i podmieniam w glownym pliku
        {
            List <pathAndDir> lista2 = new List <pathAndDir>();


            foreach (var item in listPathTobuilds)
            {
                pathAndDir tmp = new pathAndDir();
                //licznik_przejsc++;
                if (item.Contains("FS_Programs"))
                {
                    lista2.Add(GetBindDirNames(item + release + @"\Pre-releases", listExeFiles, tmp, 0));
                }
                else
                {
                    lista2.Add(GetBindDirNames(item, listExeFiles, tmp, 0));
                }


                //((MainWindow)System.Windows.Application.Current.MainWindow).progress.Value = ((MainWindow)System.Windows.Application.Current.MainWindow).progress.Value + (100 / listPathTobuilds.Count);
            }

            return(lista2);
        }
Example #4
0
        private pathAndDir GetBindDirNames(string path, List <string> exenames, pathAndDir tmp, int nr)
        {
            List <string> dir  = null;
            bool          flag = false;
            int           dl;

            try
            {
                dir = System.IO.Directory.GetDirectories(path).ToList <string>();

                var tmp2 = dir.Skip(Math.Max(0, dir.Count() - 20));

                //var firstItems = dir.OrderBy(q => q).Take(20);
                dir = tmp2.ToList <string>();
            }
            catch (Exception)
            {
            }



            if (nr == 0 && dir != null)
            {
                foreach (var item in dir)
                {
                    tmp.dir.Add(new DirectoryInfo(item).Name);
                }
            }

            if (dir != null)
            {
                foreach (var item in dir)
                {
                    GetBindDirNames($"{item}", exenames, tmp, ++nr);
                    List <string> pliczki = System.IO.Directory.GetFiles(item).ToList <string>();

                    foreach (var item2 in exenames)
                    {
                        foreach (var item3 in pliczki)
                        {
                            dl = item3.Length - 1;

                            string tmp_item3 = item3.Substring(dl - item2.Length);
                            if (tmp_item3 == ("\\" + item2))
                            {
                                tmp.path.Add(item3);
                                flag = true;
                                break;
                            }
                        }
                        if (flag)
                        {
                            flag = false;
                            break;
                        }
                    }
                }
            }

            return(tmp);
        }
Example #5
0
        private List <pathAndDir> GetListOfNightliPaths(string RootPath, string release, string find) // pobieram liste paths do exe // find - MASTER albo RC
        {
            List <string>     ListOfNightliPaths_Master = new List <string>();
            List <string>     ListOfNightliPaths        = new List <string>();
            List <pathAndDir> listallpathsanddir        = new List <pathAndDir>();
            List <string>     directories = new List <string>();

            try
            {
                directories = Directory.GetDirectories(RootPath + release).ToList();
            }
            catch (Exception x)
            {
                Console.WriteLine(x.ToString() + " \nat: " + RootPath + release);
                Console.ReadKey();
            }
            string FindStirng = "";

            if (find == "RC")
            {
                FindStirng = "-rc-";
            }
            else
            {
                FindStirng = "Nightly-master";
            }

            foreach (var item in directories)
            {
                if (item.Contains(FindStirng) /*&& !item.Contains("SkipTest")*/)
                {
                    ListOfNightliPaths_Master.Add(item);
                }
            }
            pathAndDir tmp = new pathAndDir();

            foreach (var item in ListOfNightliPaths_Master)
            {
                if (/*!IsDirectoryEmpty(item) && */ Directory.Exists(item + "\\DevResults-" + release)) // lezeli jest kompozycja to dodaje do listy
                {
                    tmp.path.Add(item);
                    tmp.dir.Add(new DirectoryInfo(item).Name + " " + Directory.GetCreationTime(item));
                }
            }

            tmp.path.Reverse();
            tmp.dir.Reverse();


            var tmp2 = tmp.path.Take(50);
            var tmp3 = tmp.dir.Take(50);

            pathAndDir tmpinstance = new pathAndDir();

            tmpinstance.path = tmp2.ToList();
            tmpinstance.dir  = tmp3.ToList();

            listallpathsanddir.Add(tmpinstance);

            return(listallpathsanddir);
        }