Load() public static method

public static Load ( string filename ) : IEnumerable
filename string
return IEnumerable
Ejemplo n.º 1
0
        static int Main() {
                Planner.Application app;
                Project project;
                List  tasks, resources;

		// GtkSharp.Libplanner.ObjectManager.Initialize ();

		Gtk.Application.Init ();

                app = new Planner.Application();
                project = new Project (app);

		//project.Loaded += Project_Loaded;
		
                project.Load ("../../examples/project-x.mrproject");

                tasks = project.AllTasks;
                resources = project.Resources;

		foreach (Task task in project.AllTasks) {
		    Console.WriteLine ("Task name: "+ task.Name);
		}
		
                foreach (Resource resource in project.Resources) {
                  Console.WriteLine ("Resource name: "+ resource.Name);
                }
                
                return 0;
        }
Ejemplo n.º 2
0
        public static Project LoadFrom(FeatureItem FeatureItem)
        {
            if (FeatureItem.Project == null) return null;

            var Result = new Project { DTEProject = FeatureItem.Project };

            Result.Load();

            return Result;
        }
Ejemplo n.º 3
0
        static void Main()
        {
            _projectPath = CommandLineUtilities.GetArgument("path", (string)null) ?? CommandLineUtilities.GetArgument(0, (string)null);
            _schema = ConvertUtilities.Nullify(CommandLineUtilities.GetArgument("schema", (string)null) ?? CommandLineUtilities.GetArgument(1, (string)null), true);
            _changeTargetDirectory = CommandLineUtilities.GetArgument("changeTargetDirectory", true);
            _disableNonPersistenceProducers = CommandLineUtilities.GetArgument("disableNonPersistenceProducers", true);

            // Load the model
            Project project = new Project();
            project.Entities.ListChanged += Entities_ListChanged; // Change schema as soon as the entity is loaded
            project.Load(_projectPath, ProjectLoadOptions.Default);

            // Update producer target directory
            if (!string.IsNullOrEmpty(_schema) && _changeTargetDirectory)
            {
                foreach (var producer in project.Producers)
                {
                    var sqlServerProducer = producer.Instance as SqlServerProducer;
                    if (sqlServerProducer != null)
                    {
                        sqlServerProducer.Production += SqlServerProducer_Production;
                    }

                    var databaseProducer = producer.Instance as DatabaseProducer;
                    if (databaseProducer != null)
                    {
                        databaseProducer.Production += DatabaseProducer_Production;
                    }
                }
            }

            // Generate code
            project.Producing += OnProjectProduction;
            ProductionOptions productionOptions = BuildProductionOptions(project);
            project.Produce(productionOptions);
            Console.WriteLine();
        }
Ejemplo n.º 4
0
	public void InitializeProject()
	{
		if (string.IsNullOrEmpty(this.ProjectFile))
			return;
			
		_projectDirectory = Path.GetDirectoryName(Path.GetFullPath(_projectFile));
		if (!Directory.Exists(_projectDirectory))
			Directory.CreateDirectory(_projectDirectory);
			
		Engine.GlobalEngine.BinPath = ToolLocationHelper.GetPathToDotNetFramework(TargetDotNetFrameworkVersion.Version20);
		_project = new Project();
		if (!File.Exists(_projectFile))
		{
			// create project file
			Guid g = Guid.NewGuid();
			string projectName = Path.GetFileNameWithoutExtension(_projectFile);
			
			StringBuilder buffer = new StringBuilder();
			buffer.Append(File.ReadAllText(Path.Combine(_internalPath, @"Project\classlibrary.csproj")));
			buffer.Replace("$safeprojectname$", projectName);
			buffer.Replace("$guid1$", g.ToString());
			File.WriteAllText(_projectFile, buffer.ToString());
			
			string propertiesDirectory = Path.Combine(_projectDirectory, "Properties");
			if (!Directory.Exists(propertiesDirectory))
				Directory.CreateDirectory(propertiesDirectory);
			
			string infoFile = Path.Combine(propertiesDirectory, "AssemblyInfo.cs");
			if (!File.Exists(infoFile))
			{
				buffer.Length = 0;
				buffer.Append(File.ReadAllText(Path.Combine(_internalPath, @"Project\assemblyinfo.cs")));
				buffer.Replace("$projectname$", projectName);
				buffer.Replace("$guid1$", g.ToString());
				File.WriteAllText(infoFile, buffer.ToString());
			}		
		}
		// loading project file
		_project.Load(_projectFile);
		// add default references
	}
Ejemplo n.º 5
0
        private bool BuildCompileAndSaveProject(string projectFilePath,string outputPath,EnvironmentSettingsManager environmentManager, int stepNumber)
        {
            Project project;
            DeploymentPackage package;
            bool result = false;

            #region 4. Build

            LogHelper.LogMessage(String.Format("\n{0}.1 Beginning Build",stepNumber));
            LogHelper.LogMessage("   -- Loading project file: " + projectFilePath);
            project = new Project();
            project.Load(projectFilePath);

            LogHelper.LogMessage("   -- Building Project");
            result = K2Helper.CompileK2Project(project);

            if (!result)
                throw new Exception("The Project did not Compile successfully.\n");

            #endregion

            #region 5. Deployment Package Creation

            LogHelper.LogMessage(String.Format("\n{0}.2 Creating the Deployment Package",stepNumber));
            package = K2Helper.CreateDeploymentPackage(
                project, environmentManager, DeployLabel, DeployDescription, testOnly);

            #endregion

            #region 6. Save Deployment Package

            LogHelper.LogMessage(String.Format("\n{0}.3. Saving Deployment Package to '" + OutputPath + "'",stepNumber));
            FileHelper fileHelper = new FileHelper();
            fileHelper.DeleteDirectory(outputPath);

            package.Save(outputPath, "K2DeploymentPackage");
            LogHelper.LogMessage("   -- Package Saved");

            #endregion

            return result;
        }
Ejemplo n.º 6
0
 public async Task OpenProject(string fileName)
 {
     var p = new Project(fileName);
     await p.Load();
     CurrentProject = p;
 }