示例#1
0
    //updates the master repository list
    public static void CheckForUpdates()
    {
        localSources.UpdateSources();
        remoteSources.UpdateSources();
//		ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
//		WebClient client = new WebClient();
//		client.DownloadFileCompleted += ClientOnDownloadFileCompleted;
//		client.DownloadProgressChanged += ClientOnDownloadProgressChanged;
//		client.DownloadFileAsync(new Uri(UPM_MASTER_REPOS_REMOTE), UPM_MASTER_REPOS_LOCAL);
//		remote_repositories = LoadRemoteRepos();
    }
示例#2
0
    public static void SaveRepositoriesList(string toPath)
    {
        var repo = new Repository
        {
            PackageName       = "SSE",
            PackageURL        = @"https://github.com/Aeal/SSE.git",
            PackageMaintainer = @"Aeal",
            PackageVersion    = 1,
            InfoUrl           = @"https://raw.github.com/Aeal/SSE/info.ups"
        };
        var source = new UPMSource();

        source.AddRepo(repo);
        var collections = new GitHubRepositoryCollection();

        collections.GET_URL = "https://api.github.com/orgs/UPMCollection/repos";
        source.AddCollection(collections);
        source.UpdateSources();
        var builder      = new StringBuilder();
        var jsonSettings = new JsonWriter(builder);

        jsonSettings.PrettyPrint = true;
        JsonMapper.ToJson(source, jsonSettings);

        using (TextWriter writer = new StreamWriter(toPath))
        {
            writer.Write(builder);
        }

        var rbuilder = new StringBuilder();
        var settings = new JsonWriter(rbuilder);

        settings.PrettyPrint = true;
        JsonMapper.ToJson(repo, settings);
        using (TextWriter twriter = new StreamWriter(toPath + ".r"))
        {
            twriter.Write(rbuilder);
        }
    }