protected override IEnumerable <ClassActivitiesInfo> ClassActivitiesForGroup(Course course, CourseGroup group) { return(EnumerableExtensions.AsEnumerable ( PraticeClasses[course], new ClassActivitiesInfo(group.Labs, true) )); }
public static bool AttemptToMakeWritable(DocumentReference documentReference, IProjectActionContext context) { bool flag; if (!documentReference.IsValidPathFormat || Microsoft.Expression.Framework.Documents.PathHelper.IsDirectory(documentReference.Path)) { return(false); } if (!Microsoft.Expression.Framework.Documents.PathHelper.FileOrDirectoryExists(documentReference.Path)) { return(true); } if (context == null) { return(false); } SourceControlHelper.UpdateSourceControl(EnumerableExtensions.AsEnumerable <DocumentReference>(documentReference), UpdateSourceControlActions.Checkout, context); try { FileAttributes attributes = File.GetAttributes(documentReference.Path); if ((attributes & FileAttributes.ReadOnly) != FileAttributes.ReadOnly) { flag = true; } else if (!context.CanOverwrite(documentReference)) { ProjectLog.LogError(documentReference.Path, StringTable.ActionCanceled, StringTable.MakeWritableAction, new object[0]); flag = false; } else if (!Microsoft.Expression.Framework.Documents.PathHelper.ClearFileOrDirectoryReadOnlyAttribute(documentReference.Path)) { attributes = attributes & (FileAttributes.Hidden | FileAttributes.System | FileAttributes.Directory | FileAttributes.Archive | FileAttributes.Device | FileAttributes.Normal | FileAttributes.Temporary | FileAttributes.SparseFile | FileAttributes.ReparsePoint | FileAttributes.Compressed | FileAttributes.Offline | FileAttributes.NotContentIndexed | FileAttributes.Encrypted | FileAttributes.IntegrityStream | FileAttributes.NoScrubData); File.SetAttributes(documentReference.Path, attributes); ProjectLog.LogSuccess(documentReference.Path, StringTable.MakeWritableAction, new object[0]); flag = true; } else { ProjectLog.LogSuccess(documentReference.Path, StringTable.MakeWritableAction, new object[0]); flag = true; } } catch (Exception exception1) { Exception exception = exception1; ProjectLog.LogError(documentReference.Path, exception, StringTable.MakeWritableAction, new object[0]); if (!context.HandleException(documentReference, exception)) { throw; } return(false); } return(flag); }
public override void Execute() { this.HandleBasicExceptions(() => { string str = base.SelectProject(this.DisplayName); if (!string.IsNullOrEmpty(str)) { IProjectStore projectStore = ProjectStoreHelper.CreateProjectStore(DocumentReference.Create(str), base.Services, ProjectStoreHelper.ResilientProjectCreationChain); if (projectStore == null) { return; } UpgradeWizard upgradeWizard = new UpgradeWizard(this.Solution() as ISolutionManagement, from project in this.Solution().Projects.OfType <ProjectBase>() select project.ProjectStore, projectStore, null, base.Services); try { if (!upgradeWizard.Upgrade()) { return; } } finally { projectStore.Dispose(); projectStore = null; } projectStore = ProjectStoreHelper.CreateProjectStore(DocumentReference.Create(str), base.Services, ProjectStoreHelper.DefaultProjectCreationChain); if (projectStore == null) { return; } INamedProject namedProject = null; try { namedProject = this.ProjectManager().AddProject(projectStore); if (namedProject != null) { base.UpdateSourceControl(EnumerableExtensions.AsEnumerable <INamedProject>(namedProject)); base.ActivateProjectPane(); } } finally { if (namedProject == null && projectStore != null) { projectStore.Dispose(); projectStore = null; } } } }); }
public IEnumerable <ClassTime> Subtract(ClassTime other) { if (!Overlaps(other)) { return(EnumerableExtensions.AsEnumerable(this)); } var result = new List <ClassTime>(2); if (Contains(other.start)) { result.Add(new ClassTime(day, start, other.start)); } if (Contains(other.end)) { result.Add(new ClassTime(day, other.end, end)); } return(result); }
internal IEnumerable <ClassTime> GetClassTimes() { IEnumerable <ClassTime> times = null; if (ClassTimes_Concreate.Any()) { times = ClassTimes_Concreate.ToList(); } else if (ClassTime != null) { times = EnumerableExtensions.AsEnumerable(ClassTime.CreateClassTime()) .ToList(); } else if (ClassTimes.Any()) { times = BuildClassTimes(ClassTimes); } return(times); }
protected override bool LoadInternal() { IProjectStore projectStore = ProjectStoreHelper.CreateProjectStore(base.DocumentReference, base.Services, ProjectStoreHelper.ResilientProjectCreationChain); if (projectStore == null) { return(false); } if (!(new UpgradeWizard(this, EnumerableExtensions.AsEnumerable <IProjectStore>(projectStore), null, () => { projectStore.Dispose(); projectStore = ProjectStoreHelper.CreateProjectStore(this.DocumentReference, this.Services, ProjectStoreHelper.DefaultProjectCreationChain); }, base.Services)).Upgrade()) { return(false); } if (projectStore is MigratingMSBuildStore) { projectStore.Dispose(); projectStore = ProjectStoreHelper.CreateProjectStore(base.DocumentReference, base.Services, ProjectStoreHelper.DefaultProjectCreationChain); } INamedProject namedProject = null; try { namedProject = base.OpenProject(projectStore); if (namedProject != null) { base.OpenInitialScene(); } } finally { if (namedProject == null && projectStore != null) { projectStore.Dispose(); } } return(namedProject != null); }
public AggregateLicenseInformation CreateLicenseStore(IList <ApplicationLicenses> studioLicenses) { return(new AggregateLicenseInformation(Enumerable.Concat <ApplicationLicenses>((IEnumerable <ApplicationLicenses>)studioLicenses, EnumerableExtensions.AsEnumerable <ApplicationLicenses>((ApplicationLicenses)this)))); }
private IEnumerable <UpgradeAction> GetProposedUpgrades(Dictionary <ConversionType, ConversionType> conversionMapping) { return(ConversionHelper.CheckAndAddFile(new ConversionTarget(base.Solution), EnumerableExtensions.AsEnumerable <IProjectConverter>(this), conversionMapping, false)); }
private static IEnumerable <ClassActivityBuilder> GetClassActivities(CourseGroupBuilder group) { return(EnumerableExtensions.AsEnumerable(group.Lecture) .Concat(group.PracticalClasses) .Concat(group.Labs)); }
private static void ScheduleInfo(IEnumerable <ClassSchedule> schedules) { var placements = schedules .Select(x => x.CoursesPlacements.Values) .ToList(); var timesPerCourse = placements .Select(x => x.Select(y => { var classTimes = new List <ClassTime>(); IEnumerable <IClassActivity> classActivities = EnumerableExtensions.AsEnumerable(y.Lecture, y.PracticeClass, y.Lab); foreach (IClassActivity classActivity in classActivities) { if (classActivity != null) { classTimes.AddRange(classActivity.Times); } } return(Course: y.Course, Times: classTimes); })) .Select(x => x.ToDictionary(y => y.Course, y => y.Times)) .ToList(); var times = timesPerCourse .Select(x => x.Values.SelectMany(y => y)) .Select(x => x .OrderBy(y => y.Day) .ThenBy(y => y.Start) .ToList() ) .ToList(); var zipped = schedules .Zip(placements) .Zip(timesPerCourse, (tuple, second) => (tuple.First, tuple.Second, second)) .Zip(times, (tuple, second) => (tuple.First, tuple.Second, tuple.second, second)) .Select(x => new { Schedule = x.First, Placements = x.Second, TimesPerCourse = x.Item3, Times = x.Item4, Weight = x.First.Weight, PermutationIndex = x.First.PermutationIndex, }) .ToList(); var orderedSchedulesInfos = zipped .OrderBy(x => x.Weight) .ToList(); //var free = orderedSchedulesInfos // .Select(schedule => // { // int freeDaysCount = 0; // for (DayOfWeek day = DayOfWeek.Sunday; day <= DayOfWeek.Thursday; day++) // { // bool found = false; // foreach (ClassTime time in schedule.Times) // { // if (time.Day == day) // { // found = true; // break; // } // } // if (!found) // { // freeDaysCount++; // } // } // return new // { // Schedule = schedule, // FreeDaysCount = freeDaysCount, // Weight = schedule.Weight, // PermutationIndex = schedule.PermutationIndex, // }; // }) // .OrderByDescending(x => x.FreeDaysCount) // .ThenBy(x => x.Weight) // .ToList(); }