public void GetDifficulties()
        {
            ProjectConfig config = new ProjectConfig();
            IList<TaskDifficulty> difficulties;

            #region StrDifficulties is null

            difficulties = config.GetDifficulties();
            Assert.That(difficulties.Count, Is.EqualTo(5));
            Assert.That(difficulties.Contains(TaskDifficulty.Easiest));
            Assert.That(difficulties.Contains(TaskDifficulty.Easy));
            Assert.That(difficulties.Contains(TaskDifficulty.Common));
            Assert.That(difficulties.Contains(TaskDifficulty.Hard));
            Assert.That(difficulties.Contains(TaskDifficulty.Hardest));

            #endregion

            #region StrDifficulties not null

            config.SetDifficulties(
                new List<TaskDifficulty> 
                {
                    TaskDifficulty.Easy,
                    TaskDifficulty.Hard
                });

            difficulties = config.GetDifficulties();
            Assert.That(difficulties.Count, Is.EqualTo(2));
            Assert.That(difficulties.Contains(TaskDifficulty.Easy));
            Assert.That(difficulties.Contains(TaskDifficulty.Hard));

            #endregion
        }
        public void GetPrioritys()
        {
            ProjectConfig config = new ProjectConfig();
            IList<TaskPriority> prioritys;

            #region StrPrioritys is null

            prioritys = config.GetPrioritys();
            Assert.That(prioritys.Count, Is.EqualTo(5));
            Assert.That(prioritys.Contains(TaskPriority.Highest));
            Assert.That(prioritys.Contains(TaskPriority.High));
            Assert.That(prioritys.Contains(TaskPriority.Common));
            Assert.That(prioritys.Contains(TaskPriority.Low));
            Assert.That(prioritys.Contains(TaskPriority.Lowest));

            #endregion

            #region StrPrioritys not null

            config.SetPrioritys(
                new List<TaskPriority> 
                {
                    TaskPriority.Lowest,
                    TaskPriority.High
                });

            prioritys = config.GetPrioritys();
            Assert.That(prioritys.Count, Is.EqualTo(2));
            Assert.That(prioritys.Contains(TaskPriority.Lowest));
            Assert.That(prioritys.Contains(TaskPriority.High));

            #endregion
        }
예제 #3
0
        static ProjectConfig ConvertToPublic(ProjectConfigInternal info)
        {
            if (info == null)
            {
                return null;
            }

            var newInfo = new ProjectConfig();

            if (info.AssetsFolder != null)
            {
                newInfo.AssetsFolder = info.AssetsFolder.ToList();
            }

            if (info.PluginsFolder != null)
            {
                newInfo.PluginsFolder = info.PluginsFolder.ToList();
            }

            if (info.SolutionProjects != null)
            {
                newInfo.SolutionProjects = info.SolutionProjects.ToList();
            }

            if (info.SolutionFolders != null)
            {
                newInfo.SolutionFolders = info.SolutionFolders.ToDictionary(x => x.Key, x => x.Value);
            }

            return newInfo;
        }
        public void BuildConfigAndAdd()
        {
            ProjectConfig config = new ProjectConfig("Debug");
            config.Assemblies.Add( Path.DirectorySeparatorChar + "tests" + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar + "debug" + Path.DirectorySeparatorChar + "assembly1.dll" );
            config.Assemblies.Add( Path.DirectorySeparatorChar + "tests" + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar + "debug" + Path.DirectorySeparatorChar + "assembly2.dll" );

            configs.Add( config );

            Assert.AreEqual( 2, configs["Debug"].Assemblies.Count );
        }
예제 #5
0
		public void SetUp()
		{
			activeConfig = new ProjectConfig( "Debug" );
            inactiveConfig = new ProjectConfig("Release");
			project = new NUnitProject( TestPath( "/test/myproject.nunit" ) );
			project.Configs.Add( activeConfig );
            project.Configs.Add(inactiveConfig);
            project.IsDirty = false;
            project.HasChangesRequiringReload = false;
		}
예제 #6
0
 public static ProjectConfig Create([PexAssumeUnderTest] String category, [PexAssumeUnderTest] String dllName)
 {
     PexAssume.IsTrue(dllName.Length > 0);
     PexAssume.IsTrue(category.Equals("Debug") || category.Equals("Release"));
     ProjectConfig config1 = new ProjectConfig(category);
     config1.BasePath = "bin" + Path.DirectorySeparatorChar + category;
     config1.Assemblies.Add(Path.GetFullPath("bin" + Path.DirectorySeparatorChar + category + Path.DirectorySeparatorChar + dllName));
     config1.Assemblies.Add(Path.GetFullPath("bin" + Path.DirectorySeparatorChar + category + Path.DirectorySeparatorChar + dllName));
     return config1;
 }
예제 #7
0
 static ProjectConfigInternal ConvertToInternal(ProjectConfig info)
 {
     return new ProjectConfigInternal()
     {
         AssetsFolder = info.AssetsFolder.ToList(),
         PluginsFolder = info.PluginsFolder.ToList(),
         SolutionProjects = info.SolutionProjects.ToList(),
         SolutionFolders = info.SolutionFolders.ToDictionary(x => x.Key, x => x.Value),
     };
 }
예제 #8
0
        public ProjectConfig GetProjectConfigFromLists()
        {
            var config = new ProjectConfig();

            config.AssetsFolder = _model.AssetItems.ToList();
            config.PluginsFolder = _model.PluginItems.ToList();
            config.SolutionProjects = _model.VsProjects.ToList();
            config.SolutionFolders = _model.VsSolutionFolders.ToDictionary(x => x.Key, x => x.Value);

            return config;
        }
        public void SetDifficulties()
        {
            ProjectConfig config = new ProjectConfig();

            var difficulties = new List<TaskDifficulty> { TaskDifficulty.Easy, TaskDifficulty.Hard };
            config.SetDifficulties(difficulties);

            var result_difficulties = config.GetDifficulties();
            Assert.That(result_difficulties.Count, Is.EqualTo(2));
            Assert.That(result_difficulties.Contains(TaskDifficulty.Easy));
            Assert.That(result_difficulties.Contains(TaskDifficulty.Hard));
        }
예제 #10
0
 static ProjectConfigInternal ConvertToInternal(ProjectConfig info)
 {
     return new ProjectConfigInternal()
     {
         ProjectSettingsPath = info.ProjectSettingsPath,
         AssetsFolder = info.AssetsFolder.IsEmpty() ? null : info.AssetsFolder.ToList(),
         PluginsFolder = info.PluginsFolder.IsEmpty() ? null : info.PluginsFolder.ToList(),
         SolutionProjects = info.SolutionProjects.IsEmpty() ? null : info.SolutionProjects.ToList(),
         PackageFolders = info.PackageFolders.IsEmpty() ? null : info.PackageFolders.ToList(),
         Prebuilt = info.Prebuilt.IsEmpty() ? null : info.Prebuilt.ToList(),
         SolutionFolders = info.SolutionFolders.IsEmpty() ? null : info.SolutionFolders.Select(x => new Dictionary<string, string>() { { x.Key, x.Value } } ).ToList(),
     };
 }
예제 #11
0
        public ProjectConfig GetProjectConfigFromLists()
        {
            var config = new ProjectConfig();

            config.ProjectSettingsPath = _model.ProjectSettingsPath;

            config.AssetsFolder.AddRange(_model.AssetItems);
            config.PluginsFolder.AddRange(_model.PluginItems);
            config.SolutionProjects.AddRange(_model.VsProjects);
            config.Prebuilt.AddRange(_model.PrebuiltProjects);
            config.SolutionFolders.AddRange(_model.VsSolutionFolders);
            config.PackageFolders.AddRange(_model.SavedPackageFolders);

            return config;
        }
예제 #12
0
        static ProjectConfig ConvertToPublic(ProjectConfigInternal info)
        {
            if (info == null)
            {
                return null;
            }

            var newInfo = new ProjectConfig();

            newInfo.ProjectSettingsPath = info.ProjectSettingsPath;

            if (info.AssetsFolder != null)
            {
                newInfo.AssetsFolder.AddRange(info.AssetsFolder.ToList());
            }

            if (info.PluginsFolder != null)
            {
                newInfo.PluginsFolder.AddRange(info.PluginsFolder.ToList());
            }

            if (info.SolutionProjects != null)
            {
                newInfo.SolutionProjects.AddRange(info.SolutionProjects.ToList());
            }

            if (info.PackageFolders != null)
            {
                newInfo.PackageFolders.AddRange(info.PackageFolders.ToList());
            }

            if (info.Prebuilt != null)
            {
                newInfo.Prebuilt.AddRange(info.Prebuilt.ToList());
            }

            if (info.SolutionFolders != null)
            {
                newInfo.SolutionFolders.AddRange(info.SolutionFolders.Select(x => x.Single()).ToList());
            }

            return newInfo;
        }
		public void SaveNormalProject()
		{
			ProjectConfig config1 = new ProjectConfig( "Debug" );
			config1.BasePath = "bin" + Path.DirectorySeparatorChar + "debug";
			config1.Assemblies.Add( Path.GetFullPath( "bin" + Path.DirectorySeparatorChar + "debug" + Path.DirectorySeparatorChar + "assembly1.dll" ) );
			config1.Assemblies.Add( Path.GetFullPath( "bin" + Path.DirectorySeparatorChar + "debug" + Path.DirectorySeparatorChar + "assembly2.dll" ) );

			ProjectConfig config2 = new ProjectConfig( "Release" );
			config2.BasePath = "bin" + Path.DirectorySeparatorChar + "release";
			config2.Assemblies.Add( Path.GetFullPath( "bin" + Path.DirectorySeparatorChar + "release" + Path.DirectorySeparatorChar + "assembly1.dll" ) );
			config2.Assemblies.Add( Path.GetFullPath( "bin" + Path.DirectorySeparatorChar + "release" + Path.DirectorySeparatorChar + "assembly2.dll" ) );

			project.Configs.Add( config1 );
			project.Configs.Add( config2 );

			project.Save( xmlfile );

			CheckContents( NUnitProjectXml.NormalProject );
		}
예제 #14
0
        public void SaveNormalProjectPUT1([PexAssumeUnderTest]String config1, [PexAssumeUnderTest]String config2, [PexAssumeUnderTest]String _xmlFile)
        {
            NUnitProject savedProject = NUnitProject.EmptyProject();
            PexAssume.IsTrue(config1.Contains("t"));
            PexAssume.IsTrue(config2.Contains("t"));

            ProjectConfig config = new ProjectConfig(config1);
            config.BasePath = "bin" + Path.DirectorySeparatorChar + config1;
            config.Assemblies.Add(Path.GetFullPath("bin" + Path.DirectorySeparatorChar + config1 + Path.DirectorySeparatorChar + "assembly1.dll"));
            config.Assemblies.Add(Path.GetFullPath("bin" + Path.DirectorySeparatorChar + config1 + Path.DirectorySeparatorChar + "assembly2.dll"));
            savedProject.Configs.Add(config);

            ProjectConfig _config = new ProjectConfig(config2);
            _config.BasePath = "bin" + Path.DirectorySeparatorChar + config2;
            _config.Assemblies.Add(Path.GetFullPath("bin" + Path.DirectorySeparatorChar + config2 + Path.DirectorySeparatorChar + "assembly1.dll"));
            _config.Assemblies.Add(Path.GetFullPath("bin" + Path.DirectorySeparatorChar + config2 + Path.DirectorySeparatorChar + "assembly2.dll"));
            savedProject.Configs.Add(config);

            savedProject.Save(_xmlFile, true);
            String testOracle = NUnitProjectXml.NormalProject.Replace("Debug", config1);
            testOracle = testOracle.Replace("Release", config2);
            Console.WriteLine(CreatedProjects.currentProject);
            PexAssert.AreEqual(testOracle, CreatedProjects.currentProject);
        }
예제 #15
0
        public void GetQualities()
        {
            ProjectConfig config = new ProjectConfig();
            IList<TaskQuality> qualities;

            #region StrQualities is null

            qualities = config.GetQualities();
            Assert.That(qualities.Count, Is.EqualTo(3));
            Assert.That(qualities.Contains(TaskQuality.Qualified));
            Assert.That(qualities.Contains(TaskQuality.Good));
            Assert.That(qualities.Contains(TaskQuality.Perfect));

            #endregion

            #region StrQualities not null

            config.SetQualities(new List<TaskQuality> { TaskQuality.Good });

            qualities = config.GetQualities();
            Assert.That(qualities.Count, Is.EqualTo(1));
            Assert.That(qualities.Contains(TaskQuality.Good));

            #endregion
        }
예제 #16
0
        public void SetQualities()
        {
            ProjectConfig config = new ProjectConfig();

            IList<TaskQuality> qualities = new List<TaskQuality> { TaskQuality.Good, TaskQuality.Perfect };
            config.SetQualities(qualities);
            qualities = config.GetQualities();

            var result_qualities = config.GetQualities();
            Assert.That(result_qualities.Count, Is.EqualTo(2));
            Assert.That(result_qualities.Contains(TaskQuality.Good));
            Assert.That(result_qualities.Contains(TaskQuality.Perfect));
        }
예제 #17
0
 public TaskBuildElement(DocumentInfo Document, ProjectConfig Configuration)
 {
     m_Document      = Document;
     m_Configuration = Configuration;
 }
 public void TestProjectConfig()
 {
     ProjectConfig project = new ProjectConfig(".\\Project1.mds.tcLS");
     Assert.AreEqual(".\\Log", project.LogDir);
     Assert.AreEqual("Project1", project.Name);
 }
예제 #19
0
        public void Initialize(ProjectConfig config)
        {
            Tables = new List <TableInfo>();
            StagingOptions options = new StagingOptions(config.ProjectName, config.ConnectionString)
            {
                Provider = ProviderType.PostgreSQL
            };

            dbContext = new PgDbContext(options);

            #region dir

            CheckNotNull.NotEmpty(config.ProjectName, nameof(config.ProjectName));

            if (config.Mode == GeneralInfo.Db)
            {
                CheckNotNull.NotEmpty(config.OutputDir, nameof(config.OutputDir));
                Config = new GeneralConfig
                {
                    OutputDir   = config.OutputDir,
                    ProjectName = config.ProjectName,
                    ModelPath   = config.OutputDir
                };

                if (!Directory.Exists(Config.ModelPath))
                {
                    Directory.CreateDirectory(Config.ModelPath);
                }
            }
            #endregion

            #region Schemas
            string[] filters = new string[this.Filters.Count];
            for (int i = 0; i < Filters.Count; i++)
            {
                filters[i] = $"'{Filters[i]}'";
            }

            string        sql     = $@"SELECT schema_name FROM information_schema.schemata WHERE SCHEMA_NAME NOT IN({string.Join(",", filters)}) ORDER BY SCHEMA_NAME; ";
            List <string> schemas = new List <string>();
            dbContext.Execute.ExecuteDataReader(dr =>
            {
                schemas.Add(dr[0].ToString());
            }, CommandType.Text, sql);
            #endregion

            #region Tables
            foreach (var schema in schemas)
            {
                string _sqltext = $@"SELECT table_name,'table' as type FROM INFORMATION_SCHEMA.tables WHERE table_schema='{schema}' AND table_type='BASE TABLE'
UNION ALL
SELECT table_name,'view' as type FROM INFORMATION_SCHEMA.views WHERE table_schema = '{schema}'";
                dbContext.Execute.ExecuteDataReader(dr =>
                {
                    var table = new TableInfo()
                    {
                        Schema = schema,
                        Name   = dr["table_name"].ToString(),
                        Type   = dr["type"].ToString() == "table" ? TableType.Table : TableType.View
                    };
                    GetFields(table);
                    Tables.Add(table);
                }, CommandType.Text, _sqltext);
            }
            #endregion
        }
예제 #20
0
 /// <summary>
 /// Needed for debugging.
 /// </summary>
 public static void Empty()
 {
     ActiveConfig = new ProjectConfig();
 }
예제 #21
0
        /// <summary>
        /// The environment calls this to set the currently selected objects that the property page should show.
        /// </summary>
        /// <param name="cObjects">The count of elements in <paramref name="ppunk"/>.</param>
        /// <param name="ppunk">An array of <b>IUnknown</b> objects to show in the property page.</param>
        /// <remarks>We are supposed to cache these objects until we get another call with
        /// <paramref name="cObjects"/> = 0.  Also, the environment is supposed to call this before calling
        /// <see cref="IPropertyPage.Activate"/>, but don't count on it.</remarks>
        void IPropertyPage.SetObjects(uint cObjects, object[] ppunk)
        {
            if (cObjects == 0)
            {
                this.ProjectMgr = null;
                return;
            }

            if (ppunk[0] is ProjectConfig)
            {
                List <ProjectConfig> configs = new List <ProjectConfig>();

                for (int i = 0; i < cObjects; i++)
                {
                    ProjectConfig config = (ProjectConfig)ppunk[i];

                    if (this.ProjectMgr == null)
                    {
                        this.ProjectMgr = config.ProjectMgr;
                    }

                    configs.Add(config);
                }

                this.ProjectConfigs = new ReadOnlyCollection <ProjectConfig>(configs);
            }
            else
            if (ppunk[0] is NodeProperties)
            {
                if (this.ProjectMgr == null)
                {
                    this.ProjectMgr = (ppunk[0] as NodeProperties).Node.ProjectMgr;
                }

                Dictionary <string, ProjectConfig> configsMap = new Dictionary <string, ProjectConfig>();

                for (int i = 0; i < cObjects; i++)
                {
                    NodeProperties property = (NodeProperties)ppunk[i];
                    IVsCfgProvider provider;
                    ErrorHandler.ThrowOnFailure(property.Node.ProjectMgr.GetCfgProvider(out provider));
                    uint[] expected = new uint[1];
                    ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null));

                    if (expected[0] > 0)
                    {
                        ProjectConfig[] configs = new ProjectConfig[expected[0]];
                        uint[]          actual  = new uint[1];
                        provider.GetCfgs(expected[0], configs, actual, null);

                        foreach (ProjectConfig config in configs)
                        {
                            if (!configsMap.ContainsKey(config.ConfigName))
                            {
                                configsMap.Add(config.ConfigName, config);
                            }
                        }
                    }
                }

                if (configsMap.Count > 0)
                {
                    this.ProjectConfigs = new ReadOnlyCollection <ProjectConfig>(configsMap.Values.ToArray());
                }
            }

            if (!this.IsDisposed && this.ProjectMgr != null)
            {
                this.BindProperties(this.Controls);
                this.IsDirty = false;
            }
        }
예제 #22
0
 public override string GetTargetDataPath(ProjectConfig target)
 {
     return(GetTargetDataPath(m_LocalTempCache, target.ProjectName, target.ProjectVersion));
 }
예제 #23
0
        /// <summary>
        /// Sets the value of the property.
        /// </summary>
        /// <param name="value">Property value to set.</param>
        /// <param name="configs">Optional list of configurations to set the property in;
        /// defaults to the project current configuration</param>
        /// <remarks>
        /// Before calling this method, the caller must ensure that the value is valid according to
        /// the <see cref="PropertyValidator"/> class, and that the project file is writable.
        /// In most cases the caller should also ensure that the new value is different from the
        /// existing value, to avoid dirtying the project file unnecessarily.
        /// </remarks>
        public void SetValue(string value, IList <ProjectConfig> configs)
        {
            WixHelperMethods.VerifyNonNullArgument(value, "value");

            value = value.Trim();

            MSBuild.Project buildProject = this.project.BuildProject;
            if (this.PerUser)
            {
                if (this.project.UserBuildProject == null)
                {
                    this.project.CreateUserBuildProject();
                }

                buildProject = this.project.UserBuildProject;
            }

            value = this.Escape(value);

            if (this.PerConfig)
            {
                if (configs == null || configs.Count == 0)
                {
                    configs = new ProjectConfig[] { this.project.CurrentConfig };
                }

                foreach (ProjectConfig config in configs)
                {
                    bool set = false;

                    // First see if there's an existing property group that matches our condition
                    foreach (ProjectPropertyGroupElement propGroup in buildProject.Xml.PropertyGroups)
                    {
                        // if there is, set it within that group
                        if (String.Equals(propGroup.Condition, config.Condition, StringComparison.Ordinal))
                        {
                            propGroup.SetProperty(this.propertyName, value);
                            set = true;
                            break;
                        }
                    }

                    // If not, add a new property group for the condition and set the property within it
                    if (!set)
                    {
                        ProjectPropertyGroupElement newPropGroup = buildProject.Xml.AddPropertyGroup();
                        newPropGroup.Condition = config.Condition;
                        newPropGroup.SetProperty(this.propertyName, value);
                        set = true;
                    }

                    buildProject.ReevaluateIfNecessary();
                }
            }
            else
            {
                if (this.EndOfProjectFile)
                {
                    List <ProjectPropertyGroupElement> propertyGroupsToDelete = new List <ProjectPropertyGroupElement>();

                    // First see if there's an existing property group with our property
                    foreach (ProjectPropertyGroupElement propGroup in buildProject.Xml.PropertyGroups)
                    {
                        List <ProjectPropertyElement> propertiesToDelete = new List <ProjectPropertyElement>();
                        if (!String.IsNullOrEmpty(propGroup.Condition))
                        {
                            continue;
                        }

                        foreach (ProjectPropertyElement property in propGroup.Properties)
                        {
                            // if there is, remove it so the new value is at the end of the file
                            if (String.IsNullOrEmpty(property.Condition) && String.Equals(property.Name, this.propertyName, StringComparison.OrdinalIgnoreCase))
                            {
                                propertiesToDelete.Add(property);
                            }
                        }

                        foreach (ProjectPropertyElement property in propertiesToDelete)
                        {
                            propGroup.RemoveChild(property);
                        }

                        if (propGroup.Count == 0)
                        {
                            propertyGroupsToDelete.Add(propGroup);
                        }
                    }

                    foreach (ProjectPropertyGroupElement propGroup in propertyGroupsToDelete)
                    {
                        buildProject.Xml.RemoveChild(propGroup);
                    }

                    ProjectPropertyGroupElement newPropGroup = buildProject.Xml.CreatePropertyGroupElement();
                    buildProject.Xml.AppendChild(newPropGroup);
                    newPropGroup.SetProperty(this.propertyName, value);
                }
                else
                {
                    buildProject.SetProperty(this.propertyName, value);
                }
            }

            this.project.InvalidatePropertyCache();
            this.project.SetProjectFileDirty(true);
        }
예제 #24
0
 /// <summary>
 /// 单个检查
 /// </summary>
 /// <param name="project"></param>
 /// <returns></returns>
 public bool Validate(ProjectConfig project)
 {
     return(_builder.Validate(project));
 }
예제 #25
0
        bool BuildElement(DocumentInfo Doc, string ConfigSetting, string AdditionalPredefines, bool OutputMessages, out Types.BuildInfo BuildInfo, out Types.ASM.FileInfo FileInfo)
        {
            BuildInfo            = new C64Studio.Types.BuildInfo();
            BuildInfo.TargetFile = "";
            BuildInfo.TargetType = Types.CompileTargetType.NONE;

            FileInfo = null;

            Types.ASM.FileInfo combinedFileInfo = null;

            try
            {
                if (Doc.Element != null)
                {
                    Doc.Element.CompileTarget     = Types.CompileTargetType.NONE;
                    Doc.Element.CompileTargetFile = null;

                    // check dependencies
                    foreach (var dependency in Doc.Element.ForcedDependency.DependentOnFile)
                    {
                        ProjectElement elementDependency = Doc.Project.GetElementByFilename(dependency.Filename);
                        if (elementDependency == null)
                        {
                            Core.AddToOutput("Could not find dependency for " + dependency.Filename + System.Environment.NewLine);
                            return(false);
                        }

                        Types.ASM.FileInfo dependencyFileInfo = null;

                        // skip building if not required
                        if (!Core.Compiling.NeedsRebuild(elementDependency.DocumentInfo, ConfigSetting))
                        {
                            Core.AddToOutput("Dependency " + dependency.Filename + " is current for config " + ConfigSetting + System.Environment.NewLine);

                            if ((Doc.Type == ProjectElement.ElementType.ASM_SOURCE) ||
                                (Doc.Type == ProjectElement.ElementType.BASIC_SOURCE))
                            {
                                dependencyFileInfo = elementDependency.DocumentInfo.ASMFileInfo;
                                //Debug.Log( "Doc " + Doc.Text + " receives " + dependencyFileInfo.Labels.Count + " dependency labels from dependency " + dependency.Filename );
                            }
                        }
                        else
                        {
                            Types.BuildInfo tempInfo = new C64Studio.Types.BuildInfo();

                            if (!BuildElement(elementDependency.DocumentInfo, ConfigSetting, null, false, out tempInfo, out dependencyFileInfo))
                            {
                                return(false);
                            }
                        }
                        // include symbols from dependency
                        if (dependency.IncludeSymbols)
                        {
                            if (combinedFileInfo == null)
                            {
                                combinedFileInfo = new C64Studio.Types.ASM.FileInfo();
                            }
                            // merge label info
                            if (dependencyFileInfo != null)
                            {
                                foreach (var entry in dependencyFileInfo.Labels)
                                {
                                    if (!combinedFileInfo.Labels.ContainsKey(entry.Key))
                                    {
                                        combinedFileInfo.Labels.Add(entry.Key, entry.Value);
                                    }
                                }
                                //Debug.Log( "Doc " + Doc.Text + " receives " + dependencyFileInfo.Labels.Count + " dependency labels from dependency " + dependency.Filename );
                            }
                        }
                    }
                }

                if (!Doc.Compilable)
                {
                    // not buildable
                    // TODO - Autoexport?
                    return(true);
                }

                ToolInfo tool = Core.DetermineTool(Doc, false);

                ProjectElement.PerConfigSettings configSetting = null;

                Parser.ParserBase parser = Core.DetermineParser(Doc);

                if (Doc.Element != null)
                {
                    if (!Doc.Element.Settings.ContainsKey(ConfigSetting))
                    {
                        Doc.Element.Settings.Add(ConfigSetting, new ProjectElement.PerConfigSettings());
                    }
                    configSetting = Doc.Element.Settings[ConfigSetting];

                    if (!string.IsNullOrEmpty(configSetting.PreBuild))
                    {
                        Core.AddToOutput("Running pre build step on " + Doc.Element.Name + System.Environment.NewLine);
                        if (!Core.MainForm.RunCommand(Doc, "pre build", configSetting.PreBuild))
                        {
                            return(false);
                        }
                    }
                    if (configSetting.PreBuildChain.Active)
                    {
                        if (!BuildChain(configSetting.PreBuildChain, "pre build chain", OutputMessages))
                        {
                            return(false);
                        }
                    }
                    Core.AddToOutput("Running build on " + Doc.Element.Name + " with configuration " + ConfigSetting + System.Environment.NewLine);
                }
                else
                {
                    Core.AddToOutput("Running build on " + Doc.DocumentFilename + System.Environment.NewLine);
                }

                // include previous symbols
                if (parser is Parser.ASMFileParser)
                {
                    ((Parser.ASMFileParser)parser).InitialFileInfo = combinedFileInfo;
                    if (combinedFileInfo != null)
                    {
                        //Debug.Log( "Doc " + Doc.Text + " receives " + combinedFileInfo.Labels.Count + " initial labels" );
                    }
                    if (!string.IsNullOrEmpty(AdditionalPredefines))
                    {
                        ((Parser.ASMFileParser)parser).ParseAndAddPreDefines(AdditionalPredefines);
                    }
                }
                else if (parser is Parser.BasicFileParser)
                {
                    // BASIC may receive symbols from assembly
                    ((Parser.BasicFileParser)parser).InitialFileInfo = combinedFileInfo;
                    if (combinedFileInfo != null)
                    {
                        //Debug.Log( "Doc " + Doc.Text + " receives " + combinedFileInfo.Labels.Count + " initial labels" );
                    }
                    Doc.ASMFileInfo = combinedFileInfo;
                }

                if ((configSetting != null) &&
                    (!string.IsNullOrEmpty(configSetting.CustomBuild)))
                {
                    Core.AddToOutput("Running custom build step on " + Doc.Element.Name + " with configuration " + ConfigSetting + System.Environment.NewLine);
                    if (!Core.MainForm.RunCommand(Doc, "custom build", configSetting.CustomBuild))
                    {
                        return(false);
                    }
                }
                else
                {
                    ProjectConfig config = null;
                    if (Doc.Project != null)
                    {
                        config = Doc.Project.Settings.Configs[ConfigSetting];
                    }

                    int startAddress = -1;
                    if ((Doc.Type == ProjectElement.ElementType.BASIC_SOURCE) &&
                        (Doc.BaseDoc != null))
                    {
                        // BASIC files bring a start address
                        startAddress = ((SourceBasicEx)Doc.BaseDoc).StartAddress;
                    }
                    if ((!Core.MainForm.ParseFile(parser, Doc, config, OutputMessages, CreatePreProcessedFile)) ||
                        (!parser.Assemble(new C64Studio.Parser.CompileConfig()
                    {
                        TargetType = Core.DetermineTargetType(Doc, parser),
                        OutputFile = Core.DetermineTargetFilename(Doc, parser),
                        AutoTruncateLiteralValues = Core.Settings.ASMAutoTruncateLiteralValues,
                        StartAddress = startAddress
                    })) ||
                        (parser.Errors > 0))
                    {
                        Core.MainForm.AddOutputMessages(parser);

                        Core.AddToOutput("Build failed, " + parser.Warnings.ToString() + " warnings, " + parser.Errors.ToString() + " errors encountered" + System.Environment.NewLine);
                        // always show messages if we fail!
                        //if ( OutputMessages )
                        {
                            Core.Navigating.UpdateFromMessages(parser.Messages,
                                                               (parser is Parser.ASMFileParser) ? ((Parser.ASMFileParser)parser).ASMFileInfo : null,
                                                               Doc.Project);
                            Core.MainForm.m_CompileResult.UpdateFromMessages(parser, Doc.Project);
                        }
                        Core.ShowDocument(Core.MainForm.m_CompileResult);
                        Core.MainForm.AppState = Types.StudioState.NORMAL;

                        if (Core.Settings.PlaySoundOnBuildFailure)
                        {
                            System.Media.SystemSounds.Exclamation.Play();
                        }
                        return(false);
                    }

                    Core.MainForm.AddOutputMessages(parser);

                    var    compileTarget     = Core.DetermineTargetType(Doc, parser);
                    string compileTargetFile = Core.DetermineTargetFilename(Doc, parser);
                    if (Doc.Element != null)
                    {
                        Doc.Element.CompileTargetFile = compileTargetFile;
                    }

                    if (compileTargetFile == null)
                    {
                        if (parser is Parser.ASMFileParser)
                        {
                            parser.AddError(-1, Types.ErrorCode.E0001_NO_OUTPUT_FILENAME, "No output filename was given, missing element setting or !to <Filename>,<FileType> macro?");
                        }
                        else
                        {
                            parser.AddError(-1, Types.ErrorCode.E0001_NO_OUTPUT_FILENAME, "No output filename was given, missing element setting");
                        }
                        if (OutputMessages)
                        {
                            Core.Navigating.UpdateFromMessages(parser.Messages,
                                                               (parser is Parser.ASMFileParser) ? ((Parser.ASMFileParser)parser).ASMFileInfo : null,
                                                               Doc.Project);

                            Core.MainForm.m_CompileResult.UpdateFromMessages(parser, Doc.Project);
                        }
                        Core.ShowDocument(Core.MainForm.m_CompileResult);
                        Core.MainForm.AppState = Types.StudioState.NORMAL;

                        if (Core.Settings.PlaySoundOnBuildFailure)
                        {
                            System.Media.SystemSounds.Exclamation.Play();
                        }
                        return(false);
                    }
                    BuildInfo.TargetFile = compileTargetFile;
                    BuildInfo.TargetType = compileTarget;

                    if (parser.Warnings > 0)
                    {
                        if (OutputMessages)
                        {
                            Core.Navigating.UpdateFromMessages(parser.Messages,
                                                               (parser is Parser.ASMFileParser) ? ((Parser.ASMFileParser)parser).ASMFileInfo : null,
                                                               Doc.Project);

                            Core.MainForm.m_CompileResult.UpdateFromMessages(parser, Doc.Project);
                        }
                        Core.ShowDocument(Core.MainForm.m_CompileResult);
                    }
                }

                if (string.IsNullOrEmpty(BuildInfo.TargetFile))
                {
                    Core.AddToOutput("No target file name specified" + System.Environment.NewLine);
                    Core.MainForm.AppState = Types.StudioState.NORMAL;
                    if (Core.Settings.PlaySoundOnBuildFailure)
                    {
                        System.Media.SystemSounds.Exclamation.Play();
                    }
                    return(false);
                }
                // write output if applicable
                if ((parser.AssembledOutput != null) &&
                    (parser.AssembledOutput.Assembly != null))
                {
                    try
                    {
                        System.IO.File.WriteAllBytes(BuildInfo.TargetFile, parser.AssembledOutput.Assembly.Data());
                    }
                    catch (System.Exception ex)
                    {
                        Core.AddToOutput("Build failed, Could not create output file " + parser.CompileTargetFile + System.Environment.NewLine);
                        Core.AddToOutput(ex.ToString() + System.Environment.NewLine);
                        Core.MainForm.AppState = Types.StudioState.NORMAL;
                        if (Core.Settings.PlaySoundOnBuildFailure)
                        {
                            System.Media.SystemSounds.Exclamation.Play();
                        }
                        return(false);
                    }
                    Core.AddToOutput("Build successful, " + parser.Warnings.ToString() + " warnings, 0 errors encountered" + System.Environment.NewLine);
                    Core.AddToOutput("Start address $" + parser.AssembledOutput.OriginalAssemblyStartAddress.ToString("X4")
                                     + " to $" + (parser.AssembledOutput.OriginalAssemblyStartAddress + parser.AssembledOutput.OriginalAssemblySize - 1).ToString("X4")
                                     + ", size " + parser.AssembledOutput.OriginalAssemblySize + " bytes" + System.Environment.NewLine);
                    Core.AddToOutput("Compiled to file " + BuildInfo.TargetFile + ", " + parser.AssembledOutput.Assembly.Length + " bytes" + System.Environment.NewLine);

                    //Debug.Log( "File " + Doc.DocumentFilename + " was rebuilt for config " + ConfigSetting + " this round" );
                }

                if ((configSetting != null) &&
                    (configSetting.PostBuildChain.Active))
                {
                    if (!BuildChain(configSetting.PostBuildChain, "post build chain", OutputMessages))
                    {
                        return(false);
                    }
                }


                if ((configSetting != null) &&
                    (!string.IsNullOrEmpty(configSetting.PostBuild)))
                {
                    Core.ShowDocument(Core.MainForm.m_Output);
                    Core.AddToOutput("Running post build step on " + Doc.Element.Name + System.Environment.NewLine);
                    if (!Core.MainForm.RunCommand(Doc, "post build", configSetting.PostBuild))
                    {
                        return(false);
                    }
                }

                Doc.HasBeenSuccessfullyBuilt = true;

                if (parser is Parser.ASMFileParser)
                {
                    FileInfo = ((Parser.ASMFileParser)parser).ASMFileInfo;
                    // update symbols in main asm file
                    Doc.SetASMFileInfo(FileInfo, parser.KnownTokens(), parser.KnownTokenInfo());
                    //Debug.Log( "Doc " + Doc.Text + " gets " + ( (SourceASM)Doc ).ASMFileInfo.Labels.Count + " labels" );
                }

                if (FileInfo != null)
                {
                    if (!string.IsNullOrEmpty(FileInfo.LabelDumpFile))
                    {
                        Core.MainForm.DumpLabelFile(FileInfo);
                    }
                }

                Core.Compiling.m_RebuiltFiles.Add(Doc.DocumentFilename);

                return(true);
            }
            catch (Exception ex)
            {
                Core.AddToOutput("An error occurred during building an element\r\n" + ex.ToString());
                return(false);
            }
        }
예제 #26
0
 private static ConversionEvent BuildConversionEvent(string eventName, ProjectConfig projectConfig)
 {
     return(UserEventFactory.CreateConversionEvent(projectConfig, eventName, TestUserId,
                                                   new UserAttributes(), new EventTags()));
 }
예제 #27
0
 public override string GetTargetDataUri(ProjectConfig target)
 {
     return(Path.Combine(GetTargetDataPath(target), s_ModuleData));
 }
예제 #28
0
        void PopulateModelFromConfig(ProjectConfig config)
        {
            _model.ProjectSettingsPath = config.ProjectSettingsPath;

            _model.ClearPluginItems();
            foreach (var name in config.PluginsFolder)
            {
                _model.AddPluginItem(name);
            }

            _model.ClearAssetItems();
            foreach (var name in config.AssetsFolder)
            {
                _model.AddAssetItem(name);
            }

            _model.ClearSolutionProjects();
            foreach (var name in config.SolutionProjects)
            {
                _model.AddVsProject(name);
            }

            _model.ClearPrebuiltProjects();
            foreach (var name in config.Prebuilt)
            {
                _model.AddPrebuilt(name);
            }

            _model.ClearSolutionFolders();
            foreach (var pair in config.SolutionFolders)
            {
                _model.AddSolutionFolder(pair.Key, pair.Value);
            }

            _model.ClearSavedPackageFolders();
            foreach (var pair in config.PackageFolders)
            {
                _model.AddSavedPackageFolder(pair);
            }
        }
예제 #29
0
 private string GetRemoteTargetDataUri(ProjectConfig target)
 {
     return(Path.Combine(GetRemoteTargetDataPath(target), s_ModuleData));
 }
예제 #30
0
        public static void ProcessFile(ProjectConfig project)
        {
            var sw = Stopwatch.StartNew();

            while (true)
            {
                try
                {
                    var pyxelPath = project.GetPyxelPath();
                    Console.WriteLine($"Processing { pyxelPath}");
                    if (File.Exists(pyxelPath))
                    {
                        using (var stream = File.Open(pyxelPath, FileMode.Open, FileAccess.Read, FileShare.Read))
                        {
                            using (var doc = new PyxelParser.Document(stream))
                            {
                                var meta = doc.MetaData.Value;

                                bool sheetFinder(KeyValuePair <int, PyxelParser.Layer> l) => l.Value.Name.Trim().Equals("Sheet", StringComparison.InvariantCultureIgnoreCase);

                                if (!meta.Canvas.Layers.Any(sheetFinder))
                                {
                                    throw new KeyNotFoundException("Could not find a layer named 'Sheet'");
                                }

                                var sheetLayer = meta.Canvas.Layers.Single(sheetFinder);

                                var columns = meta.Canvas.GetColumns();
                                var rows    = meta.Canvas.GetRows();

                                using (var img = doc.GetImages(entry => Image.FromStream(entry.Stream)).Single(i => i.Path == $"layer{sheetLayer.Key}.png").Value)
                                {
                                    Directory.CreateDirectory(Path.GetDirectoryName(project.GetTilesetImagePath()));
                                    var imgPath = project.GetTilesetImagePath();
                                    SaveSheet(project.Tileset, meta, columns, rows, img, imgPath);
                                }

                                var ts = new Tiled.Tileset()
                                {
                                    firstgid         = 1,
                                    Columns          = columns,
                                    ImagePath        = project.Tileset.ImageFile,
                                    imagewidth       = meta.Canvas.Width,
                                    imageheight      = meta.Canvas.Height,
                                    margin           = 0,
                                    name             = project.Tileset.Name,
                                    spacing          = project.Tileset.Spacing,
                                    TileCount        = columns * rows,
                                    tileheight       = meta.Canvas.TileHeight,
                                    tilewidth        = meta.Canvas.TileWidth,
                                    transparentcolor = null
                                };
                                Directory.CreateDirectory(Path.GetDirectoryName(project.GetTilesetJsonPath()));
                                File.WriteAllText(project.GetTilesetJsonPath(), JsonConvert.SerializeObject(ts, Formatting.Indented));
                            }
                        }
                    }

                    break;
                }
                catch (IOException)
                {
                    System.Threading.Thread.Sleep(10);
                    if (sw.Elapsed > TimeSpan.FromSeconds(3))
                    {
                        throw;
                    }
                }
            }
        }
예제 #31
0
 private string GetRemoteTargetInfoUri(ProjectConfig target)
 {
     return(Path.Combine(GetRemoteModulePackagePath(target), target.ProjectVersion, s_ModuleTarget));
 }
예제 #32
0
 internal static Project create(User user, string name, string description, ProjectConfig config, Project parent)
 {
     Project project = new Project { Name = name, Description = description, Config = config, Parent = parent };
     user.Create(project);
     return project;
 }
예제 #33
0
 public void Initialize()
 {
     LoggerMock         = new Mock <ILogger>();
     DecisionReasonsObj = new DecisionReasons();
     Config             = DatafileProjectConfig.Create(TestData.Datafile, LoggerMock.Object, new ErrorHandler.NoOpErrorHandler());
 }
예제 #34
0
        public void CodeFirst(ProjectConfig config)
        {
            Initialize(config);

            StringBuilder    sb     = new StringBuilder();
            List <TableInfo> tables = new List <TableInfo>();

            var fileName = config.ProjectName + ".dll";
            var dir      = System.IO.Directory.GetCurrentDirectory();

            var providerFile = System.IO.Directory.GetFiles(dir, fileName, SearchOption.AllDirectories).FirstOrDefault();

            if (string.IsNullOrEmpty(providerFile))
            {
                throw new FileNotFoundException($"在 {dir} 搜索不到文件 {fileName}");
            }

            var types = Assembly.LoadFrom(providerFile).GetTypes();
            List <TableInfo> entitys = new List <TableInfo>();

            foreach (var t in types)
            {
                var tableAttribute = t.GetCustomAttribute <TableAttribute>();
                if (tableAttribute == null)
                {
                    continue;
                }

                entitys.Add(new TableInfo
                {
                    Name       = tableAttribute.Name,
                    Schema     = tableAttribute.Schema,
                    EntityType = t
                });
            }

            foreach (var ent in entitys)
            {
                SerializeField(ent, ent.EntityType);

                var table = Tables.Where(f => f.Schema == ent.Schema && f.Name == ent.Name).FirstOrDefault();
                if (table == null) // CREATE
                {
                    DumpTable(ent, ref sb);
                }
                else // ALTER
                {
                    DumpAlter(ent, table, ref sb);
                }
            }

            // 删除实体
            foreach (var table in Tables)
            {
                if (entitys.Where(f => f.Schema == table.Schema && f.Name == table.Name).FirstOrDefault() == null)
                {
                    sb.AppendLine($"DROP TABLE {MyStagingUtils.GetTableName(table, ProviderType.PostgreSQL)};");
                }
            }

            var sql = sb.ToString();

            if (string.IsNullOrEmpty(sql))
            {
                Console.WriteLine("数据模型没有可执行的更改.");
            }
            else
            {
                Console.WriteLine("------------------SQL------------------");
                Console.WriteLine(sql);
                Console.WriteLine("------------------SQL END------------------");
                dbContext.Execute.ExecuteNonQuery(CommandType.Text, sql);
            }
        }
예제 #35
0
 public void Cleanup()
 {
     LoggerMock = null;
     Config     = null;
 }
        /// <summary>
        /// Constructor for IVSOutputGroup2 implementation
        /// </summary>
        /// <param name="outputName">Name of the output group. See VS_OUTPUTGROUP_CNAME_Build in vsshell.idl for the list of standard values</param>
        /// <param name="msBuildTargetName">MSBuild target name</param>
        /// <param name="projectManager">Project that produce this output</param>
        /// <param name="configuration">Configuration that produce this output</param>
        internal OutputGroup(string outputName, string msBuildTargetName, ProjectNode projectManager, ProjectConfig configuration)
        {
            if (outputName == null)
            {
                throw new ArgumentNullException("outputName");
            }
            if (msBuildTargetName == null)
            {
                throw new ArgumentNullException("outputName");
            }
            if (projectManager == null)
            {
                throw new ArgumentNullException("projectManager");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            name       = outputName;
            targetName = msBuildTargetName;
            project    = projectManager;
            projectCfg = configuration;
        }
예제 #37
0
        static int Main(string[] args)
        {
            var configReader = new ArgumentEvaluator();
            var config       = configReader.CheckParams(args, out string additionalDefines, out bool showNoWarnings, out List <string> WarningsToIgnore);

            if (config == null)
            {
                return(1);
            }
            config.Assembler = C64Studio.Types.AssemblerType.C64_STUDIO;

            var parser = new ASMFileParser();

            var projectConfig = new ProjectConfig();
            // TODO - add defines if given

            string fullPath = System.IO.Path.GetFullPath(config.InputFile);

            if (string.IsNullOrEmpty(config.OutputFile))
            {
                // provide a default
                config.OutputFile = GR.Path.RenameExtension(config.InputFile, ".prg");
                config.TargetType = C64Studio.Types.CompileTargetType.PRG;
            }

            bool result = parser.ParseFile(fullPath, "", projectConfig, config, additionalDefines);

            if (!result)
            {
                System.Console.WriteLine("Parsing the file failed:");

                DisplayOutput(parser, WarningsToIgnore, showNoWarnings);
                return(1);
            }

            // default to plain
            C64Studio.Types.CompileTargetType compileTargetType = C64Studio.Types.CompileTargetType.PLAIN;
            // command line given target type overrides everything
            if (config.TargetType != C64Studio.Types.CompileTargetType.NONE)
            {
                compileTargetType = config.TargetType;
            }
            else if (parser.CompileTarget != C64Studio.Types.CompileTargetType.NONE)
            {
                compileTargetType = parser.CompileTarget;
            }
            config.TargetType = compileTargetType;

            if (!parser.Assemble(config))
            {
                System.Console.WriteLine("Assembling the output failed");
                DisplayOutput(parser, WarningsToIgnore, showNoWarnings);
                return(1);
            }
            DisplayOutput(parser, WarningsToIgnore, showNoWarnings);
            if (!GR.IO.File.WriteAllBytes(config.OutputFile, parser.AssembledOutput.Assembly))
            {
                System.Console.WriteLine("Failed to write output file");
                return(1);
            }
            if (!string.IsNullOrEmpty(config.LabelDumpFile))
            {
                DumpLabelFile(parser.ASMFileInfo);
            }

            return(0);
        }
예제 #38
0
        public ConfigEvaluatorTestsBase()
        {
            this.configEvaluator = new RolloutEvaluator(logger, new ConfigDeserializer(logger, JsonSerializer.Create()));

            this.config = new ProjectConfig(this.GetSampleJson(), DateTime.UtcNow, null);
        }
예제 #39
0
        /// <summary>
        /// The environment calls this to set the currently selected objects that the property page should show.
        /// </summary>
        /// <param name="count">The count of elements in <paramref name="punk"/>.</param>
        /// <param name="punk">An array of <b>IUnknown</b> objects to show in the property page.</param>
        /// <remarks>
        /// We are supposed to cache these objects until we get another call with <paramref name="count"/> = 0.
        /// Also, the environment is supposed to call this before calling <see cref="IPropertyPage2.Activate"/>,
        /// but like all things when interacting with Visual Studio, don't trust that and code defensively.
        /// </remarks>
        void IPropertyPage.SetObjects(uint count, object[] punk)
        {
            if (count == 0)
            {
                if (this.project != null)
                {
                    this.project.OutputTypeChanged -= this.HandleOutputTypeChanged;
                    this.project = null;
                }

                return;
            }

            if (punk[0] is ProjectConfig)
            {
                List <ProjectConfig> configs = new List <ProjectConfig>();

                for (int i = 0; i < count; i++)
                {
                    ProjectConfig config = (ProjectConfig)punk[i];

                    if (this.project == null)
                    {
                        this.project = config.ProjectMgr as WixProjectNode;
                        this.project.OutputTypeChanged += this.HandleOutputTypeChanged;
                    }

                    configs.Add(config);
                }

                this.projectConfigs = configs.ToArray();
            }
            else if (punk[0] is NodeProperties)
            {
                if (this.project == null)
                {
                    this.project = (punk[0] as NodeProperties).Node.ProjectMgr as WixProjectNode;
                    this.project.OutputTypeChanged += this.HandleOutputTypeChanged;
                }

                Dictionary <string, ProjectConfig> configsMap = new Dictionary <string, ProjectConfig>();

                for (int i = 0; i < count; i++)
                {
                    NodeProperties property = (NodeProperties)punk[i];
                    IVsCfgProvider provider;
                    ErrorHandler.ThrowOnFailure(property.Node.ProjectMgr.GetCfgProvider(out provider));
                    uint[] expected = new uint[1];
                    ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null));
                    if (expected[0] > 0)
                    {
                        ProjectConfig[] configs = new ProjectConfig[expected[0]];
                        uint[]          actual  = new uint[1];
                        int             hr      = provider.GetCfgs(expected[0], configs, actual, null);
                        if (hr != 0)
                        {
                            Marshal.ThrowExceptionForHR(hr);
                        }

                        foreach (ProjectConfig config in configs)
                        {
                            if (!configsMap.ContainsKey(config.ConfigName))
                            {
                                configsMap.Add(config.ConfigName, config);
                            }
                        }
                    }
                }

                if (configsMap.Count > 0)
                {
                    if (this.projectConfigs == null)
                    {
                        this.projectConfigs = new ProjectConfig[configsMap.Keys.Count];
                    }

                    configsMap.Values.CopyTo(this.projectConfigs, 0);
                }
            }

            if (this.active && this.project != null)
            {
                this.PropertyPagePanel.BindProperties();
                this.IsDirty = false;
            }
        }
예제 #40
0
		public virtual void SetObjects(uint count, object[] punk)
		{
			if(count > 0)
			{
				if(punk[0] is ProjectConfig)
				{
					ArrayList configs = new ArrayList();

					for(int i = 0; i < count; i++)
					{
						ProjectConfig config = (ProjectConfig)punk[i];

						if(this.project == null)
						{
							this.project = config.ProjectMgr;
						}

						configs.Add(config);
					}

					this.projectConfigs = (ProjectConfig[])configs.ToArray(typeof(ProjectConfig));
				}
				else if(punk[0] is NodeProperties)
				{
					if(this.project == null)
					{
						this.project = (punk[0] as NodeProperties).Node.ProjectMgr;
					}

					System.Collections.Generic.Dictionary<string, ProjectConfig> configsMap = new System.Collections.Generic.Dictionary<string, ProjectConfig>();

					for(int i = 0; i < count; i++)
					{
						NodeProperties property = (NodeProperties)punk[i];
						IVsCfgProvider provider;
						ErrorHandler.ThrowOnFailure(property.Node.ProjectMgr.GetCfgProvider(out provider));
						uint[] expected = new uint[1];
						ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null));
						if(expected[0] > 0)
						{
							ProjectConfig[] configs = new ProjectConfig[expected[0]];
							uint[] actual = new uint[1];
							ErrorHandler.ThrowOnFailure(provider.GetCfgs(expected[0], configs, actual, null));

							foreach(ProjectConfig config in configs)
							{
								if(!configsMap.ContainsKey(config.ConfigName))
								{
									configsMap.Add(config.ConfigName, config);
								}
							}
						}
					}

					if(configsMap.Count > 0)
					{
						if(this.projectConfigs == null)
						{
							this.projectConfigs = new ProjectConfig[configsMap.Keys.Count];
						}
						configsMap.Values.CopyTo(this.projectConfigs, 0);
					}
				}
			}
			else
			{
				this.project = null;
			}

			if(this.active && this.project != null)
			{
				UpdateObjects();
			}
		}
예제 #41
0
 private string GetRemoteModulePackagePath(ProjectConfig package)
 {
     return(Path.Combine(ModuleRoot.OriginalString, s_ModulePath, package.ProjectName));
 }
예제 #42
0
 public void SetUp()
 {
     config = new ProjectConfig( "Debug" );
     project = new NUnitProject( TestPath( "/test/myproject.nunit" ) );
     project.Configs.Add( config );
 }
예제 #43
0
        protected virtual void Initialize(string connectionString = null)
        {
            if (string.IsNullOrWhiteSpace(connectionString))
                connectionString = GetConfiguredConnectionString();

            using (var db = new BuildVersioningDataContext(connectionString))
            {
                DeleteTestProjectAndTestProjectConfig(db);

                var project =
                    new Project
                    {
                        Name = TestProjectName,
                        BuildNumber = 0,
                        DateBuildNumberUpdated = DateTime.Now
                    };
                db.Projects.Add(project);
                db.SaveChanges();

                var projectConfig =
                    new ProjectConfig
                    {
                        ProjectId = project.Id,
                        Name = TestProjectConfigName,
                        GeneratedBuildNumberPosition = 3,
                        GeneratedVersionPart1 = 1,
                        GeneratedVersionPart2 = 0,
                        GeneratedVersionPart3 = 0,
                        GeneratedVersionPart4 = 0,
                        ProductVersionPart1 = 1,
                        ProductVersionPart2 = 0,
                        ProductVersionPart3 = 0,
                        ProductVersionPart4 = 0,
                        ReleaseType = ReleaseType.PreRelease
                    };
                db.ProjectConfigs.Add(projectConfig);
                db.SaveChanges();
            }
        }
예제 #44
0
        public static void Run(IConsole console, ProjectFile pf, ProjectConfig cfg, bool verbose)
        {
            try
            {
                pf.LoadAll();
            }
            catch (Exception e)
            {
                console.Error.WriteLine($"Failed to load project: {e}");
                return;
            }

            List <Command> commands = new List <Command>()
            {
                new Command(new[] { "exit", "quit" },
                            "Exits this shell.",
                            "[exit|quit]",
                            args =>
                {
                    // TODO prompt to save anything? maybe not?
                    return(Command.CommandResult.Quit);
                }),

                new Command(new[] { "reload" },
                            "Reloads the project as it currently is on disk.",
                            "reload <optional:data>",
                            args =>
                {
                    if (!ReloadProject(console, ref pf, cfg, verbose, (args.Length == 2 && args[1] == "data")))
                    {
                        return(Command.CommandResult.Quit);
                    }
                    return(Command.CommandResult.None);
                }),

                new Command(new[] { "add" },
                            "Adds an asset from game data to the project.",
                            "add <asset_type> <asset_names>",
                            args =>
                {
                    if (args.Length != 3)
                    {
                        return(Command.CommandResult.InvalidSyntax);
                    }
                    switch (args[1].ToLowerInvariant())
                    {
                    case "path":
                    case "paths":
                        AddAsset(console, args[2], pf.Paths, pf);
                        break;

                    case "sprite":
                    case "sprites":
                        AddAsset(console, args[2], pf.Sprites, pf);
                        break;

                    case "sound":
                    case "sounds":
                        AddAsset(console, args[2], pf.Sounds, pf);
                        break;

                    case "object":
                    case "objects":
                        AddAsset(console, args[2], pf.Objects, pf);
                        break;

                    case "background":
                    case "backgrounds":
                        AddAsset(console, args[2], pf.Backgrounds, pf);
                        break;

                    case "font":
                    case "fonts":
                        AddAsset(console, args[2], pf.Fonts, pf);
                        break;

                    case "room":
                    case "rooms":
                        AddAsset(console, args[2], pf.Rooms, pf);
                        break;

                    default:
                        return(Command.CommandResult.InvalidSyntax);
                    }
                    return(Command.CommandResult.None);
                }),

                new Command(new[] { "apply" },
                            "Applies the project to the input data file, resulting in output.",
                            "apply",
                            args =>
                {
                    try
                    {
                        pf.LoadAll();

                        using FileStream fs       = new FileStream(Path.Combine(cfg.OutputDirectory, pf.DataHandle.Filename), FileMode.Create);
                        using GMDataWriter writer = new GMDataWriter(pf.DataHandle, fs, fs.Name, pf.DataHandle.Length);

                        console.Output.WriteLine("Converting to data...");
                        pf.ConvertToData();
                        console.Output.WriteLine("Writing main data file...");
                        writer.Write();
                        writer.Flush();
                        foreach (GMWarning w in writer.Warnings)
                        {
                            console.Output.WriteLine($"[WARN: {w.Level}] {w.Message}"); // todo formatting
                        }
                    }
                    catch (Exception e)
                    {
                        console.Error.WriteLine($"Failed to apply project: {e}");
                    }

                    if (!ReloadProject(console, ref pf, cfg, verbose))
                    {
                        return(Command.CommandResult.Quit);
                    }

                    return(Command.CommandResult.None);
                })
            };
            int helpLength = commands.Max(c => c.Usage.Length) + 1;

            console.Error.WriteLine();
            console.Error.WriteLine("DogScepter project shell");

            bool running = true;

            while (running)
            {
                console.Output.Write("> ");
                string   command = console.Input.ReadLine();
                string[] args    = command.Split(' ', StringSplitOptions.RemoveEmptyEntries);

                if (args.Length >= 1)
                {
                    string name = args[0].ToLowerInvariant();

                    if (name == "help")
                    {
                        if (args.Length == 2)
                        {
                            string  helpName = args[1].ToLowerInvariant();
                            Command cmd      = commands.Find(c => c.Names.Contains(helpName));
                            if (cmd != null)
                            {
                                console.Output.WriteLine(cmd.Description);
                                console.Output.WriteLine(cmd.Usage);
                                console.Output.WriteLine();
                                continue;
                            }
                        }

                        foreach (var cmd in commands)
                        {
                            console.Output.WriteLine(cmd.Usage + new string(' ', helpLength - cmd.Usage.Length) +
                                                     " |  " + cmd.Description);
                        }
                    }
                    else
                    {
                        Command cmd = commands.Find(c => c.Names.Contains(name));
                        if (cmd == null)
                        {
                            console.Error.WriteLine($"Unknown command \"{args[0]}\"");
                        }
                        else
                        {
                            switch (cmd.Function(args))
                            {
                            case Command.CommandResult.InvalidSyntax:
                                console.Error.WriteLine("Invalid syntax; proper usage:");
                                console.Error.WriteLine("  " + cmd.Usage);
                                break;

                            case Command.CommandResult.Quit:
                                running = false;
                                break;
                            }
                        }
                    }
                }

                console.Output.WriteLine();
            }
        }
    }
		public ProjectConfigProperties(ProjectConfig projectConfig)
		{
			this.projectConfig = projectConfig;
		}
예제 #46
0
        /// <summary>
        /// Load a non-C++ project in the MsBuild format introduced with VS2005
        /// </summary>
        private void LoadMSBuildProject()
        {
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(_doc.NameTable);

            namespaceManager.AddNamespace("msbuild", "http://schemas.microsoft.com/developer/msbuild/2003");

            XmlNodeList nodes = _doc.SelectNodes("/msbuild:Project/msbuild:PropertyGroup", namespaceManager);

            if (nodes == null)
            {
                return;
            }

            MsBuildDocument = _doc;

            XmlElement assemblyNameElement = (XmlElement)_doc.SelectSingleNode("/msbuild:Project/msbuild:PropertyGroup/msbuild:AssemblyName", namespaceManager);
            string     assemblyName        = assemblyNameElement == null ? Name : assemblyNameElement.InnerText;

            XmlElement outputTypeElement = (XmlElement)_doc.SelectSingleNode("/msbuild:Project/msbuild:PropertyGroup/msbuild:OutputType", namespaceManager);
            string     outputType        = outputTypeElement == null ? "Library" : outputTypeElement.InnerText;

            if (outputType == "Exe" || outputType == "WinExe")
            {
                assemblyName = assemblyName + ".exe";
            }
            else
            {
                assemblyName = assemblyName + ".dll";
            }

            string commonOutputPath    = null;
            var    explicitOutputPaths = new Dictionary <string, string>();

            foreach (XmlElement configNode in nodes)
            {
                string name = GetConfigNameFromCondition(configNode);

                XmlElement outputPathElement = (XmlElement)configNode.SelectSingleNode("msbuild:OutputPath", namespaceManager);
                string     outputPath        = null;
                if (outputPathElement != null)
                {
                    outputPath = outputPathElement.InnerText;
                }

                if (name == null)
                {
                    if (outputPathElement != null)
                    {
                        commonOutputPath = outputPath;
                    }
                    continue;
                }

                if (outputPathElement != null)
                {
                    explicitOutputPaths[name] = outputPath;
                }

                if (outputPath == null)
                {
                    outputPath = explicitOutputPaths.ContainsKey(name) ? explicitOutputPaths[name] : commonOutputPath;
                }

                if (outputPath != null)
                {
                    _configs[name] = new ProjectConfig(this, name, outputPath.Replace("$(Configuration)", name), assemblyName);
                }
            }
        }
예제 #47
0
        public static void Add(string directory, string path, ProjectConfig project)
        {
            if (!Directory.Exists(Path.Combine(directory, "platforms")))
            {
                Directory.CreateDirectory(Path.Combine(directory, "platforms"));
            }

            if (Directory.Exists(Path.Combine(directory, "platforms", "IOS")))
            {
                Console.WriteLine("IOS platform already exists");
                return;
            }
            var iosPlatform = Path.Combine(directory, "platforms", "IOS");

            Directory.CreateDirectory(iosPlatform);
            var clientPath = Path.Combine(path, "Client.IOS");

            File.Copy(Path.Combine(clientPath, "Program.cs"), Path.Combine(iosPlatform, "Program.cs"));
            File.Copy(Path.Combine(clientPath, "GameClient.cs"), Path.Combine(iosPlatform, "GameClient.cs"));
            File.Copy(Path.Combine(clientPath, "Info.plist"), Path.Combine(iosPlatform, "Info.plist"));
            File.Copy(Path.Combine(clientPath, "GameThumbnail.png"), Path.Combine(iosPlatform, "GameThumbnail.png"));
            File.Copy(Path.Combine(clientPath, "Entitlements.plist"), Path.Combine(iosPlatform, "Entitlements.plist"));
            File.Copy(Path.Combine(clientPath, "Default.png"), Path.Combine(iosPlatform, "Default.png"));

            File.Copy(Path.Combine(clientPath, "Client.IOSGame.csproj"), Path.Combine(iosPlatform, "Client.IOSGame.csproj"));
            File.Copy(Path.Combine(clientPath, "Client.IOSGame.sln"), Path.Combine(iosPlatform, "Client.IOSGame.sln"));
            Directory.CreateDirectory(Path.Combine(iosPlatform, "Properties/"));
            Directory.CreateDirectory(Path.Combine(iosPlatform, "Assets/"));
            Directory.CreateDirectory(Path.Combine(iosPlatform, "Content/"));
            Directory.CreateDirectory(Path.Combine(iosPlatform, "Resources/"));
            File.Copy(Path.Combine(clientPath, "Properties/AssemblyInfo.cs"), Path.Combine(iosPlatform, "Properties/AssemblyInfo.cs"));
            File.Copy(Path.Combine(clientPath, "Content/Content.mgcb"), Path.Combine(iosPlatform, "Content/Content.mgcb"));

            FileUtils.DirectoryCopy("none", Path.Combine(clientPath, "Resources"), Path.Combine(iosPlatform, "Resources"), true);

            Directory.CreateDirectory(Path.Combine(iosPlatform, "Engine"));
            Directory.CreateDirectory(Path.Combine(iosPlatform, "Engine.Xna"));
            Directory.CreateDirectory(Path.Combine(iosPlatform, "Game"));

            var engineFiles = FileUtils.DirectoryCopy(Path.Combine(iosPlatform), Path.Combine(path, "Engine"), Path.Combine(iosPlatform, "Engine"), true, "*.cs");

            engineFiles.AddRange(FileUtils.DirectoryCopy(Path.Combine(iosPlatform), Path.Combine(path, "Engine.Xna"), Path.Combine(iosPlatform, "Engine.Xna"), true, "*.cs"));

            File.WriteAllText(Path.Combine(iosPlatform, "GameClient.cs"), File.ReadAllText(Path.Combine(iosPlatform, "GameClient.cs")).Replace("{{{projectName}}}", "new " + project.ProjectName + ".Game()"));

            engineFiles.Add("Program.cs");
            engineFiles.Add("GameClient.cs");
            engineFiles.Add(@"Properties\AssemblyInfo.cs");

            Engine  eng  = new Engine();
            Project proj = new Project(eng);

            proj.Load(Path.Combine(iosPlatform, "Client.IOSGame.csproj"));
            foreach (BuildItemGroup projItemGroup in proj.ItemGroups)
            {
                if (projItemGroup.ToArray().Any(a => a.Name == "Compile"))
                {
                    foreach (var buildItem in projItemGroup.ToArray())
                    {
                        projItemGroup.RemoveItem(buildItem);
                    }
                    foreach (var engineFile in engineFiles)
                    {
                        projItemGroup.AddNewItem("Compile", engineFile);
                    }
                    var item = projItemGroup.AddNewItem("Compile", "..\\..\\src\\**\\*.cs");
                    item.SetMetadata("Link", "Game\\%(RecursiveDir)%(Filename)%(Extension)");
                    item.SetMetadata("CopyToOutputDirectory", "PreserveNewest");
                    break;
                }
            }
            proj.Save(Path.Combine(iosPlatform, "Client.IOSGame.csproj"));
        }
예제 #48
0
        public void SetPrioritys()
        {
            ProjectConfig config = new ProjectConfig();

            var prioritys = new List<TaskPriority> { TaskPriority.Highest };
            config.SetPrioritys(prioritys);

            var result_prioritys = config.GetPrioritys();
            Assert.That(result_prioritys.Count, Is.EqualTo(1));
            Assert.That(result_prioritys.Contains(TaskPriority.Highest));
        }
예제 #49
0
        public static void Run(string directory, ProjectConfig project, BuildResult build)
        {
            var iosPlatform = Path.Combine(directory, "platforms", "IOS");

            System.Diagnostics.Process.Start(Path.Combine(iosPlatform, "Client.IOSGame.sln"));
        }
예제 #50
0
        public bool?Evaluate(ProjectConfig config, UserAttributes attributes, ILogger logger)
        {
            var result = Condition?.Evaluate(config, attributes, logger);

            return(result == null ? null : !result);
        }
예제 #51
0
        public static BuildResult Build(string directory, ProjectConfig config)
        {
            if (!Directory.Exists(Path.Combine(directory, "platforms")))
            {
                throw new Exception("No Platforms");
            }

            if (!Directory.Exists(Path.Combine(directory, "platforms", "IOS")))
            {
                throw new Exception("IOS platform does not exist");
            }
            var platformFolder            = Path.Combine(directory, "platforms", "IOS");
            var imagesFolder              = Path.Combine(directory, "assets", "images");
            var fontsFolder               = Path.Combine(directory, "assets", "fonts");
            var songsFolder               = Path.Combine(directory, "assets", "songs");
            var soundsFolder              = Path.Combine(directory, "assets", "sounds");
            var platformAssetsFolder      = Path.Combine(platformFolder, "Content", "images");
            var platformFontsFolder       = Path.Combine(platformFolder, "Content", "fonts");
            var platformFontsAssetsFolder = Path.Combine(platformFolder, "Assets", "fonts");
            var platformSongsFolder       = Path.Combine(platformFolder, "Content", "songs");
            var platformSoundsFolder      = Path.Combine(platformFolder, "Content", "sounds");
            var platformGameFolder        = Path.Combine(platformFolder, "Game");

            var platformContent = Path.Combine(platformFolder, "Content");
            var iosPlatform     = Path.Combine(directory, "platforms", "IOS");

            if (Directory.Exists(platformAssetsFolder))
            {
                Directory.Delete(platformAssetsFolder, true);
            }

            if (Directory.Exists(platformFontsFolder))
            {
                Directory.Delete(platformFontsFolder, true);
            }

            if (Directory.Exists(platformFontsAssetsFolder))
            {
                Directory.Delete(platformFontsAssetsFolder, true);
            }

            if (Directory.Exists(platformSongsFolder))
            {
                Directory.Delete(platformSongsFolder, true);
            }

            if (Directory.Exists(platformSoundsFolder))
            {
                Directory.Delete(platformSoundsFolder, true);
            }

            if (Directory.Exists(platformGameFolder))
            {
                Directory.Delete(platformGameFolder, true);
            }

            //copy assets
            var names     = FileUtils.DirectoryCopy(platformContent, imagesFolder, platformAssetsFolder, true);
            var fontFiles = FileUtils.DirectoryCopy(platformContent, fontsFolder, platformFontsFolder, true);

            FileUtils.DirectoryCopy(platformContent, fontsFolder, platformFontsAssetsFolder, true);
            var songFiles   = FileUtils.DirectoryCopy(platformContent, songsFolder, platformSongsFolder, true);
            var soundsFiles = FileUtils.DirectoryCopy(platformContent, soundsFolder, platformSoundsFolder, true);

            var xmlFontFiles = fontFiles.Where(a => a.EndsWith(".xml"));

            names.AddRange(fontFiles.Where(a => a.EndsWith(".png")));
            var contentFile = new List <string>();

            contentFile.Add("/platform:iOS");
            contentFile.Add("/profile:Reach");
            contentFile.Add("/compress:False");
            contentFile.Add("/importer:TextureImporter");
            contentFile.Add("/processor:TextureProcessor");
            contentFile.Add("/processorParam:ColorKeyColor=255,0,255,255");
            contentFile.Add("/processorParam:ColorKeyEnabled=True");
            contentFile.Add("/processorParam:GenerateMipmaps=False");
            contentFile.Add("/processorParam:PremultiplyAlpha=True");
            contentFile.Add("/processorParam:ResizeToPowerOfTwo=False");
            contentFile.Add("/processorParam:MakeSquare=False");
            contentFile.Add("/processorParam:TextureFormat=Color");
            foreach (var name in names)
            {
                contentFile.Add("/build:" + name);
            }

            contentFile.Add("/importer:Mp3Importer");
            contentFile.Add("/processor:SongProcessor");
            contentFile.Add("/processorParam:Quality=Best");
            foreach (var name in songFiles)
            {
                contentFile.Add("/build:" + name);
            }

            contentFile.Add("/importer:WavImporter");
            contentFile.Add("/processor:SoundEffectProcessor");
            contentFile.Add("/processorParam:Quality=Best");
            foreach (var name in soundsFiles)
            {
                contentFile.Add("/build:" + name);
            }
            File.WriteAllLines(Path.Combine(platformContent, "Content.mgcb"), contentFile);



            Engine  eng  = new Engine();
            Project proj = new Project(eng);

            proj.Load(Path.Combine(iosPlatform, "Client.IOSGame.csproj"));
            foreach (BuildItemGroup projItemGroup in proj.ItemGroups)
            {
                if (projItemGroup.ToArray().Any(a => a.Name == "BundleResource"))
                {
                    foreach (var buildItem in projItemGroup.ToArray())
                    {
                        if (buildItem.Include.IndexOf("Assets\\") == 0 || buildItem.Include.IndexOf("Content\\") == 0)
                        {
                            projItemGroup.RemoveItem(buildItem);
                        }
                    }
                    foreach (var engineFile in xmlFontFiles)
                    {
                        projItemGroup.AddNewItem("Content", "Assets\\" + engineFile);
                    }
                    foreach (var name in names)
                    {
                        projItemGroup.AddNewItem("BundleResource", "Content\\" + name);
                    }
                    foreach (var name in soundsFiles)
                    {
                        projItemGroup.AddNewItem("Content", "Content\\" + name);
                    }
                    foreach (var name in songFiles)
                    {
                        projItemGroup.AddNewItem("Content", "Content\\" + name);
                    }
                }
            }
            proj.Save(Path.Combine(iosPlatform, "Client.IOSGame.csproj"));


            return(build(Path.Combine(iosPlatform, "Client.IOSGame.csproj"), config));
        }
예제 #52
0
        void PopulateModelFromConfig(ProjectConfig config)
        {
            _model.ClearPluginItems();
            foreach (var name in config.PluginsFolder)
            {
                _model.AddPluginItem(name);
            }

            _model.ClearAssetItems();
            foreach (var name in config.AssetsFolder)
            {
                _model.AddAssetItem(name);
            }

            _model.ClearSolutionProjects();
            foreach (var name in config.SolutionProjects)
            {
                _model.AddVsProject(name);
            }

            _model.ClearSolutionFolders();
            foreach (var pair in config.SolutionFolders)
            {
                _model.AddSolutionFolder(pair.Key, pair.Value);
            }
        }
예제 #53
0
 /// <summary>
 /// 执行器
 /// </summary>
 public override bool Execute(ProjectConfig project)
 {
     return(true);
 }
        public ActionResult AddProjectConfig(AddProjectConfigModel addProjectConfig)
        {
            if (null == addProjectConfig)
                return View("Error");

            // Validate ParentProjectId
            var parentProjectId = addProjectConfig.ParentProjectId;
            if (parentProjectId < 1)
                return View("Error");

            // Validate ParentProjectName
            var parentProjectName = addProjectConfig.ParentProjectName;
            if (string.IsNullOrWhiteSpace(parentProjectName))
                return View("Error");

            // Validate Name
            var name = addProjectConfig.Name;
            if (string.IsNullOrWhiteSpace(name))
                return View("Error");

            var desc = addProjectConfig.Description;
            if (string.IsNullOrWhiteSpace(desc))
                desc = null;

            var buildNumberPostion = (int)addProjectConfig.BuildNumberPosition;
            if (buildNumberPostion < 3 || buildNumberPostion > 4)
                return View("Error");

            // Force the GeneratedVersion part that corresponds to the build number position to a value of zero.
            switch (buildNumberPostion)
            {
                case 3:
                    addProjectConfig.GeneratedVersionPart3 = 0;
                    break;
                case 4:
                    addProjectConfig.GeneratedVersionPart4 = 0;
                    break;
            }

            using (var db = new BuildVersioningDataContext())
            {
                if (db.ProjectConfigs
                    .Include(c => c.Project)
                    .Any(c =>
                        c.Project.Id == parentProjectId &&
                        string.Compare(c.Name, name, StringComparison.OrdinalIgnoreCase) == 0
                        ))
                    return View("Error"); // <-- A ProjectConfig with the same parent Project and the same name already exists.

                var projectConfig =
                    new ProjectConfig
                    {
                        Description = desc,
                        GeneratedBuildNumberPosition = buildNumberPostion,
                        GeneratedVersionPart1 = addProjectConfig.GeneratedVersionPart1,
                        GeneratedVersionPart2 = addProjectConfig.GeneratedVersionPart2,
                        GeneratedVersionPart3 = addProjectConfig.GeneratedVersionPart3,
                        GeneratedVersionPart4 = addProjectConfig.GeneratedVersionPart4,
                        Name = name,
                        ProductVersionPart1 = addProjectConfig.ProductVersionPart1,
                        ProductVersionPart2 = addProjectConfig.ProductVersionPart2,
                        ProductVersionPart3 = addProjectConfig.ProductVersionPart3,
                        ProductVersionPart4 = addProjectConfig.ProductVersionPart4,
                        ProjectId = parentProjectId,
                        ReleaseType = addProjectConfig.ReleaseType
                    };

                db.ProjectConfigs.Add(projectConfig);
                db.SaveChanges();
            }

            return RedirectToRoute("ViewProject", new { name = parentProjectName });
        }
예제 #55
0
 private string GetRemoteTargetDataPath(ProjectConfig target)
 {
     return(Path.Combine(ModuleRoot.OriginalString, s_ModulePath, target.ProjectName, target.ProjectVersion));
 }
		public void SaveAndLoadConfigsWithAssemblies()
		{
			ProjectConfig config1 = new ProjectConfig( "Debug" );
			config1.Assemblies.Add( Path.GetFullPath( @"bin\debug\assembly1.dll" ) );
			config1.Assemblies.Add( Path.GetFullPath( @"bin\debug\assembly2.dll" ) );

			ProjectConfig config2 = new ProjectConfig( "Release" );
			config2.Assemblies.Add( Path.GetFullPath( @"bin\release\assembly1.dll" ) );
			config2.Assemblies.Add( Path.GetFullPath( @"bin\release\assembly2.dll" ) );

			project.Configs.Add( config1 );
			project.Configs.Add( config2 );
			project.Save( xmlfile );

			Assert.IsTrue( File.Exists( xmlfile ) );

			NUnitProject project2 = projectService.LoadProject( xmlfile );

			Assert.AreEqual( 2, project2.Configs.Count );

			config1 = project2.Configs["Debug"];
			Assert.AreEqual( 2, config1.Assemblies.Count );
			Assert.AreEqual( Path.GetFullPath( @"bin\debug\assembly1.dll" ), config1.Assemblies[0] );
			Assert.AreEqual( Path.GetFullPath( @"bin\debug\assembly2.dll" ), config1.Assemblies[1] );

			config2 = project2.Configs["Release"];
			Assert.AreEqual( 2, config2.Assemblies.Count );
			Assert.AreEqual( Path.GetFullPath( @"bin\release\assembly1.dll" ), config2.Assemblies[0] );
			Assert.AreEqual( Path.GetFullPath( @"bin\release\assembly2.dll" ), config2.Assemblies[1] );
		}
예제 #57
0
 public static string SerializeProjectConfig(ProjectConfig info)
 {
     return YamlSerializer.Serialize<ProjectConfigInternal>(ConvertToInternal(info));
 }
 /// <summary>
 /// Initialize ProjectConfig and internal projectMgr objects.
 /// </summary>
 /// <remarks>Service function. Before calling this function projectNode must be 
 /// initialized by valid project data.</remarks>
 protected void PrepareProjectConfig()
 {
     object[] ppUnk = new object[2];
     ProjectConfig pjc = new ProjectConfig(projectNode, "manualSetConfigArgument", "manualSetPlatformArgument");
     ppUnk[0] = pjc;
     generalPropertyPage.SetObjects(1, ppUnk);
 }
예제 #59
0
        private static List <ProjectConfig> LoadProjectConfigs()
        {
            Logger.Info("Loading project configs");

            var fileMappingsquery = from r in ais_dev.VDC_FILE_MAPPINGS
                                    join n in ais_dev.VDC_PROJECTS on r.MAP_PROJECT_NUMBER equals n.PROJECT_NUMBER
                                    select new {
                r.MAP_PROJECT_NUMBER,
                n.PROJECT_NAME,
                r.MAP_FTP_SOURCE,
                r.MAP_COMPANY_ID,
                r.MAP_PROJECT_ID,
                r.MAP_TYPE,
                r.MAPPING_ID
            };

            var fileMappings = fileMappingsquery.ToList();


            var projectNumbers = fileMappings.Select(x => (int)x.MAP_PROJECT_NUMBER).Distinct();
            var projectConfigs = new List <ProjectConfig>();


            foreach (var projectNumber in projectNumbers)
            {
                var projectConfig = new ProjectConfig {
                    projectNumber     = projectNumber,
                    projectName       = fileMappings.First(x => x.MAP_PROJECT_NUMBER == projectNumber).PROJECT_NAME,
                    downloadDirectory = Path.Combine(@"\\cannfilesvr01.cannistraro.local\sys\data\everyone\VDC Group\_BIM Support\Turing\Downloads",
                                                     $"{projectNumber} - {fileMappings.First(x => x.MAP_PROJECT_NUMBER == projectNumber).PROJECT_NAME}") // TODO remove cannistraro.local?
                };

                var configSourceNames = fileMappings.Where(x => x.MAP_PROJECT_NUMBER == projectNumber).Select(x => x.MAP_FTP_SOURCE).Distinct();


                foreach (var sourceName in configSourceNames)
                {
                    var sourceMappings = fileMappings.Where(x => x.MAP_PROJECT_NUMBER == projectNumber && x.MAP_FTP_SOURCE == sourceName);

                    var source = new Source {
                        ftpType = (FtpType)Enum.Parse(typeof(FtpType), sourceName),

                        // assume at most one companyId and projectId per source
                        // (max. one glue source per project, max. one procore source per project, etc.)
                        companyId = sourceMappings.First().MAP_COMPANY_ID,
                        projectId = sourceMappings.First().MAP_PROJECT_ID,

                        mappings = sourceMappings.Select(x =>
                                                         new Mapping {
                            id          = x.MAPPING_ID,
                            mappingType = (MappingType)Enum.Parse(typeof(MappingType), x.MAP_TYPE)
                        }
                                                         ).ToList(),
                    };

                    projectConfig.sources.Add(source);
                }

                projectConfigs.Add(projectConfig);
            }

            return(projectConfigs);
        }