public Form1(ConvertorParams convertorParams) { InitializeComponent(); _convertorParams = convertorParams ?? throw new ArgumentException("serialazeble Parametrs load ERROR"); #region Десеріалізація foreach (FileExtention value in Enum.GetValues(typeof(FileExtention))) { comboBox_writeExt.Items.Add(value); } foreach (HandlerType value in Enum.GetValues(typeof(HandlerType))) { toolStripComboBox1.Items.Add(value); } textBox_Read.Text = _convertorParams.ReadFilePath; textBox_Write.Text = _convertorParams.WriteFilePath; textBox_readExt.Text = _convertorParams.ReadFileExtention.ToString(); comboBox_writeExt.SelectedItem = _convertorParams.WriteFileExtention; Size = _convertorParams.WindowSize; Location = _convertorParams.WindowLocationPoint; toolStripComboBox1.SelectedItem = _convertorParams.HandlerType; #endregion }
private ConvertorParams readCofigFile() { string formSettingsFullPath = Path.Combine(userDocumentsPath, formSettingsDirectoryName, formSettingsFileName); ConvertorParams convertorParams; if (Serializator.Read <ConvertorParams>(formSettingsFullPath) != null) { convertorParams = Serializator.Read <ConvertorParams>(formSettingsFullPath); } else { convertorParams = new ConvertorParams(); } if (fullFilePathWithExtentions != null) { string fileFormat = Path.GetExtension(fullFilePathWithExtentions); convertorParams.ReadFilePath = $"{Path.GetDirectoryName(fullFilePathWithExtentions)}\\{Path.GetFileNameWithoutExtension(fullFilePathWithExtentions)}"; foreach (FileExtention value in Enum.GetValues(typeof(FileExtention))) { if (value.GetFileExtension() == fileFormat) { convertorParams.ReadFileExtention = value; break; } convertorParams.ReadFileExtention = FileExtention.uknown; } } return(convertorParams); }
public NinjectConverterConfig(ConvertorParams convertorParams) { _readFileExtention = convertorParams.ReadFileExtention; _readFilePath = convertorParams.ReadFilePath; _writeFileExtention = convertorParams.WriteFileExtention; _writeFilePath = convertorParams.WriteFilePath; _handlerType = convertorParams.HandlerType; }