Пример #1
0
        private static void UpdateSteamDirTargetsFile()
        {
            SetupOperation.CreateParentDirectory(targetsFilePath);
            File.WriteAllText(targetsFilePath,
                              $@"<?xml version=""1.0"" encoding=""utf-8""?>
<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
  <PropertyGroup>
    <TerrariaSteamPath>{SteamDir}</TerrariaSteamPath>
  </PropertyGroup>
</Project>");
        }
Пример #2
0
        internal static void UpdateTargetsFile()
        {
            SetupOperation.CreateParentDirectory(targetsFilePath);

            string gitsha = "";

            RunCmd("", "git", "rev-parse HEAD", s => gitsha = s.Trim());

            string branch = "";

            RunCmd("", "git", "rev-parse --abbrev-ref HEAD", s => branch = s.Trim());

            string GITHUB_HEAD_REF = Environment.GetEnvironmentVariable("GITHUB_HEAD_REF");

            if (!string.IsNullOrWhiteSpace(GITHUB_HEAD_REF))
            {
                Console.WriteLine($"GITHUB_HEAD_REF found: {GITHUB_HEAD_REF}");
                branch = GITHUB_HEAD_REF;
            }
            string HEAD_SHA = Environment.GetEnvironmentVariable("HEAD_SHA");

            if (!string.IsNullOrWhiteSpace(HEAD_SHA))
            {
                Console.WriteLine($"HEAD_SHA found: {HEAD_SHA}");
                gitsha = HEAD_SHA;
            }

            string targetsText =
                $@"<?xml version=""1.0"" encoding=""utf-8""?>
<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
  <!-- This file will always be overwritten, do not edit it manually. -->
  <PropertyGroup>
	<BranchName>{branch}</BranchName>
	<CommitSHA>{gitsha}</CommitSHA>
	<TerrariaSteamPath>{SteamDir}</TerrariaSteamPath>
    <tModLoaderSteamPath>{TMLSteamDir}</tModLoaderSteamPath>
  </PropertyGroup>
</Project>";

            if (File.Exists(targetsFilePath) && targetsText == File.ReadAllText(targetsFilePath))
            {
                return;
            }

            File.WriteAllText(targetsFilePath, targetsText);
        }
Пример #3
0
        private static void UpdateSteamDirTargetsFile()
        {
            SetupOperation.CreateParentDirectory(targetsFilePath);

            string targetsText =
                $@"<?xml version=""1.0"" encoding=""utf-8""?>
<Project ToolsVersion=""14.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
  <PropertyGroup>
    <TerrariaSteamPath>{SteamDir}</TerrariaSteamPath>
    <tModLoaderSteamPath>{tMLSteamDir}</tModLoaderSteamPath>
  </PropertyGroup>
</Project>";


            if (File.Exists(targetsFilePath) && targetsText == File.ReadAllText(targetsFilePath))
            {
                return;
            }

            File.WriteAllText(targetsFilePath, targetsText);
        }