Skip to content

Commit

Permalink
Merge pull request #78 from Haacked/upgrades
Browse files Browse the repository at this point in the history
Upgrades
  • Loading branch information
haacked committed Oct 6, 2015
2 parents 355c35b + fa184a9 commit 01caa5b
Show file tree
Hide file tree
Showing 25 changed files with 90 additions and 277 deletions.
6 changes: 0 additions & 6 deletions .nuget/NuGet.Config

This file was deleted.

Binary file removed .nuget/NuGet.exe
Binary file not shown.
144 changes: 0 additions & 144 deletions .nuget/NuGet.targets

This file was deleted.

12 changes: 4 additions & 8 deletions SeeGit.sln
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SeeGitApp", "SeeGitApp\SeeGitApp.csproj", "{455C90CF-CB4E-41FB-8DB8-04AD1B104F64}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{AC22554C-AC27-42A3-91FA-16D49BBC0A4D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8B481ABB-96B1-4480-B8CA-EF43A860156E}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
8 changes: 0 additions & 8 deletions SeeGit.sln.DotSettings

This file was deleted.

2 changes: 1 addition & 1 deletion SeeGitApp/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
-->
<add key="SHALength" value="8"/>
</appSettings>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>
1 change: 1 addition & 0 deletions SeeGitApp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ namespace SeeGit
/// </summary>
public class App : Application
{
public const string LayoutAlgorithm = "EfficientSugiyama"; // Others include: "CompoundFDP"
}
}
9 changes: 4 additions & 5 deletions SeeGitApp/Bases/NotifyPropertyChanged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ protected void RaisePropertyChanged(string propertyName)
{
var handler = PropertyChanged;

if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
Expand All @@ -27,19 +26,19 @@ private string ExtractPropertyName<T>(Expression<Func<T>> propertyExpression)
{
if (propertyExpression == null)
{
throw new ArgumentNullException("propertyExpression");
throw new ArgumentNullException(nameof(propertyExpression));
}

var memberExpression = propertyExpression.Body as MemberExpression;
if (memberExpression == null)
{
throw new ArgumentException("propertyExpression");
throw new ArgumentException(nameof(propertyExpression));
}

var property = memberExpression.Member as PropertyInfo;
if (property == null)
{
throw new ArgumentException("propertyExpression");
throw new ArgumentException(nameof(propertyExpression));
}

return memberExpression.Member.Name;
Expand Down
6 changes: 2 additions & 4 deletions SeeGitApp/Extensions/CommitTemplatedAdorner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ internal class CommitTemplatedAdorner : Adorner
///
/// </summary>
/// <param name="adornedElement"></param>
/// <param name="frameworkElementAdorner"></param>
public CommitTemplatedAdorner(UIElement adornedElement, FrameworkElement frameworkElementAdorner)
: base(adornedElement)
{
Expand All @@ -33,10 +34,7 @@ protected override Visual GetVisualChild(int index)
/// <summary>
///
/// </summary>
protected override int VisualChildrenCount
{
get { return 1; }
}
protected override int VisualChildrenCount => 1;

/// <summary>
///
Expand Down
16 changes: 8 additions & 8 deletions SeeGitApp/Extensions/ModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ public static string AtMost(this string s, int characterCount)

public static string GetGitRepositoryPath(string path)
{
if (path == null) throw new ArgumentNullException("path");
if (path == null) throw new ArgumentNullException(nameof(path));

//If we are passed a .git directory, just return it straightaway
DirectoryInfo pathDirectoryInfo = new DirectoryInfo(path);
if (pathDirectoryInfo.Name == ".git")
var pathDirectoryInfo = new DirectoryInfo(path);
if (pathDirectoryInfo.Name == GitDirectoryName)
{
return path;
}

if (!pathDirectoryInfo.Exists) return Path.Combine(path, ".git");
if (!pathDirectoryInfo.Exists) return Path.Combine(path, GitDirectoryName);

DirectoryInfo checkIn = pathDirectoryInfo;
var checkIn = pathDirectoryInfo;

while (checkIn != null)
{
string pathToTest = Path.Combine(checkIn.FullName, ".git");
string pathToTest = Path.Combine(checkIn.FullName, GitDirectoryName);
if (Directory.Exists(pathToTest))
{
return pathToTest;
Expand All @@ -48,12 +48,12 @@ public static string GetGitRepositoryPath(string path)

// This is not good, it relies on the rest of the code being ok
// with getting a non-git repo dir
return Path.Combine(path, ".git");
return Path.Combine(path, GitDirectoryName);
}

public static IObservable<FileSystemEventArgs> CreateGitRepositoryCreationObservable(string path)
{
string expectedGitDirectory = Path.Combine(path, ".git");
string expectedGitDirectory = Path.Combine(path, GitDirectoryName);
return new FileSystemWatcher(path)
{
IncludeSubdirectories = false,
Expand Down
24 changes: 8 additions & 16 deletions SeeGitApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
using SeeGit.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Windows.Controls;
using System;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using SeeGit.Models;

namespace SeeGit
{
public partial class MainWindow : Window
{
private readonly MainWindowViewModel _viewModel;
private static readonly Settings _configuration = new Settings();

public MainWindow()
{
Expand All @@ -26,10 +21,7 @@ public MainWindow()
/// <summary>
/// A reference to the configuration.
/// </summary>
public static Settings Configuration
{
get { return _configuration; }
}
public static Settings Configuration { get; } = new Settings();

private void OnChooseRepository(object sender, RoutedEventArgs args)
{
Expand All @@ -45,13 +37,13 @@ private void OnToggleSettings(object sender, RoutedEventArgs args)
{
if (!_viewModel.ToggleSettings())
{
foreach (CommitVertex vertex in _viewModel.Graph.Vertices)
foreach (var vertex in _viewModel.Graph.Vertices)
{
vertex.AdornerMessageVisibilityType = _configuration.GetSetting("AdornerCommitMessageVisibility", "ExpandedHidden");
vertex.DescriptionShown = _configuration.GetSetting<bool>("DescriptionInExpander", false);
vertex.ShaLength = _configuration.GetSetting<int>("SHALength", 8);
vertex.AdornerMessageVisibilityType = Configuration.GetSetting("AdornerCommitMessageVisibility", "ExpandedHidden");
vertex.DescriptionShown = Configuration.GetSetting("DescriptionInExpander", false);
vertex.ShaLength = Configuration.GetSetting("SHALength", 8);
}
_configuration.Save();
Configuration.Save();
_viewModel.Refresh();
}
}
Expand Down
2 changes: 1 addition & 1 deletion SeeGitApp/Models/BranchReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public override int GetHashCode()
{
unchecked
{
int result = (Name != null ? Name.GetHashCode() : 0);
int result = Name?.GetHashCode() ?? 0;
result = (result*397) ^ IsRemote.GetHashCode();
result = (result*397) ^ IsCurrent.GetHashCode();
return result;
Expand Down
4 changes: 2 additions & 2 deletions SeeGitApp/Models/CommitEdge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public override int GetHashCode()
{
unchecked
{
int result = (Target != null ? Target.GetHashCode() : 0);
result = (result * 397) ^ (Source != null ? Source.GetHashCode() : 0);
int result = Target?.GetHashCode() ?? 0;
result = (result * 397) ^ (Source?.GetHashCode() ?? 0);
return result;
}
}
Expand Down
Loading

0 comments on commit 01caa5b

Please sign in to comment.