Ejemplo n.º 1
0
        /// <summary>
        /// Create a zip file from a directory
        /// </summary>
        /// <param name="skinbase"></param>
        /// <param name="skin"></param>
        private void ZipDirectory(string skinbase, string skin)
        {
            string   _zipFile = skinbase + "Old-" + skin + "-" + DateTime.Now.ToString("dd_MM_yy") + ".zip";
            Archiver archiver = new Archiver();

            archiver.AddDirectory(skinbase + skin, _zipFile, true);
        }
Ejemplo n.º 2
0
        public bool PerformActions()
        {
            List <ILogCreator> logs = CreateLoggers();

            totalActions = logs.Count;


            if (!Directory.Exists(_tmpDir))
            {
                Directory.CreateDirectory(_tmpDir);
            }

            foreach (ILogCreator logCreator in logs)
            {
                setAction(logCreator.ActionMessage);
                Update();
                logCreator.CreateLogs(_tmpDir);
                updateProgress(1);
            }

            CreateHTMLIndexFile();

            base.setAction("Creating ZIP Archive with gathered information...");
            try
            {
                // Get config file to help debugging. It may not exist if MediaPortal Configuration
                // has not been used yet.
                string fileName = Path.Combine(Config.GetFolder(Config.Dir.Config), "MediaPortal.xml");
                if (File.Exists(fileName))
                {
                    File.Copy(fileName, Path.Combine(_tmpDir, "MediaPortal.xml"), true);
                }

                //Add client gentle.config if it exists
                fileName = Path.Combine(Config.GetFolder(Config.Dir.Config), "Gentle.config");
                if (File.Exists(fileName))
                {
                    File.Copy(fileName, Path.Combine(_tmpDir, "Client_Gentle.config"), true);
                }

                if (File.Exists(_zipFile))
                {
                    File.Delete(_zipFile);
                }
                using (Archiver archiver = new Archiver())
                {
                    archiver.AddDirectory(_tmpDir, _zipFile, false);
                }
                Directory.Delete(_tmpDir, true);
            }
            catch (Exception ex)
            {
                Utils.ErrorDlg(ex.ToString());
            }
            updateProgress(1);
            base.Done();
            return(true);
        }
Ejemplo n.º 3
0
        public bool PerformActions()
        {
            List <ILogCreator> logs = CreateLoggers();

            totalActions = logs.Count;


            if (!Directory.Exists(_tmpDir))
            {
                Directory.CreateDirectory(_tmpDir);
            }

            foreach (ILogCreator logCreator in logs)
            {
                setAction(logCreator.ActionMessage);
                Update();
                logCreator.CreateLogs(_tmpDir);
                updateProgress(1);
            }

            CreateHTMLIndexFile();

            base.setAction("Creating ZIP Archive with gathered information...");
            try
            {
                // Get config file also to help debugging
                File.Copy(Config.GetFolder(Config.Dir.Config) + @"\\MediaPortal.xml", _tmpDir + @"\\MediaPortal.xml", true);
                //Add client gentle.config if it exists
                if (File.Exists(Config.GetFolder(Config.Dir.Config) + @"\\Gentle.config"))
                {
                    File.Copy(Config.GetFolder(Config.Dir.Config) + @"\\Gentle.config", _tmpDir + @"\\Client_Gentle.config", true);
                }

                if (File.Exists(_zipFile))
                {
                    File.Delete(_zipFile);
                }
                using (Archiver archiver = new Archiver())
                {
                    archiver.AddDirectory(_tmpDir, _zipFile, false);
                }
                Directory.Delete(_tmpDir, true);
            }
            catch (Exception ex)
            {
                Utils.ErrorDlg(ex.ToString());
            }
            updateProgress(1);
            base.Done();
            return(true);
        }