Renamed GetBreadCrumbs to Get ProviderLocator

Made in return a list of nodes rather than a string
made the data store this as json
This commit is contained in:
Lars Brubaker 2015-06-18 18:06:04 -07:00
parent e17f358b97
commit c8433b1cfa
7 changed files with 56 additions and 69 deletions

View file

@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
using MatterHackers.Agg;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.PrintQueue;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -127,33 +128,9 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
throw new NotImplementedException();
}
public override string GetBreadCrumbs()
public override List<ProviderLocatorNode> GetProviderLocator()
{
throw new NotImplementedException();
// append all of the collection keys with names
string addDirectory = currentDirectory;
List<string> collectionKeys = new List<string>();
while (addDirectory != ".")
{
collectionKeys.Add(addDirectory);
addDirectory = Path.GetDirectoryName(addDirectory);
}
string total = "";
bool first = true;
for(int i = collectionKeys.Count-1; i>=0; i--)
{
string key = collectionKeys[i];
if (!first)
{
total += "|";
}
total += key + "," + Path.GetFileName(key);
first = false;
}
return total;
}
public override PrintItemCollection GetCollectionItem(int collectionIndex)
@ -185,8 +162,9 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
public override PrintItemWrapper GetPrintItemWrapper(int itemIndex)
{
string fileName = currentDirectoryFiles[itemIndex];
string breadCrumbs = LibraryProvider.Instance.GetBreadCrumbs();
return new PrintItemWrapper(new DataStorage.PrintItem(Path.GetFileNameWithoutExtension(fileName), fileName, breadCrumbs));
List<ProviderLocatorNode> providerLocator = LibraryProvider.Instance.GetProviderLocator();
string providerLocatorJson = JsonConvert.SerializeObject(providerLocator);
return new PrintItemWrapper(new DataStorage.PrintItem(Path.GetFileNameWithoutExtension(fileName), fileName, providerLocatorJson));
}
public override void RemoveCollection(string collectionName)