Example #1
0
 /// <summary>
 /// With the default web browser, open the remote folder of a CmisSync synchronized folder.
 /// </summary>
 /// <param name="name">Name of the synchronized folder</param>
 public void OpenRemoteFolder(string name)
 {
     Config.SyncConfig.Folder folder = ConfigManager.CurrentConfig.getFolder(name);
     if (folder != null)
     {
         RepoInfo repo = folder.GetRepoInfo();
         Process.Start(CmisUtils.GetBrowsableURL(repo));
     }
     else
     {
         Logger.Warn("Could not find requested config for \"" + name + "\"");
     }
 }
Example #2
0
 public void OpenRemoteFolder(string name)
 {
     Config.SyncConfig.Folder f = ConfigManager.CurrentConfig.getFolder(name);
     if (f != null)
     {
         RepoInfo repo = f.GetRepoInfo();
         Process.Start(CmisUtils.GetBrowsableURL(repo));
     }
     else
     {
         Logger.Warn("Repo not found: " + name);
     }
 }
Example #3
0
        /// <summary>
        /// Migrate the specified Database file to current version.
        /// </summary>
        /// <param name="syncFolder">target syncFolder</param>
        public static void Migrate(Config.SyncConfig.Folder syncFolder)
        {
            int    currentDbVersion = Database.SchemaVersion;
            string dbPath           = syncFolder.GetRepoInfo().CmisDatabase;

            try
            {
                Logger.Info(String.Format("Checking whether database {0} exists", dbPath));
                if (!File.Exists(dbPath))
                {
                    Logger.Info(string.Format("Database file {0} not exists.", dbPath));
                    return;
                }

                using (var connection = GetConnection(dbPath))
                {
                    int dbVersion = GetDatabaseVersion(connection);

                    if (dbVersion >= currentDbVersion)
                    {
                        return;     // migration is not needed
                    }

                    Logger.DebugFormat("Current Database Schema must be update from {0} to {0}", dbVersion, currentDbVersion);

                    switch (dbVersion)
                    {
                    case 0:
                        MigrateFromVersion0(syncFolder, connection, currentDbVersion);
                        break;

                    default:
                        throw new NotSupportedException(String.Format("Unexpected database version: {0}.", dbVersion));
                    }
                }

                Logger.Debug("Database migration successful");
            }
            catch (Exception e)
            {
                Logger.Error("Error migrating database: " + e.Message, e);
                throw;
            }
        }