public ProjectImplementation(VisualStudioProjectScheme?scheme, TestVersion testVersion, TestPackage testPackage, IDictionary <string, string> nugetPackagesToInstall)
            {
                _nugetPackagesToInstall = nugetPackagesToInstall;

                Name     = $"{(scheme.HasValue ? scheme.Value.ToString() : "null")}_{testVersion}_{(int)testPackage}";
                FilePath = GetPath(scheme, testVersion, (int)testPackage);
            }
        internal static string GetPath(VisualStudioProjectScheme?scheme, TestVersion testVersion, int number)
        {
            string path;

            switch (scheme)
            {
            case VisualStudioProjectScheme.Lean:
                path = $@"{scheme}/{testVersion}Version{number}.xml";
                break;

            case VisualStudioProjectScheme.VerboseWithPackageReference:
                path = $@"{scheme}/{testVersion}Version{number}.xml";
                break;

            case VisualStudioProjectScheme.VerboseWithPackagesDotConfig:
                path = $@"{scheme}/{testVersion}Version{number}/csproj.xml";
                break;

            case VisualStudioProjectScheme.Unsupported:
            case null:
                path = $@"VerboseWithNoScheme/csproj.xml";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(scheme), scheme, null);
            }

            return($"NuGet/Data/{path}");
        }
Exemplo n.º 3
0
 internal static NuGetProject CreateNuGetProject(NuGetScheme?scheme, TestVersion testVersion, TestPackage testPackage, IDictionary <string, string> nugetPackagesToInstall)
 {
     return(NugetInstallerFactoryExtension.DeterminePackages(
                applicationProjects: new[]
     {
         CreateProject(scheme, testVersion, testPackage, nugetPackagesToInstall)
     },
                loadDelegate: p => File.ReadAllText(p.ProjectFile())).Projects.Single());
 }
Exemplo n.º 4
0
 public void TryParseVersionTest(TestVersion testVersion)
 {
     if (VersionHandler.TryParseVersion(testVersion.version, out VersionHandler.Version test_version))
     {
         Assert.IsTrue(testVersion.version_out.Equals(test_version) && testVersion.can_parse);
     }
     else
     {
         Assert.IsTrue(!testVersion.can_parse);
     }
 }
Exemplo n.º 5
0
            public ProjectImplementation(NuGetScheme?scheme, TestVersion testVersion, TestPackage testPackage, IDictionary <string, string> nugetPackagesToInstall)
            {
                _nuGetScheme = scheme;
                _testVersion = testVersion;
                _number      = (int)testPackage;

                Name        = $"{(scheme.HasValue ? scheme.Value.ToString() : "null")}_{testVersion}_{_number}";
                ProjectType = new ProjectTypeImplementation(Name);
                this.InitializeVSMetaData();
                this.NugetPackages().AddRange(nugetPackagesToInstall.Select(x => new NuGetPackages(x)));
            }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            try
            {
                var  path       = args[0];
                var  procId     = int.Parse(args[1]);
                bool exceptions = false;
                Console.WriteLine("Waiting for app closing...");
                Process proc = null;
                do
                {
                    try
                    {
                        proc = Process.GetProcessById(procId);
                    }
                    catch
                    {
                        proc = null;
                    }
                } while (proc != null);
                Console.WriteLine("done.");

                var updFilePath = Path.Combine(UpdatePath, "update-config.json");
                var json        = JsonValue.ParseFile(updFilePath);
                var version     = Version.Parse(json["version"]);

                foreach (var jfile in json["files"])
                {
                    var updPath  = Path.Combine(UpdatePath, jfile["path"], jfile["name"]);
                    var filePath = Path.Combine(path, jfile["path"], jfile["name"]);
                    switch (jfile["action"].String)
                    {
                    case "replace":
                    case "add":
                        Console.WriteLine("Copying file " + jfile["name"]);
                        exceptions = exceptions || CatchAction(() => Directory.CreateDirectory(Path.GetDirectoryName(filePath)));
                        exceptions = exceptions || CatchAction(() => File.Copy(updPath, filePath, true));
                        break;

                    case "del":
                    case "delete":
                        Console.WriteLine("Deleting file " + jfile["name"]);
                        exceptions = exceptions || CatchAction(() => File.Delete(filePath));
                        break;
                    }
                }

                Console.WriteLine("updating reg version");
                exceptions = exceptions || CatchAction(() => TestVersion.SetVersion("Time Logger", string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build)));

                Console.WriteLine("all done.");
                if (exceptions)
                {
                    Console.ReadKey();
                }

                try
                {
                    ProcessStartInfo info = new ProcessStartInfo(Path.Combine(path, "TimeLogger.exe"));
                    info.Arguments = "-delete";
                    Process.Start(info);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.WriteLine(e.StackTrace);
                    Console.ReadLine();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
                Console.ReadLine();
            }
        }
 internal static NuGetProject CreateNuGetProject(VisualStudioProjectScheme?scheme, TestVersion testVersion, TestPackage testPackage, IDictionary <string, string> nugetPackagesToInstall)
 {
     return(NugetInstallerFactoryExtension.DetermineProjectNugetPackageInfo(CreateProject(scheme, testVersion, testPackage, nugetPackagesToInstall)));
 }
 internal static ProjectImplementation CreateProject(VisualStudioProjectScheme?scheme, TestVersion testVersion, TestPackage testPackage, IDictionary <string, string> nugetPackagesToInstall)
 {
     return(new ProjectImplementation(scheme, testVersion, testPackage, nugetPackagesToInstall));
 }