예제 #1
0
        /// <summary>
        /// Reads the Languages from the <param name="path">file path</param>
        /// </summary>
        /// <param name="path">The full path to the excel file where the languages are located</param>
        /// <param name="reset">Resets the default languages</param>
        /// <returns>Returns a list of Languages</returns>
        public List <MappedLanguage> GetMappedLanguages(string path, bool reset = false)
        {
            var common = new Implementation.Common();

            if (reset)
            {
                common.SaveDefaultLanguagesDocument(path);
            }

            var reader    = new Reader(common);
            var languages = GetLanguages(reader.ReadLanguages(path));

            return(languages);
        }
예제 #2
0
        /// <summary>
        /// Reads the cell values from the rows of the first sheet in the
        /// excel document <param name="path">file path</param>
        /// , considering the <param name="columns">columns</param> defined.
        /// </summary>
        /// <param name="path">The full path to the excel file</param>
        /// <param name="columns">
        ///	The excel columns used to define the structure of the excel sheet.
        ///	If null, then the default columns are used to identify the languages.
        /// </param>
        internal List <ExcelRow> ReadLanguages(string path, List <ExcelColumn> columns = null)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new Exception(PluginResources.Warning_FilePathNull);
            }

            if (!File.Exists(path))
            {
                // create the default languages file
                _common.SaveDefaultLanguagesDocument(path);
            }

            if (columns == null)
            {
                columns = _common.GetDefaultExcelColumns();
            }

            // reads the rows from the first sheet
            var excelRows = GetExcelRows(path, columns);

            return(excelRows);
        }