+ list.Sort(nameField, 1);
+ list.SelectRow(root.row);
+ }
+
+ void LoadListDirectory()
+ {
+ FileListing listing { path, extensions = extensions };
+
+ bits.mode = directory;
+ while(listing.Find())
+ ProcessListItem(listing.name, listing.path, listing.stats, false);
+ }
+
+ void LoadListFileList(File f)
+ {
+ char line[65536];
+ bits.mode = list;
+ while(f.GetLine(line, 65536))
+ {
+ FileStats stats {};
+ char name[MAX_FILENAME];
+ FileGetStats(line, stats);
+ GetLastDirectory(line, name);
+ ProcessListItem(name, line, stats, true);
+ }
+ }
+
+ void LoadTreeFileList(File f)
+ {
+ char line[65536];
+ bits.mode = list;
+ while(f.GetLine(line, 65536))
+ {
+ FileStats stats {};
+ char name[MAX_FILENAME];
+ FileSystemNode node;
+ FileGetStats(line, stats);
+ GetLastDirectory(line, name);
+ node = ProcessTreeItem(name, line, stats, node);
+ }
+ }
+
+ void LoadListIterator()
+ {
+ FileSystemIterator iterator = eInstance_New(iteratorClass);
+ if(iterator)
+ {
+ iterator.owner = this;
+ iterator.OnObject = ListIterator_OnObject;
+ //iterator.OnLeavingDirectory = ListIterator_OnLeavingDirectory;
+ NotifyIteratorInit(master, this, iterator);
+ iterator.Iterate(path, true);
+ delete iterator;
+ }
+ }
+
+ bool ListIterator_OnObject(const char * name, const char * path, FileStats stats, bool isRootObject)
+ {
+ ProcessListItem(name, path, stats, false);
+ return false;
+ }
+
+ //void ListIterator_OnLeavingDirectory(char * path) { }
+
+ void ProcessListItem(const char * name, const char * path, FileStats stats, bool isListItem)
+ {
+ if((!bits.foldersOnly && !bits.filesOnly) || (bits.foldersOnly && stats.attribs.isDirectory) || (bits.filesOnly && stats.attribs.isFile))
+ {
+ FileSystemNode node = MakeFileSystemNode(stats, name, path, false, bits.previewPictures, isListItem, displaySystem);
+ AddNode(node);
+ }
+ }
+
+ FileSystemNode ProcessTreeItem(char * name, char * path, FileStats stats, FileSystemNode parent)
+ {
+ FileSystemNode node = MakeFileSystemNode(stats, name, path, false, bits.previewPictures, true, displaySystem);
+ AddTreeNode(parent, false, false, true, null);
+ //LoadTreeNode(node);
+ return node;
+ }
+
+ void LoadTreeNode(FileSystemNode node)
+ {
+ if(!node.bits.loaded)
+ {
+ char path[MAX_LOCATION];
+ node.GetPath(path);
+ {
+ FileListing listing { path, extensions = extensions };
+ if(node.children.count == 1)
+ DeleteNode(node.children.first);
+
+ while(listing.Find())
+ {
+ char * test;
+ FileSystemNode child = null;
+ if(!listing.stats.attribs.isRemovable && ((!bits.foldersOnly && !bits.filesOnly) ||
+ (bits.foldersOnly && listing.stats.attribs.isDirectory) ||
+ (bits.filesOnly && listing.stats.attribs.isFile)))
+ child = MakeAndAddToTreeFileSystemNodeFromFileListing(listing, node);
+ if(child)
+ NodeChildLoad(child, node);
+ test = child.name;
+ if(!test)
+ PrintLn("error");
+ }
+ }
+ node.bits.childrenLoaded = true;
+ node.bits.loaded = true;
+ node.row.SortSubRows(false);
+ }
+ else if(!node.bits.childrenLoaded)
+ {
+ FileSystemNode child;
+ if(node.children.first)
+ {
+ for(child = node.children.first; child; child = child.next)
+ {
+ if(!child.bits.loaded)
+ LoadTreeNode(child);
+ else if(!child.bits.childrenLoaded)
+ NodeChildLoad(child, node);
+ }
+ node.bits.childrenLoaded = true;
+ node.row.SortSubRows(false);
+ }
+ }
+ }
+
+ void NodeChildLoad(FileSystemNode parent, FileSystemNode node)
+ {
+ char path[MAX_LOCATION];
+ parent.GetPath(path);
+ if(bits.textFileLinesStyle && FileExists(path).isFile)
+ {
+ PrintLn("Test");
+ }
+ else
+ {
+ bool added = false;
+ FileListing listing { path, extensions = extensions };
+ while(listing.Find())
+ {
+ //char * test;
+ FileSystemNode child = null;
+ if((!bits.foldersOnly && !bits.filesOnly) ||
+ (bits.foldersOnly && listing.stats.attribs.isDirectory) ||
+ (bits.filesOnly && listing.stats.attribs.isFile))
+ child = MakeAndAddToTreeFileSystemNodeFromFileListing(listing, parent);
+ if(child)
+ {
+ added = true;
+ /*
+ test = child.name;
+ if(!test)
+ PrintLn("error");
+ */
+ }
+ }
+ if(!added)
+ added = true;
+ }
+ parent.bits.childrenLoaded = true;
+ }
+
+ void LoadComparedList()
+ {
+ int c/*, cmp*/ /*, smallest*/, icon;//, equalCount;
+ int count = comparedPaths ? comparedPaths.count : 0;
+ //bool allDone = false;
+ bool not;
+ FileStats stats;
+ char path[MAX_LOCATION];
+ //Array<ComparisonState> states { };
+ //Array<FileListing> listings { };
+ //Array<int> equals { };
+ //Array<MapNode<String, int>> mapNodes { };
+
+ //Array<Map<String, int>> lists { };
+ //Map<int, bool> equals{ };
+
+
+ MapNode<String, /*Map<int, */Array<int>> na;
+ //MapNode<int, int> nb;
+ Map<String, /*Map<int, */Array<int>> names { };
+ //Map<String, Array<bool>> names { };
+ //Map<String, bool[16]> names { }; // does not seem to be working
+ //Map<String, BoolArrayInt> names { };
+ {
+ for(c = 0; c < comparedPaths.count; c++)
+ {
+ FileListing listing { comparedPaths[c], extensions = extensions };
+ while(listing.Find())
+ {
+ /*Map<int, int>*/Array<int> m = names[listing.name];
+ if(!m)
+ m = { };
+ names[listing.name] = m;
+ /*/m[c] = */m.Add(c);
+ }
+ }
+ /* // compiles and should work but better solution?
+ for(c = 0; c < comparedPaths.count; c++)
+ {
+ FileListing listing { comparedPaths[c], extensions = extensions };
+ while(listing.Find())
+ {
+ Array<bool> a = names[listing.name];
+ if(!a)
+ a = { };
+ names[listing.name] = a;
+ a[c] = true;
+ }
+ }
+ */
+ /* // does not seem to be working
+ for(c = 0; c < comparedPaths.count; c++)
+ {
+ FileListing listing { comparedPaths[c], extensions = extensions };
+ while(listing.Find())
+ {
+ names[listing.name][c] = true;
+ }
+ }
+ */
+ /*
+ if(comparedPaths.count > 0)
+ {
+ FileListing listing { comparedPaths[0], extensions = extensions };
+ while(listing.Find())
+ {
+ // should be able to just do names[listing.name]._0 = true;
+ BoolArrayInt bai = names[listing.name];
+ bai._0 = true;
+ names[listing.name] = bai;
+ }
+ }
+ if(comparedPaths.count > 1)
+ {
+ FileListing listing { comparedPaths[1], extensions = extensions };
+ while(listing.Find())
+ {
+ // should be able to just do names[listing.name]._1 = true;
+ BoolArrayInt bai = names[listing.name];
+ bai._1 = true;
+ names[listing.name] = bai;
+ }
+ }
+ */
+ // and so on....
+ }
+
+ /*
+ for(dirPath : comparedPaths)