コード例 #1
0
ファイル: LanguageHandlerEditor.cs プロジェクト: moalexey/ade
	/// <summary>
	/// Loads the parsed language file.(without the type identifiers)
	/// </summary>
	public static Dictionary<string, LocalizedObject> LoadParsedLanguageFile(string languageCode, bool isRoot)
	{
		string fileContents = string.Empty;
		string filePath = null;

		if(isRoot)
		{
			filePath = LocalizationWorkspace.ResourcesFolderFilePath() + "/" + 
				LocalizationWorkspace.rootLanguageName + LocalizationWorkspace.txtFileEnding;
		}
		else
		{
			filePath = LocalizationWorkspace.ResourcesFolderFilePath() + "/" + 
					LocalizationWorkspace.rootLanguageName + "." + languageCode + LocalizationWorkspace.txtFileEnding;
		}
					
		if(!FileUtility.ReadFromFile(filePath, out fileContents))
		{
			Debug.LogError("Failed to read language from file - " + filePath);
		}

	
		var loadedLanguageDB = LanguageParser.LoadLanguage(fileContents);
		
		return new Dictionary<string,LocalizedObject>(loadedLanguageDB);	
	}
コード例 #2
0
        /// <summary>
        /// Read a csv file
        /// </summary>
        /// <param name="path">The path to the file</param>
        /// <param name="delimiter">The delimiter used in the file</param>
        /// <returns>The parsed csv values</returns>
        public static List <List <string> > Read(string path, char delimiter)
        {
            string csvContent = null;

            if (FileUtility.Exists(path))
            {
                FileUtility.ReadFromFile(path, out csvContent);
                return(ReadFromString(csvContent, delimiter));
            }

            throw new System.IO.FileNotFoundException("CSV file does not exist!", path);
        }
コード例 #3
0
        static bool DoesFileHavePresence(string filePath)
        {
            string fileData = string.Empty;

            FileUtility.ReadFromFile(filePath, out fileData);

            if (fileData.Contains(SmartLocalizationDeclaration))
            {
                return(true);
            }

            return(false);
        }