private string InstallAzurePowershell(string pathToWebPIExe)
        {
            // .\WebpiCmdLine.exe /Products:AzureNodePowershell
            String     logFileName = String.Concat("WebPiLog_", Guid.NewGuid().ToString(), ".txt");
            FileStream logFileFs   = File.Create(logFileName);

            logFileFs.Close();

            String installCommand = String.Format(CultureInfo.InvariantCulture, "Start-Process -File \"{0}\" -ArgumentList \" /Install /Products:WindowsAzurePowershell /Log:{1} /AcceptEULA \" -Wait", pathToWebPIExe, logFileName);

            ExecuteCommands.ExecuteCommand(installCommand, this.Host);
            return(logFileName);
        }
Esempio n. 2
0
        private void CopyBinaries()
        {
            string roleDir = Path.Combine(CurrentLocation, this.RoleName);

            if (Directory.Exists(roleDir) == true)
            {
                WriteObject(string.Format(CultureInfo.InvariantCulture, Resources.RoleDirAlreadyPresent, this.RoleName));
            }
            else
            {
                Directory.CreateDirectory(roleDir);
                ExecuteCommands.ExecuteCommand(string.Format(CultureInfo.InvariantCulture, "COPY-ITEM \"{0}\" \"{1}\" -recurse", Path.Combine(this.RoleBinariesFolder, "*"), roleDir), this.Host);
            }
        }
    public static void Main()
    {
        DraftManager manager = new DraftManager();

        while (true)
        {
            List <string> input = Console.ReadLine().Split().ToList();

            ExecuteCommands.ExecuteCommand(input, manager);
            if (input[0].Equals("Shutdown"))
            {
                break;
            }
        }
    }
Esempio n. 4
0
        private void Unzip(string downloadLocation)
        {
            String unzipCommand = String.Format(CultureInfo.InvariantCulture, @"function Unzip([string]$locationOfZipFile, [string]$unzipLocation)
                                                {{
                                                    Write-Host $locationOfZipFile
                                                    Write-Host $unzipLocation
                                                    $shell_app = new-object -com shell.application
                                                    $zip_file = $shell_app.namespace($locationOfZipFile)
                                                    $destination = $shell_app.namespace($unzipLocation)
                                                    $destination.Copyhere($zip_file.items(), 0x10)
                                                }}
                                                Unzip ""{0}""  ""{1}""
                                                ", downloadLocation, UnzipLoc);

            ExecuteCommands.ExecuteCommand(unzipCommand, this.Host);
        }
Esempio n. 5
0
        /// <summary>
        /// Deletes objects based on an expression
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="criteria"></param>
        public int DeleteObjects <T>(Expression <Func <T, bool> > criteria)
        {
            StringBuilder sb = new StringBuilder("DELETE FROM ");

            sb.Append(Connection.CommandGenerator.ResolveTableName(typeof(T)));
            sb.Append(" WHERE ");
            IDbCommand                  cmd         = Connection.GetCommand();
            IDeleteFormatter            formatter   = Connection.GetDeleteFormatter(this);
            Dictionary <string, object> whereParams = new Dictionary <string, object>();
            string whereString = formatter.FormatDelete(DataAccess.Core.Linq.Common.PartialEvaluator.Eval(criteria), out whereParams);

            foreach (KeyValuePair <string, object> par in whereParams)
            {
                cmd.Parameters.Add(Connection.GetParameter(par.Key, par.Value));
            }

            sb.Append(whereString);
            cmd.CommandText = sb.ToString();
            return(ExecuteCommands.ExecuteCommand(cmd, Connection));
        }
Esempio n. 6
0
 public async Task <int> ExecuteCommand(IDbCommand command)
 {
     return(await Task.Run(() => ExecuteCommands.ExecuteCommand(command, Connection)));
 }
Esempio n. 7
0
 /// <summary>
 /// Executes a command on the data store
 /// </summary>
 /// <param name="command">The command to execute</param>
 public virtual int ExecuteCommand(IDbCommand command)
 {
     return(ExecuteCommands.ExecuteCommand(command, Connection));
 }
Esempio n. 8
0
        /// <summary>
        /// Deletes objects based on an expression
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="criteria"></param>
        public int DeleteObjects <T>(Expression <Func <T, bool> > criteria)
        {
            IDbCommand command = Connection.CommandGenerator.GetDeleteCommand <T>(criteria);

            return(ExecuteCommands.ExecuteCommand(command, Connection));
        }