private void FillInAssets(TreeNode node) { // Store assets under this classifcation ArrayList assets = MOG_ControllerAsset.GetAssetsByClassification(node.FullPath); assets.Sort(); bool assetsValid = (assets != null && assets.Count > 0); // If we actually have assets to list, and our archivedAssets do not differ from our branch-related assets... if (assetsValid) { // Foreach asset in this classification... foreach (MOG_Filename asset in assets) { TreeNode assetNode = CreateAssetNode(asset, node.ForeColor); node.Nodes.Add(assetNode); } } // Also, get our archived assets, if we are in archive view ArrayList archivedAssets = MOG_ControllerAsset.GetArchivedAssetsByClassification(node.FullPath); archivedAssets.Sort(); // If we have valid archivedAssets, AND // (we EITHER have more archivedAssets than assets // OR we have no valid assets) if (archivedAssets != null && archivedAssets.Count > 0 && ((assetsValid && assets.Count < archivedAssets.Count) || !assetsValid)) { //TODO: Possibly add a "Removed Assets" node here... // If we do have branch-related assets, check for them by name... List <string> branchAssetsList = new List <string>(); if (assets != null && assets.Count > 0) { // Create a list of our Current assets foreach (MOG_Filename asset in assets) { branchAssetsList.Add(asset.GetAssetFullName().ToLower()); } } // Fill in any Assets that are not current foreach (MOG_Filename archiveAsset in archivedAssets) { TreeNode assetNode = null; // If there is nothing in our branchAssetsList OR // branchAssetsList does not contain the current asset we're looking at... if (branchAssetsList.Count == 0 || !branchAssetsList.Contains(archiveAsset.GetAssetFullName().ToLower())) { assetNode = CreateAssetNode(archiveAsset, Archive_Color); node.Nodes.Add(assetNode); //Add this bad boy to the list so we don't add it more than once branchAssetsList.Add(archiveAsset.GetAssetFullName().ToLower()); } } } }