Esempio n. 1
0
        private static void SetDownloadDependencies(IObjectWriter writer, IList <DownloadDependency> downloadDependencies)
        {
            if (!downloadDependencies.Any())
            {
                return;
            }

            writer.WriteArrayStart("downloadDependencies");

            foreach (var dependency in downloadDependencies.OrderBy(dep => dep))
            {
                writer.WriteObjectInArrayStart();
                SetValue(writer, "name", dependency.Name);
                SetValue(writer, "version", dependency.VersionRange.ToNormalizedString());
                writer.WriteObjectEnd();
            }
            writer.WriteArrayEnd();
        }
Esempio n. 2
0
        private static void SetDownloadDependencies(IObjectWriter writer, IList <DownloadDependency> downloadDependencies)
        {
            if (!downloadDependencies.Any())
            {
                return;
            }

            writer.WriteArrayStart("downloadDependencies");

            foreach (var dependency in downloadDependencies.GroupBy(dep => dep.Name).OrderBy(dep => dep.Key))
            {
                var version = string.Join(";", dependency.Select(dep => dep.VersionRange).OrderBy(dep => dep.MinVersion).Select(dep => dep.ToNormalizedString()));

                writer.WriteObjectInArrayStart();
                SetValue(writer, "name", dependency.Key);
                SetValue(writer, "version", version);
                writer.WriteObjectEnd();
            }
            writer.WriteArrayEnd();
        }