Ejemplo n.º 1
0
    public void SentMailToPManager(int solutionid)
    {
        string          strYourSinscerely  = Resources.MessageResource.strYourSinscerely.ToString();
        string          strContactNumber   = Resources.MessageResource.strContactNumber.ToString();
        Solution_mst    objSolution        = new Solution_mst();
        SolutionCreator objSolutionCreator = new SolutionCreator();

        objSolution        = objSolution.Get_By_id(solutionid);
        objSolutionCreator = objSolutionCreator.Get_By_id(solutionid);
        UserLogin_mst objUserCreator = new UserLogin_mst();

        objUserCreator = objUserCreator.Get_By_id(objSolutionCreator.Createdby);
        int    FlagUser;
        string varRole = Resources.MessageResource.strPManagerRole.ToString();
        int    roleid;

        roleid  = objRole.Get_By_RoleName(varRole);
        colUser = objUser.Get_All_By_Role(roleid);
        foreach (UserLogin_mst objusr in colUser)
        {
            objC_info      = objC_info.Get_By_id(objusr.Userid);
            obj.From       = Resources.MessageResource.strAdminEmail.ToString();
            obj.To         = objC_info.Emailid;
            obj.Subject    = "New Solution Added. Solution Id : " + solutionid;
            obj.Body       = "Dear Sir/Madam,<br/>A New Solution has been Added.Please find the New Solution details .<br/><br/><b>Solution Details : </b> <br/><br/><b>Solution Id &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSolution.Solutionid + "<br/><b>Title &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSolution.Title + " <br/><b>Added By &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objUserCreator.Username + "<br/><b>Created Date &nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSolutionCreator.CreateDatetime + "<br/><b>Content&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSolution.Content + "<br/><br/>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/> <b>" + strYourSinscerely + "</b>";
            obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString();
            obj.SentMail();
        }
    }
Ejemplo n.º 2
0
        private async Task <Solution> LoadAsync(CancellationToken cancellationToken)
        {
            var adhocWorkspace = new AdhocWorkspace();
            var serializer     = adhocWorkspace.Services.GetService <ISerializerService>();

            var solutionChecksum = default(Checksum);
            var map = new Dictionary <Checksum, object>();

            using (var stream = new FileStream(_fileName, FileMode.Open))
                using (var compressed = new DeflateStream(stream, CompressionMode.Decompress))
                    using (var reader = ObjectReader.TryGetReader(compressed, cancellationToken))
                    {
                        // save root checksum and number of entries
                        solutionChecksum = Checksum.ReadFrom(reader);

                        // number of items in the package
                        var count = reader.ReadInt32();

                        for (var i = 0; i < count; i++)
                        {
                            var itemChecksum = Checksum.ReadFrom(reader);

                            var kind = (WellKnownSynchronizationKind)reader.ReadInt32();

                            // in service hub, cancellation means simply closed stream
                            var @object = serializer.Deserialize <object>(kind, reader, cancellationToken);

                            Debug.Assert(itemChecksum == serializer.CreateChecksum(@object, cancellationToken));

                            map.Add(itemChecksum, @object);
                        }
                    }

            var assetSource  = new SimpleAssetSource(AssetStorage.Default, map);
            var assetService = new AssetService(scopeId: 0, AssetStorage.Default, serializer);

            var solutionCreator = new SolutionCreator(assetService, _solution, cancellationToken);

            // check whether solution is update to the given base solution
            if (await solutionCreator.IsIncrementalUpdateAsync(solutionChecksum).ConfigureAwait(false))
            {
                // create updated solution off the baseSolution
                return(await solutionCreator.CreateSolutionAsync(solutionChecksum).ConfigureAwait(false));
            }

            // get new solution info
            var solutionInfo = await solutionCreator.CreateSolutionInfoAsync(solutionChecksum).ConfigureAwait(false);

            // otherwise, just return new solution
            return(adhocWorkspace.AddSolution(solutionInfo));
        }
Ejemplo n.º 3
0
        private void btnFinish_Click(object sender, EventArgs e)
        {
            btnFinish.Enabled = false;
            btnFinish.Text    = "执行中……";
            if (solutionControl.Valid())
            {
                try
                {
                    SolutionCreator creator = new SolutionCreator();
                    if (Home.form_Database.GetTreeView1Selected().Count <= 0)
                    {
                        MessageBox.Show("没有找到你选择的Table,请双击展开Selected Table", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        btnFinish.Enabled = true;
                        btnFinish.Text    = "&Finish";
                        return;
                    }
                    string db       = ((Model.TreeNodeTag)Home.form_Database.GetTreeView1Selected()[0].Parent.Tag).Tag.ToString();
                    var    tvTables = Home.form_Database.InitTreeView(db);
                    string dtime    = DateTime.Now.ToString("yyMMddHHmmss");
                    string date     = dtime;// DateTime.Now.ToString("yyMMddHH24mmsszzz").Substring(0, DateTime.Now.ToString("yyMMddHH24mmsszzz").Length - 8);
                    string path     = solutionControl.Path + "\\" + date;
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    creator.CreateSolution(db + "_" + configControl.SolutionName, path, tvTables, configControl.dataAccessType, configControl.architectureType, solutionControl.gridSolution, Config.GetConnectionString(StaticTool.ServerID));
                    //creator.CreateSolution(configControl.SolutionName,@"C:\Users\JiangYanJun\Desktop\新建文件夹", tableControl.tvTables,
                    //    configControl.dataAccessType, configControl.architectureType, solutionControl.gridSolution, connectionControl.ConnectionString);

                    MessageBox.Show("项目成功生成目录在:" + Environment.NewLine + Environment.NewLine + path, "\t\t成功生成", MessageBoxButtons.OK,
                                    MessageBoxIcon.None);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("该项目创建过程中发生了错误。 详情: " + ex.Message,
                                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    DeleteUselessFiles();
                }
            }
            else
            {
                MessageBox.Show("Please fill all required fields.",
                                "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            btnFinish.Enabled = true;
            btnFinish.Text    = "&Finish";
        }
 private void ApplyEncoding()
 {
     if (SolutionCreator.GetType() == typeof(JSMRandomCreator))
     {
         Operators.AddRange(ApplicationManager.Manager.GetInstances <IJSMOperator>());
         ScheduleDecoder = new JSMDecoder();
     }
     else if (SolutionCreator.GetType() == typeof(PRVRandomCreator))
     {
         Operators.AddRange(ApplicationManager.Manager.GetInstances <IPRVOperator>());
         ScheduleDecoder = new PRVDecoder();
     }
     else if (SolutionCreator.GetType() == typeof(PWRRandomCreator))
     {
         Operators.AddRange(ApplicationManager.Manager.GetInstances <IPWROperator>());
         ScheduleDecoder = new PWRDecoder();
     }
     else if (SolutionCreator.GetType() == typeof(DirectScheduleRandomCreator))
     {
         Operators.AddRange(ApplicationManager.Manager.GetInstances <IDirectScheduleOperator>());
         ScheduleDecoder = null;
     }
 }
Ejemplo n.º 5
0
        async Task <AvalonEditTextOutput> CreateSolution(IEnumerable <LoadedAssembly> assemblies, Language language, CancellationToken ct)
        {
            var result = new AvalonEditTextOutput();

            var duplicates = new HashSet <string>();

            if (assemblies.Any(asm => !duplicates.Add(asm.ShortName)))
            {
                result.WriteLine("Duplicate assembly names selected, cannot generate a solution.");
                return(result);
            }

            Stopwatch stopwatch = Stopwatch.StartNew();

            try {
                await Task.Run(() => Parallel.ForEach(assemblies, n => WriteProject(n, language, solutionDirectory, ct)))
                .ConfigureAwait(false);

                await Task.Run(() => SolutionCreator.WriteSolutionFile(solutionFilePath, projects))
                .ConfigureAwait(false);
            } catch (AggregateException ae) {
                if (ae.Flatten().InnerExceptions.All(e => e is OperationCanceledException))
                {
                    result.WriteLine();
                    result.WriteLine("Generation was cancelled.");
                    return(result);
                }

                result.WriteLine();
                result.WriteLine("Failed to generate the Visual Studio Solution. Errors:");
                ae.Handle(e => {
                    result.WriteLine(e.Message);
                    return(true);
                });

                return(result);
            }

            foreach (var item in statusOutput)
            {
                result.WriteLine(item);
            }

            if (statusOutput.Count == 0)
            {
                result.WriteLine("Successfully decompiled the following assemblies into Visual Studio projects:");
                foreach (var item in assemblies.Select(n => n.Text.ToString()))
                {
                    result.WriteLine(item);
                }

                result.WriteLine();

                if (assemblies.Count() == projects.Count)
                {
                    result.WriteLine("Created the Visual Studio Solution file.");
                }

                result.WriteLine();
                result.WriteLine("Elapsed time: " + stopwatch.Elapsed.TotalSeconds.ToString("F1") + " seconds.");
                result.WriteLine();
                result.AddButton(null, "Open Explorer", delegate { Process.Start("explorer", "/select,\"" + solutionFilePath + "\""); });
            }

            return(result);
        }
Ejemplo n.º 6
0
        public async Task UpdatePrimaryWorkspaceAsync(Checksum solutionChecksum, CancellationToken cancellationToken)
        {
            var currentSolution = s_primaryWorkspace.CurrentSolution;

            var primarySolutionChecksum = await currentSolution.State.GetChecksumAsync(cancellationToken).ConfigureAwait(false);
            if (primarySolutionChecksum == solutionChecksum)
            {
                // nothing changed
                return;
            }

            using (await s_gate.DisposableWaitAsync(cancellationToken).ConfigureAwait(false))
            {
                var updater = new SolutionCreator(_assetService, currentSolution, cancellationToken);

                if (await updater.IsIncrementalUpdateAsync(solutionChecksum).ConfigureAwait(false))
                {
                    // solution has updated
                    s_primaryWorkspace.UpdateSolution(await updater.CreateSolutionAsync(solutionChecksum).ConfigureAwait(false));
                    return;
                }

                // new solution. bulk sync all asset for the solution
                await _assetService.SynchronizeSolutionAssetsAsync(solutionChecksum, cancellationToken).ConfigureAwait(false);

                s_primaryWorkspace.ClearSolution();
                s_primaryWorkspace.AddSolution(await updater.CreateSolutionInfoAsync(solutionChecksum).ConfigureAwait(false));
            }
        }
Ejemplo n.º 7
0
        private async Task<Solution> CreateSolution_NoLockAsync(Checksum solutionChecksum, Solution baseSolution, CancellationToken cancellationToken)
        {
            var updater = new SolutionCreator(_assetService, baseSolution, cancellationToken);

            if (await updater.IsIncrementalUpdateAsync(solutionChecksum).ConfigureAwait(false))
            {
                // solution has updated
                return await updater.CreateSolutionAsync(solutionChecksum).ConfigureAwait(false);
            }

            // new solution. bulk sync all asset for the solution
            await _assetService.SynchronizeSolutionAssetsAsync(solutionChecksum, cancellationToken).ConfigureAwait(false);

            var workspace = new TemporaryWorkspace(await updater.CreateSolutionInfoAsync(solutionChecksum).ConfigureAwait(false));
            return workspace.CurrentSolution;
        }
    protected void ShowPanal1()
    {
        panShowdata.Visible = true;
        panEditData.Visible = false;

        int Solutionid = Convert.ToInt16(Request.QueryString[0]);
        ObjSolution = ObjSolution.Get_By_id(Solutionid);
        ObjSolutionKeyword = ObjSolutionKeyword.Get_By_id(Solutionid);
        if(ObjCategory.CategoryName==null)
        {
            lbltitle.Text = ObjSolution.Title.ToString();
            lblcontent.Text = ObjSolution.Content.ToString();
            ObjCategory = ObjCategory.Get_By_id(ObjSolution.Topicid);
            lbltopic.Text = "";
            lblkeyword.Text = ObjSolutionKeyword.Keywords.ToString();
            lblsolid.Text = Solutionid.ToString();
            editsolheader.Visible = false;
        }
        else
        {
            lbltitle.Text = ObjSolution.Title.ToString();
            lblcontent.Text = ObjSolution.Content.ToString();
            ObjCategory = ObjCategory.Get_By_id(ObjSolution.Topicid);
            lbltopic.Text = ObjCategory.CategoryName.ToString();
            lblkeyword.Text = ObjSolutionKeyword.Keywords.ToString();
            lblsolid.Text = Solutionid.ToString();
            editsolheader.Visible = false;
        }

        int status=Convert.ToInt16(ObjSolution.SolutionStatus);
        if (status ==1)
        {
            imgapprove.Visible = true;
            Imgunapproved.Visible = false;
            lblapprove.Text = "Approve";
        }
        else if (status == 2)
        {
            Imgunapproved.Visible = true;
            imgapprove.Visible = false;
            lblapprove.Text = "Rejected";
        }
        else
        {
            imgapprove.Visible = false;
            Imgunapproved.Visible = false;
            lblapprove.Text = "UnApproved";
        }

        ObjSolutionCreator = ObjSolutionCreator.Get_By_id(ObjSolution.Solutionid);

        int userid = Convert.ToInt16(ObjSolutionCreator.Createdby);
        objUser = objUser.Get_By_id(userid);

        lblcreatedby.Text = objUser.Username.ToString();
        lblcreatedon.Text = ObjSolutionCreator.CreateDatetime.ToString();
        int lastupdateid = Convert.ToInt16(ObjSolutionCreator.LastUpdateBy);
        if (lastupdateid != 0)
        {
            objUser = objUser.Get_By_id(lastupdateid);
            lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString();
            lbllastupdate.Text = objUser.Username.ToString();

        }
        else
        {
            lbllastupdateon.Text = "";
            lbllastupdate.Text = "";

        }

        //if (objUser.Username == "")
        //{
        //    lbllastupdate.Text = objUser.Username.ToString();
        //    lbllastupdate.Text = objUser.Username.ToString();

        //}

        //else
        //{
        //    lbllastupdate.Text = "";
        //    lbllastupdateon.Text = "";
        //}
        //if (objUser.Username != "")
        //{
        //    lbllastupdate.Text = objUser.Username.ToString();

        //}
        //if (ObjSolutionCreator.LastUpdateon == "")
        //{
        //    lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString();

        //}
        //if (ObjSolutionCreator.LastUpdateon != "")
        //{
        //    lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString();

        //}
    }
 public int Update_SolutionCreator_mst_By_id(SolutionCreator ObjSolutionCreator)
 {
     return (int)ExecuteNonQuery(Sp_SolutionCreator_Update, new object[] { ObjSolutionCreator.Solutionid, ObjSolutionCreator.LastUpdateBy });
 }
 public int Insert_SolutionCreator_mst(SolutionCreator objSolutionCreator)
 {
     return (int)ExecuteNonQuery(Sp_SolutionCreator_Insert, new object[] { objSolutionCreator.Solutionid, objSolutionCreator.Createdby });
 }
    public object GenerateSolutionCreator_mstCollection_mstObject(ref IDataReader returnData)
    {
        SolutionCreator obj = new SolutionCreator();
        while (returnData.Read())
        {
            DateTime Mydatetime = new DateTime();
            Mydatetime = (DateTime)returnData["CreateDatetime"];
            DateTime Mydatetime1 = new DateTime();
            Mydatetime1 = (DateTime)returnData["CreateDatetime"];
            if (returnData["Solutionid"] != DBNull.Value)
            {
                obj.Solutionid = (int)returnData["Solutionid"];
            }
            if (returnData["CreatedBy"] != DBNull.Value)
            {
                obj.Createdby = (int)returnData["CreatedBy"];
            }
            if (returnData["CreateDatetime"] != DBNull.Value)
            {
                obj.CreateDatetime = Mydatetime.ToString();
            }

            if (returnData["LastUpdateBy"] != DBNull.Value)
            {
                obj.LastUpdateBy = (int)returnData["LastUpdateBy"];
            }
            if (returnData["LastUpdateon"] != DBNull.Value)
            {
                obj.LastUpdateon = Mydatetime1.ToString();
            }

        }
        returnData.Close();
        returnData.Dispose();
        return obj;
    }
    public void SentMailToPManager(int solutionid)
    {
        string strYourSinscerely = Resources.MessageResource.strYourSinscerely.ToString();
        string strContactNumber = Resources.MessageResource.strContactNumber.ToString();
        Solution_mst objSolution = new Solution_mst();
        SolutionCreator objSolutionCreator = new SolutionCreator();
        objSolution = objSolution.Get_By_id(solutionid);
        objSolutionCreator = objSolutionCreator.Get_By_id(solutionid);
        UserLogin_mst objUserCreator = new UserLogin_mst();
        objUserCreator = objUserCreator.Get_By_id(objSolutionCreator.Createdby);
        int FlagUser;
        string varRole = Resources.MessageResource.strPManagerRole.ToString();
        int roleid;
        roleid = objRole.Get_By_RoleName(varRole);
        colUser = objUser.Get_All_By_Role(roleid);
        foreach (UserLogin_mst objusr in colUser)
        {

            objC_info = objC_info.Get_By_id(objusr.Userid);
            obj.From = Resources.MessageResource.strAdminEmail.ToString();
            obj.To = objC_info.Emailid;
            obj.Subject = "New Solution Added. Solution Id : " + solutionid;
            obj.Body = "Dear Sir/Madam,<br/>A New Solution has been Added.Please find the New Solution details .<br/><br/><b>Solution Details : </b> <br/><br/><b>Solution Id &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSolution.Solutionid + "<br/><b>Title &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSolution.Title + " <br/><b>Added By &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objUserCreator.Username + "<br/><b>Created Date &nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSolutionCreator.CreateDatetime + "<br/><b>Content&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b>" + objSolution.Content + "<br/><br/>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/> <b>" + strYourSinscerely + "</b>";
            obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString();
            obj.SentMail();

        }
    }
    protected void ShowPanal1()
    {
        panShowdata.Visible = true;
        panEditData.Visible = false;

        int Solutionid = Convert.ToInt16(Request.QueryString[0]);

        ObjSolution        = ObjSolution.Get_By_id(Solutionid);
        ObjSolutionKeyword = ObjSolutionKeyword.Get_By_id(Solutionid);
        if (ObjCategory.CategoryName == null)
        {
            lbltitle.Text         = ObjSolution.Title.ToString();
            lblcontent.Text       = ObjSolution.Content.ToString();
            ObjCategory           = ObjCategory.Get_By_id(ObjSolution.Topicid);
            lbltopic.Text         = "";
            lblkeyword.Text       = ObjSolutionKeyword.Keywords.ToString();
            lblsolid.Text         = Solutionid.ToString();
            editsolheader.Visible = false;
        }
        else
        {
            lbltitle.Text         = ObjSolution.Title.ToString();
            lblcontent.Text       = ObjSolution.Content.ToString();
            ObjCategory           = ObjCategory.Get_By_id(ObjSolution.Topicid);
            lbltopic.Text         = ObjCategory.CategoryName.ToString();
            lblkeyword.Text       = ObjSolutionKeyword.Keywords.ToString();
            lblsolid.Text         = Solutionid.ToString();
            editsolheader.Visible = false;
        }

        int status = Convert.ToInt16(ObjSolution.SolutionStatus);

        if (status == 1)
        {
            imgapprove.Visible    = true;
            Imgunapproved.Visible = false;
            lblapprove.Text       = "Approve";
        }
        else if (status == 2)
        {
            Imgunapproved.Visible = true;
            imgapprove.Visible    = false;
            lblapprove.Text       = "Rejected";
        }
        else
        {
            imgapprove.Visible    = false;
            Imgunapproved.Visible = false;
            lblapprove.Text       = "UnApproved";
        }

        ObjSolutionCreator = ObjSolutionCreator.Get_By_id(ObjSolution.Solutionid);

        int userid = Convert.ToInt16(ObjSolutionCreator.Createdby);

        objUser = objUser.Get_By_id(userid);

        lblcreatedby.Text = objUser.Username.ToString();
        lblcreatedon.Text = ObjSolutionCreator.CreateDatetime.ToString();
        int lastupdateid = Convert.ToInt16(ObjSolutionCreator.LastUpdateBy);

        if (lastupdateid != 0)
        {
            objUser = objUser.Get_By_id(lastupdateid);
            lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString();
            lbllastupdate.Text   = objUser.Username.ToString();
        }
        else
        {
            lbllastupdateon.Text = "";
            lbllastupdate.Text   = "";
        }



        //if (objUser.Username == "")
        //{
        //    lbllastupdate.Text = objUser.Username.ToString();
        //    lbllastupdate.Text = objUser.Username.ToString();

        //}

        //else
        //{
        //    lbllastupdate.Text = "";
        //    lbllastupdateon.Text = "";
        //}
        //if (objUser.Username != "")
        //{
        //    lbllastupdate.Text = objUser.Username.ToString();

        //}
        //if (ObjSolutionCreator.LastUpdateon == "")
        //{
        //    lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString();

        //}
        //if (ObjSolutionCreator.LastUpdateon != "")
        //{
        //    lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString();

        //}
    }
Ejemplo n.º 14
0
        async Task <AvalonEditTextOutput> CreateSolution(IEnumerable <LoadedAssembly> assemblies, Language language, CancellationToken ct)
        {
            var result = new AvalonEditTextOutput();

            var duplicates = new HashSet <string>();

            if (assemblies.Any(asm => !duplicates.Add(asm.ShortName)))
            {
                result.WriteLine("Duplicate assembly names selected, cannot generate a solution.");
                return(result);
            }

            Stopwatch stopwatch = Stopwatch.StartNew();

            try
            {
                // Explicitly create an enumerable partitioner here to avoid Parallel.ForEach's special cases for lists,
                // as those seem to use static partitioning which is inefficient if assemblies take differently
                // long to decompile.
                await Task.Run(() => Parallel.ForEach(Partitioner.Create(assemblies),
                                                      new ParallelOptions {
                    MaxDegreeOfParallelism = Environment.ProcessorCount, CancellationToken = ct
                },
                                                      n => WriteProject(n, language, solutionDirectory, ct)))
                .ConfigureAwait(false);

                if (projects.Count == 0)
                {
                    result.WriteLine();
                    result.WriteLine("Solution could not be created, because none of the selected assemblies could be decompiled into a project.");
                }
                else
                {
                    await Task.Run(() => SolutionCreator.WriteSolutionFile(solutionFilePath, projects))
                    .ConfigureAwait(false);
                }
            }
            catch (AggregateException ae)
            {
                if (ae.Flatten().InnerExceptions.All(e => e is OperationCanceledException))
                {
                    result.WriteLine();
                    result.WriteLine("Generation was cancelled.");
                    return(result);
                }

                result.WriteLine();
                result.WriteLine("Failed to generate the Visual Studio Solution. Errors:");
                ae.Handle(e => {
                    result.WriteLine(e.Message);
                    return(true);
                });

                return(result);
            }

            foreach (var item in statusOutput)
            {
                result.WriteLine(item);
            }

            if (statusOutput.Count == 0)
            {
                result.WriteLine("Successfully decompiled the following assemblies into Visual Studio projects:");
                foreach (var item in assemblies.Select(n => n.Text.ToString()))
                {
                    result.WriteLine(item);
                }

                result.WriteLine();

                if (assemblies.Count() == projects.Count)
                {
                    result.WriteLine("Created the Visual Studio Solution file.");
                }

                result.WriteLine();
                result.WriteLine("Elapsed time: " + stopwatch.Elapsed.TotalSeconds.ToString("F1") + " seconds.");
                result.WriteLine();
                result.AddButton(null, "Open Explorer", delegate { Process.Start("explorer", "/select,\"" + solutionFilePath + "\""); });
            }

            return(result);
        }