예제 #1
0
        public static Color GetDatabaseStatusColor(DATABASESTATUS status)
        {
            Color color = Color.Plum;

            if ((status & DATABASESTATUS.ERROR) > 0)
            {
                color = Color.Red;
            }
            else if ((status & DATABASESTATUS.UPTODATE) > 0)
            {
                color = Color.Green;
            }
            else if ((status & DATABASESTATUS.COMPLETE) > 0)
            {
                color = Color.Blue;
            }
            else if ((status & DATABASESTATUS.UPDATING) > 0)
            {
                color = Color.Gold;
            }
            else if ((status & DATABASESTATUS.EMPTY) > 0)
            {
                color = Color.Black;
            }
            return(color);
        }
예제 #2
0
 public void ResetDBStatusBit(DATABASESTATUS statusbit, System.Data.SQLite.SQLiteDatabase db = null)
 {
     if (db == null)
     {
         db = this.db;
     }
     if (db != null)
     {
         db.Status &= ~statusbit;
     }
 }
예제 #3
0
 public void SetDBStatus(DATABASESTATUS status, System.Data.SQLite.SQLiteDatabase db = null)
 {
     if (db == null)
     {
         db = this.db;
     }
     if (db != null)
     {
         db.Status = status;
     }
 }
예제 #4
0
 public bool GetDBStatusBit(DATABASESTATUS statusbit, System.Data.SQLite.SQLiteDatabase db = null)
 {
     if (db == null)
     {
         db = this.db;
     }
     if (db != null)
     {
         return((((int)db.Status) & ((int)statusbit)) > 0);
     }
     return(false);
 }
예제 #5
0
        public static string GetDatabaseStatusText(DATABASESTATUS status)
        {
            string s = "";

            if ((status & DATABASESTATUS.UNDEFINED) > 0)
            {
                s = "Database status is unknown.";
            }
            if ((status & DATABASESTATUS.ERROR) > 0)
            {
                if (s.Length > 0)
                {
                    s = s + "\n";
                }
                s = s + "Database has errors.";
            }
            if ((status & DATABASESTATUS.UPTODATE) > 0)
            {
                if (s.Length > 0)
                {
                    s = s + "\n";
                }
                s = s + "Database is up to date.";
            }
            if ((status & DATABASESTATUS.COMPLETE) > 0)
            {
                if (s.Length > 0)
                {
                    s = s + "\n";
                }
                s = s + "Database is complete.";
            }
            if ((status & DATABASESTATUS.UPDATING) > 0)
            {
                if (s.Length > 0)
                {
                    s = s + "\n";
                }
                s = s + "Database is updating.";
            }
            if ((status & DATABASESTATUS.EMPTY) > 0)
            {
                if (s.Length > 0)
                {
                    s = s + "\n";
                }
                s = s + "Database is empty.";
            }
            return(s);
        }
예제 #6
0
        public SQLiteDatabase(string filename)
        {
            if (String.IsNullOrEmpty(filename))
            {
                // create a default database file name
                filename = "db.db3";
            }
            // handle special filenames
            if (filename == ":memory:")
            {
                isinmemory = true;
                dblocation = filename;
                return;
            }
            // check if filename contains path
            string directory = Path.GetDirectoryName(filename);

            if (String.IsNullOrEmpty(directory))
            {
                // create default database directory name
                // collect entry assembly info
                Assembly ass     = Assembly.GetCallingAssembly();
                string   name    = ass.GetName().Name;
                string   product = "";
                string   company = "";
                object[] attribs;
                attribs = ass.GetCustomAttributes(typeof(AssemblyCompanyAttribute), true);
                if (attribs.Length > 0)
                {
                    company = ((AssemblyCompanyAttribute)attribs[0]).Company;
                }
                attribs = ass.GetCustomAttributes(typeof(AssemblyProductAttribute), true);
                if (attribs.Length > 0)
                {
                    product = ((AssemblyProductAttribute)attribs[0]).Product;
                }
                // create database path
                string dir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                if (!String.IsNullOrEmpty(company))
                {
                    dir = Path.Combine(dir, company);
                }
                if (!String.IsNullOrEmpty(product))
                {
                    dir = Path.Combine(dir, product);
                }
                directory = Path.Combine(dir, "Database");
                filename  = Path.Combine(directory, filename);
            }
            dblocation = filename;
            // create an empty database if not file found
            if (!File.Exists(dblocation))
            {
                // check for existing directory first
                string dir = Path.GetDirectoryName(dblocation);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
            }
            // set status to UNDEFINED after initialization
            Status = DATABASESTATUS.UNDEFINED;
        }
예제 #7
0
 public void ResetDBStatusBit(ELEVATIONMODEL model, DATABASESTATUS statusbit)
 {
     this.ResetDBStatusBit(statusbit, GetPropagationDatabase(model));
 }
예제 #8
0
 public bool GetDBStatusBit(ELEVATIONMODEL model, DATABASESTATUS statusbit)
 {
     return(this.GetDBStatusBit(statusbit, GetPropagationDatabase(model)));
 }
예제 #9
0
 public void SetDBStatus(ELEVATIONMODEL model, DATABASESTATUS status)
 {
     this.SetDBStatus(status, GetPropagationDatabase(model));
 }