Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            //System.Data.SQLite.SQLiteConnection.CreateFile("MyDatabase.sqlite");

            m_dbConnection = new System.Data.SQLite.SQLiteConnection("Data Source=..\\..\\Data\\SustainableChemistry.sqlite;Version=3;");
            m_dbConnection.Open();

            FunctionalGroups     = new DataTable();
            NamedReactions       = new DataTable();
            molecule             = new ChemInfo.Molecule();
            fGroups              = new ChemInfo.FunctionalGroupCollection();
            reactions            = new ChemInfo.NamedReactionCollection();
            this.trackBar1.Value = (int)(this.moleculeViewer1.Zoom * 100);
            documentPath         = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\USEPA\\SustainableChemistry";

            this.OpenFunctionGroupExcelResource();

            System.IO.FileStream fs = new System.IO.FileStream("..\\..\\Data\\references.dat", System.IO.FileMode.Open);

            // Construct a BinaryFormatter and use it to serialize the data to the stream.
            System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            try
            {
                m_References = (ChemInfo.References)formatter.Deserialize(fs);
            }
            catch (System.Runtime.Serialization.SerializationException e)
            {
                Console.WriteLine("Failed to deserialize. Reason: " + e.Message);
                throw;
            }
            finally
            {
                fs.Close();
            }


            //Reads in functional groups from JSON file. This should be used after Excel file is completed.
            //var json = new System.Web.Script.Serialization.JavaScriptSerializer();
            //functionalGroups = (List<ChemInfo.FunctionalGroup>)json.Deserialize(ChemInfo.Functionalities.AvailableFunctionalGroups(), typeof(List<ChemInfo.FunctionalGroup>));            // string text = ChemInfo.Functionalities.FunctionalGroups("P(c1ccccc1)(c1ccccc1)(N)=O", "json");

            // Test code for generating a results file from a functional group name.
            //Results res = new Results("phosphoramidite", m_References);
            //string results = json.Serialize(res);

            // Initial code to load references from text RIS resource files. Can be deleted when done.
            //m_References = new ChemInfo.References();
            //m_References.Add(new ChemInfo.Reference("phosphoramidite", "Diisoproprylethyamine Solvent", enc8.GetString(Properties.Resources.S0040403900813763)));
            //m_References.Add(new ChemInfo.Reference("phosphoramidite", "Diisoproprylethyamine Solvent", enc8.GetString(Properties.Resources.S0040403900942163)));
            //m_References.Add(new ChemInfo.Reference("phosphoramidite", "Diisoproprylethyamine Solvent", enc8.GetString(Properties.Resources.S0040403901904617)));
            //m_References.Add(new ChemInfo.Reference("phosphoramidite", "Diisoproprylethyamine Solvent", enc8.GetString(Properties.Resources.achs_jacsat105_661)));
            //m_References.Add(new ChemInfo.Reference("phosphate", "No Name", enc8.GetString(Properties.Resources.S1001841712003142)));
            //m_References.Add(new ChemInfo.Reference("phosphate", "Catalyst", Properties.Resources._10_1002_2Fchin_199605199));
            //m_References.Add(new ChemInfo.Reference("phosphoramidite", "Catalyst Solvent", enc8.GetString(Properties.Resources.europepmc)));
            //m_References.Add(new ChemInfo.Reference("phosphoramidite", "Catalyst Solvent", enc8.GetString(Properties.Resources.europepmc1)));
            //m_References.Add(new ChemInfo.Reference("phosphoramidite", "Catalyst Solvent", enc8.GetString(Properties.Resources.achs_oprdfk4_175)));
            //m_References.Add(new ChemInfo.Reference("phosphoramidite", "Catalyst Solvent", enc8.GetString(Properties.Resources.BIB)));
        }
Ejemplo n.º 2
0
 public Results(ChemInfo.FunctionalGroup functionalGroup, ChemInfo.References references)
 {
     groupOutput = new FunctionalGroupOutput(functionalGroup);
     References  = references.GetReferences(functionalGroup.Name);
 }