public KodiNfoRootTree(string rpath) { this.m_rootPath = rpath; string[] parts = rpath.Split(new char[] { '\\', '/' }); KodiNfoRootTreeItem lastItem = null; int index = 0; if (rpath.StartsWith("\\")) { index = 2; Log.WriteInformation("Root Path is UNC path."); this.Item = new KodiNfoRootTreeItem(parts[2], KodiNfoElementType.FileSystem); lastItem = this.Item; } index++; for (; index < parts.Length; index++) { KodiNfoElementType type = GetKodiNfoElementType(parts[index]); if (type == KodiNfoElementType.FileSystem) { if (this.Item == null) { this.Item = new KodiNfoRootTreeItem(parts[index], KodiNfoElementType.FileSystem); lastItem = this.Item; } else { lastItem.Item = new KodiNfoRootTreeItem(parts[index], KodiNfoElementType.FileSystem); lastItem = lastItem.Item; } } else { if (this.Item == null) { this.Item = new KodiNfoRootTreeItem(parts[index], type); lastItem = this.Item; } else { lastItem.Item = new KodiNfoRootTreeItem(parts[index], type); lastItem = lastItem.Item; } } } }
public KodiNfoRootTreeItem(string directoryPart, KodiNfoElementType type) { this.Type = type; this.DirectoryName = directoryPart; }