Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Conversation

shana and others added 30 commits September 19, 2017 14:33
Copy link
Member

@shana shana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this show on the road

@StanleyGoldman
Copy link
Contributor Author

I was not sure what to do with data that was "derived" from cached data".
In the end I decided to lazily determine that data in the getters

public UriString CloneUrl
{
get
{
if (cloneUrl == null)
{
var currentRemote = CurrentRemote;
if (currentRemote.HasValue && currentRemote.Value.Url != null)
{
cloneUrl = new UriString(currentRemote.Value.Url);
}
}
return cloneUrl;
}
private set
{
cloneUrl = value;
}
}
public string Name
{
get
{
if (name == null)
{
var url = CloneUrl;
if (url != null)
{
name = url.RepositoryName;
}
else
{
name = LocalPath.FileName;
}
}
return name;
}
private set { name = value; }
}

I realize now that this function repeats the functionality to determine Name and CloneUrl.

private void UpdateRepositoryInfo()
{
if (CurrentRemote.HasValue)
{
CloneUrl = new UriString(CurrentRemote.Value.Url);
Name = CloneUrl.RepositoryName;
Logger.Trace("CloneUrl: {0}", CloneUrl.ToString());
}
else
{
CloneUrl = null;
Name = LocalPath.FileName;
Logger.Trace("CloneUrl: [NULL]");
}
}

@StanleyGoldman
Copy link
Contributor Author

I have a dirty underbelly here...

IRemoteConfigBranchDictionary should no longer implement IDictionary< ... , IDictionary< ... , ... >>
That is left over from attempts to use SerializableDictionary. And as a result creates this mess here. 😓

IEnumerator<KeyValuePair<string, IDictionary<string, ConfigBranch>>> IEnumerable<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.GetEnumerator()
{
throw new NotImplementedException();
//return AsDictionary
// .Select(pair => new KeyValuePair<string, IDictionary<string, ConfigBranch>>(pair.Key, pair.Value.AsDictionary))
// .GetEnumerator();
}
void ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.Add(KeyValuePair<string, IDictionary<string, ConfigBranch>> item)
{
throw new NotImplementedException();
//Guard.ArgumentNotNull(item, "item");
//Guard.ArgumentNotNull(item.Value, "item.Value");
//
//var serializableDictionary = item.Value as SerializableDictionary<string, ConfigBranch>;
//if (serializableDictionary == null)
//{
// serializableDictionary = new SerializableDictionary<string, ConfigBranch>(item.Value);
//}
//
//Add(item.Key, serializableDictionary);
}
bool ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.Contains(KeyValuePair<string, IDictionary<string, ConfigBranch>> item)
{
throw new NotImplementedException();
}
void ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.CopyTo(KeyValuePair<string, IDictionary<string, ConfigBranch>>[] array, int arrayIndex)
{
throw new NotImplementedException();
}
bool ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.Remove(KeyValuePair<string, IDictionary<string, ConfigBranch>> item)
{
throw new NotImplementedException();
}
bool ICollection<KeyValuePair<string, IDictionary<string, ConfigBranch>>>.IsReadOnly
{
get { throw new NotImplementedException(); }
}
void IDictionary<string, IDictionary<string, ConfigBranch>>.Add(string key, IDictionary<string, ConfigBranch> value)
{
throw new NotImplementedException();
}
bool IDictionary<string, IDictionary<string, ConfigBranch>>.TryGetValue(string key, out IDictionary<string, ConfigBranch> value)
{
value = null;
Dictionary<string, ConfigBranch> branches;
if (TryGetValue(key, out branches))
{
value = branches;
return true;
}
return false;
}
IDictionary<string, ConfigBranch> IDictionary<string, IDictionary<string, ConfigBranch>>.this[string key]
{
get
{
throw new NotImplementedException();
//var dictionary = (IDictionary<string, IDictionary<string, ConfigBranch>>)this;
//IDictionary<string, ConfigBranch> value;
//if (!dictionary.TryGetValue(key, out value))
//{
// throw new KeyNotFoundException();
//}
//
//return value;
}
set
{
throw new NotImplementedException();
//var dictionary = (IDictionary<string, IDictionary<string, ConfigBranch>>)this;
//dictionary.Add(key, value);
}
}
ICollection<string> IDictionary<string, IDictionary<string, ConfigBranch>>.Keys
{
get
{
throw new NotImplementedException();
}
}
ICollection<IDictionary<string, ConfigBranch>> IDictionary<string, IDictionary<string, ConfigBranch>>.Values
{
get
{
return Values.Cast<IDictionary<string,ConfigBranch>>().ToArray();
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants