public void AssertFileLastWriteTimeDifference(IReplacementStrategy replacementStrategy, Action<DateTime, DateTime> assert)
        {
            var replacer = new FileContentReplacer(replacementStrategy);

            var temporaryFilePath = Path.GetTempFileName();
            File.WriteAllText(temporaryFilePath, "dummy line");
            using (var temporaryFile = new TemporaryFile(temporaryFilePath))
            {
                var originalWriteTime = File.GetLastWriteTimeUtc(temporaryFile.AbsolutePath);

                Thread.Sleep(100); // delay to ensure we pick up any time difference

                replacer.Replace(temporaryFile.AbsolutePath);

                assert(originalWriteTime, File.GetLastWriteTimeUtc(temporaryFile.AbsolutePath));
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Please specify config postfix:");

            var configFilePostFix = Console.ReadLine();

            var dt = DateTime.Now;

            var solution = JsonSerializer.Deserialize <Solution>
                               (File.ReadAllText(Environment.CurrentDirectory + $"\\config-{configFilePostFix}.json"));

            FilterProjects(args, solution);

            GitRepositoryPuller.Pull(solution.RepositoryPath);

            foreach (var project in solution.Projects)
            {
                DotNetBuilder.Release(Path.Combine(solution.RepositoryPath, project.ProjectPath), GetPath(solution, project, PathType.Publish));

                IISWebSiteManager.Stop(project.SiteName);

                DirectoryFullGraphCopier.Copy(GetPath(solution, project, PathType.WebSite), GetPath(solution, project, PathType.BackUp));

                DirectoryFullGraphCopier.Copy(GetPath(solution, project, PathType.Publish), GetPath(solution, project, PathType.WebSite));

                foreach (var solutionSetting in solution.SolutionSettings)
                {
                    FileContentReplacer.ReplaceByKey(GetPath(solution, project, PathType.WebSite, solutionSetting.FileName), solutionSetting.Key, solutionSetting.NewValue);
                }

                foreach (var projectSetting in project.ProjectSettings)
                {
                    FileContentReplacer.ReplaceByKey(GetPath(solution, project, PathType.WebSite, projectSetting.FileName), projectSetting.Key, projectSetting.NewValue);
                }

                IISWebSiteManager.Start(project.SiteName);
            }

            var period = DateTime.Now - dt;

            Console.WriteLine($"Finished in: {period}");

            Console.ReadLine();
        }
Esempio n. 3
0
        public MainForm()
        {
            _settingsManager          = new SettingsManager(SettingsPath);
            _debuggerTargetsGenerator = new DebuggerTargetsGenerator();
            _fileDownloader           = new FileDownloader();
            _fileContentReplacer      = new FileContentReplacer();
            _fileSaver      = new FileSaver();
            _versionChecker = new VersionChecker();

            _remoteConfigVersionTimer          = new Timer();
            _remoteConfigVersionTimer.Interval = 1000 * 60 * RemoteConfigVersionTimerInterval;
            _remoteConfigVersionTimer.Tick    += RemoteConfigVersionTimer_Elapsed;
            _remoteConfigVersionTimer.Start();

            _updaterTimer          = new Timer();
            _updaterTimer.Interval = 1000 * 60 * UpdaterTimerIntervalMinutes;
            _updaterTimer.Tick    += UpdaterTimer_Elapsed;
            _updaterTimer.Start();

            InitializeComponent();
        }