DetectMavenRepository
        (
            string id_fully_qualified
        )
        {
            (string id_group, string id_artifact, string version)a = Artifact.Parse(id_fully_qualified);

            string url = null;

            MavenRepository mr_google = null;

            try
            {
                url = MavenRepositoryGoogle.GetUrlForGroupId(a.id_group);

                if (url != null)
                {
                    mr_google = new MavenRepositoryGoogle();
                }
            }
            catch (System.Exception exc)
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.AppendLine($"Artifact.DetectMavenRepository Exception for MavenRepositoryGoogle");
                sb.AppendLine($"    Message : {exc.Message}");
                sb.AppendLine($"    Artifact Id Fully Qualified: {id_fully_qualified}");

                System.Diagnostics.Trace.WriteLine(sb.ToString());

                throw;
            }

            yield return(mr_google);

            //try
            //{
            //    mr = new MavenRepositoryMavenCentral();

            //}
            //catch (System.Exception exc)
            //{
            //    System.Text.StringBuilder sb = new System.Text.StringBuilder();
            //    sb.AppendLine($"Artifact.DetectMavenRepository Exception for MavenRepositoryMavenCentral");
            //    sb.AppendLine($"    Message : {exc.Message}");
            //    sb.AppendLine($"    Artifact Id Fully Qualified: {id_fully_qualified}");

            //    System.Diagnostics.Trace.WriteLine(sb.ToString());

            //    throw;
            //}

            //return;
        }
        DeserializeFromJSON_System_Text_Json
        (
            string json
        )
        {
            MavenRepository mr = null;

            mr = System.Text.Json.JsonSerializer.Deserialize <MavenRepository>
                 (
                json
                 );
            return(mr);
        }
        DeserializeFromJSON_Newtonsoft
        (
            string json
        )
        {
            MavenRepository mr = null;

            mr = Newtonsoft.Json.JsonConvert.DeserializeObject <MavenRepository>
                 (
                json
                 );
            return(mr);
        }
        SerializeToJSON_Newtonsoft
        (
            MavenRepository maven_repo_data
        )
        {
            string content = null;

            content = Newtonsoft.Json.JsonConvert.SerializeObject
                      (
                maven_repo_data
                      );

            return(content);
        }
        SerializeToJSON_System_Text_Json
        (
            MavenRepository maven_repo_data
        )
        {
            string content = null;

            content = System.Text.Json.JsonSerializer.Serialize <MavenRepository>
                      (
                maven_repo_data,
                new System.Text.Json.JsonSerializerOptions
            {
                WriteIndented = true
            }
                      );

            return(content);
        }
        SerializeToXML
        (
            MavenRepository maven_repo_data
        )
        {
            System.Xml.Serialization.XmlSerializer xs = null;
            string content = null;

            using (System.IO.TextWriter tw = new System.IO.StringWriter())
            {
                xs = new System.Xml.Serialization.XmlSerializer(typeof(Artifact));

                xs.Serialize(tw, maven_repo_data);
                content = tw.ToString();
            }

            return(content);
        }
        SaveAsync
        (
            string path = "MavenRepository.newtonsoft.json"
        )
        {
            string[] path_parts = path.Split(new[] { "." }, StringSplitOptions.None);
            string   format     = path_parts[path_parts.Length - 1];
            string   library    = path_parts[path_parts.Length - 2];

            if (path_parts.Length >= 2)
            {
                library = path_parts[path_parts.Length - 2];
            }

            string content = null;
            string msg     = null;

            switch (format)
            {
            case "proto":
            case "protobuf":
                break;

            case "xml":
                content = MavenRepository.SerializeToXML(this);
                break;

            case "json":
                switch (library)
                {
                case "system-text-json":
                    content = MavenRepository.SerializeToJSON_System_Text_Json(this);
                    break;

                case "newtonsoft":
                    content = MavenRepository.SerializeToJSON_Newtonsoft(this);
                    break;

                default:
                    msg = $"Unknown serialization format {format}";
                    throw new InvalidProgramException(msg);
                }
                break;

            default:
                msg = $"Unknown serialization format {format}";
                throw new InvalidProgramException(msg);
            }

            string type_name = this.GetType().Name;
            string timestamp = DateTime.Now.ToString("yyyyMMdd-HHmm");
            string filename  = $"{type_name}-{timestamp}.{library}.json";

            //System.IO.File.WriteAllText(filename, content);
            using (System.IO.StreamWriter writer = System.IO.File.CreateText(filename))
            {
                await writer.WriteAsync(content);
            }

            return;
        }