Esempio n. 1
0
        public IGridDataRecords OpenData(byte[] dataSettings, IGridDataOpenContext openContext)
        {
            CSVGridDataSettings thesettings = CSVGridDataSettings.FromBytes(dataSettings);

            if (thesettings == null || thesettings.FileName == null) // and maybe check that file exists and can be opened, etc?
            {
                return(null);
            }

            thesettings.TryFindFile(openContext);
            return(new CSVGridDataRecords(thesettings));
        }
Esempio n. 2
0
        public static CSVGridDataSettings FromBytes(byte[] settings)
        {
            if (settings == null)
            {
                return(null);
            }

            System.IO.MemoryStream memstream = new System.IO.MemoryStream(settings);
            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter fmt = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

            CSVGridDataSettings csvsettings = (CSVGridDataSettings)fmt.Deserialize(memstream);

            return(csvsettings);
        }
Esempio n. 3
0
        public string GetDataSummary(byte[] dataSettings)
        {
            CSVGridDataSettings thesettings = CSVGridDataSettings.FromBytes(dataSettings);

            if (thesettings == null || thesettings.FileName == null) // and maybe check that file exists and can be opened, etc?
            {
                return(null);
            }

            if (String.IsNullOrWhiteSpace(thesettings.ImportCulture) == false)
            {
                return(String.Format("Bound to CSV: {0}, Use headers = {1}, Separator = '{2}', Culture='{3}'", thesettings.FileName, thesettings.UseHeaders, thesettings.Separator, thesettings.ImportCulture));
            }

            return(String.Format("Bound to CSV: {0}, Use headers = {1}, Separator = '{2}'", thesettings.FileName, thesettings.UseHeaders, thesettings.Separator));
        }
Esempio n. 4
0
        public byte[] GetDataSettings(byte[] existingSettings)
        {
            CSVGridDataSettings thesettings = CSVGridDataSettings.FromBytes(existingSettings);

            if (thesettings == null)
            {
                thesettings = new CSVGridDataSettings();
            }

            SettingsDialog dlg = new SettingsDialog();

            dlg.SetSettings(thesettings);

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                return(thesettings.ToBytes());
            }

            return(existingSettings);
        }
Esempio n. 5
0
 public CSVGridDataRecords(CSVGridDataSettings settings)
 {
     _settings = settings;
 }
Esempio n. 6
0
 internal void SetSettings(CSVGridDataSettings settings)
 {
     /// cSVGridDataSettingsBindingSource.DataSource = settings;
 }