private void DrawImportSettings()
    {
        EditorGUI.indentLevel++;
        importSettingsFoldout = EditorGUILayout.Foldout(importSettingsFoldout, "Advanced settings");

        if (importSettingsFoldout)
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(40);
                GUILayout.Label("Ignore first row (Header)", GUILayout.Width(200));
                bool lastIgnore = excelIgnoreHeaderLine;
                excelIgnoreHeaderLine = GUILayout.Toggle(excelIgnoreHeaderLine, "", GUILayout.Width(15));
                if (lastIgnore != excelIgnoreHeaderLine)
                {
                    excelState = ExcelState.Nothing;
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(3);

            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(40);
                GUILayout.Label("Seperator char", GUILayout.Width(200));
                char lastChar = ExcelManager.excelSeperatorChar;
                ExcelManager.excelSeperatorChar = char.Parse(GUILayout.TextField(ExcelManager.excelSeperatorChar.ToString(), 1, GUILayout.Width(15)));
                if (lastChar != ExcelManager.excelSeperatorChar)
                {
                    excelState = ExcelState.Nothing;
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(40);
                GUILayout.Label("String combiner char", GUILayout.Width(200));
                char lastChar = ExcelManager.excelStringCombinerChar;
                ExcelManager.excelStringCombinerChar = char.Parse(GUILayout.TextField(ExcelManager.excelStringCombinerChar.ToString(), 1, GUILayout.Width(15)));
                if (lastChar != ExcelManager.excelStringCombinerChar)
                {
                    excelState = ExcelState.Nothing;
                }
            }
            GUILayout.EndHorizontal();
        }
        EditorGUI.indentLevel--;
    }
    private void DrawExcelAnalyse()
    {
        if (excelState >= ExcelState.Analysing)
        {
            if (excelState == ExcelState.Analysing)
            {
                excelColumnCheckLog = ExcelManager.CheckExcel(excelPath);
                excelState          = ExcelState.ExcelChecked;
            }

            EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
            if (excelColumnCheckLog != "")
            {
                EditorGUILayout.LabelField("  ERROR: " + excelColumnCheckLog);
            }
            else if (excelState == ExcelState.ExcelChecked)
            {
                excelExampleHeaderSplit = ExcelManager.CSVSplit(ExcelManager.ReadOneLine(excelPath));
                excelExampleColumnSplit = ExcelManager.CSVSplit(ExcelManager.ReadOneLine(excelPath, excelIgnoreHeaderLine));
                excelState = ExcelState.HasReadFirstColumn;
            }

            if (excelState >= ExcelState.HasReadFirstColumn)
            {
                GUILayout.Label("Please define the header - Example column");
                GUILayout.Space(5);

                //Header popups generieren
                int len = excelExampleColumnSplit.Length;
                if (excelState == ExcelState.HasReadFirstColumn)
                {
                    headerPopupSelectedIndex.Clear();
                    for (int i = 0; i < len; i++)
                    {
                        if (i == 0)
                        {
                            headerPopupSelectedIndex.Add(1);
                        }
                        else if (i == 1)
                        {
                            headerPopupSelectedIndex.Add(2);
                        }
                        else
                        {
                            headerPopupSelectedIndex.Add(0);
                        }
                    }

                    headerPopupList.Clear();
                    headerPopupList.Add("None");
                    headerPopupList.Add("Category");
                    headerPopupList.Add("Tag");
                    foreach (string language in Enum.GetNames(typeof(Languages)))
                    {
                        headerPopupList.Add(language);
                    }

                    //Header Tags vorbelegen, wenn category, tag oder eine vergebene Sprache gefunden wird
                    for (int i = 0; i < excelExampleHeaderSplit.Length; i++)
                    {
                        if (excelExampleHeaderSplit[i].Equals("Category", StringComparison.CurrentCultureIgnoreCase) ||
                            excelExampleHeaderSplit[i].Equals("Categories", StringComparison.CurrentCultureIgnoreCase))
                        {
                            headerPopupSelectedIndex[i] = 1;
                        }
                        if (excelExampleHeaderSplit[i].Equals("Tag", StringComparison.CurrentCultureIgnoreCase) ||
                            excelExampleHeaderSplit[i].Equals("Tags", StringComparison.CurrentCultureIgnoreCase))
                        {
                            headerPopupSelectedIndex[i] = 2;
                        }
                        if (Enum.IsDefined(typeof(Languages), excelExampleHeaderSplit[i]))
                        {
                            headerPopupSelectedIndex[i] = (int)Enum.Parse(typeof(Languages), excelExampleHeaderSplit[i]) + 3;
                        }
                    }

                    excelState = ExcelState.HasFilledHeaderList;
                }

                //Draw Header wenn gewünscht
                if (excelIgnoreHeaderLine)
                {
                    GUILayout.BeginHorizontal();
                    for (int i = 0; i < len; i++)
                    {
                        GUILayout.Space(10);
                        if (headerPopupSelectedIndex[i] == 0)
                        {
                            GUI.enabled = false;
                        }

                        EditorGUILayout.LabelField(excelExampleHeaderSplit[i], GUILayout.Width(position.width / len - 14));
                        GUI.enabled = true;
                    }
                    GUILayout.EndHorizontal();
                }

                //Draw Popups für jede Spalte
                GUILayout.BeginHorizontal();
                for (int i = 0; i < len; i++)
                {
                    headerPopupSelectedIndex[i] = EditorGUILayout.Popup(headerPopupSelectedIndex[i], headerPopupList.ToArray(), GUILayout.Width(position.width / len - 4));
                }
                GUILayout.EndHorizontal();

                //Draw Example Zeile
                GUILayout.BeginHorizontal();
                for (int i = 0; i < len; i++)
                {
                    GUILayout.Space(10);
                    if (headerPopupSelectedIndex[i] == 0)
                    {
                        GUI.enabled = false;
                    }

                    EditorGUILayout.LabelField(excelExampleColumnSplit[i], GUILayout.Width(position.width / len - 14));
                    GUI.enabled = true;
                }
                GUILayout.EndHorizontal();

                if (CheckExcelHeaderTags())
                {
                    if (excelState != ExcelState.IsTagged)
                    {
                        excelState = ExcelState.IsTagged;
                    }
                }
                else
                {
                    excelState = ExcelState.HasFilledHeaderList;
                }
            }
        }
    }
    private void DrawExcelImportAndGen()
    {
        GUILayout.Space(8);
        if (excelPath.Equals(""))
        {
            excelPath = Application.dataPath;
        }
        GUIStyle style = new GUIStyle(GUI.skin.label);

        style.richText = true;
        EditorGUILayout.LabelField("Language must be created <b>beforehand</b>.", style);
        EditorGUILayout.LabelField("CSV file needs at least 3 columns (Category, Tag, LocalisedText)");
        EditorGUILayout.LabelField("The csv import will create new tags if they aren't found in the default language.");
        EditorGUILayout.LabelField("Also it will <b>override</b> the LanguageFile if it already exists.", style);
        EditorGUILayout.LabelField("");
        EditorGUILayout.BeginHorizontal();
        {
            GUILayout.Space(10);
            EditorGUILayout.LabelField("Excel path: ", GUILayout.Width(75));
            EditorGUILayout.LabelField("<b>" + excelPath + "</b>", style);
        }
        EditorGUILayout.EndHorizontal();

        if (csvGen && !EditorApplication.isCompiling)
        {
            GenerateCSV();
            csvGen = false;
        }

        GUILayout.BeginHorizontal();
        {
            if (GUILayout.Button("Select csv file"))
            {
                string importPath = EditorUtility.OpenFilePanel("Localization file to import", Path.GetFullPath(excelPath), "csv");
                if (!string.IsNullOrEmpty(importPath))
                {
                    excelPath = importPath;
                }
            }

            if (GUILayout.Button("Generate", GUILayout.Width(75)))
            {
                if (isDirtyTags && !csvGen)
                {
                    if (EditorUtility.DisplayDialog("Save Tags", "Do you want to save the new tags before you generate the CSV file?", "Save", "Ignore"))
                    {
                        SaveFiles();
                        AssetDatabase.Refresh();
                    }
                }
                csvGen = true;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
        DrawImportSettings();

        EditorGUILayout.BeginHorizontal();
        if ((excelState == ExcelState.Nothing) && (Path.GetExtension(excelPath) == ".csv" && excelPath != Application.dataPath))
        {
            excelState = ExcelState.PathSelected;
        }

        GUI.enabled = excelState >= ExcelState.PathSelected;
        if (GUILayout.Button("Analyse " + Path.GetFileName(excelPath)))
        {
            excelState = ExcelState.Analysing;
        }
        GUI.enabled = true;


        GUI.enabled = excelState == ExcelState.IsTagged;
        if (GUILayout.Button("Import " + Path.GetFileName(excelPath)))
        {
            int categoryIndex = -1, tagIndex = -1;
            for (int i = 0; i < headerPopupSelectedIndex.Count; i++)
            {
                if (headerPopupSelectedIndex[i] == 1)
                {
                    categoryIndex = i;
                }
                if (headerPopupSelectedIndex[i] == 2)
                {
                    tagIndex = i;
                }
                if (categoryIndex > 0 && tagIndex > 0)
                {
                    break;
                }
            }
            for (int i = 0; i < headerPopupSelectedIndex.Count; i++)
            {
                if (headerPopupSelectedIndex[i] > 2)
                {
                    ImportExcelFileAndCreateTags((Languages)(headerPopupSelectedIndex[i] - 3), categoryIndex, tagIndex, i);
                    showImportFeedback = true;
                }
            }

            m_englishFile = LocalizationManager.GetLanguageDataFromFile(Languages.English);

            SaveFiles();
            excelState = ExcelState.Nothing;
            excelPath  = Path.GetDirectoryName(excelPath);
        }
        GUI.enabled = true;

        EditorGUILayout.EndHorizontal();

        if (showImportFeedback)
        {
            for (int i = 0; i < headerPopupSelectedIndex.Count; i++)
            {
                if (headerPopupSelectedIndex[i] > 2)
                {
                    EditorGUILayout.HelpBox("Imported content into " + ((Languages)headerPopupSelectedIndex[i] - 3).ToString(), MessageType.Info);
                }
            }

            framesFeedbackShown++;
            if (framesFeedbackShown >= 20)
            {
                framesFeedbackShown = 0;
                showImportFeedback  = false;
            }
        }
    }