本文整理汇总了C#中Project.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Project.Load方法的具体用法?C# Project.Load怎么用?C# Project.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project.Load方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
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;
}
示例2: LoadFrom
public static Project LoadFrom(FeatureItem FeatureItem)
{
if (FeatureItem.Project == null) return null;
var Result = new Project { DTEProject = FeatureItem.Project };
Result.Load();
return Result;
}
示例3: Main
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();
}
示例4: InitializeProject
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
}
示例5: BuildCompileAndSaveProject
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;
}
示例6: OpenProject
public async Task OpenProject(string fileName)
{
var p = new Project(fileName);
await p.Load();
CurrentProject = p;
}