コード例 #1
0
        // Called by ADD button
        public CreatePicasaDBForm(string appSettingsDir, Settings settings)
        {
            InitializeComponent();

            _settings = settings;
            AppSettingsDir = appSettingsDir;
            //appSettingsBaseDir = Path.GetDirectoryName(AppSettingsDir);
            PicasaDB = new PicasaDB();
            PicDrivecomboBox.Text = "";
        }
コード例 #2
0
        // Called by ADD button
        public CreatePicasaDBForm(string appSettingsDir, Settings settings)
        {
            InitializeComponent();

            _settings      = settings;
            AppSettingsDir = appSettingsDir;
            //appSettingsBaseDir = Path.GetDirectoryName(AppSettingsDir);
            PicasaDB = new PicasaDB();
            PicDrivecomboBox.Text = "";
        }
コード例 #3
0
 public PicasaDB(PicasaDB picasaDB)
 {
     Name                     = picasaDB.Name;
     Description              = picasaDB.Description;
     BaseDir                  = picasaDB.BaseDir;
     BackupDir                = picasaDB.BackupDir;
     BackupFrequency          = picasaDB.BackupFrequency;
     BackupDBOnly             = picasaDB.BackupDBOnly;
     BackupComputerName       = picasaDB.BackupComputerName;
     LastBackupDate           = picasaDB.LastBackupDate;
     IsStandardDB             = picasaDB.IsStandardDB;
     PictureVirtualDrive      = picasaDB.PictureVirtualDrive;
     EnableVirtualDrive       = picasaDB.EnableVirtualDrive;
     VirtualDriveBaseDir      = picasaDB.VirtualDriveBaseDir;
     VirtualDrivePathAbsolute = picasaDB.VirtualDrivePathAbsolute;
 }
コード例 #4
0
ファイル: Settings.cs プロジェクト: EarlBoss/picasastarter
 public PicasaDB(PicasaDB picasaDB)
 {
     Name = picasaDB.Name;
     Description = picasaDB.Description;
     BaseDir = picasaDB.BaseDir;
     BackupDir = picasaDB.BackupDir;
     BackupFrequency = picasaDB.BackupFrequency;
     BackupDBOnly = picasaDB.BackupDBOnly;
     BackupComputerName = picasaDB.BackupComputerName;
     LastBackupDate = picasaDB.LastBackupDate;
     IsStandardDB = picasaDB.IsStandardDB;
     PictureVirtualDrive = picasaDB.PictureVirtualDrive;
     EnableVirtualDrive = picasaDB.EnableVirtualDrive;
     VirtualDriveBaseDir = picasaDB.VirtualDriveBaseDir;
     VirtualDrivePathAbsolute = picasaDB.VirtualDrivePathAbsolute;
 }
コード例 #5
0
        public static PicasaDB GetDefaultPicasaDB()
        {
            PicasaDB picasaDB = new PicasaDB();

            picasaDB.Name         = "Personal database of " + Environment.GetEnvironmentVariable("username") + " (=default for picasa)";
            picasaDB.BaseDir      = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            picasaDB.IsStandardDB = true;
            picasaDB.Description  = "This is the database Picasa always uses if you don't use Picasa starter. Because of some "
                                    + "technical reasons in some situations it is not recommended to share this database. You cannot change any settings "
                                    + "for this database either. Create a new one if you want to share a database... and if you want, copy your default "
                                    + "one into it.";
            picasaDB.PictureVirtualDrive = "C:";
            picasaDB.EnableVirtualDrive  = false;

            return(picasaDB);
        }
コード例 #6
0
        private void buttonEditDB_Click(object sender, EventArgs e)
        {
            bool isStandardDatabase = false;
            int  saveIndex          = -1;

            if (listBoxPicasaDBs.SelectedIndex == -1 ||
                listBoxPicasaDBs.SelectedIndex >= _settings.picasaDBs.Count)
            {
                MessageBox.Show("Please choose a picasa database from the list first");
                return;
            }
            if (_settings.picasaDBs[listBoxPicasaDBs.SelectedIndex].IsStandardDB == true)
            {
                isStandardDatabase = true;
            }

            PicasaDB picasaDB = _settings.picasaDBs[listBoxPicasaDBs.SelectedIndex];

            saveIndex = listBoxPicasaDBs.SelectedIndex;

            CreatePicasaDBForm createPicasaDB = new CreatePicasaDBForm(picasaDB, _appSettingsDir, _settings, isStandardDatabase);

            DialogResult result = createPicasaDB.ShowDialog();

            // If OK, update the picasaDB to the edited version
            if (result == DialogResult.OK)
            {
                _settings.picasaDBs[listBoxPicasaDBs.SelectedIndex] = createPicasaDB.PicasaDB;
                ReFillPicasaDBList(true);
                listBoxPicasaDBs.SelectedIndex = saveIndex;
                //Map the directory below the PicasaStarter Directory to the Virtual drive
                // if the drive is not mapped and virtual drive is enabled
                bool xxx = IOHelper.MapVirtualDrive(_settings.picasaDBs[listBoxPicasaDBs.SelectedIndex], _appSettingsDir);
                if (xxx)
                {
                    MessageBox.Show("Error Mapping Virtual Drive" +
                                    "\nCheck the Virtual Drive settings and Path.");
                }
            }
        }
コード例 #7
0
 public CopyExistingDBForm( PicasaDB database, Settings settings)
 {
     InitializeComponent();
     _settings = settings;
     Db = database;
 }
コード例 #8
0
        static void Main()
        {
            #region Initialization
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string        appSettingsDir   = ""; //Directory containing PicasaStarter settings
            string        configurationDir = "";
            Configuration config;
            Settings      settings;
            bool          ConfigFileExists = true;
            bool          settingsfound    = false;

            configurationDir = SettingsHelper.DetermineConfigDir();
            appSettingsDir   = SettingsHelper.DetermineSettingsDir(configurationDir);
            try
            {
                settings = new Settings();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Picasa 3.9 Has not been Initialized for this user.\n" +
                                "Please run Picasa3 from the start menu to set up the registry.\n " +
                                "Error Msg:  " + ex.Message);
                return;
            }
            config = new Configuration();
            bool showGUI = true;


            try
            {
                config = SettingsHelper.DeSerializeConfig(
                    configurationDir + "\\" + SettingsHelper.ConfigFileName);
            }
            catch (Exception)
            {
                //No config file, set config & settings defaults and signal first time run
                ConfigFileExists = false;
                config.picasaStarterSettingsXMLPath = "";
                settings.picasaDBs.Add(SettingsHelper.GetDefaultPicasaDB());
            }
            // load settings...

            if (ConfigFileExists)
            {
                bool   cancelSettingsFileSearch = false;
                string currentDir = appSettingsDir;
                currentDir = Path.GetDirectoryName(currentDir);


                while (!settingsfound && cancelSettingsFileSearch == false)
                {
                    if (!File.Exists(appSettingsDir + "\\" + SettingsHelper.SettingsFileName))
                    {
                        // Take care of case where the settings file is not available but it is referenced in the config file (The settings drive/dir is missing).
                        // Initializes the variables to pass to the MessageBox.Show method.
                        string message = "The Picasa Starter settings file was not found in:\n" + appSettingsDir + "\n\n" +
                                         "NOTE:----------\n" +
                                         "If this is a new PicasaStarter Installation, Push NO,\n" +
                                         "Then define the Settings File location in the First Run dialog \n" +
                                         "----------------\n\n" +
                                         "If the Settings File is on a NAS or Portable Drive, " +
                                         "\nPlease Connect the drive as the correct drive letter.\n" +
                                         "When the Drive is connected, Push YES to Try Again.\n\n" +
                                         "To define a new Settings File location, Push NO,\n" +
                                         "Then Correct the Settings File location in the First Run dialog \n\n" +
                                         "To Exit PicasaStarter immediately, Push CANCEL.";
                        string caption = "Missing Settings File";

                        // Displays the MessageBox.
                        DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.YesNoCancel);

                        if (result == DialogResult.Yes)
                        {
                            settingsfound = false;
                        }
                        if (result == DialogResult.Cancel)
                        {
                            cancelSettingsFileSearch = true;
                            ConfigFileExists         = false;
                            showGUI = false;
                        }
                        else if (result == DialogResult.No)
                        {
                            ConfigFileExists         = false;
                            cancelSettingsFileSearch = true;
                            settings.picasaDBs.Add(SettingsHelper.GetDefaultPicasaDB());
                        }
                    }
                    else
                    {
                        settingsfound = true;
                    }
                }

                // Try to read the settings file...

                if (settingsfound == true)
                {
                    try
                    {
                        settings = SettingsHelper.DeSerializeSettings(
                            appSettingsDir + "\\" + SettingsHelper.SettingsFileName);
                        settingsfound = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error reading settings file: " + ex.Message);
                        settings.picasaDBs.Add(SettingsHelper.GetDefaultPicasaDB());
                        settingsfound = false;
                    }
                }
            }
            #endregion

            #region Process Command Line Arguments
            if (ConfigFileExists)
            {
                // Save settings
                //---------------------------------------------------------------------------
                try
                {
                    SettingsHelper.SerializeSettings(settings,
                                                     appSettingsDir + "\\" + SettingsHelper.SettingsFileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error saving settings: " + ex.Message);
                }

                // Process command line arguments...
                //---------------------------------------------------------------------------
                string autoRunDatabaseName = null;
                string backupDatabaseName  = null;

                for (int i = 1; i < Environment.GetCommandLineArgs().Length; i++)
                {
                    string arg = Environment.GetCommandLineArgs()[i];

                    // Check if Picasastarter should autorun Picasa with a specified database name...
                    if (arg.Equals("/autorun", StringComparison.CurrentCultureIgnoreCase))
                    {
                        showGUI = false;

                        // The next argument should be the database name...
                        i++;
                        if (i < Environment.GetCommandLineArgs().Length)
                        {
                            autoRunDatabaseName = Environment.GetCommandLineArgs()[i];
                            autoRunDatabaseName = autoRunDatabaseName.Trim(new char[] { '"', ' ' });
                        }
                        else
                        {
                            MessageBox.Show("The /autorun directive should be followed by an existing Picasa database name, or \"Personal\" or \"AskUser\"", "No Database Name");
                        }
                    }
                    else if (arg.Equals("/backup", StringComparison.CurrentCultureIgnoreCase))
                    {
                        showGUI = false;

                        // The next argument should be the database name...
                        i++;
                        if (i < Environment.GetCommandLineArgs().Length)
                        {
                            backupDatabaseName = Environment.GetCommandLineArgs()[i];
                            backupDatabaseName = backupDatabaseName.Trim(new char[] { '"', ' ' });
                        }
                        else
                        {
                            MessageBox.Show("The /backup directive should be followed by an existing Picasa database name, or \"Personal\" or \"AskUser\"", "No Database Name");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid or no command line parameter: " + arg);
                    }
                }

                // If /autorun argument was passed...
                //---------------------------------------------------------------------------
                if (autoRunDatabaseName != null)
                {
                    PicasaDB foundDB = null;
                    if (IOHelper.IsProcessOpen("Picasa3"))
                    {
                        MessageBox.Show("Picasa 3 is presently running on this computer." +
                                        "\n\nPlease Exit Picasa before trying to\nrun it from PicasaStarter", "Picasa Already Running");
                        return;
                    }

                    // First check if he wants to be asked which database to run
                    if (autoRunDatabaseName.Equals("AskUser", StringComparison.CurrentCultureIgnoreCase))
                    {
                        // Show Database selection menu
                        SelectDBForm selectDBForm = new SelectDBForm(settings, false);
                        selectDBForm.ShowDialog();

                        if (selectDBForm.ReturnDBName != null)
                        {
                            autoRunDatabaseName = selectDBForm.ReturnDBName;
                        }
                        else
                        {
                            return;
                        }
                    }

                    // Next check if he wants to run with the standard personal database...
                    if (autoRunDatabaseName.Equals("personal", StringComparison.CurrentCultureIgnoreCase))
                    {
                        autoRunDatabaseName = settings.picasaDBs[0].Name;
                    }
                    foreach (PicasaDB db in settings.picasaDBs)
                    {
                        if (db.Name.Equals(autoRunDatabaseName, StringComparison.CurrentCultureIgnoreCase))
                        {
                            foundDB = db;
                        }
                    }

                    if (foundDB != null)
                    {
                        bool xxx = IOHelper.MapVirtualDrive(foundDB, appSettingsDir);

                        PicasaRunner runner = new PicasaRunner(settings.PicasaExePath);
                        String       dbPath;
                        string       destButtonDir;

                        // If the user wants to run his personal default database...
                        if (foundDB.IsStandardDB == true)
                        {
                            dbPath = null;
                            // Set the directory to put the PicasaButtons in the PicasaDB...
                            destButtonDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) +
                                            "\\Google\\Picasa2\\buttons";
                        }

                        // If the user wants to run a custom database...
                        else
                        {
                            // Set the choosen BaseDir
                            if (!Directory.Exists(foundDB.BaseDir + "\\Google\\Picasa2") &&
                                Directory.Exists(foundDB.BaseDir + "\\Local Settings\\Application Data\\Google\\Picasa2"))
                            {
                                DialogResult result = MessageBox.Show("Do you want to temporarily use the Picasa version 3.8 database?\n" +
                                                                      "This Picasa 3.8 Database path is:\n " + foundDB.BaseDir + "\\Local Settings\\Application Data" +
                                                                      "\n\n Please edit the database settings, and convert the database to version 3.9 to stop receiving this warning message",
                                                                      "Database Not Converted for Picasa Version 3.9+", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
                                                                      (MessageBoxOptions)0x40000);
                                if (result == DialogResult.Yes)
                                {
                                    foundDB.BaseDir = foundDB.BaseDir + "\\Local Settings\\Application Data";
                                }
                            }
                            // Get out without creating a database if the database directory doesn't exist
                            if (!Directory.Exists(foundDB.BaseDir + "\\Google\\Picasa2"))
                            {
                                MessageBox.Show("The database doesn't exist at this location, please choose an existing database or create one.",
                                                "Database doesn't exist or not created", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1,
                                                (MessageBoxOptions)0x40000);
                                return;
                            }
                            dbPath = foundDB.BaseDir;
                            // Set the directory to put the PicasaButtons in the PicasaDB...
                            destButtonDir = foundDB.BaseDir + "\\Google\\Picasa2\\buttons";
                        }

                        // Copy Buttons and scripts and set the correct Path variable to be able to start scripts...
                        IOHelper.TryDeleteFiles(destButtonDir, "PSButton*");
                        foreach (PicasaButton button in settings.picasaButtons.ButtonList)
                        {
                            try
                            {
                                button.CreateButtonFile(destButtonDir);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.Message);
                            }
                        }

                        settings.picasaButtons.Registerbuttons();

                        // Go!
                        try
                        {
                            runner.RunPicasa(dbPath, appSettingsDir);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }

                        bool xyz;
                        xyz = IOHelper.UnmapVDrive();
                    }
                    else
                    {
                        MessageBox.Show("The database passed with the /autorun parameter was not found: (" + autoRunDatabaseName + ")");
                        autoRunDatabaseName = null;
                    }
                }

                // If /backup argument was passed...
                //---------------------------------------------------------------------------
                if (backupDatabaseName != null)
                {
                    PicasaDB foundDB = null;
                    // First check if he wants to be asked which database to backup
                    if (backupDatabaseName.Equals("AskUser", StringComparison.CurrentCultureIgnoreCase))
                    {
                        // Show Database selection menu
                        SelectDBForm selectDBForm = new SelectDBForm(settings, true);
                        selectDBForm.ShowDialog();

                        if (selectDBForm.ReturnDBName != null)
                        {
                            backupDatabaseName = selectDBForm.ReturnDBName;
                        }
                    }
                    // Next check if he wants to backup the standard personal database...
                    if (backupDatabaseName.Equals("personal", StringComparison.CurrentCultureIgnoreCase))
                    {
                        // If the user wants to backup his personal default database... (cmd line arg was "personal")
                        Application.Run(new BackupForm_CL(settings.picasaDBs[0], appSettingsDir));
                        if (BackupComplete)
                        {
                            settings.picasaDBs[0].LastBackupDate = DateTime.Today;
                            try
                            {
                                SettingsHelper.SerializeSettings(settings,
                                                                 appSettingsDir + "\\" + SettingsHelper.SettingsFileName);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Error saving settings: " + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        // Exit if the Ask menu was cancelled
                        if (backupDatabaseName.Equals("AskUser", StringComparison.CurrentCultureIgnoreCase))
                        {
                            return;
                        }

                        foreach (PicasaDB db in settings.picasaDBs)
                        {
                            //MessageBox.Show("db: " + db.Name + "\nBackup name: " + backupDatabaseName);
                            if (db.Name.Equals(backupDatabaseName, StringComparison.CurrentCultureIgnoreCase))
                            {
                                foundDB = db;
                            }
                        }
                        //MessageBox.Show("Foundb: " + foundDB.Name + "\nBackup dir " + foundDB.BackupDir );

                        if (foundDB != null)
                        {
                            bool xxx = IOHelper.MapVirtualDrive(foundDB, appSettingsDir);

                            // Set backup date to now in settings and then save new date to settings file before backup
                            DateTime SaveBUDate = foundDB.LastBackupDate;
                            foundDB.LastBackupDate = DateTime.Today;
                            try
                            {
                                SettingsHelper.SerializeSettings(settings,
                                                                 appSettingsDir + "\\" + SettingsHelper.SettingsFileName);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Error saving settings: " + ex.Message);
                            }
                            Application.Run(new BackupForm_CL(foundDB, appSettingsDir));

                            //If backup was cancelled, try to restore settings file backup date to original
                            if (!BackupComplete)
                            {
                                // try to save old backup date if backup does not complete
                                foundDB.LastBackupDate = SaveBUDate;
                                try
                                {
                                    SettingsHelper.SerializeSettings(settings,
                                                                     appSettingsDir + "\\" + SettingsHelper.SettingsFileName);
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show("Error saving settings: " + ex.Message);
                                }
                            }

                            bool xyz;
                            xyz = IOHelper.UnmapVDrive();
                        }
                        else
                        {
                            MessageBox.Show("The database passed with the /backup parameter was not found: (" + backupDatabaseName + ")");
                            backupDatabaseName = null;
                        }
                    }
                }
            }
            #endregion

            #region Start GUI

            if (showGUI == true)
            {
                Application.Run(new MainForm(settings, appSettingsDir, ConfigFileExists));
            }
            #endregion
        }
コード例 #9
0
        // Called ny EDIT button
        public CreatePicasaDBForm(PicasaDB picasaDB, string appSettingsDir, Settings settings, bool standardDatabase = false)
        {
            InitializeComponent();

            AppSettingsDir = appSettingsDir;
            //appSettingsBaseDir = Path.GetDirectoryName(AppSettingsDir);
            //appSettingsBaseDir = Path.GetPathRoot(AppSettingsDir);
            PicasaDB  = new PicasaDB(picasaDB);
            _settings = settings;

            //Backup Tab initialization
            textBoxBackupDir.Text = PicasaDB.BackupDir;
            if (string.IsNullOrEmpty(PicasaDB.BackupComputerName))
            {
                textBoxBackupName.Text = "Not Defined";
            }
            else
            {
                textBoxBackupName.Text = PicasaDB.BackupComputerName;
            }
            BackupFrequencyBox.SelectedIndex = PicasaDB.BackupFrequency;
            CheckBackupDBOnly.Checked        = PicasaDB.BackupDBOnly;
            if (PicasaDB.LastBackupDate.Year <= 1900)
            {
                textLastBackupDate.Text = "Never Backed Up";
            }
            else
            {
                textLastBackupDate.Text = PicasaDB.LastBackupDate.ToString("d");
            }

            //Database Tab Initialization
            textBoxDBBaseDir.Text     = PicasaDB.BaseDir;
            textBoxDBDescription.Text = PicasaDB.Description;
            textBoxDBName.Text        = PicasaDB.Name;
            messageBoxDB.ForeColor    = Color.Blue;
            messageBoxDB.Text         = "";
            full38DBDirectory         = PicasaDB.BaseDir + "\\Local Settings\\Application Data";

            //Virtual Drive Tab Initialization
            buttonVDRelPath.Checked = !PicasaDB.VirtualDrivePathAbsolute;
            buttonVDAbsPath.Checked = !buttonVDRelPath.Checked;
            PicDrivecomboBox.Text   = PicasaDB.PictureVirtualDrive;
            EnablecheckBox.Checked  = PicasaDB.EnableVirtualDrive;
            textBoxSourceRoot.Text  = Path.GetPathRoot(AppSettingsDir);
            if (string.IsNullOrEmpty(PicasaDB.VirtualDriveBaseDir))
            {
                textBoxVDSource.Text    = Path.GetDirectoryName(AppSettingsDir);
                buttonVDRelPath.Checked = true;
                buttonVDAbsPath.Checked = !buttonVDRelPath.Checked;
            }
            else
            {
                bool   _VDPathRelative    = buttonVDRelPath.Checked;
                string _VDriveBaseDir     = PicasaDB.VirtualDriveBaseDir;
                string _VDriveBaseDirRoot = Path.GetPathRoot(_VDriveBaseDir);
                if (_VDPathRelative)
                {
                    int _VDRootLength = _VDriveBaseDirRoot.Length;
                    if (_VDriveBaseDirRoot.StartsWith("\\\\"))
                    {
                        _VDRootLength += 1;
                    }
                    string AppsBaseDirRoot = Path.GetPathRoot(AppSettingsDir);
                    string AppRootTrimmed  = AppsBaseDirRoot.TrimEnd('\\');
                    if (_VDriveBaseDirRoot == _VDriveBaseDir)
                    {
                        _VDriveBaseDir = AppsBaseDirRoot;
                    }
                    else
                    {
                        _VDriveBaseDir = AppRootTrimmed + "\\" + _VDriveBaseDir.Substring(_VDRootLength);
                    }
                }

                textBoxVDSource.Text = _VDriveBaseDir;
            }

            //Disable options for Personal database
            if (standardDatabase == true)
            {
                textBoxDBName.Enabled         = false;
                textBoxDBDescription.Enabled  = false;
                buttonBrowseDBBaseDir.Enabled = false;
                BrowseVDSource.Enabled        = false;
                buttonDoVDNow.Enabled         = false;
                PicDrivecomboBox.Text         = "C:";
                PicDrivecomboBox.Enabled      = false;
                EnablecheckBox.Checked        = false;
                EnablecheckBox.Enabled        = false;
                buttonConvert38.Enabled       = false;
            }
        }
コード例 #10
0
 public RebuildRestoreForm(PicasaDB database, Settings settings)
 {
     InitializeComponent();
     _database = database;
     _settings = settings;
 }
コード例 #11
0
        // Called ny EDIT button
        public CreatePicasaDBForm(PicasaDB picasaDB, string appSettingsDir, Settings settings, bool standardDatabase = false)
        {
            InitializeComponent();

            AppSettingsDir = appSettingsDir;
            //appSettingsBaseDir = Path.GetDirectoryName(AppSettingsDir);
            //appSettingsBaseDir = Path.GetPathRoot(AppSettingsDir);
            PicasaDB = new PicasaDB(picasaDB);
            _settings = settings;

            //Backup Tab initialization
            textBoxBackupDir.Text = PicasaDB.BackupDir;
            if (string.IsNullOrEmpty(PicasaDB.BackupComputerName))
                textBoxBackupName.Text = "Not Defined";
            else
                textBoxBackupName.Text = PicasaDB.BackupComputerName;
            BackupFrequencyBox.SelectedIndex = PicasaDB.BackupFrequency;
            CheckBackupDBOnly.Checked = PicasaDB.BackupDBOnly;
            if (PicasaDB.LastBackupDate.Year <= 1900)
                textLastBackupDate.Text = "Never Backed Up";
            else
                textLastBackupDate.Text = PicasaDB.LastBackupDate.ToString("d");

            //Database Tab Initialization
            textBoxDBBaseDir.Text = PicasaDB.BaseDir;
            textBoxDBDescription.Text = PicasaDB.Description;
            textBoxDBName.Text = PicasaDB.Name;
            messageBoxDB.ForeColor = Color.Blue;
            messageBoxDB.Text = "";
            full38DBDirectory = PicasaDB.BaseDir + "\\Local Settings\\Application Data";

            //Virtual Drive Tab Initialization
            buttonVDRelPath.Checked = !PicasaDB.VirtualDrivePathAbsolute;
            buttonVDAbsPath.Checked = !buttonVDRelPath.Checked;
            PicDrivecomboBox.Text = PicasaDB.PictureVirtualDrive;
            EnablecheckBox.Checked = PicasaDB.EnableVirtualDrive;
            textBoxSourceRoot.Text = Path.GetPathRoot(AppSettingsDir);
            if (string.IsNullOrEmpty(PicasaDB.VirtualDriveBaseDir))
            {
                textBoxVDSource.Text = Path.GetDirectoryName(AppSettingsDir);
                buttonVDRelPath.Checked = true;
                buttonVDAbsPath.Checked = !buttonVDRelPath.Checked;
            }
            else
            {

                bool _VDPathRelative = buttonVDRelPath.Checked;
                string _VDriveBaseDir = PicasaDB.VirtualDriveBaseDir;
                string _VDriveBaseDirRoot = Path.GetPathRoot(_VDriveBaseDir);
                if (_VDPathRelative)
                {
                    int _VDRootLength = _VDriveBaseDirRoot.Length;
                    if (_VDriveBaseDirRoot.StartsWith("\\\\"))
                        _VDRootLength += 1;
                    string AppsBaseDirRoot = Path.GetPathRoot(AppSettingsDir);
                    string AppRootTrimmed = AppsBaseDirRoot.TrimEnd('\\');
                    if (_VDriveBaseDirRoot == _VDriveBaseDir)
                        _VDriveBaseDir = AppsBaseDirRoot;
                    else
                        _VDriveBaseDir = AppRootTrimmed + "\\" + _VDriveBaseDir.Substring(_VDRootLength);
                }

                textBoxVDSource.Text = _VDriveBaseDir;
            }

            //Disable options for Personal database
            if (standardDatabase == true)
            {
                textBoxDBName.Enabled = false;
                textBoxDBDescription.Enabled = false;
                buttonBrowseDBBaseDir.Enabled = false;
                BrowseVDSource.Enabled = false;
                buttonDoVDNow.Enabled = false;
                PicDrivecomboBox.Text = "C:";
                PicDrivecomboBox.Enabled = false;
                EnablecheckBox.Checked = false;
                EnablecheckBox.Enabled = false;
                buttonConvert38.Enabled = false;
            }
        }
コード例 #12
0
 public CopyExistingDBForm(PicasaDB database, Settings settings)
 {
     InitializeComponent();
     _settings = settings;
     Db        = database;
 }
コード例 #13
0
ファイル: Settings.cs プロジェクト: EarlBoss/picasastarter
        public static PicasaDB GetDefaultPicasaDB()
        {
            PicasaDB picasaDB = new PicasaDB();
            picasaDB.Name = "Personal database of " + Environment.GetEnvironmentVariable("username") + " (=default for picasa)";
            picasaDB.BaseDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            picasaDB.IsStandardDB = true;
            picasaDB.Description = "This is the database Picasa always uses if you don't use Picasa starter. Because of some "
                    + "technical reasons in some situations it is not recommended to share this database. You cannot change any settings "
                    + "for this database either. Create a new one if you want to share a database... and if you want, copy your default "
                    + "one into it.";
            picasaDB.PictureVirtualDrive = "C:";
            picasaDB.EnableVirtualDrive = false;

            return picasaDB;
        }
コード例 #14
0
 public BackupForm_CL(PicasaDB db, String _settingsDir)
 {
     InitializeComponent();
     _db         = db;
     settingsDir = _settingsDir;
 }
コード例 #15
0
 public BackupForm_CL(PicasaDB db, String _settingsDir)
 {
     InitializeComponent();
     _db = db;
     settingsDir = _settingsDir;
 }
コード例 #16
0
 public RebuildRestoreForm(PicasaDB database, Settings settings)
 {
     InitializeComponent();
     _database = database;
     _settings = settings;
 }