예제 #1
0
 public void AddFolder(TernaryFolder folder)
 {
     if (!_Folders.ContainsKey(folder.Name))
     {
         _Folders.Add(folder.Name, folder);
     }
 }
예제 #2
0
 public void RemoveFolder(TernaryFolder folder)
 {
     if (_Folders.ContainsKey(folder.Name))
     {
         _Folders.Remove(folder.Name);
     }
 }
예제 #3
0
파일: TStorage.cs 프로젝트: bmdevx/Ternary
        private void CreateFolder(TernaryString fullName, Tryte attr)
        {
            TernaryFolder folder = new TernaryFolder(fullName.Trim('/'), attr);

            int index = folder.Name.IndexOf('/');

            if (index > 0 && index != folder.Name.Length - 1)
            {
                TernaryString baseFolderName = folder.Name.Substring('/');
                if (_Folders.ContainsKey(baseFolderName))
                {
                    _Folders[baseFolderName].AddFolder(folder);
                }
                else
                {
                    throw new Exception($"Folder root folder '{baseFolderName}' Not Found");
                }
            }
            else
            {
                _Folders.Add(folder.Name, folder);
            }
        }