Exemplo n.º 1
0
 public IAsyncOperation <ColorFrameReader> OpenColorFrameReaderAsync(ReaderConfig config = ReaderConfig.Default)
 {
     return(Task.Run(async() =>
     {
         if (ColorReader == null)
         {
             if (Type == SensorType.NetworkClient)
             {
                 ColorReader = new ColorFrameReader(this, _networkClient, config);
             }
             else
             {
                 var colorSourceInfo = _sourceGroup.SourceInfos.FirstOrDefault(si => si.SourceKind == MediaFrameSourceKind.Color);
                 if (colorSourceInfo != null)
                 {
                     MediaFrameSource colorSource;
                     if (_mediaCapture.FrameSources.TryGetValue(colorSourceInfo.Id, out colorSource))
                     {
                         var colorMediaReader = await _mediaCapture.CreateFrameReaderAsync(colorSource);
                         ColorReader = new ColorFrameReader(this, colorMediaReader, config);
                     }
                 }
             }
         }
         await ColorReader?.OpenAsync();
         return ColorReader;
     }).AsAsyncOperation());
 }
Exemplo n.º 2
0
        public MainForm()
        {
            InitializeComponent();
            this.thesisRecordBindingSource.Add(MainThread.getInstance().ThesisRecord);
            this.viewModelBindingSource.Add(ViewModel.getInstance());
            this.readerConfigBindingSource.Add(ReaderConfig.getInstance());
            this.inventoryRecordBindingSource.Add(InventoryStore.getInstance().SelectedInventoryRecord);

            this.fileSelectListBox.DataSource           = DiscContents.getInstance().MaskedFileInfoList;
            this.fileSelectListBox.DisplayMember        = "MaskedFileName";
            this.allFileListBox.DataSource              = DiscContents.getInstance().DisplayFileInfoList;
            this.allFileListBox.DisplayMember           = "DisplayFileName";
            this.inventoryMatchesComboBox.DataSource    = MainThread.getInstance().MatchingInventoryList;
            this.inventoryMatchesComboBox.DisplayMember = "DisplayString";

            ViewModel.getInstance().ProgressBar          = this.progressBar;
            PdfReaderHelper.getInstance().ContainerPanel = this.pdfReaderPanel;

            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            this.Text = Text + " - v" + version.Major + "." + version.Minor + "." + version.Build;

            this.chineseAbstractTextBox.KeepLineBreaks = true;
            this.englishAbstractTextBox.KeepLineBreaks = true;

            this.menuPanel.DataBindings.Add(new Binding("Visible", this.viewModelBindingSource, "ShowMenu", true, DataSourceUpdateMode.OnPropertyChanged));
            this.pdfTextsTextArea.DataBindings.Add(new Binding("Visible", this.viewModelBindingSource, "ShowPdfTexts", true, DataSourceUpdateMode.OnPropertyChanged));
        }
        public static void CopyContentToStaging()
        {
            CleanUpStaging();
            long   totalFileSize   = DiscContents.getInstance().TotalFileSize;
            long   copiedFileSize  = 0;
            string sourceDirectory = ReaderConfig.getInstance().ContentPath;

            if (!sourceDirectory.EndsWith(@"\"))
            {
                sourceDirectory += @"\";
            }

            foreach (FileInfo fileInfo in DiscContents.getInstance().FileInfoList)
            {
                string fileName            = fileInfo.Name;
                string targetFileDirectory = DEFAULT_STAGING_DIRECTORY + fileInfo.FullName.Substring(sourceDirectory.Length);
                targetFileDirectory = targetFileDirectory.Substring(0, targetFileDirectory.Length - fileName.Length);
                if (!targetFileDirectory.EndsWith(@"\"))
                {
                    targetFileDirectory += @"\";
                }
                if (!Directory.Exists(targetFileDirectory))
                {
                    Directory.CreateDirectory(targetFileDirectory);
                }

                File.Copy(fileInfo.FullName, targetFileDirectory + fileName);
                copiedFileSize += fileInfo.Length;
                ViewModel.getInstance().ProgressPercentage = copiedFileSize * 100 / totalFileSize;
            }
        }
Exemplo n.º 4
0
 public OpenReader(ReaderType readerType, ReaderConfig config)
 {
     Type    = readerType;
     Config  = config;
     Status  = OperationStatus.Request;
     _signal = new ManualResetEvent(false);
 }
Exemplo n.º 5
0
        public void save()
        {
            ViewModel.getInstance().ProgressBarColor = Color.Green;
            ViewModel.getInstance().ProgressBar.Maximum = 100;
            ThesisRecord record = MainThread.getInstance().ThesisRecord;

            if (!validateInput(record))
            {
                return;
            }

            ViewModel.getInstance().AllowInput(false);
            ViewModel.getInstance().MenuButtonEnabled = false;

            record.RecordId         = DBEtdRecords.generateRecordId();
            record.FilePath         = record.RecordId + ".zip";
            record.FullTextFilePath = record.RecordId + ".pdf";

            string storageFolderPath = ReaderConfig.getInstance().StoragePath;

            if (!storageFolderPath.EndsWith(@"\"))
            {
                storageFolderPath += @"\";
            }
            record.StorageFolderPath = storageFolderPath;

            FileUtils.CopyZipToStorage();
        }
Exemplo n.º 6
0
        private SourceInfo[] getSourceInfo(FileInfo fileInfo, bool getDetails)
        {
            var sourceInfoList = new List <SourceInfo>();

            sourceInfoList.Add(new SourceInfo());
            sourceInfoList[0].type         = getSourceType(fileInfo);
            sourceInfoList[0].name         = fileInfo.Name;
            sourceInfoList[0].hasDetails   = getDetails;
            sourceInfoList[0].size         = (UInt64)fileInfo.Length;
            sourceInfoList[0].dateModified = fileInfo.LastWriteTime;
            if (sourceInfoList[0].type != String.Empty)
            {
                if (!getDetails)
                {
                    return(sourceInfoList.ToArray());
                }

                try
                {
                    ReaderList readerList   = ReaderList.FullReaderList;
                    var        readerConfig = new ReaderConfig
                    {
                        simAsSpectra = Properties.Settings.Default.SimAsSpectra,
                        srmAsSpectra = Properties.Settings.Default.SrmAsSpectra,
                        combineIonMobilitySpectra = Properties.Settings.Default.CombineIonMobilitySpectra,
                        ignoreZeroIntensityPoints = Properties.Settings.Default.IgnoreZeroIntensityPoints,
                        acceptZeroLengthSpectra   = Properties.Settings.Default.AcceptZeroLengthSpectra,
                        allowMsMsWithoutPrecursor = false
                    };

                    MSDataList msInfo = new MSDataList();
                    readerList.read(fileInfo.FullName, msInfo, readerConfig);

                    foreach (MSData msData in msInfo)
                    {
                        SourceInfo sourceInfo = new SourceInfo();
                        sourceInfo.type = sourceInfoList[0].type;
                        sourceInfo.name = sourceInfoList[0].name;
                        if (msInfo.Count > 1)
                        {
                            sourceInfo.name += " (" + msData.run.id + ")";
                        }
                        sourceInfo.populateFromMSData(msData);
                        sourceInfoList.Add(sourceInfo);
                    }
                } catch
                {
                    sourceInfoList[0].spectra = 0;
                    sourceInfoList[0].type    = "Invalid " + sourceInfoList[0].type;
                }

                foreach (SourceInfo sourceInfo in sourceInfoList)
                {
                    sourceInfo.size         = (UInt64)fileInfo.Length;
                    sourceInfo.dateModified = fileInfo.LastWriteTime;
                }
                return(sourceInfoList.ToArray());
            }
            return(null);
        }
Exemplo n.º 7
0
 public IAsyncOperation <ColorFrameReader> OpenColorFrameReaderAsync(ReaderConfig config = ReaderConfig.Default)
 {
     return(Task.Run(async() =>
     {
         if (_colorReader == null)
         {
             var colorSourceInfo = _sourceGroup.SourceInfos.FirstOrDefault(si => si.SourceKind == MediaFrameSourceKind.Color);
             if (colorSourceInfo == null)
             {
                 return null;
             }
             MediaFrameSource colorSource;
             if (_mediaCapture.FrameSources.TryGetValue(colorSourceInfo.Id, out colorSource))
             {
                 var colorMediaReader = await _mediaCapture.CreateFrameReaderAsync(colorSource);
                 _colorReader = new ColorFrameReader(this, colorMediaReader, config);
             }
             else
             {
                 return null;
             }
         }
         await _colorReader.OpenAsync();
         return _colorReader;
     }).AsAsyncOperation());
 }
Exemplo n.º 8
0
        internal ColorFrameReader(Sensor sensor, MediaFrameReader colorReader, ReaderConfig config)
        {
            Sensor = sensor;
            ReaderConfiguration = config;

            _colorReader = colorReader;
        }
Exemplo n.º 9
0
        public static void WriteLog(Action <Exception> action, string[] prms)
        {
            RFIDServiceClient client = null;

            try
            {
                string           remoteAddress = ReaderConfig.BuildUrl();
                EndpointAddress  endpoint      = new EndpointAddress(remoteAddress);
                BasicHttpBinding binding       = new BasicHttpBinding(BasicHttpSecurityMode.None);
                //binding.Security = BasicHttpSecurityMode.Transport;
                binding.OpenTimeout            = new TimeSpan(0, 0, 10);
                binding.CloseTimeout           = new TimeSpan(0, 0, 10);
                binding.SendTimeout            = new TimeSpan(0, 0, 10);
                binding.ReceiveTimeout         = new TimeSpan(0, 0, 10);
                binding.MaxReceivedMessageSize = int.MaxValue;
                binding.MaxBufferPoolSize      = int.MaxValue;
                binding.MaxBufferSize          = int.MaxValue;
                client = new RFIDServiceClient(binding, endpoint);

                client.WriteLog(prms);
                action(null);
            }
            catch (Exception e)
            {
                action(e);
            }
        }
Exemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            Regex rx = new Regex(@"^((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))$");

            if (!rx.IsMatch(txtServerIP.Text))
            {
                MessageBox.Show("服务器IP地址格式不合法。", "输入错误");
                txtServerIP.SelectAll();
                txtServerIP.Focus();
                return;
            }
            //int port = -1;
            try
            {
                int.Parse(txtPort.Text);
            }
            catch
            {
                MessageBox.Show("端口地址范围为0~65535。", "输入错误");
                txtPort.SelectAll();
                txtPort.Focus();
                return;
            }


            ReaderConfig.SaveConfig(txtServerIP.Text, txtPort.Text);


            this.DialogResult = DialogResult.OK;
        }
Exemplo n.º 11
0
        public SpectrumSource(string filepath)
        {
            MSDataList msdList      = new MSDataList();
            var        readerConfig = new ReaderConfig
            {
                simAsSpectra = Program.SimAsSpectra,
                srmAsSpectra = Program.SrmAsSpectra
            };

            ReaderList.FullReaderList.read(filepath, msdList, readerConfig);
            msDataFile = msdList[0];
            //msDataFile = new MSDataFile(filepath);
            sourceFilepath = filepath;

            // create dummy spectrum/chromatogram list to simplify logic
            msDataFile.run.spectrumList     = msDataFile.run.spectrumList ?? new SpectrumListSimple();
            msDataFile.run.chromatogramList = msDataFile.run.chromatogramList ?? new ChromatogramListSimple();

            setInputFileWaitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);

            /*setInputFileDelegate = new ParameterizedThreadStart( startSetInputFile );
             * Thread setInputFileThread = new Thread( setInputFileDelegate );
             *
             * setInputFileThread.Start( (object) filepath );*/
        }
        protected bool initStorage()
        {
            String dbPath      = ReaderConfig.getInstance().DBPath.Trim();
            String storagePath = ReaderConfig.getInstance().StoragePath.Trim();

            if (dbPath == null || dbPath.Equals("") || !File.Exists(dbPath))
            {
                return(false);
            }
            if (storagePath == null || storagePath.Equals("") || !Directory.Exists(storagePath))
            {
                return(false);
            }

            InventoryStore inventoryStore = InventoryStore.getInstance();

            if (inventoryStore.InventoryDataTable == null || inventoryStore.InventoryDataTable.Rows.Count <= 0)
            {
                try
                {
                    inventoryStore.InventoryDataTable = DBInventoryRecords.listInventoryItems();
                    if (inventoryStore.InventoryDataTable.Rows.Count <= 0)
                    {
                        return(false);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 13
0
        public SpectrumSource(string filepath)
        {
            MSDataList msdList      = new MSDataList();
            var        readerConfig = new ReaderConfig
            {
                simAsSpectra = Program.SimAsSpectra,
                srmAsSpectra = Program.SrmAsSpectra
            };

            if (!File.Exists(filepath) && !Directory.Exists(filepath)) // Some mass spec "files" are really directory structures
            {
                throw new FileNotFoundException("Filepath not found: " + filepath, filepath);
            }

            ReaderList.FullReaderList.read(filepath, msdList, readerConfig);
            msDataFile = msdList[0];
            //msDataFile = new MSDataFile(filepath);
            sourceFilepath = filepath;

            // create dummy spectrum/chromatogram list to simplify logic
            msDataFile.run.spectrumList     = msDataFile.run.spectrumList ?? new SpectrumListSimple();
            msDataFile.run.chromatogramList = msDataFile.run.chromatogramList ?? new ChromatogramListSimple();

            setInputFileWaitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);

            /*setInputFileDelegate = new ParameterizedThreadStart( startSetInputFile );
             * Thread setInputFileThread = new Thread( setInputFileDelegate );
             *
             * setInputFileThread.Start( (object) filepath );*/
        }
Exemplo n.º 14
0
        public static IVideoIndexer CreateInstance(VideoIndexerConfig config, ReaderConfig readerConfig, ILog logger)
        {
            if (config == null)
            {
                throw new NullReferenceException();
            }

            return(new VideoIndexerService(config, readerConfig, logger));
        }
Exemplo n.º 15
0
        public static IVideoIndexer <T> CreateInstance(VideoIndexerConfig config, ReaderConfig readerConfig, ILog logger)
        {
            if (config == null)
            {
                return(null);
            }

            return(new VideoIndexerService <T>(config, readerConfig, logger));
        }
Exemplo n.º 16
0
        private SourceInfo[] getSourceInfo(FileInfo fileInfo, bool getDetails)
        {
            var sourceInfoList = new List <SourceInfo>();

            sourceInfoList.Add(new SourceInfo());
            sourceInfoList[0].type         = getSourceType(fileInfo);
            sourceInfoList[0].name         = fileInfo.Name;
            sourceInfoList[0].hasDetails   = getDetails;
            sourceInfoList[0].size         = (UInt64)fileInfo.Length;
            sourceInfoList[0].dateModified = fileInfo.LastWriteTime;
            if (sourceInfoList[0].type != String.Empty)
            {
                if (!getDetails)
                {
                    return(sourceInfoList.ToArray());
                }

                try
                {
                    ReaderList readerList   = ReaderList.FullReaderList;
                    var        readerConfig = new ReaderConfig
                    {
                        simAsSpectra = Program.SimAsSpectra,
                        srmAsSpectra = Program.SrmAsSpectra
                    };

                    MSDataList msInfo = new MSDataList();
                    readerList.read(fileInfo.FullName, msInfo, readerConfig);

                    foreach (MSData msData in msInfo)
                    {
                        SourceInfo sourceInfo = new SourceInfo();
                        sourceInfo.type = sourceInfoList[0].type;
                        sourceInfo.name = sourceInfoList[0].name;
                        if (msInfo.Count > 1)
                        {
                            sourceInfo.name += " (" + msData.run.id + ")";
                        }
                        sourceInfo.populateFromMSData(msData);
                        sourceInfoList.Add(sourceInfo);
                    }
                } catch
                {
                    sourceInfoList[0].spectra = 0;
                    sourceInfoList[0].type    = "Invalid " + sourceInfoList[0].type;
                }

                foreach (SourceInfo sourceInfo in sourceInfoList)
                {
                    sourceInfo.size         = (UInt64)fileInfo.Length;
                    sourceInfo.dateModified = fileInfo.LastWriteTime;
                }
                return(sourceInfoList.ToArray());
            }
            return(null);
        }
Exemplo n.º 17
0
 public Config(string outputPath)
 {
     OutputPath      = outputPath;
     Filenames       = new List <string>();
     Filters         = new List <string>();
     Extension       = string.Empty;
     ContactFilename = string.Empty;
     WriteConfig     = new MSDataFile.WriteConfig();
     ReaderConfig    = new ReaderConfig();
 }
        public FileStreamInsightsReaderService(ReaderConfig config, ILog logger)
        {
            if (config == null || logger == null)
            {
                throw new NullReferenceException();
            }

            _config = config;
            _logger = logger;
        }
Exemplo n.º 19
0
        protected static SQLiteConnection getConnection()
        {
            string dbFilePath = ReaderConfig.getInstance().DBPath;

            if (dbFilePath != null && File.Exists(dbFilePath))
            {
                return(new SQLiteConnection(@"Data Source=" + dbFilePath + @";Version=3;", true));
            }
            return(null);
        }
Exemplo n.º 20
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         ReaderConfig.ReleaseReader();
     }
     catch (Exception)
     {
     }
     Application.Exit();
 }
Exemplo n.º 21
0
 public void setReaderConfig(ReaderConfig config)
 {
     readerconfig.attenuation          = config.attenuation;
     readerconfig.modeIndex            = config.modeIndex;
     readerconfig.tagPopulation        = config.tagPopulation;
     readerconfig.tagTransitTime       = config.tagTransitTime;
     readerconfig.antennaID            = config.antennaID;
     readerconfig.readerSensitivity    = config.readerSensitivity;
     readerconfig.channelIndex         = config.channelIndex;
     readerconfig.hopTableIndex        = config.hopTableIndex;
     readerconfig.periodicTriggerValue = config.periodicTriggerValue;
 }
Exemplo n.º 22
0
        public MainForm()
        {
            InitializeComponent();

            try
            {
                ReaderConfig.InitRfidReader();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 23
0
        public AzureBlobInsightsReaderService(ReaderConfig config, ILog logger, string thumbnailImageLocation)
        {
            if (config == null || logger == null)
            {
                throw new NullReferenceException();
            }

            _config                  = config;
            _logger                  = logger;
            _blobServiceClient       = new BlobServiceClient(_config.AzureBlob.ConnectionString);
            _insightsContainerClient = _blobServiceClient.GetBlobContainerClient(_config.AzureBlob.InsightsContainer);
            _insightsContainerClient.CreateIfNotExists();
            _failedInsightsContainerClient = _blobServiceClient.GetBlobContainerClient(_config.AzureBlob.FailedInsightsContainer);
            _failedInsightsContainerClient.CreateIfNotExists();
            _thumbnailImageLocation = thumbnailImageLocation;
        }
Exemplo n.º 24
0
        public VideoIndexerService(VideoIndexerConfig config, ReaderConfig readerConfig, ILog logger)
        {
            if (config == null || readerConfig == null || logger == null)
            {
                throw new NullReferenceException();
            }
            _config       = config;
            _readerConfig = readerConfig;
            _logger       = logger;

            if (string.IsNullOrEmpty(_config.AccessToken))
            {
                _accountAccessToken          = GetAccountAccessTokenAsync().GetAwaiter().GetResult();
                _accountAccessTokenTimeStamp = DateTime.UtcNow;
            }
        }
Exemplo n.º 25
0
        public static void GetModuleInfo(Action <ModuleInfo, Exception> action, string[] prms)
        {
            RFIDServiceClient client = null;

            try
            {
                string           remoteAddress = ReaderConfig.BuildUrl();
                EndpointAddress  endpoint      = new EndpointAddress(remoteAddress);
                BasicHttpBinding binding       = new BasicHttpBinding(BasicHttpSecurityMode.None);
                //binding.Security = BasicHttpSecurityMode.Transport;
                binding.OpenTimeout            = new TimeSpan(0, 0, 10);
                binding.CloseTimeout           = new TimeSpan(0, 0, 10);
                binding.SendTimeout            = new TimeSpan(0, 0, 10);
                binding.ReceiveTimeout         = new TimeSpan(0, 0, 10);
                binding.MaxReceivedMessageSize = int.MaxValue;
                binding.MaxBufferPoolSize      = int.MaxValue;
                binding.MaxBufferSize          = int.MaxValue;
                client = new RFIDServiceClient(binding, endpoint);

                //client = new RFIDServiceClient();

                action(client.getModuleInfo(prms), null);

                //client.Close();
            }
            catch (Exception ex)
            {
                //client.Abort();
                action(null, ex);
            }
            //finally
            //{

            //    ICommunicationObject comObj = ((ICommunicationObject)client);



            //    if (comObj.State == CommunicationState.Faulted)
            //    {
            //        comObj.Abort();
            //    }
            //    else
            //    {
            //        comObj.Close();
            //    }
            //}
        }
Exemplo n.º 26
0
    public IReader GetReader(string path)
    {
        IReader reader = null;

        if (_readersDic.ContainsKey(path))
        {
            reader = _readersDic[path];
        }
        else
        {
            reader = ReaderConfig.GetReader(path);
            LoadMgr.Single.LoadConfig(path, (data) => reader.SetData(data));
            _readersDic[path] = reader;
        }

        return(reader);
    }
Exemplo n.º 27
0
        public string ocrPDFTexts(string pdfFileName)
        {
            string ghostScriptPath = ReaderConfig.getInstance().GhostscriptPath;

            if (ghostScriptPath == null || "".Equals(ghostScriptPath) || !File.Exists(ghostScriptPath))
            {
                alert("Invalid Ghostscript Path: " + ghostScriptPath, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            string tesseractPath = ReaderConfig.getInstance().TesseractPath;

            if (tesseractPath == null || "".Equals(tesseractPath) || !File.Exists(tesseractPath))
            {
                alert("Invalid Tesseeract Path: " + tesseractPath, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            string ghostScriptParam = "-q -dNOPAUSE -dFirstPage=1 -dLastPage=1 -sDEVICE=tifflzw -r300 -sOutputFile=temp.tif " + "\"" + pdfFileName + "\"" + " -c quit";

            CmdHelper.run(ghostScriptPath, ghostScriptParam);
            if (!File.Exists(@"temp.tif"))
            {
                alert("Error converting pdf to tiff", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            string tesseractParam = "temp.tif tsrout";

            CmdHelper.run(tesseractPath, tesseractParam);
            if (!File.Exists(@"tsrout.txt"))
            {
                alert("Error reading ocr output", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }

            string parseResult = File.ReadAllText(@"tsrout.txt");

            File.Delete(@"temp.tif");
            File.Delete(@"tsrout.txt");
            return(parseResult);
        }
Exemplo n.º 28
0
        public static IInsightsReader <T> CreateInstance(ReaderConfig readerConfig, WriterConfig writerConfig, ILog logger)
        {
            if (readerConfig == null)
            {
                throw new NullReferenceException();
            }
            if (writerConfig == null)
            {
                throw new NullReferenceException();
            }

            if (readerConfig.Type == "AzureBlob")
            {
                // If it is a AzureBlob type, it will add the Uri of the image as a property
                var thumbnailImageLocation = writerConfig.AzureBlob.ThumbnailsContainer;
                return(new AzureBlobInsightsReaderService <T, T_Parser>(readerConfig, logger, thumbnailImageLocation));
            }

            return(new FileStreamInsightsReaderService <T, T_Parser>(readerConfig, logger));
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            runOnce(); // Setup application icon for "Add remove programs"

            Application.ApplicationExit += new EventHandler(OnApplicationExit);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (args.Length > 1 && "reset".Equals(args[0]))
            {
                ReaderConfig config = ReaderConfig.getInstance();
                config.ContentPath     = args[1];
                config.PythonPath      = @"lib\WinPython\python\python.exe";
                config.PdfminerPath    = @"lib\WinPython\python\Scripts\pdf2txt.py";
                config.UseAdobeReader  = true;
                config.EnableOCR       = false;
                config.GhostscriptPath = @"lib\Ghostscript\bin\gswin32.exe";
                config.TesseractPath   = @"lib\Tesseract-ocr\tesseract.exe";
                config.DBPath          = @"Y:\rsdiconversion\db\ethesis2016.db3";
                config.StoragePath     = @"Y:\rsdiconversion\contents";
                config.SaveSettings();
            }

            Form mainForm = new MainForm();

            // Initialize PDF viewer component
            PdfReaderHelper.getInstance().init(ReaderConfig.getInstance().UseAdobeReader);

            // Map network drive
            DriveHelper.connectStorageDrive();

            // Start file monitor thread
            Thread readCDThread = new Thread(new ThreadStart(m.start));

            readCDThread.SetApartmentState(ApartmentState.STA);
            readCDThread.Start();

            Application.Run(mainForm);
        }
Exemplo n.º 30
0
    public IReader GetReader(string path)
    {
        IReader reader = null;

        if (_readersDic.ContainsKey(path))
        {
            reader = _readersDic[path];
        }
        else
        {
            //从当前的配置中,获取一个新的reader
            reader = ReaderConfig.GetReader(path);
            if (reader != null)
            {
                //读取当前路径配置数据,赋值给reader
                _readersDic[path] = reader;
            }
            else
            {
                Debug.LogError("未获取到对应的reader,路径:" + path);
            }
        }
        return(reader);
    }
Exemplo n.º 31
0
        private SourceInfo[] getSourceInfo( FileInfo fileInfo, bool getDetails )
        {
            var sourceInfoList = new List<SourceInfo>();
            sourceInfoList.Add( new SourceInfo() );
            sourceInfoList[0].type = getSourceType( fileInfo );
            sourceInfoList[0].name = fileInfo.Name;
            sourceInfoList[0].hasDetails = getDetails;
            sourceInfoList[0].size = (UInt64) fileInfo.Length;
            sourceInfoList[0].dateModified = fileInfo.LastWriteTime;
            if( sourceInfoList[0].type != String.Empty )
            {
                if( !getDetails )
                    return sourceInfoList.ToArray();

                try
                {
                    ReaderList readerList = ReaderList.FullReaderList;
                    var readerConfig = new ReaderConfig
                        {
                            simAsSpectra = Program.SimAsSpectra,
                            srmAsSpectra = Program.SrmAsSpectra
                        };

                    MSDataList msInfo = new MSDataList();
                    readerList.read( fileInfo.FullName, msInfo, readerConfig );

                    foreach( MSData msData in msInfo )
                    {
                        SourceInfo sourceInfo = new SourceInfo();
                        sourceInfo.type = sourceInfoList[0].type;
                        sourceInfo.name = sourceInfoList[0].name;
                        if( msInfo.Count > 1 )
                            sourceInfo.name += " (" + msData.run.id + ")";
                        sourceInfo.populateFromMSData( msData );
                        sourceInfoList.Add( sourceInfo );
                    }
                } catch
                {
                    sourceInfoList[0].spectra = 0;
                    sourceInfoList[0].type = "Invalid " + sourceInfoList[0].type;
                }

                foreach( SourceInfo sourceInfo in sourceInfoList )
                {
                    sourceInfo.size = (UInt64) fileInfo.Length;
                    sourceInfo.dateModified = fileInfo.LastWriteTime;
                }
                return sourceInfoList.ToArray();
            }
            return null;
        }
Exemplo n.º 32
0
 public MsDataFileImpl(string path, int sampleIndex = 0, LockMassParameters lockmassParameters = null, bool simAsSpectra = false, bool srmAsSpectra = false, bool acceptZeroLengthSpectra = true, bool requireVendorCentroidedMS1 = false, bool requireVendorCentroidedMS2 = false)
 {
     // see note above on enabling performance measurement
     _perf = PerfUtilFactory.CreatePerfUtil("MsDataFileImpl " + // Not L10N 
         string.Format("{0},sampleIndex:{1},lockmassCorrection:{2},simAsSpectra:{3},srmAsSpectra:{4},acceptZeroLengthSpectra:{5},requireVendorCentroidedMS1:{6},requireVendorCentroidedMS2:{7}",  // Not L10N
         path, sampleIndex, !(lockmassParameters == null || lockmassParameters.IsEmpty), simAsSpectra, srmAsSpectra, acceptZeroLengthSpectra, requireVendorCentroidedMS1, requireVendorCentroidedMS2));
     using (_perf.CreateTimer("open")) // Not L10N
     {
         FilePath = path;
         _msDataFile = new MSData();
         _config = new ReaderConfig {simAsSpectra = simAsSpectra, srmAsSpectra = srmAsSpectra, acceptZeroLengthSpectra = acceptZeroLengthSpectra};
         _lockmassParameters = lockmassParameters;
         FULL_READER_LIST.read(path, _msDataFile, sampleIndex, _config);
         _requireVendorCentroidedMS1 = requireVendorCentroidedMS1;
         _requireVendorCentroidedMS2 = requireVendorCentroidedMS2;
     }
 }
Exemplo n.º 33
0
 public Reader(ReaderConfig config){}
Exemplo n.º 34
0
		public SpectrumSource( string filepath )
		{
            MSDataList msdList = new MSDataList();
            var readerConfig = new ReaderConfig
            {
                simAsSpectra = Program.SimAsSpectra,
                srmAsSpectra = Program.SrmAsSpectra
            };
            ReaderList.FullReaderList.read(filepath, msdList, readerConfig);
            msDataFile = msdList[0];
			//msDataFile = new MSDataFile(filepath);
			sourceFilepath = filepath;

            // create dummy spectrum/chromatogram list to simplify logic
            msDataFile.run.spectrumList = msDataFile.run.spectrumList ?? new SpectrumListSimple();
            msDataFile.run.chromatogramList = msDataFile.run.chromatogramList ?? new ChromatogramListSimple();

			setInputFileWaitHandle = new EventWaitHandle( false, EventResetMode.ManualReset );
			/*setInputFileDelegate = new ParameterizedThreadStart( startSetInputFile );
			Thread setInputFileThread = new Thread( setInputFileDelegate );

			setInputFileThread.Start( (object) filepath );*/
		}
Exemplo n.º 35
0
 public void setReaderConfig(ReaderConfig config)
 {
     readerconfig.attenuation = config.attenuation;
     readerconfig.modeIndex = config.modeIndex;
     readerconfig.tagPopulation = config.tagPopulation;
     readerconfig.tagTransitTime = config.tagTransitTime;
     readerconfig.antennaID = config.antennaID;
     readerconfig.readerSensitivity = config.readerSensitivity;
     readerconfig.channelIndex = config.channelIndex;
     readerconfig.hopTableIndex = config.hopTableIndex;
     readerconfig.periodicTriggerValue = config.periodicTriggerValue;
 }