Exemplo n.º 1
0
            public static BuildPackageInfo FromModulePath(string modulePath)
            {
                string[] parts = modulePath.Split(new[] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries);

                if (parts.Length != 2 || String.IsNullOrWhiteSpace(parts[0]) || String.IsNullOrWhiteSpace(parts[1]))
                {
                    return(null);
                }

                string id   = parts[0];
                string path = parts[1];

                FileInfo propsFile   = new FileInfo(Path.Combine(path, "build", $"{id}.props"));
                FileInfo targetsFile = new FileInfo(Path.Combine(path, "build", $"{id}.targets"));

                BuildPackageInfo buildPackageInfo = new BuildPackageInfo
                {
                    Id                 = parts[0],
                    PropsPath          = propsFile.Exists ? propsFile.FullName : null,
                    TargetsPath        = targetsFile.Exists ? targetsFile.FullName : null,
                    EnablePropertyName = $"Enable{id.Replace(".", "_")}",
                    RunPropertyName    = $"Run{id.Replace(".", "_")}",
                };

                return(buildPackageInfo);
            }
            public static BuildPackageInfo FromModulePath(string modulePath)
            {
                string[] parts = modulePath.Split(new[] {'='}, 2, StringSplitOptions.RemoveEmptyEntries);

                if (parts.Length != 2 || String.IsNullOrWhiteSpace(parts[0]) || String.IsNullOrWhiteSpace(parts[1]))
                {
                    return null;
                }
                string id = parts[0];
                string path = parts[1];

                string propsPath = Path.Combine(path, "build", $"{id}.props");
                string targetsPath = Path.Combine(path, "build", $"{id}.targets");

                if (!File.Exists(propsPath) && !File.Exists(targetsPath))
                {
                    return null;
                }

                BuildPackageInfo buildPackageInfo = new BuildPackageInfo
                {
                    Id = parts[0],
                    PropsPath = propsPath,
                    TargetsPath = targetsPath,
                    EnablePropertyName = $"Enable{id.Replace(".", "_")}",
                    RunPropertyName = $"Run{id.Replace(".", "_")}",
                };

                return buildPackageInfo;
            }