protected void DrawAddPath(Dictionary <List <PathInfo>, int> pathDic)
 {
     if (pathDic == null)
     {
         return;
     }
     //EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandHeight(true));
     for (int i = 0; i < CDNResourceMoveConfig.Instance().pathList.Count; i++)
     {
         EditorGUILayout.BeginHorizontal();
         foreach (var item in pathDic)
         {
             if (GUILayout.Button(item.Value + "", GUILayout.Width(50)))
             {
                 var             path   = CDNResourceMoveConfig.Instance().pathList[i];
                 List <PathInfo> digout = item.Key.Where(o => o.path.Equals(path)).ToList();
                 if (digout.Count > 0)
                 {
                     continue;
                 }
                 PathInfo pi = new PathInfo();
                 pi.path = path;
                 item.Key.Add(pi);
             }
         }
         EditorGUILayout.LabelField(CDNResourceMoveConfig.Instance().pathList[i], EditorStyles.boldLabel);
         EditorGUILayout.EndHorizontal();
     }
 }
    public static void WriteOnly(string outFileName, List <string> content, WriteType type = WriteType.TEXT)
    {
        if (string.IsNullOrEmpty(CDNResourceMoveConfig.Instance().logOutPath) || !Directory.Exists(CDNResourceMoveConfig.Instance().logOutPath))
        {
            Debug.LogError("write error !:" + CDNResourceMoveConfig.Instance().logOutPath);
            return;
        }
        string outputPath = CDNResourceMoveConfig.Instance().logOutPath + "/" + outFileName;

        string dir = Path.GetDirectoryName(outputPath);

        if (!Directory.Exists(dir))
        {
            Directory.CreateDirectory(dir);
        }
        if (type == WriteType.EXCEL)
        {
            ExcelIns ei = ExcelManager.GetExcel(outputPath + ".xls");
            ei.WriteSimpleList(content);
            //ei.GetWorkSheet();
        }
        else
        {
            outputPath = outputPath + ".txt";
            if (!File.Exists(outputPath))
            {
                FileStream fs1 = new FileStream(outputPath, FileMode.Create, FileAccess.Write);//创建写入文件
                fs1.Close();
            }
            System.IO.File.WriteAllLines(outputPath, content.ToArray());
        }
    }
    void Update()
    {
        ResrouceCardInterface inter;

        if (cardList.TryGetValue(CDNResourceMoveConfig.Instance().cardIndex, out inter))
        {
            inter.Update();
        }
    }
    public T GetSerializableBean <T>()
    {
        Type t    = CDNResourceMoveConfig.Instance().GetType();
        var  mems = t.GetFields(); //拿所有成员
        Type mT   = typeof(T);

        for (int i = 0; i < mems.Length; i++)
        {
            if (mems[i].FieldType == mT)// mems[i].FieldType.IsAssignableFrom(T)
            {
                FieldInfo mi = mems[i];
                return((T)mi.GetValue(CDNResourceMoveConfig.Instance()));
            }
        }
        EditorUtility.DisplayDialog("错误",
                                    "找不到对应的类型:" + mT,
                                    "确认");
        return((T) new object());
    }
    private void DrawModifyPath()
    {
        List <int> modifyList = curSelectCard.PathList();

        if (modifyList == null)
        {
            return;
        }
        //EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandHeight(true));
        for (int i = 0; i < CDNResourceMoveConfig.Instance().pathList.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            foreach (var item in modifyList)
            {
                if (GUILayout.Button(item + "", GUILayout.Width(50)))
                {
                    var path = CDNResourceMoveConfig.Instance().pathList[i];
                    curSelectCard.OnPathClick(item, path);
                }
            }
            EditorGUILayout.LabelField(CDNResourceMoveConfig.Instance().pathList[i], EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
        }
    }
    void OnGUI()
    {
        if (curSelectCard != null)
        {
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button(CDNResourceMoveConfig.Instance().pathListInHide ? "展开路径" : "收起路径", GUILayout.Width(70)))
            {
                CDNResourceMoveConfig.Instance().pathListInHide = !CDNResourceMoveConfig.Instance().pathListInHide;
            }
            if (GUILayout.Button("添加路径", GUILayout.Width(70)))
            {
                string folderPath = EditorUtility.OpenFolderPanel("选择文件夹", "", "");
                if (folderPath != string.Empty)
                {
                    if (!CDNResourceMoveConfig.Instance().pathList.Contains(folderPath))
                    {
                        CDNResourceMoveConfig.Instance().pathList.Add(folderPath);
                    }
                }
            }
            //绘制输出路径.
            EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
            if (GUILayout.Button("日志输出路径", GUILayout.Width(100)))
            {
                string folderPath = EditorUtility.OpenFolderPanel("选择文件夹", "", "");
                if (folderPath != string.Empty)
                {
                    CDNResourceMoveConfig.Instance().logOutPath = folderPath;
                }
            }
            EditorGUILayout.LabelField(CDNResourceMoveConfig.Instance().logOutPath);

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            if (!CDNResourceMoveConfig.Instance().pathListInHide)
            {
                m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition, GUILayout.Height(90));
                if (curSelectCard.PathList() == null || curSelectCard.PathList().Count == 0)
                {
                    DrawAddPath(curSelectCard.PathDic());
                }
                if (curSelectCard.PathDic() == null || curSelectCard.PathDic().Count == 0)
                {
                    DrawModifyPath();
                }
                EditorGUILayout.EndScrollView();
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
        }
        //EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandHeight(true));
        //(ResourceActionType)
        CDNResourceMoveConfig.Instance().cardIndex = GUILayout.SelectionGrid(CDNResourceMoveConfig.Instance().cardIndex, selectionMenu, selectionMenu.Length, EditorStyles.toolbarButton);
        ResrouceCardInterface inter;

        if (cardList.TryGetValue(CDNResourceMoveConfig.Instance().cardIndex, out inter))
        {
            curSelectCard = inter;
            inter.Draw();
        }
    }
 public OhterCardItemBase()
 {
     serBean = CDNResourceMoveConfig.Instance().otherInfo;
     Init();
 }