/// <summary>
        /// sets the initial data for an application
        /// </summary>
        /// <param name="variables">All variables needed to run the application.</param>
        public void ConfigureApplication(ApplicationVariable[] variables)
        {
            try
            {
                ApplicationParsedData parsedData = PluginHelper.GetParsedData(variables);
                this.startupLogger = new FileLogger(parsedData.StartupLogFilePath);

                this.appName = RemoveSpecialCharacters(parsedData.AppInfo.Name) + parsedData.AppInfo.Port.ToString(CultureInfo.InvariantCulture);
                this.appPath = parsedData.AppInfo.Path;

                this.applicationInfo = parsedData.AppInfo;

                this.autoWireTemplates = parsedData.AutoWireTemplates;

                this.aspDotNetVersion = this.GetAppVersion(this.applicationInfo);

                this.cpuTarget = this.GetCpuTarget(this.applicationInfo);

                this.AutowireApp(parsedData.AppInfo, variables, parsedData.GetServices(), parsedData.LogFilePath, parsedData.ErrorLogFilePath);
            }
            catch (Exception ex)
            {
                this.startupLogger.Error(ex.ToString());
                throw;
            }
        }
        /// <summary>
        /// Processes the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        /// <returns></returns>
        public object Process(dynamic args)
        {
            //Initialize
            this.blobStroreProvider = Config.BlobstoreProvider;
            this.blobStoreOptions = Config.BlobstoreOptions;
            this.blobStoreClient = BlobstoreClient.Blobstore.CreateClient(blobStroreProvider, blobStoreOptions);

            this.blobStoreId = args[0].Value.ToString();
            this.sha1 = args[1].Value.ToString();
            this.packageName = args[2].Value.ToString();
            this.packageVersion = args[3].Value.ToString();
            this.dependencies = args[4];

            Directory.CreateDirectory(Path.Combine(Config.BaseDir, @"data", @"tmp"));

            this.compileBase = Path.Combine(Config.BaseDir, "data", "compile");
            this.installBase = Path.Combine(Config.BaseDir, "data", "packages");
            this.logFile = Path.Combine(Config.BaseDir, "data", "tmp", Config.AgentId);
            this.logger = new FileLogger(logFile);

            this.compileDir = Path.Combine(compileBase, packageName);
            this.installDir = Path.Combine(installBase, packageName, packageVersion);
            this.compiledPackage = sourceFile + ".compiled";

            this.maxDiskUsagePercent = 90.0;

            return this.Start();
        }
 /// <summary>
 /// recovers a running application
 /// </summary>
 /// <param name="variables">All variables needed to run the application.</param>
 public void RecoverApplication(ApplicationVariable[] variables)
 {
     try
     {
         ApplicationParsedData parsedData = PluginHelper.GetParsedData(variables);
         this.startupLogger = new FileLogger(parsedData.StartupLogFilePath);
         this.appName = RemoveSpecialCharacters(parsedData.AppInfo.Name) + parsedData.AppInfo.Port.ToString(CultureInfo.InvariantCulture);
         this.appPath = parsedData.AppInfo.Path;
         this.applicationInfo = parsedData.AppInfo;
         this.autoWireTemplates = parsedData.AutoWireTemplates;
     }
     catch (Exception ex)
     {
         this.startupLogger.Error(ex.ToString());
         throw;
     }
 }
        /// <summary>
        /// Clears the log file after a compilation runs.  This is needed because if
        /// reuse_compilation_vms is being used then without clearing the log then
        /// the log from each subsequent compilation will include the previous
        /// compilation's output.
        /// </summary>
        /// <param name="logFile">The log file.</param>
        private void ClearLogFile()
        {
            if (File.Exists(this.logFile))
            {
                File.Delete(this.logFile);
            }

            this.logger = new FileLogger(this.logFile);
        }