mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
Project Location
This commit is contained in:
parent
014e37e505
commit
a1a14f8858
305 changed files with 9783 additions and 9783 deletions
|
@ -1,83 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public class RepositoryConfigure : Popup
|
||||
{
|
||||
public string UserName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string UserEmail
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool GPGSigningEnabled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string GPGUserSigningKey
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string HttpProxy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public RepositoryConfigure(Repository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
|
||||
_cached = new Commands.Config(repo.FullPath).ListAll();
|
||||
if (_cached.ContainsKey("user.name")) UserName = _cached["user.name"];
|
||||
if (_cached.ContainsKey("user.email")) UserEmail = _cached["user.email"];
|
||||
if (_cached.ContainsKey("commit.gpgsign")) GPGSigningEnabled = _cached["commit.gpgsign"] == "true";
|
||||
if (_cached.ContainsKey("user.signingkey")) GPGUserSigningKey = _cached["user.signingkey"];
|
||||
if (_cached.ContainsKey("http.proxy")) HttpProxy = _cached["user.signingkey"];
|
||||
|
||||
View = new Views.RepositoryConfigure() { DataContext = this };
|
||||
}
|
||||
|
||||
public override Task<bool> Sure()
|
||||
{
|
||||
SetIfChanged("user.name", UserName);
|
||||
SetIfChanged("user.email", UserEmail);
|
||||
SetIfChanged("commit.gpgsign", GPGSigningEnabled ? "true" : "false");
|
||||
SetIfChanged("user.signingkey", GPGUserSigningKey);
|
||||
SetIfChanged("http.proxy", HttpProxy);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void SetIfChanged(string key, string value)
|
||||
{
|
||||
bool changed = false;
|
||||
if (_cached.ContainsKey(key))
|
||||
{
|
||||
changed = value != _cached[key];
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
new Commands.Config(_repo.FullPath).Set(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Repository _repo = null;
|
||||
private readonly Dictionary<string, string> _cached = null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue