예제 #1
0
        void UpdateFromCSV(string chosenUpdateFile)
        {
            LanguageHandlerEditor.UpdateLanguageFile(chosenCulture.languageCode, CSVParser.Read(chosenUpdateFile, CSVParser.GetDelimiter(delimiter)));

            if (parentWindow.translateLanguageWindow != null)
            {
                parentWindow.translateLanguageWindow.ReloadLanguage();
            }
        }
        void UpdateFromCSV(string chosenUpdateFile)
        {
            UpdateLanguageFile(CSVParser.Read(chosenUpdateFile, CSVParser.GetDelimiter(delimiter)));

            /*
             * if (parentWindow.translateLanguageWindow != null)
             * {
             *  parentWindow.translateLanguageWindow.ReloadLanguage();
             * }
             */
        }
예제 #3
0
 void OnWatchedFileChanged(object source, FileSystemEventArgs e)
 {
     EditorThreadQueuer.QueueOnMainThread(() => {
         Console.WriteLine("File changed. Reloading...");
         List <List <string> > values = CSVParser.Read(e.FullPath, CSVParser.GetDelimiter(CSVParser.Delimiter.COMMA));
         LanguageHandlerEditor.UpdateLanguageFile(currentCultureInfo.languageCode, values);
         ReloadLanguage();
         if (Application.isPlaying && LanguageManager.HasInstance)
         {
             LanguageManager.Instance.ChangeLanguage(currentCultureInfo.languageCode);
         }
         Repaint();
     });
 }
예제 #4
0
        void ImportFromCSV(string chosenImportFile)
        {
            List <List <string> > values = CSVParser.Read(chosenImportFile, CSVParser.GetDelimiter(delimiter));

            if (chosenCulture == null)
            {
                Debug.LogError("The language: " + chosenCulture.englishName + " could not be created");
                this.Close();
                return;
            }
            LanguageHandlerEditor.CreateNewLanguage(chosenCulture.languageCode, values);

            if (creationDelegate != null)
            {
                creationDelegate();
                creationDelegate = null;
            }
        }
        void ShowImportGUI()
        {
            if (GUILayout.Button("Import"))
            {
                if (availableFileFormats[chosenFileFormat] == csvFileEnding)
                {
                    string file = EditorUtility.OpenFilePanel("Select CSV file.", "", "");
                    if (file != null && file != "")
                    {
                        var values = CSVParser.Read(file, CSVParser.GetDelimiter(delimiter));
                        if (values.Count > 0)
                        {
                            LanguageHandlerEditor.BulkUpdateLanguageFiles(values);
                        }
                    }
                    this.Close();
                }
                else if (availableFileFormats[chosenFileFormat] == xlsFileEnding)
                {
                    string file = EditorUtility.OpenFilePanel("Select XLS file.", "", "");
                    if (file != null && file != "")
                    {
                        var values = XLSExporter.Read(file);
                        if (values.Count > 0)
                        {
                            LanguageHandlerEditor.BulkUpdateLanguageFiles(values);
                        }
                    }
                    this.Close();
                }
                else
                {
                    Debug.LogError("BulkUpdateWindow: Unsupported import format!");
                }

                if (parentWindow.translateLanguageWindow != null)
                {
                    parentWindow.translateLanguageWindow.ReloadLanguage();
                }
            }
        }
예제 #6
0
 public static List <List <string> > ReadCSV(string path, char delimiter)
 {
     return(CSVParser.Read(path, delimiter));
 }
예제 #7
0
 public void TestCSVRead_FileNotFoundException()
 {
     CSVParser.Read(string.Empty, CSVParser.GetDelimiter(CSVParser.Delimiter.COMMA));
 }
예제 #8
0
 public void TestCSVRead_FileNotFoundException()
 {
     Assert.Throws <System.IO.FileNotFoundException>(() => CSVParser.Read(string.Empty, CSVParser.GetDelimiter(CSVParser.Delimiter.COMMA)));
 }