public FilesStats GetFilesStats()
        {
            DateTime   halfAnHourAgo = DateTime.Now.AddMinutes(-30);
            FilesStats filesStats    = new FilesStats();

            foreach (FilePath filePath in FilePaths)
            {
                if (filePath.Path.EndsWith(".java"))
                {
                    filesStats.NotCompiledCount.Add(filePath);
                }
                else if (!File.Exists(filePath.Path))
                {
                    filesStats.MissingCount.Add(filePath);
                }
                else if (File.GetLastAccessTime(filePath.Path).CompareTo(halfAnHourAgo) < 0)
                {
                    filesStats.OutdatedCount.Add(filePath);
                }
            }
            return(filesStats);
        }
Beispiel #2
0
        private void ellipseButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            createButton.Focus();
            if (ValidateForm())
            {
                bool?      proceedWithPatchCreation = true;
                FilesStats fileStats = Logic.GetFilesStats();
                if (!fileStats.AllClear)
                {
                    Window confirm = new ConfirmWindow(BuildConfirmMessage(fileStats));
                    confirm.Owner            = this;
                    proceedWithPatchCreation = confirm.ShowDialog();
                }

                if (proceedWithPatchCreation.GetValueOrDefault(false))
                {
                    string pathToPatch = Logic.createPatch(commonBaseTextBox.Text, prodTextBox.Text, buildTextBox.Text, descriptionTextBox.Text);
                    if (pathToPatch != null)
                    {
                        Process.Start("explorer.exe", string.Format("/select,\"{0}\"", pathToPatch));
                    }
                }
            }
        }
Beispiel #3
0
        private string BuildConfirmMessage(FilesStats fileStats)
        {
            StringBuilder confirmWindowMessage = new StringBuilder();

            if (fileStats.MissingCount.Count > 0)
            {
                confirmWindowMessage.AppendLine("The following files cannot be found and will be skipped:");
                foreach (FilePath filePath in fileStats.MissingCount)
                {
                    confirmWindowMessage.Append(" - ").AppendLine(filePath.Path);
                }
                confirmWindowMessage.AppendLine();
            }

            if (fileStats.OutdatedCount.Count > 0)
            {
                confirmWindowMessage.AppendLine("The following files were last modified more than 30 minutes ago:");
                foreach (FilePath filePath in fileStats.OutdatedCount)
                {
                    confirmWindowMessage.Append(" - ").AppendLine(filePath.Path);
                }
                confirmWindowMessage.AppendLine();
            }

            if (fileStats.NotCompiledCount.Count > 0)
            {
                confirmWindowMessage.AppendLine("The following files are uncompiled JAVA files:");
                foreach (FilePath filePath in fileStats.NotCompiledCount)
                {
                    confirmWindowMessage.Append(" - ").AppendLine(filePath.Path);
                }
                confirmWindowMessage.AppendLine();
            }

            return(confirmWindowMessage.Append("Would you like to proceed anyway?").ToString());
        }