public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            //Create a project reader instance
            Project project = new Project(dataDir + "RetrieveCalendarInfo.mpp");

            //Retrieve Calendars Information
            CalendarCollection alCals = project.Calendars;
            foreach (Aspose.Tasks.Calendar cal in alCals)
            {
                if (cal.Name != null)
                {
                    Console.WriteLine("Calendar UID : " + cal.Uid);
                    Console.WriteLine("Calendar Name : " + cal.Name);

                    WeekDayCollection alDays = cal.WeekDays;
                    foreach (WeekDay wd in alDays)
                    {
                        TimeSpan ts = wd.GetWorkingTime();
                        if (wd.DayWorking)
                        {
                            Console.WriteLine(wd.DayType.ToString() + ":");
                            Console.WriteLine(ts.ToString());
                        }
                    }
                }


            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            Project project = new Project(dataDir + "ReadProjectFiles.mpp");
        }
 public static void Run()
 {
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_Projects();
     Project project = new Project(dataDir+ "DetermineProjectVersion.mpp");
     Console.WriteLine("Project Version : " + project.Get(Prj.SaveVersion).ToString());
     Console.WriteLine("Last Saved : " + project.Get(Prj.LastSaved).ToShortDateString());
 }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            Project project = new Project();

            project.Save(dataDir+ "saved.xml", SaveFileFormat.XML);
            
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            //Create a project instance
            Project prj = new Project(dataDir+ "WriteFiscalYearProperties.mpp");
            //Set fiscal year properties
            prj.Set(Prj.FyStartDate, Month.July);
            prj.Set(Prj.FiscalYearStart, true);
            prj.Save(dataDir+ "saved.mpp", SaveFileFormat.MPP);
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();
            //Create a project reader instance
            Project project = new Project(dataDir+ "ReadFiscalYearProperties.mpp");

            //Display fiscal year properties
            Console.WriteLine("Fiscal Year Start Date : " + project.Get(Prj.FyStartDate).ToString());
            Console.WriteLine("Fiscal Year Numbering : " + project.Get(Prj.FiscalYearStart).ToString());
            
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();
            Project project = new Project(dataDir+ "ReadCurrencyProperties.mpp");

            //Display currency properties
            Console.WriteLine("Currency Code : " + project.Get(Prj.CurrencyCode).ToString());
            Console.WriteLine("<br>Currency Digits : " + project.Get(Prj.CurrencyDigits).ToString());
            Console.WriteLine("<br>Currency Symbol : " + project.Get(Prj.CurrencySymbol).ToString());
            Console.WriteLine("Currency Symbol Position" + project.Get(Prj.CurrencySymbolPosition).ToString());
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();
            Project project = new Project(dataDir+ "ReadWeekdayProperties.mpp");

            //Display week days properties
            Console.WriteLine("Week Start Date : " + project.Get(Prj.WeekStartDay).ToString());
            Console.WriteLine("Days Per Month : " + project.Get(Prj.DaysPerMonth).ToString());
            Console.WriteLine("Minutes Per Day : " + project.Get(Prj.MinutesPerDay).ToString());
            Console.WriteLine("Minutes Per Week : " + project.Get(Prj.MinutesPerWeek).ToString());
            
            
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();
            Project project = new Project(dataDir+ "WriteProjectInfo.mpp");
            project.Set(Prj.Author, "Author");
            project.Set(Prj.LastAuthor, "Last Author");
            project.Set(Prj.Revision, 15);
            project.Set(Prj.Keywords, "MSP Aspose");
            project.Set(Prj.Comments, "Comments");

            project.Save(dataDir+ "saved.mpp", SaveFileFormat.MPP);
            
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            Project prj = new Project(dataDir+ "DefaultProperties.mpp");

            //Display default properties
            Console.WriteLine("New Task Default Start: " + prj.Get(Prj.DefaultStartTime).ToShortDateString());
            Console.WriteLine("New Task Default Type: " + prj.Get(Prj.DefaultTaskType));
            Console.WriteLine("Resouce Default Standard Rate: " + prj.Get(Prj.DefaultStandardRate).ToString());
            Console.WriteLine("Resource Default Overtime Rate: " + prj.Get(Prj.DefaultOvertimeRate).ToString());
            Console.WriteLine("Default Task EV Method: " + prj.Get(Prj.DefaultTaskEVMethod).ToString());
            Console.WriteLine("Default Cost Accrual: " + prj.Get(Prj.DefaultFixedCostAccrual).ToString());
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();
            //Read an existing project
            Project project = new Project(dataDir+ "MPPFileUpdate.mpp");

            //create a new task
            Task task = project.RootTask.Children.Add("Task1");

            task.Set(Tsk.Start, new System.DateTime(2012, 8, 1));
            task.Set(Tsk.Finish, new DateTime(2012, 8, 5));

            //Save the project as MPP project file
            project.Save(dataDir+ "AfterLinking.Mpp", Aspose.Tasks.Saving.SaveFileFormat.MPP);
            
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();
            //Create a project instance
            Project project = new Project(dataDir+ "WriteWeekdayProperties.mpp");

            //Set week days properties
            project.Set(Prj.WeekStartDay, DayType.Monday);
            project.Set(Prj.DaysPerMonth, 24);
            project.Set(Prj.MinutesPerDay, 540);
            project.Set(Prj.MinutesPerWeek, 3240);

            project.Save(dataDir+ "saved.xml", SaveFileFormat.XML);
            
            
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            Project project = new Project(dataDir+ "PrintTaskWritingException.mpp");

            try
            {
                project.Save("project.MPP", Aspose.Tasks.Saving.SaveFileFormat.MPP);
            }
            catch (TasksWritingException ex)
            {
                Console.WriteLine(ex.LogText);
            }

        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            //Read the source Project
            Project project = new Project(dataDir+ "GetNumberOfPagesForViews.mpp");


            //Get number of pages
            Console.WriteLine(string.Format("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage, Timescale.Days)));

            //Get number of pages (Months)
            Console.WriteLine(string.Format("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage, Timescale.Months)));

            //Get number of pages (ThirdsOfMonths)
            Console.WriteLine(string.Format("Number of Pages = '{0}'", project.GetPageCount(PresentationFormat.ResourceUsage, Timescale.ThirdsOfMonths)));
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            ///Create a project instance
            Project prj = new Project();

            //Set new task property
            prj.Set(Prj.NewTaskStartDate, TaskStartDateType.CurrentDate);

            //Save the project as XML project file
            prj.Save(dataDir+ "project.xml", Aspose.Tasks.Saving.SaveFileFormat.XML);
 

            // Display Status.
            System.Console.WriteLine("New Task created with start date successfully.");
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            //Create a project instance
            Project project = new Project(dataDir+ "WriteCurrencyProperties.mpp");

            //Set currency properties
            project.Set(Prj.CurrencyCode, "AUD");
            project.Set(Prj.CurrencyDigits, 2);
            project.Set(Prj.CurrencySymbol, "$");
            project.Set(Prj.CurrencySymbolPosition, CurrencySymbolPositionType.After);

            //Save the project as XML project file
            project.Save(dataDir+ "project.xml", Aspose.Tasks.Saving.SaveFileFormat.XML);
            
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            //Create a project reader instance
            Project project = new Project(dataDir+ "ReadProjectInfo.mpp");
            if (project.Get(Prj.ScheduleFromStart))
                Console.WriteLine("Project Finish Date : " + project.Get(Prj.StartDate).ToShortDateString());
            else
                Console.WriteLine("Project Finish Date : " + project.Get(Prj.FinishDate).ToShortDateString());
            Console.WriteLine(project.Get(Prj.Author));
            Console.WriteLine(project.Get(Prj.LastAuthor));
            Console.WriteLine(project.Get(Prj.Revision));
            Console.WriteLine(project.Get(Prj.Keywords));
            Console.WriteLine(project.Get(Prj.Comments));
            Console.WriteLine("The program has run successfully");
           
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            Project project = new Project(dataDir+ "CalculateCriticalPath.mpp");
            project.CalculationMode = CalculationMode.Automatic;

            Task subtask1 = project.RootTask.Children.Add("1");
            Task subtask2 = project.RootTask.Children.Add("2");
            Task subtask3 = project.RootTask.Children.Add("3");

            project.TaskLinks.Add(subtask1, subtask2, TaskLinkType.FinishToStart);

            //Display the critical path now
            foreach (Task task in project.CriticalPath)
            {
                Console.WriteLine(task.Get(Tsk.Name));
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();
            Project project = new Project(dataDir+ "ReplaceCalendar.mpp");

            Aspose.Tasks.Calendar cal = new Aspose.Tasks.Calendar("New Cal");
            CalendarCollection calColl = project.Calendars;
            foreach (Aspose.Tasks.Calendar c in calColl)
            {
                if (c.Name == "Standard")
                {
                    calColl.Remove(c);
                    calColl.Add("Standard", cal);
                    break;
                }
            }
            
            
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();



            //Read the input Project file
            Project project = new Project(dataDir+ "GetNumberOfPages.mpp");

            //Get number of pages
            int iPages = project.GetPageCount();

            //Get number of pages (Timescale.Months)
            iPages = project.GetPageCount(Aspose.Tasks.Visualization.Timescale.Months);

            //Get number of pages (Timescale.ThirdsOfMonths)
            iPages = project.GetPageCount(Aspose.Tasks.Visualization.Timescale.ThirdsOfMonths);


        }
Example #21
0
        private void crawl(Project project)
        {
            var reader = new ProjectReader(project.File);
            // Get base assemblies first to better be equiped to locate variable types
            reader
                .ReadReferences()
                .ForEach(x =>
                {
                    if (!_handledReferences.Any(y => y.Equals(x)))
                    {
                        parseAssembly(x);
                        _handledReferences.Add(x);
                    }
                });

            _builder.WriteProject(project);
            reader
                .ReadFiles()
                .ForEach(x => {
                    parseFile(new FileRef(x, project));
                });
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            Project prj = new Project(dataDir+ "ExtendedAttributes.mpp");
            ExtendedAttributeDefinitionCollection eads = prj.ExtendedAttributes;

            // Create extended attribute definition
            ExtendedAttributeDefinition ead = new ExtendedAttributeDefinition();
            ead.FieldId = ((int)ExtendedAttributeTask.Start7).ToString();
            ead.FieldName = "Start7";
            eads.Add(ead);

            // Get zero index task
            Task tsk = prj.RootTask.Children.GetById(1);
            ExtendedAttributeCollection eas = tsk.ExtendedAttributes;

            string dateTimeFormat = "yyyy-MM-ddTHH:mm:ss";
            ExtendedAttribute ea = new ExtendedAttribute();
            ea.FieldId = ead.FieldId;
            ea.Value = XmlConvert.ToString(DateTime.Now, dateTimeFormat);
            eas.Add(ea);
        }
Example #23
0
 public void AddProject(Project project)
 {
     Console.WriteLine("project|" + project.File + "|filesearch");
 }
        private void buildCache()
        {
            var project1 = new Project("Project1");
            _cache.WriteProject(project1);
            var file = new FileRef("File1", project1);
            _cache.WriteFile(file);
            _cache.WriteUsing(new Using(file, "Project1.FirstNamespace", 1, 1));
            _cache.WriteNamespace(new Namespce(file, "Project1", 2, 1));
            _cache.WriteClass(
                new Class(file, "Project1", "FirstClass", "public", 5, 1));
            _cache.WriteField(
                new Field(file, "Project1.FirstClass", "FCls", "public", 6, 2, "SecondClass"));
            _cache.WriteMethod(
                new Method(file, "Project1.FirstClass", "myMethod", "private", 7, 5, "System.Void", new Parameter[]{}));
            _cache.WriteVariable(
                new Variable(file, "Project1.FirstClass.myMethod", "str", "local", 9, 3, "System.String"));

            var file2 = new FileRef("File2", project1);
            _cache.WriteFile(file2);
            _cache.WriteNamespace(new Namespce(file2, "Project1.SecondNamespace", 10, 1));
            _cache.WriteClass(
                new Class(file2, "Project1.SecondNamespace", "ThirdClass", "public", 12, 2));
            _cache.WriteClass(
                new Class(file2, "Project1.SecondNamespace", "SecondClass", "public", 2, 1));

            _cache.WriteNamespace(new Namespce(file2, "Project1.FirstNamespace", 1, 1));
            _cache.WriteClass(
                new Class(file2, "Project1.FirstNamespace", "SecondClass", "public", 2, 1));
            _cache.WriteField(
                new Field(file, "Project1.FirstNamespace.SecondClass", "Count", "public", 3, 2, "System.Int32"));

            var staticField =
                new Field(file, "Project1.FirstNamespace.SecondClass", "NAME", "public", 3, 2, "System.String");
            staticField.AddModifiers(new[]{ "static" });
            _cache.WriteField(staticField);

            var project2 = new Project("Project2");
            _cache.WriteProject(project2);

            var system = new FileRef("mscorlib", null);
            _cache.WriteFile(system);
            _cache.WriteNamespace(new Namespce(system, "System",0,0));
            _cache.WriteNamespace(new Namespce(system, "System.More", 0, 0));
            _cache.WriteClass(
                new Class(system, "System", "String", "public", 0, 0));
            _cache.WriteMethod(
                new Method(system, "System.Object", "ToString", "public", 0, 0, "System.String", new Parameter[] {}));
            _cache.WriteEnum(
                new EnumType(system, "System.More", "FunnyBool", "public", 0, 0));
            _cache.WriteField(
                new Field(system, "System.More.FunnyBool", "True", "public", 0, 0, "System.Int32").AddModifiers(new[] { "static" }));

            _cache.BuildTypeIndex();
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Projects();

            string newFile = dataDir+ "WriteUpdatedExtendedAttributeDefinitions.mpp";
            string resultFile = dataDir+ "Output.mpp";

            Project project = new Project(dataDir + "WriteUpdatedExtendedAttributeDefinitions.mpp");

            #region task attributes
            // Add new text3 extended attribute and one text value
            ExtendedAttributeDefinition taskTextAttr = new ExtendedAttributeDefinition();
            taskTextAttr.Alias = "New text3 attribute";
            taskTextAttr.FieldName = "Text3";
            taskTextAttr.ElementType = ElementType.Task;
            taskTextAttr.CfType = CustomFieldType.Text;

            project.ExtendedAttributes.Add(taskTextAttr);

            Value textVal = new Value();
            textVal.Id = 1;
            textVal.Description = "Text value descr";
            textVal.Val = "Text value1";

            taskTextAttr.ValueList.Add(textVal);

            // Add new cost1 extended attribute and two cost values
            ExtendedAttributeDefinition taskCostAttr = new ExtendedAttributeDefinition();
            taskCostAttr.Alias = "New cost1 attribute";
            taskCostAttr.FieldName = "Cost1";
            taskCostAttr.ElementType = ElementType.Task;
            taskCostAttr.CfType = CustomFieldType.Cost;

            project.ExtendedAttributes.Add(taskCostAttr);

            Value costVal1 = new Value();
            costVal1.Id = 2;
            costVal1.Description = "Cost value 1 descr";
            costVal1.Val = "99900";

            Value costVal2 = new Value();
            costVal2.Id = 3;
            costVal2.Description = "Cost value 2 descr";
            costVal2.Val = "11100";

            taskCostAttr.ValueList.Add(costVal1);
            taskCostAttr.ValueList.Add(costVal2);

            // Add new task and assign attribute value
            Task task = project.RootTask.Children.Add("New task");

            ExtendedAttribute taskAttr = new ExtendedAttribute();
            taskAttr.AttributeDefinition = taskCostAttr;
            taskAttr.Value = "99900";
            taskAttr.FieldId = taskCostAttr.FieldId;
            task.ExtendedAttributes.Add(taskAttr);

            ExtendedAttributeDefinition taskStartAttr = new ExtendedAttributeDefinition();
            taskStartAttr.Alias = "New start 7 attribute";
            taskStartAttr.CfType = CustomFieldType.Start;
            taskStartAttr.ElementType = ElementType.Task;
            taskStartAttr.FieldName = "Start7";

            Value startVal = new Value();
            startVal.Val = DateTime.Now.ToString();
            startVal.Description = "Start 7 value description";

            taskStartAttr.ValueList.Add(startVal);

            project.ExtendedAttributes.Add(taskStartAttr);

            ExtendedAttributeDefinition taskFinishAttr = new ExtendedAttributeDefinition();
            taskFinishAttr.Alias = "New finish 4 attribute";
            taskFinishAttr.CfType = CustomFieldType.Finish;
            taskFinishAttr.ElementType = ElementType.Task;
            taskFinishAttr.FieldName = "Finish4";

            Value finishVal = new Value();
            finishVal.Val = DateTime.Now.ToString();
            finishVal.Description = "Finish 4 value description";

            taskFinishAttr.ValueList.Add(finishVal);

            project.ExtendedAttributes.Add(taskFinishAttr);

            ExtendedAttributeDefinition numberAttr = new ExtendedAttributeDefinition();
            numberAttr.Alias = "New number attribute";
            numberAttr.FieldName = "Number20";
            numberAttr.CfType = CustomFieldType.Number;
            numberAttr.ElementType = ElementType.Task;

            Value val1 = new Value();
            val1.Val = "1";
            val1.Description = "Number 1 value";
            Value val2 = new Value();
            val2.Val = "2";
            val2.Description = "Number 2 value";
            Value val3 = new Value();
            val3.Val = "3";
            val3.Description = "Number 3 value";

            numberAttr.ValueList.Add(val1);
            numberAttr.ValueList.Add(val2);
            numberAttr.ValueList.Add(val3);

            project.ExtendedAttributes.Add(numberAttr);

            #endregion

            ExtendedAttributeDefinition rscStartAttr = new ExtendedAttributeDefinition();
            rscStartAttr.Alias = "New start5 attribute";
            rscStartAttr.FieldName = "Start5";
            rscStartAttr.ElementType = ElementType.Resource;
            rscStartAttr.CfType = CustomFieldType.Start;

            Value startVal2 = new Value();
            startVal2.Id = 4;
            startVal2.Val = DateTime.Now.ToString();
            startVal2.Description = "this is start5 value descr";

            rscStartAttr.ValueList.Add(startVal2);

            project.ExtendedAttributes.Add(rscStartAttr);


            //Save the project as MPP project file
            project.Save(resultFile, Aspose.Tasks.Saving.SaveFileFormat.MPP);
        }
Example #26
0
 public bool Read(string location, Func<string, ProviderSettings> getTypesProviderByLocation)
 {
     _project = null;
     _provider = getTypesProviderByLocation(location);
     if (_provider == null)
         return false;
     _with = (IProvideVersionedTypes) _provider.TypesProvider;
     if (_with == null)
         return false;
     _project = _with.Reader().Read(_provider.ProjectFile);
     return _project != null;
 }
 public void AddProject(Project project)
 {
 }
 public bool ProjectExists(Project project)
 {
     return true;
 }
Example #29
0
 public FileRef(string file, Project project)
 {
     File = file;
     Project = project;
 }