Ejemplo n.º 1
0
        public DatabaseManager(string dbtype, string dbname, string dbserver, string dbuser, string dbpassword)
        {
            // TODO: Complete member initialization
            this.dbtype = dbtype;
            this.dbname = dbname;
            this.dbserver = dbserver;
            this.dbuser = dbuser;
            this.dbpassword = dbpassword;

            Initialize();

            instance = this;
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string dbtype = ConfigurationHandler.GetValue("DB_Type");
            string dbname = ConfigurationHandler.GetValue("DB_Name");
            string dbserver = ConfigurationHandler.GetValue("DB_Server");
            string dbuser = ConfigurationHandler.GetValue("DB_User");
            string dbpassword = ConfigurationHandler.GetValue("DB_Password");

            dbserver = dbserver == null ? "localhost" : dbserver;
            dbuser = dbuser == null ? "root" : dbuser;
            dbpassword = dbpassword == null ? "root" : dbpassword;

            DatabaseManager database_manager = new DatabaseManager(dbtype, dbname, dbserver, dbuser, dbpassword);

            string storage_path = ConfigurationHandler.GetValue("Storage_path");

            ResourceDB res = new ResourceDB(database_manager, storage_path);

            res.Add( new Category(100, "Image", "Resource is a image (Image, Photo etc)") );
            res.Add( new Category(200, "Text", "UTF-8 encoded text") );

            //res.AddImageResource(System.Drawing.Image.FromFile("Z:\\Pictures\\IMG_0538.JPG"));

            //IDatabase db = null;

            //string dbtype = ConfigurationHandler.GetValue("DB");

            //switch (dbtype)
            //{
            //    case "MySql":
            //    default:
            //        db = new MySQLDatabase();
            //        break;
            //}

            //db.Insert();
            //db.Select();

            //// z:\pictures\img_0538.jpg

            /*
            Info inf = new Info("Z:\\Pictures\\IMG_0538.JPG");

            foreach (string propertyname in inf.PropertyItems.Keys)
            {
                Debug.WriteLine(propertyname + ": " + (inf.PropertyItems[propertyname]).ToString());
                Console.WriteLine(propertyname + ": " + (inf.PropertyItems[propertyname]).ToString());

            }
             */
        }
Ejemplo n.º 3
0
        private string storage_path = null; // root path for storage of filebased resources

        #endregion Fields

        #region Constructors

        public ResourceDB(DatabaseManager database_manager, string storage_path, IFunctionAdapter function_adapter)
        {
            instance = this;
            ApplicationInitializer(database_manager, storage_path, function_adapter);
        }
Ejemplo n.º 4
0
 public ResourceDB(DatabaseManager database_manager, string storage_path)
     : this(database_manager, storage_path, new DefaultFunctionAdapter())
 {
 }
Ejemplo n.º 5
0
 private void ApplicationInitializer(DatabaseManager database_manager, string storage_path, IFunctionAdapter function_adapter)
 {
     this.database_manager = database_manager;
     this.storage_path = storage_path;
     this.function_adapter = function_adapter;
 }