Пример #1
0
        public static OutputQueue CopyApplicationBinContent(int timeOut)
        {
            var output = new OutputQueue();

            Parallel.ForEach(LocalFarm.Get().Servers.Where(p => Server.ValidSPServerRole(p.Role)),
                             server =>
            {
                if (SPWebService.ContentService.Instances.Any(p => p.Server.Id == server.Id) || SPWebService.AdministrationService.Instances.Any(p => p.Server.Id == server.Id))
                {
                    var command = string.Format(CultureInfo.InvariantCulture, @"{0} -o copyappbincontent", SPUtility.GetGenericSetupPath(@"bin\stsadm.exe"));

                    output.Add(string.Format(CultureInfo.CurrentUICulture, UserDisplay.RunningCommandOn, command, server.Address));

                    try
                    {
                        var processWMI = new Threading.ProcessWMI();
                        processWMI.ExecuteRemoteProcessWMI(server.Address, command, timeOut);
                    }
                    catch (Exception exception)
                    {
                        output.Add(string.Format(CultureInfo.CurrentUICulture, Exceptions.ExceptionRunningCommandOn, command, server.Address, exception.Message), OutputType.Error, exception.ToString(), exception);
                    }
                }
            });

            return(output);
        }
Пример #2
0
        public OutputQueue Run()
        {
            var output = new OutputQueue();

            this.Status = TaskStatus.InProgress;

            try
            {
                output.Add(NewsGator.Install.Resources.Tasks.TaskDetails_ExecuteTimerServiceJob);

                var cmdOutput = Utilities.Runspace.RunInPowerShell(string.Format(CultureInfo.InvariantCulture, "[Newsgator.Install.Common.Utilities.Jobs]::ExecuteInstallerJob(\"{0}\", {1})", JobName, this.Timeout.ToString(CultureInfo.InvariantCulture)));

                if (cmdOutput.Items.Any(p => p.Type == OutputType.Error))
                {
                    this.Status = TaskStatus.CompleteFailed;
                }
                else
                {
                    this.Status = TaskStatus.CompleteSuccess;
                }

                output.Add(cmdOutput);
                output.Add(NewsGator.Install.Resources.Tasks.TaskDetails_ExecuteTimerServiceJobComplete);
            }
            catch (Exception exception)
            {
                output.Add(string.Format(CultureInfo.CurrentUICulture, NewsGator.Install.Resources.Exceptions.ExecuteTimerRecycleJobException, exception.Message), OutputType.Error, exception.ToString(), exception);
                this.Status = TaskStatus.CompleteFailed;
            }

            return(output);
        }
Пример #3
0
        public override void ProcessData()
        {
            while (!ReadedQueue.Completed() && !ForceStopped)
            {
                var bytesBlock = ReadedQueue.Pop();
                if (bytesBlock == null)
                {
                    continue;
                }

                using (var memoryStream = new MemoryStream(bytesBlock.BytesArray))
                {
                    using (var gZipStream = new GZipStream(memoryStream, CompressionMode))
                    {
                        var tempBytesArray   = new byte[BlockProcessingLength];
                        var readedBytesCount = gZipStream.Read(tempBytesArray, 0, tempBytesArray.Length);

                        var bytesArray = new byte[readedBytesCount];
                        Buffer.BlockCopy(tempBytesArray, 0, bytesArray, 0, readedBytesCount);

                        OutputQueue.Push(new BytesBlock(bytesBlock.OrderNum, bytesArray));
                    }
                }
            }
        }
Пример #4
0
        private void OutputDelegate(long value)
        {
            OutputQueue.Enqueue(value);

            switch (OutputState)
            {
            case 0:
                XPos = value;
                OutputState++;
                break;

            case 1:
                YPos = value;
                OutputState++;
                break;

            case 2:
                TileID = value;
                if (GamePlayHasStarted)
                {
                    ProcessGameInstruction();
                }
                OutputState = 0;
                break;

            default:
                throw new ArgumentException("OutputState wonky");
            }
        }
        internal static OutputQueue IsLocalAdministrator(out bool isLocalAdmin)
        {
            var outputQueue = new OutputQueue();

            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisite, UserDisplay.PrerequisiteUserIsLocalAdmin));
            try
            {
                var user = WindowsIdentity.GetCurrent();
                if (user == null)
                {
                    isLocalAdmin = false;
                    return(outputQueue);
                }
                var principle = new WindowsPrincipal(user);
                isLocalAdmin = principle.IsInRole(WindowsBuiltInRole.Administrator);
            }
            catch (Exception exception)
            {
                isLocalAdmin = false;
                outputQueue.Add(exception.Message, OutputType.Error, null, exception);
            }
            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisiteComplete, UserDisplay.PrerequisiteUserIsLocalAdmin, isLocalAdmin ? UserDisplay.CheckingPrerequisitePassed : UserDisplay.CheckingPrerequisiteFailed));

            return(outputQueue);
        }
        public OutputQueue Run()
        {
            var output = new OutputQueue();

            this.Status = TaskStatus.InProgress;

            try
            {
                output.Add(string.Format(CultureInfo.CurrentUICulture, NewsGator.Install.Resources.Tasks.TaskDetails_UpdateServiceApplication, this.ServiceApplicationTypeName));

                var command = string.Format(CultureInfo.InvariantCulture, "[Newsgator.Install.Common.Utilities.ServiceApplication]::UpdateNewsGatorServiceApplication([NewsGator.Install.Common.Entities.Flags.ServiceApplicationType]::{0}, ${1})",
                                            this.ServiceApplicationType.ToString(),
                                            this.UseTimerJob.ToString(CultureInfo.InvariantCulture));

                output.Add(Utilities.Runspace.RunInPowerShell(command));

                output.Add(string.Format(CultureInfo.CurrentUICulture, NewsGator.Install.Resources.Tasks.TaskDetails_UpdateServiceApplication_Complete, this.ServiceApplicationTypeName));
                this.Status = TaskStatus.CompleteSuccess;
            }
            catch (Exception exception)
            {
                output.Add(string.Format(CultureInfo.CurrentUICulture, NewsGator.Install.Resources.Exceptions.UpdateServiceApplicationException, exception.Message), OutputType.Error, exception.ToString(), exception);
                this.Status = TaskStatus.CompleteFailed;
            }

            return(output);
        }
Пример #7
0
        internal static OutputQueue DisableJob(SPJobDefinition job)
        {
            var outputQueue = new OutputQueue();

            if (job == null)
            {
                return(outputQueue);
            }

            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.DisableJob, string.IsNullOrEmpty(job.DisplayName) ? job.Name : job.DisplayName));

            try
            {
                job.IsDisabled = true;
                job.Update();
            }
            catch (SPUpdatedConcurrencyException)
            { }
            catch (Exception exception)
            {
                outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, Exceptions.DisableJobsUnableToDisableError, job.DisplayName, exception.Message), OutputType.Error, null, exception);
            }

            outputQueue.Add(UserDisplay.DisableJobComplete);

            return(outputQueue);
        }
        internal static OutputQueue IsSupportedVersionOfSharePoint(out bool isSupported)
        {
            var outputQueue = new OutputQueue();

            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisite, UserDisplay.PrerequisiteSharePointVersion));
            try
            {
                isSupported = false;
                var farm = LocalFarm.Get();
                switch (farm.BuildVersion.Major)
                {
                case 14:
                    isSupported = farm.BuildVersion >= new Version(14, 0, 6029, 1000);     // SharePoint 2010 SP1
                    break;

                case 15:
                    isSupported = farm.BuildVersion >= new Version(15, 0, 4420, 1017);     // SharePoint 2013 RTM
                    break;

                case 16:
                    isSupported = farm.BuildVersion >= new Version(16, 0, 4306, 1001);     // SharePoint 2016 Beta 2, TODO: Replace with RTM
                    break;
                }
            }
            catch (Exception exception)
            {
                isSupported = false;
                outputQueue.Add(exception.Message, OutputType.Error, null, exception);
            }
            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisiteComplete, UserDisplay.PrerequisiteSharePointVersion, isSupported ? UserDisplay.CheckingPrerequisitePassed : UserDisplay.CheckingPrerequisiteFailed));
            return(outputQueue);
        }
        internal static OutputQueue IsWebApplicationStarted(out bool isRunning)
        {
            var outputQueue = new OutputQueue();

            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisite, UserDisplay.PrerequisiteWebApplicationServiceIsStarted));
            try
            {
                isRunning = false;
                var webServiceInstance = SPServer.Local.GetChild <SPWebServiceInstance>();
                if (webServiceInstance != null)
                {
                    if (webServiceInstance.Status == SPObjectStatus.Online)
                    {
                        isRunning = true;
                    }
                }
            }
            catch (Exception exception)
            {
                isRunning = false;
                outputQueue.Add(exception.Message, OutputType.Error, null, exception);
            }
            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisiteComplete, UserDisplay.PrerequisiteWebApplicationServiceIsStarted, isRunning ? UserDisplay.CheckingPrerequisitePassed : UserDisplay.CheckingPrerequisiteFailed));
            return(outputQueue);
        }
Пример #10
0
        internal static OutputQueue RemoveExistingJob(SPSolution solution)
        {
            var outputQueue = new OutputQueue();

            if (solution == null || !solution.JobExists)
            {
                return(outputQueue);
            }

            if (solution.JobStatus == SPRunningJobStatus.Initialized)
            {
                outputQueue.Add(string.Format(CultureInfo.CurrentCulture, Exceptions.DeploySolutionError, solution.Name, Exceptions.DeploySolutionJobAlreadyRunning), OutputType.Warning);
            }

            var jobs = GetSolutionJobs(solution);

            foreach (var jobid in jobs.Keys)
            {
                var jobDefinition = jobs[jobid];
                if (jobDefinition != null)
                {
                    try
                    {
                        outputQueue.Add(string.Format(CultureInfo.CurrentCulture, UserDisplay.DeploySolutionRemoveJob, jobDefinition.DisplayName, solution.Name));
                        jobDefinition.Delete();
                    }
                    catch (Exception exception)
                    {
                        outputQueue.Add(string.Format(CultureInfo.CurrentCulture, Exceptions.DeploySolutionRemoveJobFailed, jobDefinition.DisplayName, solution.Name, exception), OutputType.Warning);
                    }
                }
            }

            return(outputQueue);
        }
Пример #11
0
 private static void Initialize()
 {
     ParentServerConfig = new ParentConfig(2);
     ServerConfig       = new NetConfig();
     ServerConfig.SetMaxBackLogConnections(MAXIMUM_BACKLOG);
     ServerConfig.SetMaxConnections(MAXIMUM_CONNECTIONS);
     ServerConfig.SetMaxMessageSize(MESSAGE_SIZE);
     ServerConfig.SetBufferSize(BUFFER_SIZE);
     ServerConfig.SetHeaderSize(HEADER_SIZE);
     ServerConfig.SetEnableKeepAlive(false);
     ServerConfig.SetPort(1660);
     ParentServer = new Parent(ParentServerConfig, ServerConfig);
     ParentServer.OnParentCreatedEvent     += ParentServer_OnParentCreatedEvent;
     ParentServer.OnParentClosedEvent      += ParentServer_OnParentClosedEvent;
     ParentServer.OnExceptionEvent         += ParentServer_OnExceptionEvent;
     ParentServer.OnChildCreateEvent       += ParentServer_OnChildCreateEvent;
     ParentServer.OnChildConnectEvent      += ParentServer_OnChildConnectEvent;
     ParentServer.OnChildAuthenticateEvent += ParentServer_OnChildAuthenticateEvent;
     ParentServer.OnChildSendEvent         += ParentServer_OnChildSendEvent;
     ParentServer.OnChildReceiveEvent      += ParentServer_OnChildReceiveEvent;
     ParentServer.OnChildDisconnectEvent   += ParentServer_OnChildDisconnectEvent;
     ParentServer.OnChildDestroyEvent      += ParentServer_OnChildDestroyEvent;
     Input  = new InputQueue(ParentServer);
     Output = new OutputQueue();
     Output.OnFrameEvent += Output_OnFrameEvent;
     ParentServer.StartParent();
     PacketHandler = new PacketHandler(Input, Output, MainLogger);
     ConnectPipeline();
     Pipeline.SendMessage(new IViewNet.Common.Models.Packet(1111, "SetDetectionType", new byte[1024 * 19]));
     Console.ReadKey();
 }
Пример #12
0
        protected override void PopulateControl()
        {
            base.PopulateControl();
            this.packSellingCompany.DataSource = Common.SellingCompany.FetchAll();
            this.packType.DataSource           = Packtype.FetchAll();
            this.packOutputMethod.DataSource   = OutputQueue.FetchAll();

            //Gets merge fields list
            var mergeFields  = new List <KeyValuePair <string, byte> >();
            var packTypeList = Packtype.FetchAll();

            foreach (var packTypeObject in packTypeList)
            {
                var mergeFieldListFromView = Query.Create()
                                             .Select("COLUMN_NAME")
                                             .From(QuerySources.PackMergeFields)
                                             .WhereRaw("(TABLE_NAME = '" + packTypeObject.StoredProc + "' and COLUMN_NAME not like 'PR_ID%')", null)
                                             .OrderBy("COLUMN_NAME", true)
                                             .Run();

                foreach (var field in mergeFieldListFromView)
                {
                    mergeFields.Add(new KeyValuePair <string, byte>(field.Values.First().ToString(), packTypeObject.Type));
                }
            }

            this.AllMergeFields.DataSource = mergeFields;

            if (this.Id.FieldValue == "")
            {
                this.packRetainAttachments.FieldValue = true;
                this.DataSource.ActPqKeep             = 1;
                this.packSellingCompany.FieldValue    = this.CurrentSession.User.SellingCompanyId;
            }
            else
            {
                this.packSellingCompany.FieldValue = this.DataSource.PackSellingCompanyIdId;
                Packtype objPackType = Packtype.FetchAll().Where(s => s.Type == this.DataSource.PackType).FirstOrDefault();
                if (objPackType != null)
                {
                    this.packType.FieldValue    = objPackType.Type.ToString();
                    this.packType.DisplayMember = objPackType.Desc;
                }
                this.packType.IsReadOnly = ConfigurableBoolean.True;
                //this.packDeliveryFailure.FieldValue = false;
                //this.packDeliveryDelay.FieldValue = false;
                //this.packDeliverySuccess.FieldValue = false;

                if (!string.IsNullOrEmpty(this.DataSource.DsnOptions))
                {
                    var dsnOptions = this.DataSource.DsnOptions.Split(',');
                    foreach (string val in dsnOptions)
                    {
                        getDSNOptionsVal(val);
                    }
                }
            }
        }
Пример #13
0
            public static void SendRawMessage([NotNull] string line)
            {
                if (line == null)
                {
                    throw new ArgumentNullException("line");
                }

                OutputQueue.Enqueue(line);
            }
Пример #14
0
        private int ExecuteOutput(int[] workingSet, int position, int input)
        {
            var outputPosition = position + 1;
            var x = GetParameter(workingSet, outputPosition, GetParameterMode(input, 0));

            OutputQueue.Enqueue(x);
            OutputProduced?.Invoke(this, new OutputProducedEventArgs(x));
            return(position + 2);
        }
Пример #15
0
        internal virtual OutputQueue[] BuildOutputQueues()
        {
            long queueCount = GetBlockCount();

            OutputQueue[] queues   = new OutputQueue[queueCount];
            long          capacity = GetQueueCapacity(queueCount + 1);

            queues.Initialize(() => new OutputQueue(capacity));
            return(queues);
        }
Пример #16
0
        void Start()
        {
            this.inputQueue    = GameObject.Find("InputQueue").GetComponent <InputQueue>();
            this.outputQueue   = GameObject.Find("OutputQueue").GetComponent <OutputQueue>();
            this.startPosition = transform.position;
            this.newLocation   = new Dictionary <string, Vector3>();
            this.anim          = GetComponent <Animator>();
            this.path          = new List <string>();
            this.callbacks     = new List <ICommand>();

            FillLocation();
        }
Пример #17
0
    public void Play()
    {
        /*
         * main scene
         */
        SceneManager.LoadScene(1);

        /*
         * send message to python
         */
        OutputQueue.connect();
    }
        /// <summary>
        /// Создает очередь для отправки сообщений
        /// </summary>
        /// <param name="queueConfig">Параметры создания очереди</param>
        /// <returns>True, если очередь была создана, false если возвращена уже существующая очередь</returns>
        public IOutputQueue GetOrAddOutputQueue(QueueConfig queueConfig)
        {
            if (!this.OutputQueues.TryGetValue(queueConfig.Name, out var outputQueue))
            {
                outputQueue = new OutputQueue();
                outputQueue.Init(this, queueConfig);

                this.outputQueues.Add(queueConfig.Name, outputQueue);
            }

            return(outputQueue);
        }
Пример #19
0
        internal virtual void FillOutputQueue(OutputQueue queue, DataBlockDescriptor blockDescriptor)
        {
            if (blockDescriptor.AvailableSize == 0)
            {
                return;
            }
            long itemCount = Math.Min(queue.Capacity, blockDescriptor.AvailableSize);

            T[] data = Owner.TemporaryFile.ReadBlock(blockDescriptor.CursorPosition, itemCount);
            blockDescriptor.IncrementCursor(itemCount);
            queue.Fill(data);
        }
Пример #20
0
        private static OutputQueue ExecuteRecycleTimerJob(int timeout)
        {
            var output = new OutputQueue();

            try
            {
                var timerService = LocalFarm.Get().Services.Where(p => p is SPTimerService).First() as SPTimerService;
                var job          = timerService.JobDefinitions.Where(p => (p.Name.IndexOf(RecycleJobName, StringComparison.OrdinalIgnoreCase) > -1)).First();

                var lastRun = job.LastRunTime;
                job.RunNow();

                Func <bool> wait = () =>
                {
                    var complete = false;
                    while (!complete)
                    {
                        try
                        {
                            var waitTimerService = LocalFarm.Get().Services.Where(p => p is SPTimerService).First() as SPTimerService;
                            var waitJob          = waitTimerService.JobDefinitions.Where(p => (p.Name.IndexOf(RecycleJobName, StringComparison.OrdinalIgnoreCase) > -1)).First();

                            if (waitJob.LastRunTime > lastRun)
                            {
                                complete = true;
                            }

                            if (!complete)
                            {
                                Thread.Sleep(10000);
                            }
                        }
                        catch { }
                    }

                    return(complete);
                };

                var success = Threading.WaitFor <bool> .Run(TimeSpan.FromMilliseconds(timeout / 2), wait);

                if (!success)
                {
                    throw new System.TimeoutException();
                }
            }
            catch (Exception exception)
            {
                output.Add(string.Format(CultureInfo.CurrentUICulture, NewsGator.Install.Resources.Exceptions.TimerJobException, exception.Message), OutputType.Error, exception.ToString(), exception);
            }

            return(output);
        }
Пример #21
0
    private IEnumerator SpawnWave()
    {
        LevelManager.Instance.GeneratePath();

        // current wave functionality: number of monsters to spawn is equal to the wave number per wave
        for (int i = 0; i < wave; i++)
        {
            int monsterIndex = Random.Range(0, numMonsters);

            string type = string.Empty;

            switch (monsterIndex)
            {
            case 0:
                type = "BlueMonster";
                break;

            case 1:
                type = "RedMonster";
                break;

            case 2:
                type = "GreenMonster";
                break;

            case 3:
                type = "PurpleMonster";
                break;
            }

            /*
             * create monster
             */
            Monster monster = Pool.GetObject(type).GetComponent <Monster>();

            monster.Spawn(monsterHealth);

            /*
             * send path of monster
             */
            OutputQueue.sendData();

            if (wave % 3 == 0)
            {
                monsterHealth += 5;
            }

            activeMonsters.Add(monster);

            yield return(new WaitForSeconds(spawnWait));
        }
    }
Пример #22
0
        internal static OutputQueue GetAssemblies(out Assembly[] assemblies)
        {
            var output             = new OutputQueue();
            var assembliesToOutput = new Collection <Assembly>();

            try
            {
                var windir = Environment.GetEnvironmentVariable("SystemRoot");

                foreach (var gacLocation in GacDirectories)
                {
                    var gacPath = string.Format(CultureInfo.InvariantCulture, gacLocation, windir);
                    if (Directory.Exists(gacPath))
                    {
                        foreach (var prefix in AssemblyPrefixes)
                        {
                            var assemblyDirectories = Directory.GetDirectories(gacPath, prefix);
                            foreach (var assemblyDirectory in assemblyDirectories)
                            {
                                var versionDirectories = Directory.GetDirectories(assemblyDirectory);
                                foreach (var versionDirectory in versionDirectories)
                                {
                                    var assemblyFiles = Directory.GetFiles(versionDirectory, "*.dll");
                                    foreach (var assemblyFile in assemblyFiles)
                                    {
                                        if (File.Exists(assemblyFile))
                                        {
                                            try
                                            {
                                                assembliesToOutput.Add(Assembly.ReflectionOnlyLoadFrom(assemblyFile));
                                            }
                                            catch (Exception exception)
                                            {
                                                output.Add(exception.Message, OutputType.Error, exception.ToString(), exception);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                output.Add(exception.Message, OutputType.Error, exception.ToString(), exception);
            }

            assemblies = assembliesToOutput.ToArray();
            return(output);
        }
Пример #23
0
        internal static OutputQueue DisableServiceJobs(SPServiceApplication serviceApp)
        {
            var outputQueue = new OutputQueue();
            var app         = serviceApp as SPIisWebServiceApplication;

            if (app != null)
            {
                if (app.Service != null)
                {
                    outputQueue.Add(DisableJobs(app.Service));
                }
            }

            return(outputQueue);
        }
        public OutputQueue Run()
        {
            var output = new OutputQueue();

            this.Status = TaskStatus.InProgress;

            try
            {
                output.Add(string.Format(CultureInfo.CurrentUICulture, NewsGator.Install.Resources.Tasks.TaskDetails_ProvisionServiceApplication, this.ServiceApplicationTypeName));

                var command = string.Format(CultureInfo.InvariantCulture, "[Newsgator.Install.Common.Utilities.ServiceApplication]::ProvisionNewsGatorServiceApplication([NewsGator.Install.Common.Entities.Flags.ServiceApplicationType]::{0}, \"{1}\", \"{2}\", \"{3}\", \"{4}\", \"{5}\", \"{6}\", \"{7}\", \"{8}\", \"{9}\", \"{10}\", \"{11}\", \"{12}\", \"{13}\", \"{14}\", \"{15}\", \"{16}\", \"{17}\", \"{18}\", \"{19}\", \"{20}\", \"{21}\", ${22})",
                                            this.ServiceApplicationType.ToString(),
                                            this.DatabaseName,
                                            this.DatabaseServer,
                                            this.DatabaseFailoverServer,
                                            this.ReportDatabaseName,
                                            this.ReportDatabaseServer,
                                            this.ReportDatabaseFailoverServer,
                                            this.ApplicationPoolName,
                                            this.ApplicationPoolUsername,
                                            this.ApplicationPoolPassword,
                                            this.LicenseKey,
                                            this.EmailListLocation,
                                            this.VideoEncodingInputFolder,
                                            this.VideoEncodingOutputFolder,
                                            this.VideoStreamingServerFolder,
                                            this.VideoUploadFolder,
                                            this.VideoStreamingServerUrlDefaultZone,
                                            this.VideoStreamingServerUrlIntranetZone,
                                            this.VideoStreamingServerUrlInternetZone,
                                            this.VideoStreamingServerUrlCustomZone,
                                            this.VideoStreamingServerUrlExtranetZone,
                                            this.LearningGlobalKnowledgeBase,
                                            this.UseTimerJob.ToString(CultureInfo.InvariantCulture));

                output.Add(Utilities.Runspace.RunInPowerShell(command));

                output.Add(string.Format(CultureInfo.CurrentUICulture, NewsGator.Install.Resources.Tasks.TaskDetails_ProvisionServiceApplication_Complete, this.ServiceApplicationTypeName));
                this.Status = TaskStatus.CompleteSuccess;
            }
            catch (Exception exception)
            {
                output.Add(string.Format(CultureInfo.CurrentUICulture, NewsGator.Install.Resources.Exceptions.ProvisionServiceApplicationException, exception.Message), OutputType.Error, exception.ToString(), exception);
                this.Status = TaskStatus.CompleteFailed;
            }

            return(output);
        }
Пример #25
0
        public async Task Pipeline_Execute_ShouldEnqeueForSecondStatepForTwoInstruction()
        {
            var pem = GetMessage();

            pem.Instructions.Add(new PipelineExecutionInstruction()
            {
                Name    = "Second Step",
                QueueId = "MODULE2",
                Type    = "ANOTHEREQUEUE"
            });

            await ProcessMessageAsync(pem);

            Assert.AreEqual(StatusTypes.PendingExecution, pem.Status);
            Assert.IsTrue(OutputQueue.ContainsMessage(pem.Id));
        }
Пример #26
0
        internal static OutputQueue RepairAssemblies(string literalPath)
        {
            var output = new OutputQueue();

            try
            {
                var           tempPath  = Path.Combine(literalPath, "temp");
                DirectoryInfo directory = null;
                if (!Directory.Exists(tempPath))
                {
                    Directory.CreateDirectory(tempPath);
                }
                directory = new DirectoryInfo(tempPath);

                var command = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\expand.exe";
                var wsps    = Directory.GetFiles(literalPath, "*.wsp");
                foreach (var wsp in wsps)
                {
                    var args = "\"" + wsp + "\" -f:*.dll \"" + tempPath + "\"";
                    output.Add(Files.RunCommand(command, args));
                }

                var publish    = new Publish();
                var assemblies = directory.GetFiles("*.dll");
                foreach (var assembly in assemblies)
                {
                    try
                    {
                        output.Add(string.Format(CultureInfo.InvariantCulture, "Adding \"{0}\" to the Global Assembly Cache.", assembly.Name));
                        publish.GacInstall(assembly.FullName);
                    }
                    catch (Exception exception)
                    {
                        output.Add(exception.Message, OutputType.Error, exception.ToString(), exception);
                    }
                }

                directory.Delete(true);
            }
            catch (Exception exception)
            {
                output.Add(exception.Message, OutputType.Error, exception.ToString(), exception);
            }

            return(output);
        }
Пример #27
0
        internal static OutputQueue IsUserProfileServiceApplicationInvokable(out bool isInvokable)
        {
            var outputQueue = new OutputQueue();

            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisite, UserDisplay.PrerequisiteUserProfileAccess));
            try
            {
                outputQueue.Add(UserProfileService.UserHasAccess(out isInvokable));
            }
            catch (Exception exception)
            {
                isInvokable = false;
                outputQueue.Add(exception.Message, OutputType.Error, null, exception);
            }
            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisiteComplete, UserDisplay.PrerequisiteUserProfileAccess, isInvokable ? UserDisplay.CheckingPrerequisitePassed : UserDisplay.CheckingPrerequisiteFailed));
            return(outputQueue);
        }
Пример #28
0
        internal static OutputQueue IsFarmAdministrator(out bool isFarmAdmin)
        {
            var outputQueue = new OutputQueue();

            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisite, UserDisplay.PrerequisiteUserIsFarmAdmin));
            try
            {
                isFarmAdmin = LocalFarm.Get().CurrentUserIsAdministrator();
            }
            catch (Exception exception)
            {
                isFarmAdmin = false;
                outputQueue.Add(exception.Message, OutputType.Error, null, exception);
            }
            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisiteComplete, UserDisplay.PrerequisiteUserIsFarmAdmin, isFarmAdmin ? UserDisplay.CheckingPrerequisitePassed : UserDisplay.CheckingPrerequisiteFailed));

            return(outputQueue);
        }
Пример #29
0
        public OutputQueue Run()
        {
            var output = new OutputQueue();

            this.Status = TaskStatus.InProgress;

            try
            {
                output.Add(NewsGator.Install.Resources.Tasks.TaskDetails_UpdateFeatures);

                if (this.SolutionIds == null || this.SolutionIds.Count == 0)
                {
                    throw new InvalidOperationException("SolutionIds");
                }

                var solutionsString = string.Empty;
                for (var i = 0; i < this.SolutionIds.Count; i++)
                {
                    if (i == 0)
                    {
                        solutionsString = "\"" + this.SolutionIds[i].ToString() + "\"";
                    }
                    else
                    {
                        solutionsString += ", \"" + this.SolutionIds[i].ToString() + "\"";
                    }
                }

                var parameter = string.Format(CultureInfo.InvariantCulture, "([System.Collections.ObjectModel.Collection``1[[System.Guid]]] ([GUID[]] ({0})))", solutionsString);
                var command   = string.Format(CultureInfo.InvariantCulture, "[Newsgator.Install.Common.Utilities.Features]::UpgradeFeaturesAll({0})", parameter);

                output.Add(Utilities.Runspace.RunInPowerShell(command));

                output.Add(NewsGator.Install.Resources.Tasks.TaskDetails_UpdateFeatures_Complete);
                this.Status = TaskStatus.CompleteSuccess;
            }
            catch (Exception exception)
            {
                output.Add(string.Format(CultureInfo.CurrentUICulture, NewsGator.Install.Resources.Exceptions.UpdateFeaturesException, exception.Message), OutputType.Error, exception.ToString(), exception);
                this.Status = TaskStatus.CompleteFailed;
            }

            return(output);
        }
Пример #30
0
        internal static OutputQueue IsUserProfileServiceApplicationAvailable(out bool isAvailable)
        {
            var outputQueue = new OutputQueue();

            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisite, UserDisplay.PrerequisiteUserProfileAvailable));
            try
            {
                SPIisWebServiceApplication app = null;
                outputQueue.Add(UserProfileService.GetUserProfileApplication(out app));
                isAvailable = app != null;
            }
            catch (Exception exception)
            {
                isAvailable = false;
                outputQueue.Add(exception.Message, OutputType.Error, null, exception);
            }
            outputQueue.Add(string.Format(System.Globalization.CultureInfo.CurrentCulture, UserDisplay.CheckingPrerequisiteComplete, UserDisplay.PrerequisiteUserProfileAvailable, isAvailable ? UserDisplay.CheckingPrerequisitePassed : UserDisplay.CheckingPrerequisiteFailed));
            return(outputQueue);
        }