Exemplo n.º 1
0
        private void Build(Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Project project, string configuration, string projectFolder, ProjectBuildTracker projectBuildTracker)
        {
            foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Config config in project.Configs)
            {
                string configName = "";

                if (config.Condition.IndexOf("Debug") != -1)
                {
                    configName = "Debug";
                }
                else if (config.Condition.IndexOf("Release") != -1)
                {
                    configName = "Release";
                }
                else
                {
                    throw new System.Exception("Unknown configuration: " + config.Condition);
                }

                if (configName.ToLower().Equals(configuration.ToLower()))
                {
                    string output = new System.IO.FileInfo(projectFolder).DirectoryName;
                    if (!output.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                    {
                        output += System.IO.Path.DirectorySeparatorChar;
                    }

                    string outputFolder = output;

                    string extension = (project.Settings.OutputType.ToUpper().Equals("EXE") || project.Settings.OutputType.ToUpper().Equals("WINEXE")) ? ".exe" : ".dll";
                    output += config.OutputPath + project.Settings.AssemblyName + extension;

                    this.Build(project, configuration, projectFolder, output, outputFolder, projectBuildTracker);

                    break;
                }
            }
        }
Exemplo n.º 2
0
        private void Build(Bamboo.VisualStudio.VisualStudio2003.CSharpProject.Models.Project project, string configuration, string projectFolder, ProjectBuildTracker projectBuildTracker)
        {
            foreach (Bamboo.VisualStudio.VisualStudio2003.CSharpProject.Models.Config config in project.Configs)
            {
                if (config.Name.ToLower().Equals(configuration.ToLower()))
                {
                    string output = new System.IO.FileInfo(projectFolder).DirectoryName;
                    if (!output.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                    {
                        output += System.IO.Path.DirectorySeparatorChar;
                    }

                    string outputFolder = output;

                    string extension = (project.Settings.OutputType.ToUpper().Equals("EXE") || project.Settings.OutputType.ToUpper().Equals("WINEXE")) ? ".exe" : ".dll";
                    output += config.OutputPath + project.Settings.AssemblyName + extension;

                    this.Build(project, configuration, projectFolder, output, outputFolder, projectBuildTracker);

                    break;
                }
            }
        }
Exemplo n.º 3
0
        private void BuildConfig(
            string projectName,
            string projectFolder,
            System.Guid projectGuid,
            string output,
            string outputFolder,
            Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Settings settings,
            Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Config config,
            Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.ReferenceCollection references,
            Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.ProjectReferenceCollection projectReferences,
            Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.ItemCollection items,
            ProjectBuildTracker projectBuildTracker)
        {
            this._output.Add(new Output("Begin Build " + projectName));
            this._output.Add(new Output(""));



            System.IO.DirectoryInfo directoryInfo = new System.IO.FileInfo(output).Directory;
            if (!directoryInfo.Exists)
            {
                directoryInfo.Create();
            }



            Bamboo.CSharp.Compilers.CompilerParameters compilerParameters = new Bamboo.CSharp.Compilers.CompilerParameters();

            if (settings.ApplicationIcon.Length > 0)
            {
                compilerParameters.ApplicationIcon = projectFolder + System.IO.Path.DirectorySeparatorChar + settings.ApplicationIcon;
            }

            compilerParameters.Assembly = output;

            compilerParameters.Target = settings.OutputType.ToLower();

            compilerParameters.Define = config.DefineConstants;
            if (config.DebugSymbols.Length == 0)
            {
                compilerParameters.Debug = false;
            }
            else
            {
                compilerParameters.Debug = System.Boolean.Parse(config.DebugSymbols);
            }
            foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Reference reference in references)
            {
                if (ProjectReferenceRules.IsFrameworkReference(reference))
                {
                    //
                    // Framework reference.
                    //
                    string frameworkPath = this._compiler.GetFrameworkPath();
                    string referencePath = frameworkPath + reference.Include + ".dll";

                    if (!System.IO.File.Exists(referencePath))
                    {
                    }
                    else
                    {
                        compilerParameters.References.Add(referencePath);
                    }
                }
                else if (ProjectReferenceRules.IsAssemblyFolderReference(reference))
                {
                    //
                    // AssemblyFolder reference.
                    //
                    string referencePath = ProjectReferenceRules.GetReferencePath(projectFolder, reference.HintPath, this._compiler);
                    if (referencePath != null)
                    {
                        if (System.IO.File.Exists(referencePath))
                        {
                            compilerParameters.References.Add(referencePath);
                        }
                        else if (System.IO.File.Exists(referencePath + ".dll"))
                        {
                            compilerParameters.References.Add(referencePath + ".dll");
                        }
                        else
                        {
                        }
                    }
                }
                else
                {
                    //
                    // File reference.
                    //
                    string referencePath = ProjectReferenceRules.GetReferencePath(projectFolder, reference.HintPath, this._compiler);
                    if (referencePath != null)
                    {
                        string output_folder = new System.IO.FileInfo(output).DirectoryName;
                        if (!output_folder.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                        {
                            output_folder += System.IO.Path.DirectorySeparatorChar;
                        }
                        string target = output_folder + new System.IO.FileInfo(referencePath).Name;
                        if (!target.Equals(referencePath))
                        {
                            System.IO.File.Copy(referencePath, target, true);

                            while (!System.IO.File.Exists(target))
                            {
                                System.Threading.Thread.Sleep(500);
                            }
                        }

                        compilerParameters.References.Add(referencePath);
                    }
                }
            }
            foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.ProjectReference projectReference in projectReferences)
            {
                //
                // Project reference.
                //
                string projectReferencePath = projectBuildTracker.GetPath(new System.Guid(projectReference.Project));

                if (projectReferencePath != null)
                {
                    string output_folder = new System.IO.FileInfo(output).DirectoryName;
                    if (!output_folder.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                    {
                        output_folder += System.IO.Path.DirectorySeparatorChar;
                    }
                    string target = output_folder + new System.IO.FileInfo(projectReferencePath).Name;
                    if (!target.Equals(projectReferencePath))
                    {
                        System.IO.File.Copy(projectReferencePath, target, true);

                        while (!System.IO.File.Exists(target))
                        {
                            System.Threading.Thread.Sleep(500);
                        }
                    }
                    compilerParameters.References.Add(target);
                }
            }
            foreach (Bamboo.VisualStudio.VisualStudio2005.CSharpProject.Models.Item item in items)
            {
                if (item.Type == "Compile")
                {
                    compilerParameters.Sources.Add(projectFolder + System.IO.Path.DirectorySeparatorChar + item.Include);
                }
                else if (item.Type == "Content")
                {
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(outputFolder + item.Include);
                    if (!fileInfo.Directory.Exists)
                    {
                        fileInfo.Directory.Create();
                    }
                    System.IO.File.Copy(projectFolder + System.IO.Path.DirectorySeparatorChar + item.Include, outputFolder + item.Include, true);
                }
                else if (item.Type == "None" && item.Include.Equals("App.config"))
                {
                    System.IO.File.Copy(projectFolder + System.IO.Path.DirectorySeparatorChar + item.Include, output + ".config");
                }
                else if (item.Type == "EmbeddedResource")
                {
                    if (item.Include.ToLower().EndsWith(".resx"))
                    {
                        string RESGEN_EXE = Bamboo.CSharp.FrameworkDetector.GetSDKInstallRoot("v" + this._compiler.GetFrameworkVersion()) + "Bin\\resgen.exe";
                        //TODO OLD string RESGEN_EXE = @"C:\Program Files\Swampware\SDK\NET_2.0\resgen.exe";

                        System.Diagnostics.ProcessStartInfo processStartInfo = new System.Diagnostics.ProcessStartInfo();
                        processStartInfo.FileName = RESGEN_EXE;
                        processStartInfo.RedirectStandardOutput = true;
                        processStartInfo.UseShellExecute        = false;
                        processStartInfo.CreateNoWindow         = true;
                        processStartInfo.WorkingDirectory       = System.Environment.CurrentDirectory;

                        string arguments = "\"" + projectFolder + System.IO.Path.DirectorySeparatorChar + item.Include + "\"";

                        string resourceFile  = item.Include.Substring(0, item.Include.Length - 5) + ".resources";
                        string resource_name = settings.RootNamespace + "." + resourceFile.Replace(System.IO.Path.DirectorySeparatorChar.ToString(), ".");
                        string resource_path = "\"" + projectFolder + System.IO.Path.DirectorySeparatorChar + "obj" + System.IO.Path.DirectorySeparatorChar + "res" + System.IO.Path.DirectorySeparatorChar + resource_name + "\"";
                        arguments += " " + resource_path;

                        if (!System.IO.Directory.Exists(projectFolder + System.IO.Path.DirectorySeparatorChar + "obj" + System.IO.Path.DirectorySeparatorChar + "res"))
                        {
                            System.IO.Directory.CreateDirectory(projectFolder + System.IO.Path.DirectorySeparatorChar + "obj" + System.IO.Path.DirectorySeparatorChar + "res");
                        }

                        processStartInfo.Arguments = arguments;
                        System.Diagnostics.Process process = System.Diagnostics.Process.Start(processStartInfo);

                        System.IO.StringWriter stringWriter = new System.IO.StringWriter();
                        while (!process.HasExited)
                        {
                            stringWriter.Write(process.StandardOutput.ReadToEnd());
                            process.WaitForExit(50);
                        }
                        stringWriter.Write(process.StandardOutput.ReadToEnd());
                        process.Close();
                        process.Dispose();

                        this._output.Add(new Output(stringWriter.ToString()));



                        this._output.Add(new Output("Converting " + item.Include + " to " + resourceFile + ""));

                        compilerParameters.Resources.Add(resource_path);
                    }
                    else
                    {
                        string resource_name = settings.RootNamespace + "." + item.Include.Replace(System.IO.Path.DirectorySeparatorChar.ToString(), ".");

                        compilerParameters.Resources.Add("\"" + projectFolder + System.IO.Path.DirectorySeparatorChar + item.Include + "\"" + "," + resource_name);
                    }
                }
            }


            this._compiler.Compile(compilerParameters);



            //
            // Output
            //
            foreach (string line in compilerParameters.Output)
            {
                this._output.Add(new Output(line));
            }

            //
            // Errors
            //
            bool hasErrors = false;

            foreach (Bamboo.CSharp.Compilers.Error error in compilerParameters.Errors)
            {
                if (!error.IsWarning)
                {
                    hasErrors = true;
                }
                this._errors.Add(new Error(error.IsWarning, error.File, error.Line, error.Column, error.Code, error.Description, error.Text));
            }



            if (hasErrors)
            {
                this._succeeded = false;
                this._output.Add(new Output(""));
                this._output.Add(new Output("Build Failed " + projectName));
            }
            else
            {
                this._succeeded = true;
                this._assembly  = compilerParameters.Assembly;
                this._output.Add(new Output(""));
                this._output.Add(new Output("Build Succeeded " + projectName));

                projectBuildTracker.Add(projectGuid, compilerParameters.Assembly);
            }
        }
Exemplo n.º 4
0
        public void SetPresentation()
        {
            lbSelectedFiles.Items.Clear();

            foreach (PresentationPlay pPlay in Presentation.Plays)
            {
                string strStandardFilePath = new System.IO.FileInfo(pPlay.PlayPath).FullName;

                if (strStandardFilePath.EndsWith(".Ttl", true, null))
                {
                    Title title = new Title(strStandardFilePath);

                    TitleViewModel tvm = new TitleViewModel(title, null);

                    lbSelectedFiles.Items.Add(tvm);
                }
                else
                {
                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Offensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Offensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Offensive"))
                    {
                        Formation formation = new Formation(strStandardFilePath);

                        FormationViewModel fvm = new FormationViewModel(formation, null);

                        lbSelectedFiles.Items.Add(fvm);
                    }

                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Defensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Defensive") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Defensive"))
                    {
                        Formation formation = new Formation(strStandardFilePath);

                        FormationViewModel fvm = new FormationViewModel(formation, null);

                        lbSelectedFiles.Items.Add(fvm);
                    }

                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Kicks") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Kicks") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Kicks"))
                    {
                        Formation formation = new Formation(strStandardFilePath);

                        FormationViewModel fvm = new FormationViewModel(formation, null);

                        lbSelectedFiles.Items.Add(fvm);
                    }

                    if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Playbook") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Playbook") ||
                        strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Playbook"))
                    {
                        Play play = new Play(strStandardFilePath);

                        PlayViewModel pvm = new PlayViewModel(play, null);

                        lbSelectedFiles.Items.Add(pvm);
                    }
                }

                foreach (Object objVideo in pPlay.Videos)
                {
                    if (objVideo.ToString().EndsWith(".ppt", true, null))
                    {
                        PowerPoint ppt = new PowerPoint(objVideo.ToString());

                        PPTViewModel pptVM = new PPTViewModel(ppt, null);

                        lbSelectedFiles.Items.Add(pptVM);
                    }
                    else
                    {
                        VideoCoachingPointInfo vcpi = null;

                        if (!(objVideo is VideoCoachingPointInfo))
                        {
                            vcpi = new VideoCoachingPointInfo(objVideo.ToString());
                        }
                        else
                        {
                            vcpi = objVideo as VideoCoachingPointInfo;
                        }

                        VideoViewModel vvm = new VideoViewModel(vcpi, null);

                        this.lbSelectedFiles.Items.Add(vvm);
                    }
                }
            }
        }