Example #1
0
        public void SaveModel()
        {
            RaiseDisposed();

            try
            {
                MzLiteJson.SaveJsonFile(model, GetModelFilePath());
            }
            catch (Exception ex)
            {
                throw new MzLiteIOException(ex.Message, ex);
            }
        }
Example #2
0
        public WiffFileReader(string wiffFilePath, string licenseFilePath)
        {
            if (string.IsNullOrWhiteSpace(wiffFilePath))
            {
                throw new ArgumentNullException("wiffFilePath");
            }
            if (string.IsNullOrWhiteSpace(licenseFilePath))
            {
                throw new ArgumentNullException("licenseFilePath");
            }
            if (!File.Exists(wiffFilePath))
            {
                throw new FileNotFoundException("Wiff file not exists.");
            }
            try
            {
                ReadWiffLicense(licenseFilePath);

                this.dataProvider = new AnalystWiffDataProvider(true);
                this.batch        = AnalystDataProviderFactory.CreateBatch(wiffFilePath, dataProvider);
                this.wiffFilePath = wiffFilePath;

                if (!File.Exists(GetModelFilePath(wiffFilePath)))
                {
                    model = CreateModel(batch, wiffFilePath);
                    MzLiteJson.SaveJsonFile(model, GetModelFilePath(wiffFilePath));
                }
                else
                {
                    model = MzLiteJson.ReadJsonFile <MzLiteModel>(GetModelFilePath(wiffFilePath));
                }
            }
            catch (Exception ex)
            {
                throw new MzLiteIOException(ex.Message, ex);
            }
        }