public ProcessStartInfo TryPerformOutOfBrowserDeployment(IProject startupProject, DocumentReference serverRoot, Uri baseWebServerUri, out bool shouldStartServer)
        {
            ProcessStartInfo processStartInfo = (ProcessStartInfo)null;

            shouldStartServer = false;
            DocumentReference xapDeploymentDirectory = (DocumentReference)null;
            IProject          xapSourceProject       = this.FindXapSourceProject(startupProject, out xapDeploymentDirectory);

            if (xapDeploymentDirectory != (DocumentReference)null && this.SupportsOutOfBrowserDeployment(xapSourceProject))
            {
                DocumentReference documentReference = this.DetermineLauncherLocation();
                if (documentReference != (DocumentReference)null)
                {
                    DocumentReference fromRelativePath           = DocumentReference.CreateFromRelativePath(xapDeploymentDirectory.Path, PathHelper.GetFileOrDirectoryName(xapSourceProject.FullTargetPath));
                    Uri               ofBrowserQueryUri          = this.CreateOutOfBrowserQueryUri(baseWebServerUri, serverRoot, fromRelativePath);
                    string            applicationIdentifier      = (string)null;
                    DocumentReference privateDeploymentDirectory = this.DetermineOutOfBrowserPrivateLocation(xapSourceProject, ofBrowserQueryUri, out applicationIdentifier);
                    processStartInfo = new ProcessStartInfo(documentReference.Path);
                    if (string.IsNullOrEmpty(applicationIdentifier))
                    {
                        Uri uri = new Uri(fromRelativePath.Path, UriKind.Absolute);
                        processStartInfo.Arguments = "/emulate:\"" + (object)fromRelativePath + "\" /origin:\"" + (string)(object)uri + "\"";
                        shouldStartServer          = false;
                    }
                    else if (this.AttemptToCopyToOutOfBrowserPrivateLocation(fromRelativePath, privateDeploymentDirectory))
                    {
                        processStartInfo.Arguments = applicationIdentifier;
                        shouldStartServer          = true;
                    }
                    processStartInfo.UseShellExecute       = false;
                    processStartInfo.RedirectStandardError = true;
                }
            }
            return(processStartInfo);
        }
        private DocumentReference DetermineLauncherLocation()
        {
            DocumentReference fromRelativePath = DocumentReference.CreateFromRelativePath(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Microsoft Silverlight\\sllauncher.exe");

            if (PathHelper.FileOrDirectoryExists(fromRelativePath.Path))
            {
                return(fromRelativePath);
            }
            return((DocumentReference)null);
        }
예제 #3
0
        public static DocumentReference CreateDeepZoomDirectoryReference(DocumentReference deepZoomPath, string directoryExtension)
        {
            if (deepZoomPath == null)
            {
                throw new ArgumentNullException("deepZoomPath");
            }
            if (string.IsNullOrEmpty(directoryExtension))
            {
                throw new ArgumentNullException("directoryExtension");
            }
            string directoryNameOrRoot      = Microsoft.Expression.Framework.Documents.PathHelper.GetDirectoryNameOrRoot(deepZoomPath.Path);
            string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(deepZoomPath.Path);

            return(DocumentReference.CreateFromRelativePath(directoryNameOrRoot, Microsoft.Expression.Framework.Documents.PathHelper.EnsurePathEndsInDirectorySeparator(string.Concat(fileNameWithoutExtension, directoryExtension))));
        }