Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //--
            //FutureDev: make sure user has sufficient priviledges to open files and run SUSHI.

            //--initialize settings
            SushiSettingsUtil.LoadSushiSettings();

            //--command line args
            parseArgs(args);
            if (GlobalVars.AutoStartBackup)
            {
                AutoBackup.StartBackup();
                return;
            }

            //--windows init stuff
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); //note: don't want to add this handler when starting from commandline, because we don't want to try and show a message box.

            //--Splash screen
            //SplashScreen.Definstance = new SplashScreen();
            //SplashScreen.Definstance.Show();
            //Application.DoEvents();

            //--kick off main Form of SUSHI
            MainForm.DefInstance = new MainForm();
            Application.Run(MainForm.DefInstance);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //--
            //FutureDev: make sure user has sufficient priviledges to open files and run SUSHI.

            //--initialize settings
            SushiSettingsUtil.LoadSushiSettings();

            //--command line args
            parseArgs(args);
            if (GlobalVars.AutoStartBackup)
            {
                AutoBackup.StartBackup();
                return;
            }

            //--windows init stuff
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); //note: don't want to add this handler when starting from commandline, because we don't want to try and show a message box.

            //--Splash screen
            //SplashScreen.Definstance = new SplashScreen();
            //SplashScreen.Definstance.Show();
            //Application.DoEvents();

            //Resolve Assemblies
            AppDomain.CurrentDomain.AssemblyResolve += (sender, e) =>
            {
                if (e.Name == "Microsoft.SharePoint")
                {
                    if (SharePointUtil.IsSharePoint2007InstalledLocally)
                    {
                        return(Assembly.Load("Microsoft.SharePoint, Version=12.0.0.0"));
                    }
                    else
                    if (SharePointUtil.IsSharePoint2010InstalledLocally)
                    {
                        return(Assembly.Load("Microsoft.SharePoint, Version=14.0.0.0"));
                    }
                    else
                    if (SharePointUtil.IsSharePoint2013InstalledLocally)
                    {
                        return(Assembly.Load("Microsoft.SharePoint, Version=15.0.0.0"));
                    }
                    else
                    {
                        throw new Exception("SharePoint is not installed.  You must run SUSHI locally from a machine that has SharePoint installed.");
                    }
                }
                else
                {
                    return(null);
                }
            };

            //--kick off main Form of SUSHI
            MainForm.DefInstance = new MainForm();
            Application.Run(MainForm.DefInstance);
        }
Exemplo n.º 3
0
        private void BackupRecursively(SPWeb web, bool onlyValidate, bool isTopLevelSite, bool isCompressed)
        {
            //--loop through all subsites, call StartBackup3 recursively
            if (optBackupAllSubsites.Checked)
            {
                foreach (SPWeb subweb in web.Webs)
                {
                    if (isCompressed)
                    {
                        BackupRecursively(subweb, onlyValidate, false, true);
                    }
                    else
                    {
                        BackupRecursively(subweb, onlyValidate, false, false);
                    }
                }

                if (isTopLevelSite)
                {
                    return;
                }
            }

            if (_cancelNotice)
            {
                throw new Eh.CancelException();
            }

            _totalSites++;

            string backupFileName = txtBackupPath.Text + "\\" + AutoBackup.fetchCleanBackupFileName(web.Url) + ".SUSHIbackup";
            //SmartStepUtil.AddToRTB(rtbDisplay, "Site to backup: ");
            //SmartStepUtil.AddToRTB(rtbDisplay, web.Url + "\r\n", Color.Blue, 0, true);
            //SmartStepUtil.AddToRTB(rtbDisplay, "Backup file name: " + backupFileName + "\r\n\r\n");

            string args = string.Empty;

            if (isCompressed)
            {
                args = AutoBackup.fetchStsadmCmdArgsForBackup(web.Url, backupFileName, true);
            }
            else
            {
                args = AutoBackup.fetchStsadmCmdArgsForBackup(web.Url, backupFileName, false);
            }

            if (onlyValidate)
            {
                SmartStepUtil.AddToRTB(rtbDisplay, "stsadm.exe " + args + "\r\n\r\n", Color.Gray, 8, false);
            }
            else
            {
                //--do backup of site
                SmartStepUtil.AddToRTB(rtbDisplay, "starting backup..\r\n", Color.SeaGreen, 11, true);
                SmartStepUtil.AddToRTB(rtbDisplay, "stsadm.exe " + args + "\r\n", Color.Gray, 8, false);
                ProcessStartInfo si = new ProcessStartInfo();
                si.Arguments = args;
                si.FileName  = GlobalVars.StsadmExePath;
                Process ret = Process.Start(si);
                ret.WaitForExit();
            }
        }