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);

        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;
    }
 /// <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";
   var archiver = new Archiver();
   archiver.AddDirectory(skinbase + skin, zipFile, true);
 }
Exemplo 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 to help debugging. It may not exist if MediaPortal Configuration
        // has not been used yet.
        string fileName = Config.GetFolder(Config.Dir.Config) + @"\\MediaPortal.xml";
        if (File.Exists(fileName))
        {
          File.Copy(fileName, _tmpDir + @"\\MediaPortal.xml", true);
        }

        //Add client gentle.config if it exists
        fileName = Config.GetFolder(Config.Dir.Config) + @"\\Gentle.config";
        if (File.Exists(fileName))
        {
          File.Copy(fileName, _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;
    }