Esempio n. 1
0
        public static Project LoadProject(string existingProject)
        {
            try {
                string  projectsPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                Project loadedProj   = new Project();

                string           projectSQL  = "SELECT project_base64 FROM project";     // WHERE id_project=0"+id_samples.ToString();
                SQLiteConnection projectConn = new SQLiteConnection("Data Source=" + projectsPath + @"\\Projects\\" + existingProject + ".db;Version=3;New=False;Compress=True;Synchronous=Off");
                SQLiteCommand    cmd         = new SQLiteCommand(projectSQL, projectConn);
                projectConn.Open();

                loadedProj = (Project)ConversionUtilities.DeserializeBase64((string)cmd.ExecuteScalar());

//				using(SQLiteDataReader sqReader = cmd.ExecuteReader())
//				{
//					if (sqReader.Read())
//					{
//						loadedProj = (Project)ConversionUtilities.DeserializeBase64(sqReader.GetString(0));
//					}
//				}

                projectConn.Close();

                return(loadedProj);
            } catch (Exception ex) {
                throw ex;
            }
        }