Beispiel #1
0
 private void GetDirSetting(string relPath)
 {
     if (!string.IsNullOrEmpty(relPath))
     {
         string path = AMTool.GetAbsPath(relPath);
         if (!Directory.Exists(path))
         {
             return;
         }
         Dictionary <string, TextureSetting> dict = new Dictionary <string, TextureSetting>();
         TextureSetting root = TextureSettings.Find(t => t.RelPath.Equals(relPath));
         if (root == null)
         {
             var setting = new TextureSetting();
             setting.RelPath = relPath;
             dict.Add(path, setting);
             TextureSettings.Add(dict[path]);
         }
         else
         {
             AMTool.GetCurrentSetting(root, dict);
         }
         AMTool.LoadDirSetting(path, dict);
     }
 }
Beispiel #2
0
        private void OnSelectionItemChange(SelectionChangedType type)
        {
            if (MenuTree == null)
            {
                return;
            }

            switch (type)
            {
            case SelectionChangedType.ItemAdded:
                var setting = MenuTree.Selection[0].ObjectInstance as TextureSetting;
                if (setting == null)
                {
                    return;
                }
                _lastObj = setting;
                break;

            case SelectionChangedType.ItemRemoved:
                break;

            case SelectionChangedType.SelectionCleared:
                if (_lastObj == null)
                {
                    return;
                }

                _lastObj.SaveCfg2Children();
                break;

            default:
                break;
            }
        }
Beispiel #3
0
        private void CheckValidPath(TextureSetting parent)
        {
            List <TextureSetting> children = parent.Children;

            for (int i = 0; i < children.Count; i++)
            {
                if (!Directory.Exists(children[i].Path))
                {
                    parent.Children.Remove(children[i]);
                }
                else
                {
                    CheckValidPath(children[i]);
                }
            }
        }