コード例 #1
0
    /// <summary>
    /// Processes the excel files.
    /// </summary>
    private static void ProcessExcelFiles()
    {
        ExcelToJsonConverter excelProcessor = new ExcelToJsonConverter();

        excelProcessor.ConversionToJsonSuccessfull += ExcelSuccessCallback;
        excelProcessor.ConvertExcelFilesToJson(EditorPrefs.GetString(ExcelToJsonConverterWindow.kExcelToJsonConverterInputPathPrefsName, Application.dataPath),
                                               EditorPrefs.GetString(ExcelToJsonConverterWindow.kExcelToJsonConverterOuputPathPrefsName, Application.dataPath),
                                               false);
    }
コード例 #2
0
    /// <summary>
    /// Class attribute [InitializeOnLoad] triggers calling the static constructor on every refresh.
    /// </summary>
    static ExcelToJsonAutoConverter()
    {
        string inputPath = EditorPrefs.GetString(ExcelToJsonConverterWindow.kExcelToJsonConverterInputPathPrefsName, Application.dataPath);
        string outputPath = EditorPrefs.GetString(ExcelToJsonConverterWindow.kExcelToJsonConverterOuputPathPrefsName, Application.dataPath);
        bool onlyModifiedFiles = EditorPrefs.GetBool(ExcelToJsonConverterWindow.kExcelToJsonConverterModifiedFilesOnlyPrefsName, false);

        ExcelToJsonConverter excelProcessor = new ExcelToJsonConverter();
        excelProcessor.ConvertExcelFilesToJson(inputPath, outputPath, onlyModifiedFiles);
    }
コード例 #3
0
    /// <summary>
    /// Class attribute [InitializeOnLoad] triggers calling the static constructor on every refresh.
    /// </summary>
    static ExcelToJsonAutoConverter()
    {
        var inputPath         = EditorPrefs.GetString(ExcelToJsonConverterWindow.ExcelToJsonConverterInputPathPrefsName, Application.dataPath);
        var outputPath        = EditorPrefs.GetString(ExcelToJsonConverterWindow.ExcelToJsonConverterOutputPathPrefsName, Application.dataPath);
        var onlyModifiedFiles = EditorPrefs.GetBool(ExcelToJsonConverterWindow.ExcelToJsonConverterModifiedFilesOnlyPrefsName, false);

        var excelProcessor = new ExcelToJsonConverter();

        excelProcessor.ConvertExcelFilesToJson(inputPath, outputPath, onlyModifiedFiles);
    }
コード例 #4
0
    public void OnEnable()
    {
        if (_excelProcessor == null)
        {
            _excelProcessor = new ExcelToJsonConverter();
        }

        _inputPath         = EditorPrefs.GetString(ExcelToJsonConverterInputPathPrefsName, Application.dataPath);
        _outputPath        = EditorPrefs.GetString(ExcelToJsonConverterOutputPathPrefsName, Application.dataPath);
        _onlyModifiedFiles = EditorPrefs.GetBool(ExcelToJsonConverterModifiedFilesOnlyPrefsName, false);
    }
コード例 #5
0
    public void OnEnable()
    {
        if (_excelProcessor == null)
        {
            _excelProcessor = new ExcelToJsonConverter();
        }

        _inputPath = EditorPrefs.GetString(kExcelToJsonConverterInputPathPrefsName, Application.dataPath);
        _outputPath = EditorPrefs.GetString(kExcelToJsonConverterOuputPathPrefsName, Application.dataPath);
        _onlyModifiedFiles = EditorPrefs.GetBool(kExcelToJsonConverterModifiedFilesOnlyPrefsName, false);
    }
コード例 #6
0
    public void OnEnable()
    {
        if (_excelProcessor == null)
        {
            _excelProcessor = new ExcelToJsonConverter();
        }

        _inputPath         = Path.Combine(Application.dataPath, "Editor/Localization");
        _outputPath        = Path.Combine(Application.dataPath, "Resources/Localization");
        _onlyModifiedFiles = EditorPrefs.GetBool(kExcelToJsonConverterModifiedFilesOnlyPrefsName, false);
    }
コード例 #7
0
    private void ApplyLocalizations(string inputPath, string outputPath, LocalizationOverride[] localizationOverrides)
    {
        var localizationOverrideDict = localizationOverrides.ToDictionary(
            lo => lo.Key,
            lo => new Dictionary <string, string>
        {
            { "en-gb", lo.EnGb },
            { "el", lo.El },
            { "es", lo.Es },
            { "nl", lo.Nl },
        });

        var converter = new ExcelToJsonConverter();

        converter.ConvertExcelFileToJson(inputPath, outputPath, localizationOverrideDict);
    }
コード例 #8
0
        public bool Import(byte[] fileByteArray)
        {
            var sectionService      = CreateService <SectionService>();
            var amenityService      = CreateService <AmenityService>();
            var directoryInfo       = GetExecutingDirectory();
            var isAllValid          = true;
            var communityRuleString = File.ReadAllText(Path.Combine(directoryInfo.FullName, @"community_rule.json"));
            var template            = JsonConvert.DeserializeObject <Template>(communityRuleString);

            executionContext = new ExecutionContext()
            {
                HierarchyProviderFactory     = new HierarchyProviderFactory(this._serviceFactory.FaciTechDbContext, this.communityId),
                ReferenceDataProviderFactory = new ReferenceDataProviderFactory()
            };


            executionContext.ReferenceDataProviderFactory.Sections  = sectionService.GetListByComunityId(this.communityId);
            executionContext.ReferenceDataProviderFactory.Amenities = amenityService.GetAll();

            ExcelToJsonConverter excelToJsonConverter = new ExcelToJsonConverter(template);
            JObject allWorksheetsJobject = excelToJsonConverter.Convert(fileByteArray);

            foreach (var worksheet in template.Worksheets)
            {
                var rowsJArray = (JArray)allWorksheetsJobject[worksheet.SheetName];
                if (rowsJArray != null)
                {
                    foreach (JObject rowJobject in rowsJArray)
                    {
                        foreach (var column in worksheet.Columns)
                        {
                            var isColumRuleSuccess = Validate(rowJobject, column);
                            isAllValid = isAllValid && isColumRuleSuccess;
                        }
                        var isRowRuleSuccess = Validate(rowJobject, worksheet.Rules);
                    }
                    SaveRows(rowsJArray, worksheet.SheetName);
                }
            }

            JsonToExcelConverter jsonToExcelConverter = new JsonToExcelConverter(allWorksheetsJobject, template);

            jsonToExcelConverter.Convert(_outputFilePath);
            return(isAllValid);
        }
コード例 #9
0
 /// <summary>
 /// Processes the excel files.
 /// </summary>
 private static void ProcessExcelFiles()
 {
     ExcelToJsonConverter excelProcessor = new ExcelToJsonConverter();
     excelProcessor.ConversionToJsonSuccessfull += ExcelSuccessCallback;
     excelProcessor.ConvertExcelFilesToJson(EditorPrefs.GetString(ExcelToJsonConverterWindow.kExcelToJsonConverterInputPathPrefsName, Application.dataPath),
                                      EditorPrefs.GetString(ExcelToJsonConverterWindow.kExcelToJsonConverterOuputPathPrefsName, Application.dataPath),
                                      false);
 }