Ejemplo n.º 1
0
        public VersionList GetBuildList(bool beta)
        {
            if (!Configured())
            {
                return(null);
            }

            var liste  = new VersionList();
            var liste2 = new VersionList();

            liste.Load(_tempDirectory + @"\Versions_" + _platform + ".xml");
            foreach (var build in liste.Version)
            {
                if (build.Beta && beta)
                {
                    liste2.Version.Add(build);
                }
                else
                if (!build.Beta)
                {
                    liste2.Version.Add(build);
                }
            }
            Log("Get build list : Builds founds  : " + liste2.Version.Count);
            return(liste2);
        }
Ejemplo n.º 2
0
        public VersionList GetBuildList()
        {
            if (!Configured())
            {
                return(null);
            }

            var liste = new VersionList();

            liste.Load(_repoDir + @"\xmls\Versions_" + _platform + ".xml");
            return(liste);
        }
Ejemplo n.º 3
0
        public bool RemoveFromRepository(VersionInfo build)
        {
            if (!Configured())
            {
                return(false);
            }

            if (File.Exists(_repoDir + @"\xmls\Version_" + _platform + "_" + build.Build + ".xml"))
            {
                Directory.Delete(_platformDir + @"\" + build.Build, true);
                File.Delete(_repoDir + @"\xmls\Version_" + _platform + "_" + build.Build + ".xml");
            }

            var versions = new VersionList();

            versions.Load(_repoDir + @"\xmls\Versions_" + _platform + ".xml");
            versions.Version.Remove(build);
            versions.Save(_repoDir + @"\xmls\Versions_" + _platform + ".xml");

            return(true);
        }
Ejemplo n.º 4
0
        public string AddToRepository(string sourceDir, bool beta, string description)
        {
            if (!Configured())
            {
                return("Error : Not configured");
            }

            var build = Tools.GetFileRevision(sourceDir + @"\Yatse2.exe");

            if (build == 0)
            {
                return("Error : Invalid source dir");
            }

            if (Directory.Exists(_platformDir + @"\" + build))
            {
                return("Error : Build allready in repository");
            }

            Directory.CreateDirectory(_platformDir + @"\" + build);
            Directory.CreateDirectory(_platformDir + @"\" + build + @"\Files");

            var fileinfos = new Collection <FileInfo>();
            var files     = Directory.GetFiles(sourceDir, "*.*", SearchOption.AllDirectories);

            foreach (var file in files)
            {
                if (file.Contains(".pdb") || file.Contains(".vshost.") || file.Contains(".application"))
                {
                    continue;
                }
                var fileinfo = new FileInfo
                {
                    FilePath = file.Replace(sourceDir, ""),
                    FileHash = FileHash.GetFileHashString(file)
                };
                if (!File.Exists(_platformDir + @"\" + build + @"\Files\" +
                                 fileinfo.FileHash + ".dat"))
                {
                    File.Copy(file, _platformDir + @"\" + build + @"\Files\" +
                              fileinfo.FileHash + ".dat");
                }
                fileinfos.Add(fileinfo);
            }

            var versionFile = new VersionFile {
                Description = description, FileInfos = fileinfos
            };

            versionFile.Save(_repoDir + @"\xmls\Version_" + _platform + "_" + build + ".xml");

            var liste = new VersionList();

            liste.Load(_repoDir + @"\xmls\Versions_" + _platform + ".xml");
            liste.Version.Add(new VersionInfo {
                Beta = beta, Build = build
            });
            liste.Save(_repoDir + @"\xmls\Versions_" + _platform + ".xml");

            return(null);
        }