/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="jasonFilePath"></param>

        public ImportSetting(string jasonFilePath)
        {
            // use 'Deserializing Partial JSON Fragments'
            JObject jObject;

            try
            {
                // Read JSON
                string text = HoUtil.ReadAllText(jasonFilePath);
                jObject = JObject.Parse(text);
            }
            catch (Exception e)
            {
                MessageBox.Show(
                    $@"Can't read '{jasonFilePath}

Consider Resetting to factory settings
- File, Reset Factory Settings!!!'

{e}", @"Can't import Chapter: 'Importer' from Settings.json");
                return;
            }

            //----------------------------------------------------------------------
            // Deserialize "DiagramStyle", "DiagramObjectStyle",""DiagramLinkStyle"
            // get JSON result objects into a list
            ImportSettings =
                (List <FileImportSettingsItem>)JasonHelper.GetConfigurationItems <FileImportSettingsItem>(
                    jObject, "Importer");
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Read Import Settings
 /// </summary>
 private void ReadImportSettings()
 {
     // Get settings from 'Settings.json', Chapter 'Importer'
     _importSettings = (List <FileImportSettingsItem>)JasonHelper
                       .GetConfigurationItems <FileImportSettingsItem>(JasonHelper
                                                                       .DeserializeSettings(_jsonFilePath), "Importer");
 }