Example #1
0
        public void EsUnArchivoAppManifestValido()
        {
            var appManifest = new AppManifest();
            // string appManifestJson =

            // appManifest.
        }
Example #2
0
        public void CanProduceHttpWithTestUrl()
        {
            var app = new App
            {
                Rule = new Rule
                {
                    Title = "title",
                    Query = "*",
                    Then  = new ThenHttp("http://localhost")
                    {
                        TestUrl = "http://test"
                    }
                }
            };

            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp, Is.Not.Null);
            Assert.That(newApp.Rule, Is.Not.Null);
            Assert.That(newApp.Rule.Then, Is.Not.Null);
            Assert.That(newApp.Rule.Then.Type, Is.EqualTo(ThenType.Http));
            var http = newApp.Rule.Then as ThenHttp;

            Assert.That(http != null);
            Assert.That(http.TestUrl, Is.EqualTo("http://test"));
        }
Example #3
0
        /// <summary>
        /// Start a new application using manifest metadata
        /// </summary>
        /// <param name="manifest">Application manifest</param>
        /// <returns></returns>
        public ApplicationProcess StartApplication(AppManifest manifest)
        {
            string viewLocation = FSHelper.NormalizeLocation($"{manifest.Location}\\{manifest.MainPage}");

            Log($"Starting application from package '{manifest.Domain}'");

            if (!File.Exists(viewLocation))
            {
                throw new LauncherException($"Failed to start application '{manifest.Name}' ({manifest.Domain}). View not found.");
            }

            ApplicationProcess proc = ProcessManager.GetInstance().CreateProcess();

            proc.Name       = manifest.Name;
            proc.Domain     = manifest.Domain;
            proc.DomainPath = manifest.Location;

            // TODO: Add icon loader
            proc.Host.ViewName = manifest.MainPage;
            proc.Host.Styles   = manifest.Window;
            proc.Host.Label    = manifest.Name;


            proc.Start();
            proc.Host.Show();

            return(proc);
        }
Example #4
0
        public FileInfo DeployManifest(AppManifest manifest)
        {
            var j = JsonConvert.SerializeObject(manifest, Formatting.Indented, new Newtonsoft.Json.Converters.VersionConverter());

            File.WriteAllText(GetPublishLocation(), j);
            return(new FileInfo(GetPublishLocation()));
        }
Example #5
0
        public void CanProduceMarkerApp()
        {
            var app    = new App();
            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp != null);
        }
Example #6
0
        public AppManifest CreateAppManifest()
        {
            AppManifest manifest;

            switch (Source)
            {
            case InformationSource.AssemblyInfo:
                manifest = CreateFromAssemblyInfo();
                break;

            case InformationSource.AppManifest:
                manifest = CreateFromDeployManifest();
                break;

            case InformationSource.None:
                manifest = new AppManifest();
                break;

            case InformationSource.Both:
                manifest = CreateFromAssemblyInfo();
                manifest = CreateFromDeployManifest(manifest);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(manifest);
        }
Example #7
0
        public void CanProduceHttpWithBasicAuth()
        {
            var app = new App
            {
                Rule = new Rule
                {
                    Title = "title",
                    Query = "*",
                    Then  = new ThenHttp("http://localhost")
                    {
                        Authentication = new BasicAuthentication
                        {
                            Username = "******",
                            Password = "******"
                        }
                    }
                }
            };

            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp, Is.Not.Null);
            Assert.That(newApp.Rule, Is.Not.Null);
            Assert.That(newApp.Rule.Then, Is.Not.Null);
            Assert.That(newApp.Rule.Then.Type, Is.EqualTo(ThenType.Http));
            var http = newApp.Rule.Then as ThenHttp;

            Assert.That(http != null);
            var basicAuth = http.Authentication as BasicAuthentication;

            Assert.That(basicAuth != null);
            Assert.That(basicAuth.Username, Is.EqualTo("username"));
            Assert.That(basicAuth.Password, Is.EqualTo("password"));
        }
Example #8
0
        public void CanProduceHttpWithBearerTokenAuth()
        {
            var app = new App
            {
                Rule = new Rule
                {
                    Title = "title",
                    Query = "*",
                    Then  = new ThenHttp("http://localhost")
                    {
                        Authentication = new BearerTokenAuthentication()
                        {
                            Token = "token"
                        }
                    }
                }
            };

            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp, Is.Not.Null);
            Assert.That(newApp.Rule, Is.Not.Null);
            Assert.That(newApp.Rule.Then, Is.Not.Null);
            Assert.That(newApp.Rule.Then.Type, Is.EqualTo(ThenType.Http));
            var http = newApp.Rule.Then as ThenHttp;

            Assert.That(http != null);
            var bearerTokenAuthentication = http.Authentication as BearerTokenAuthentication;

            Assert.That(bearerTokenAuthentication != null);
            Assert.That(bearerTokenAuthentication.Token, Is.EqualTo("token"));
        }
Example #9
0
        public void CanProduceHttp()
        {
            var app = new App
            {
                Rule = new Rule
                {
                    Title = "title",
                    Query = "*",
                    Then  = new ThenHttp("http://localhost")
                    {
                        Method      = "POST",
                        ContentType = "application/json",
                        Body        = "{}"
                    }
                }
            };

            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp, Is.Not.Null);
            Assert.That(newApp.Rule, Is.Not.Null);
            Assert.That(newApp.Rule.Then, Is.Not.Null);
            Assert.That(newApp.Rule.Then.Type, Is.EqualTo(ThenType.Http));
            var http = newApp.Rule.Then as ThenHttp;

            Assert.That(http != null);
            Assert.That(http.Url, Is.EqualTo(new Uri("http://localhost")));
            Assert.That(http.Method, Is.EqualTo("POST"));
            Assert.That(http.ContentType, Is.EqualTo("application/json"));
            Assert.That(http.Body, Is.EqualTo("{}"));
        }
Example #10
0
        public async Task <ChunkManifest> GetChunkManifestAsync(AppManifest manifest)
        {
            var item     = manifest.Items["MANIFEST"];
            var request  = new RestRequest($"{item.Distribution}{item.Path}?{item.Signature}");
            var response = await FortniteApi.DefaultRestClient.HandleRequest <ChunkManifest>(request);

            return(response);
        }
Example #11
0
 public LaunchPageModel(AppManifest manifest)
 {
     if (manifest == null)
     {
         manifest = new AppManifest();
     }
     Manifest = manifest;
 }
Example #12
0
 public LaunchPageModel(AppManifest manifest, ExtendedAppInfo appinfo) : this(manifest)
 {
     if (appinfo == null)
     {
         appinfo = new ExtendedAppInfo();
     }
     AppInfo = appinfo;
 }
Example #13
0
        /// <summary>
        /// Creates or updates the Experience App manifest file. This file is required for the app to build correctly.
        /// </summary>
        public static void CreateAppManifest(int id = 999, int version = 1)
        {
            var manifest = new AppManifest(id, version);

            var json = JsonConvert.SerializeObject(manifest, Formatting.Indented);

            File.WriteAllText(AppManifest.Path, json);
            AssetDatabase.Refresh();
        }
 /// <inheritdoc/>
 public Task <Permissions> PromptForPermissions(
     Uri appLocation,
     IEnumerable <Permissions> permissionsNeeded,
     IEnumerable <Permissions> permissionsWanted,
     Permissions permissionFlagsNeeded,
     Permissions permissionFlagsWanted,
     AppManifest appManifest)
 {
     return(Task.FromResult(GrantedPermissions));
 }
Example #15
0
        public DeploymentDialogViewModel(IServiceProvider services, string projectName, string directoryOfProjectToDeploy, string targetFrameworkMoniker)
            : base(services)
        {
            _errorDialogService  = services.GetRequiredService <IErrorDialog>();
            TasExplorerViewModel = services.GetRequiredService <ITasExplorerViewModel>();

            OutputView      = ViewLocatorService.GetViewByViewModelName(nameof(ViewModels.OutputViewModel)) as IView;
            OutputViewModel = OutputView?.ViewModel as IOutputViewModel;

            DeploymentInProgress = false;
            PathToProjectRootDir = directoryOfProjectToDeploy;
            SelectedBuildpacks   = new ObservableCollection <string>();

            if (targetFrameworkMoniker.StartsWith(FullFrameworkTFM))
            {
                _fullFrameworkDeployment = true;
            }

            CfInstanceOptions       = new List <CloudFoundryInstance>();
            CfOrgOptions            = new List <CloudFoundryOrganization>();
            CfSpaceOptions          = new List <CloudFoundrySpace>();
            BuildpackOptions        = new List <BuildpackListItem>();
            StackOptions            = new List <string>();
            DeploymentDirectoryPath = null;

            ManifestModel = new AppManifest
            {
                Version      = 1,
                Applications = new List <AppConfig>
                {
                    new AppConfig
                    {
                        Name       = projectName,
                        Buildpacks = new List <string>(),
                    }
                }
            };

            SetManifestIfDefaultExists();

            if (TasExplorerViewModel.TasConnection != null)
            {
                TargetName = TasExplorerViewModel.TasConnection.DisplayText;
                IsLoggedIn = true;

                ThreadingService.StartTask(UpdateCfOrgOptions);
                ThreadingService.StartTask(UpdateBuildpackOptions);
                ThreadingService.StartTask(UpdateStackOptions);
            }

            _projectName = projectName;

            Expanded = false;
        }
Example #16
0
 public string GetInstallDir()
 {
     if ((AppConfig != null) && AppConfig.ContainsKey("installdir"))
     {
         return(AppConfig["installdir"].AsString());
     }
     try {
         return(AppManifest?.GetKeyValue("installdir").AsString());
     } catch (KeyNotFoundException ex) {
         if (Common.Flags.Verbose)
         {
             MainLog.Logger.FormattedWarnException(ex, "AppManifest Invalid ({0})".FormatWith(AppId));
         }
     }
     return(null);
 }
Example #17
0
        public static RegistrationState GetNativeMessagingState()
        {
            if (!File.Exists(Instance.ManifestPath))
            {
                return(RegistrationState.Unregistered);
            }

            var manifest = AppManifest.FromJson(File.ReadAllText(Instance.ManifestPath));

            if (manifest?.Path != PathToExecutable)
            {
                return(RegistrationState.RegisteredDifferentHandler);
            }

            return(RegistrationState.Registered);
        }
Example #18
0
        public void CanProduceVariables()
        {
            var app = new App
            {
                Variables = new List <IVariable>
                {
                    new TextVariable {
                        Key = "astring", Name = "A string", Example = "Some string", Description = "description", Required = true
                    },
                    new TextVariable {
                        Key = "anotherstring", Name = "Another string", Example = "Some string", Description = "description", Required = false
                    },
                    new TextVariable {
                        Key = "asimplestring"
                    },
                    new HiddenVariable {
                        Key = "ahiddenstring"
                    },
                    new ChoiceVariable {
                        Key = "aselect", Name = "A select", Values = new [] { "One", "Two", "Three" }
                    },
                    new NumberVariable {
                        Key = "anumber", Name = "A number"
                    },
                    new BoolVariable {
                        Key = "acheckbox", Name = "A checkbox", Default = true
                    },
                    new PasswordVariable {
                        Key = "apassword", Name = "A password", Example = "Some password", Required = true
                    }
                },
            };

            var produce = AppManifest.Produce(app);
            var newApp  = AppManifest.Parse(produce);

            Assert.That(newApp, Is.Not.Null);
            Assert.That(newApp.Variables.Count, Is.EqualTo(8));
            Assert.That(VariablePresent(newApp.Variables, "astring", VariableType.Text, true));
            Assert.That(VariablePresent(newApp.Variables, "anotherstring", VariableType.Text, false));
            Assert.That(VariablePresent(newApp.Variables, "asimplestring", VariableType.Text, false));
            Assert.That(VariablePresent(newApp.Variables, "ahiddenstring", VariableType.Hidden, false));
            Assert.That(VariablePresent(newApp.Variables, "aselect", VariableType.Choice, false));
            Assert.That(VariablePresent(newApp.Variables, "anumber", VariableType.Number, false));
            Assert.That(VariablePresent(newApp.Variables, "acheckbox", VariableType.Bool, false));
            Assert.That(VariablePresent(newApp.Variables, "apassword", VariableType.Password, true));
        }
Example #19
0
        /// <summary>
        /// Start a new application using package name
        /// </summary>
        /// <param name="packageName">Package name</param>
        /// <returns></returns>
        public ApplicationProcess StartApplication(string packageName)
        {
            try
            {
                AppManifest app = PackageManager.GetInstance().GetPackage(packageName);

                if (app == null)
                {
                    throw new LauncherException($"Failed to start application '{packageName}'. Application not found");
                }

                return(StartApplication(app));
            } catch (Exception ex)
            {
                throw new LauncherException($"Failed to start application '{packageName}'. {ex.Message}");
            }
        }
Example #20
0
        private AppManifest CreateFromDeployManifest(AppManifest manifest = null)
        {
            manifest = manifest ?? new AppManifest();
            var xdoc   = XDocument.Load(ApplicationManifestLocation);
            var descEl = xdoc.XPathSelectElement("//*[local-name()='description']");

            manifest.ApplicationName = descEl.FindAttribute("product");
            manifest.PublisherName   = descEl.FindAttribute("publisher");
            manifest.SuiteName       = descEl.FindAttribute("suiteName");
            var identEl = xdoc.XPathSelectElement("//*[local-name()='assemblyIdentity']");

            manifest.AppVersion = new Version(identEl.FindAttribute("version"));
            manifest.ShortName  = identEl.FindAttribute("name").Split('.').First();
            var frameworksRoot = xdoc.XPathSelectElement("//*[local-name()='compatibleFrameworks']");

            manifest.FrameworkVersion = new Version(frameworksRoot.Elements().OrderByDescending(x => x.FindAttribute("targetVersion")).First().FindAttribute("targetVersion"));
            return(manifest);
        }
Example #21
0
        public void CanProduceAppWithBoolVariable()
        {
            var app = new App
            {
                Variables = new List <IVariable>
                {
                    new BoolVariable {
                        Key = "mybool", Default = true
                    }
                }
            };
            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp != null);
            Assert.That(newApp.Variables != null);
            Assert.That(newApp.Variables.Count, Is.EqualTo(1));
            Assert.That(newApp.Variables.First() is BoolVariable);
            Assert.That((newApp.Variables.First() as BoolVariable).Default, Is.EqualTo(true));
        }
Example #22
0
        public void CanProduceAppWithNumberVariable()
        {
            var app = new App
            {
                Variables = new List <IVariable>
                {
                    new NumberVariable {
                        Key = "myselect", Default = 42
                    }
                }
            };
            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp != null);
            Assert.That(newApp.Variables != null);
            Assert.That(newApp.Variables.Count, Is.EqualTo(1));
            Assert.That(newApp.Variables.First() is NumberVariable);
            Assert.That((newApp.Variables.First() as NumberVariable).Default, Is.EqualTo(42));
        }
Example #23
0
        public void CanProduceAppWithChoice()
        {
            var app = new App
            {
                Variables = new List <IVariable>
                {
                    new ChoiceVariable {
                        Key = "myselect", Values = new[] { "One", "Two", "three" }
                    }
                }
            };
            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp != null);
            Assert.That(newApp.Variables != null);
            Assert.That(newApp.Variables.Count, Is.EqualTo(1));
            Assert.That(newApp.Variables.First() is ChoiceVariable);
            Assert.That((newApp.Variables.First() as ChoiceVariable).Values.Length, Is.EqualTo(3));
        }
Example #24
0
        private AppManifest CreateFromAssemblyInfo(AppManifest manifest = null)
        {
            manifest = manifest ?? new AppManifest();
            var projectFolder = new FileInfo(ProjectFilePath).Directory;
            var infoFilePath  = Path.Combine(projectFolder.FullName, "Properties", "AssemblyInfo.cs");

            if (File.Exists(infoFilePath))
            {
                var props = File.ReadAllLines(infoFilePath).Where(l => l.StartsWith("[assembly: ")).ToList();
                manifest.ApplicationName = props.Property("AssemblyTitle");
                manifest.Description     = props.Property("AssemblyDescription");
                manifest.PublisherName   = props.Property("AssemblyCompany");
                manifest.SuiteName       = props.Property("AssemblyProduct");
                manifest.Copyright       = props.Property("Copyright");
                manifest.AppVersion      = new Version(props.Property("Version"));
                return(manifest);
            }
            return(null);
        }
Example #25
0
 void SetAppPath()
 {
     if (AppConfig != null && AppConfig.ContainsKey("installdir"))
     {
         AppPath =
             InstallBase.GetChildDirectoryWithName(@"SteamApps\Common\" +
                                                   AppConfig.GetString("installdir"));
     }
     else if (AppManifest != null)
     {
         try {
             AppPath =
                 InstallBase.GetChildDirectoryWithName(@"SteamApps\Common\" +
                                                       AppManifest.GetString(new[] { "AppState", "installdir" }));
         } catch (KeyNotFoundException ex) {
             MainLog.Logger.FormattedWarnException(ex, "AppManifest Invalid ({0})".FormatWith(AppId));
         }
     }
 }
Example #26
0
        private void UpdateApplicationManifest()
        {
            // Define the parameters passed to the task.
            string targetDir    = this.Context.Parameters["targetDir"];
            string documentName = this.Context.Parameters["documentName"];
            string assemblyName = this.Context.Parameters["assemblyName"];

            if (String.IsNullOrEmpty(targetDir))
            {
                throw new InstallException("Cannot update the application manifest. The specified target directory name is not valid.");
            }
            if (String.IsNullOrEmpty(documentName))
            {
                throw new InstallException("Cannot update the application manifest. The specified document name is not valid.");
            }
            if (String.IsNullOrEmpty(assemblyName))
            {
                throw new InstallException("Cannot update the application manifest. The specified assembly name is not valid.");
            }

            // Get the application manifest from the document.
            string         documentPath   = Path.Combine(targetDir, documentName);
            ServerDocument serverDocument = new ServerDocument(documentPath, FileAccess.ReadWrite);

            try
            {
                AppManifest appManifest = serverDocument.AppManifest;

                string assemblyPath = Path.Combine(targetDir, assemblyName);
                appManifest.Dependency.AssemblyPath = assemblyPath;

                serverDocument.Save();
            }
            finally
            {
                if (serverDocument != null)
                {
                    serverDocument.Close();
                }
            }
        }
Example #27
0
        public void CanProduceHide()
        {
            var app = new App
            {
                Rule = new Rule
                {
                    Title = "title",
                    Query = "*",
                    Then  = new ThenHide()
                }
            };

            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp, Is.Not.Null);
            Assert.That(newApp.Rule, Is.Not.Null);
            Assert.That(newApp.Rule.Then, Is.Not.Null);
            Assert.That(newApp.Rule.Then.Type, Is.EqualTo(ThenType.Hide));
            var http = newApp.Rule.Then as ThenHide;

            Assert.That(http != null);
        }
Example #28
0
        public void CanProduceEmail()
        {
            var app = new App
            {
                Rule = new Rule
                {
                    Title = "title",
                    Query = "*",
                    Then  = new ThenEmail("*****@*****.**")
                }
            };

            var newApp = AppManifest.Parse(AppManifest.Produce(app));

            Assert.That(newApp, Is.Not.Null);
            Assert.That(newApp.Rule, Is.Not.Null);
            Assert.That(newApp.Rule.Then, Is.Not.Null);
            Assert.That(newApp.Rule.Then.Type, Is.EqualTo(ThenType.Email));
            var http = newApp.Rule.Then as ThenEmail;

            Assert.That(http != null);
            Assert.That(http.Email, Is.EqualTo("*****@*****.**"));
        }
Example #29
0
            public PluginGridRow(string url)
            {
                Title    = "讀取中...";
                Url      = url;
                UrlShort = Program.TrimModuleServerUrl(url);

                Task task = Task.Factory.StartNew(() =>
                {
                    Manifest = new AppManifest();
                    Manifest.Load(url);
                }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default);

                task.ContinueWith(x =>
                {
                    if (x.Exception != null)
                    {
                        Title = "讀取錯誤!";
                    }
                    else
                    {
                        Title = Manifest.Title;
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
Example #30
0
            public PluginGridRow(string url)
            {
                Title = "讀取中...";
                Url = url;
                UrlShort = Program.TrimModuleServerUrl(url);

                Task task = Task.Factory.StartNew(() =>
                {
                    Manifest = new AppManifest();
                    Manifest.Load(url);
                }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default);

                task.ContinueWith(x =>
                {
                    if (x.Exception != null)
                        Title = "讀取錯誤!";
                    else
                        Title = Manifest.Title;
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
Example #31
0
 public AppManifestPair(AppManifest local, AppManifest remote)
 {
     Local  = local;
     Remote = remote;
 }
Example #32
0
        public void Push(string name, string deployFQDN, ushort instances,
                         DirectoryInfo path, uint memoryMB, string[] provisionedServiceNames)
        {
            if (path == null)
            {
                throw new ArgumentException("Application local location is needed");
            }

            if (deployFQDN == null)
            {
                throw new ArgumentException("Please specify the url to deploy as.");
            }

            DetetectedFramework framework = FrameworkDetetctor.Detect(path);
            if (framework == null)
            {
                throw new InvalidOperationException("Please specify application framework");
            }
            else
            {
                if (AppExists(name))
                {
                    throw new VcapException(String.Format(Resources.AppsHelper_PushApplicationExists_Fmt, name));
                }
                else
                {
                    /*
                     * Before creating the app, ensure we can build resource list
                     */
                    var resources = new List<Resource>();
                    AddDirectoryToResources(resources, path, path.FullName);

                    var manifest = new AppManifest
                                       {
                                           Name = name,
                                           Staging =
                                               new Staging
                                                   {Framework = framework.Framework, Runtime = framework.Runtime},
                                           Uris = new[] {deployFQDN},
                                           Instances = instances,
                                           Resources = new AppResources {Memory = memoryMB},
                                       };

                    VcapJsonRequest r = BuildVcapJsonRequest(Method.POST, Constants.AppsResource);
                    r.AddBody(manifest);
                    r.Execute();

                    UploadAppBits(name, path);

                    Application app = GetApplication(name);
                    app.Start();
                    r = BuildVcapJsonRequest(Method.PUT, Constants.AppsResource, name);
                    r.AddBody(app);
                    r.Execute();

                    bool started = IsStarted(app.Name);

                    if (started && !provisionedServiceNames.IsNullOrEmpty())
                    {
                        foreach (string serviceName in provisionedServiceNames)
                        {
                            var servicesHelper = new ServicesHelper(proxyUser, credentialManager);
                            servicesHelper.BindService(serviceName, app.Name);
                        }
                    }
                }
            }
        }
Example #33
0
        public VcapClientResult Push(string name, string deployFQDN, ushort instances,
            DirectoryInfo path, uint memoryMB, string[] provisionedServiceNames, string framework, string runtime)
        {
            VcapClientResult rv;

            if (path == null)
            {
                rv = new VcapClientResult(false, "Application local location is needed");
            }
            else if (deployFQDN == null)
            {
                rv = new VcapClientResult(false, "Please specify the url to deploy as.");
            }
            else if (framework == null)
            {
                rv = new VcapClientResult(false, "Please specify application framework");
            }
            else
            {
                if (AppExists(name))
                {
                    rv = new VcapClientResult(false, String.Format(Resources.AppsHelper_PushApplicationExists_Fmt, name));
                }
                else
                {
                    /*
                     * Before creating the app, ensure we can build resource list
                     */
                    var resources = new List<Resource>();
                    ulong totalSize = addDirectoryToResources(resources, path, path.FullName);

                    var manifest = new AppManifest
                    {
                        Name = name,
                        Staging = new Staging { Framework = framework, Runtime = runtime },
                        Uris = new string[] { deployFQDN },
                        Instances = instances,
                        Resources = new AppResources { Memory = memoryMB },
                    };

                    var r = new VcapJsonRequest(credMgr, Method.POST, Constants.APPS_PATH);
                    r.AddBody(manifest);
                    RestResponse response = r.Execute();

                    uploadAppBits(name, path);

                    Application app = GetApplication(name);
                    app.Start();
                    r = new VcapJsonRequest(credMgr, Method.PUT, Constants.APPS_PATH, name);
                    r.AddBody(app);
                    response = r.Execute();

                    bool started = isStarted(app.Name);

                    if (started && false == provisionedServiceNames.IsNullOrEmpty())
                    {
                        foreach (string svcName in provisionedServiceNames)
                        {
                            var servicesHelper = new ServicesHelper(credMgr);
                            servicesHelper.BindService(svcName, app.Name);
                        }
                    }

                    rv = new VcapClientResult(started);
                }
            }

            return rv;
        }