Beispiel #1
0
 private void UpdateProperties(IBuild otherBuild)
 {
     LastChangedTime = otherBuild.LastChangedTime;
     QueueTime       = otherBuild.QueueTime;
     Status          = otherBuild.Status;
     Progress        = otherBuild.Progress;
 }
Beispiel #2
0
        public void ShowBuild(IBuild build, Func <IBuild, String> iconProvider, Action <IBuild> notificationClickAction)
        {
            // Get a toast XML template
            var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText04);

            // Fill in the text elements
            var stringElements = toastXml.GetElementsByTagName("text");

            stringElements[0].AppendChild(toastXml.CreateTextNode(GetTitle(build)));
            stringElements[1].AppendChild(toastXml.CreateTextNode(build.GenerateStatus()));
            stringElements[2].AppendChild(toastXml.CreateTextNode(build.GenerateUsername()));

            // Specify the absolute path to an image
            var imagePath = "file:///" + Path.GetFullPath(iconProvider.Invoke(build));

            var imageElements = toastXml.GetElementsByTagName("image");
            var src           = imageElements[0].Attributes.GetNamedItem("src");

            if (src != null)
            {
                src.NodeValue = imagePath;
            }

            // Create the toast and attach event listeners
            var toast = new ToastNotification(toastXml);

            if (notificationClickAction != null)
            {
                toast.Activated += (sender, args) => { notificationClickAction.Invoke(build); };
            }

            // Show the toast. Be sure to specify the AppUserModelId on your application's shortcut!
            ToastNotificationManager.CreateToastNotifier(AppId).Show(toast);
        }
        private string PathFor(IBuild build, bool asFilePath)
        {
            if (build == null)
            {
                return(null);
            }
            // Happens for current/selected builds that are not saved when Serialize is called
            if (!_names.ContainsKey(build))
            {
                return(null);
            }
            if (build == _persistentData.RootBuild)
            {
                return(asFilePath ? _persistentData.Options.BuildsSavePath : "");
            }

            var path   = SerializationUtils.EncodeFileName(_names[build]);
            var parent = _parents[build];

            while (parent != _persistentData.RootBuild)
            {
                path   = Path.Combine(SerializationUtils.EncodeFileName(_names[parent]), path);
                parent = _parents[parent];
            }
            return(asFilePath ? Path.Combine(_persistentData.Options.BuildsSavePath, path) : path);
        }
        public override bool Build(DirectShowLib.IPin source, IBuild build)
        {
            bool result = false;

            if (Abstract.FindCaptureDeviceNameByIdentifier(this.device).NotNull())
            {
                DirectShowLib.IBaseFilter filter = Abstract.FindCaptureDeviceByIdentifier(this.device, false);
                if (filter.NotNull() && this.SetFormat(filter))
                {
                    if (build.Graph.AddFilter(filter, "Capture") == 0)
                    {
                        foreach (Filters.Abstract candidate in this.Next)
                        {
                            if (result = candidate.Build(filter, 0, build))
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        Error.Log.Append(Error.Level.Debug, "Unable to open capture.", "DirectShow was unable to capture \"" + this.device + "\".");
                        Exception.GraphError.Check(build.Graph.RemoveFilter(filter));
                    }
                }
            }
            return(result);
        }
Beispiel #5
0
        protected override bool IsBuildIncludedInternal(IBuild build, string input)
        {
            var buildDate = build.QueueTime;

            if (buildDate == null)
            {
                return(true);
            }

            if (input.Equals(_todayString, StringComparison.InvariantCultureIgnoreCase))
            {
                return(buildDate.Value.Date.Equals(Today()));
            }

            if (input.Equals(_yesterdayString, StringComparison.InvariantCultureIgnoreCase))
            {
                return(buildDate.Value.Date.Equals(Today() - TimeSpan.FromDays(1)));
            }

            if (DateTime.TryParse(input, CurrentCultureInfo, DateTimeStyles.AssumeLocal, out var inputAsDateTime))
            {
                return(buildDate.Value.Date.Equals(inputAsDateTime.Date));
            }

            return(false);
        }
        public override bool Build(DirectShowLib.IPin source, IBuild build)
        {
            bool result = false;

            DirectShowLib.IBaseFilter filter = this.Create();
            if (filter.NotNull())
            {
                Exception.GraphError.Check((filter as DirectShowLib.IFileSourceFilter).Load(this.file, new DirectShowLib.AMMediaType()));
                if (build.Graph.AddFilter(filter, "Asf Reader") == 0)
                {
                    foreach (Abstract candidate in this.Next)
                    {
                        if (result = candidate.Build(filter, build))
                        {
                            break;
                        }
                    }
                }
                else
                {
                    Error.Log.Append(Error.Level.Debug, "Unable to open file.", "DirectShow was unable to open file \"" + this.file + "\".");
                    Exception.GraphError.Check(build.Graph.RemoveFilter(filter));
                }
            }
            return(result);
        }
        /// <summary>
        /// Gets the build name.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="build">The build.</param>
        /// <returns>The build name.</returns>
        public static string GetBuildName(IProject project, IBuild build)
        {
            Ensure.That(project).IsNotNull();
            Ensure.That(build).IsNotNull();

            return(GetBuildName(project.Name, build.VersionNumber()));
        }
Beispiel #8
0
        virtual protected List <IBuild> DiscoverBuilds()
        {
            var BuildList = new List <IBuild>();

            if (BuildPaths.Count() > 0)
            {
                foreach (string Path in BuildPaths)
                {
                    IEnumerable <IFolderBuildSource> BuildSources = Gauntlet.Utils.InterfaceHelpers.FindImplementations <IFolderBuildSource>();

                    foreach (var BS in BuildSources)
                    {
                        IEnumerable <IBuild> Builds = BS.GetBuildsAtPath(ProjectName, Path);

                        BuildList.AddRange(Builds);
                    }
                }
            }

            // Editor?
            IBuild EditorBuild = CreateEditorBuild(UnrealPath);

            if (EditorBuild != null)
            {
                BuildList.Add(EditorBuild);
            }
            else
            {
                Log.Verbose("No editor found for {0}, editor-builds will be unavailable", ProjectName);
            }

            // give higher level code a chance to reject stuff
            return(BuildList.Where(B => ShouldMakeBuildAvailable(B)).ToList());
        }
        public override bool Build(DirectShowLib.IPin source, IBuild build)
        {
            this.build          = build;
            this.build.OnClose += this.Dispose;
            bool result;

            if (result = base.Build(source, build))
            {
                DirectShowLib.AMMediaType media = new DirectShowLib.AMMediaType();
                Exception.GraphError.Check((this.grabber as  DirectShowLib.ISampleGrabber).GetConnectedMediaType(media));
                DirectShowLib.VideoInfoHeader header = (DirectShowLib.VideoInfoHeader)System.Runtime.InteropServices.Marshal.PtrToStructure(media.formatPtr, typeof(DirectShowLib.VideoInfoHeader));
                this.size     = new Geometry2D.Integer.Size(header.BmiHeader.Width, header.BmiHeader.Height);
                this.lifetime = header.AvgTimePerFrame;
                // NOTE!!!! Here we set a default frame rate if the video does not have such information available.
                if (this.lifetime < 1000 || this.lifetime > 10000000)
                {
                    this.lifetime = 400000;
                }
                if (this.Rate.NotNull())
                {
                    double factor = (double)this.Rate / (1000 / new TimeSpan(this.lifetime).TotalMilliseconds);
                    int    code   = (this.build.Graph as DirectShowLib.IMediaSeeking).SetRate(factor);
                }
            }
            return(result);
        }
        /// <summary>
        /// Deletes the given build from the filesystem.
        /// </summary>
        /// <remarks>
        /// The build's parent folder must have been saved beforehand.
        /// </remarks>
        public void DeleteBuild(IBuild build)
        {
            // Return if build was not yet saved to the filesystem.
            if (!_names.ContainsKey(build))
            {
                return;
            }
            string path;

            if (!_markedForDeletion.TryGetValue(build, out path))
            {
                throw new ArgumentException(
                          "The build must have been removed from its parent folder and its parent folder must have been saved",
                          nameof(build));
            }
            if (build is PoEBuild)
            {
                File.Delete(path);
            }
            else
            {
                Directory.Delete(path, true);
            }
            _markedForDeletion.Remove(build);
            _names.Remove(build);
        }
 /// <param name="o">IBuild instance</param>
 public SBuild(IBuild o)
 {
     link = o;
     if(link == null) {
         link = new SBuildEmpty();
     }
 }
        private static void TreeTraverse(Action <IBuild> action, IBuild current)
        {
            action(current);
            var folder = current as BuildFolder;

            folder?.Builds.ForEach(b => TreeTraverse(action, b));
        }
		public virtual bool Build(DirectShowLib.IBaseFilter previous, int i, IBuild build)
		{
			bool result = false;
			DirectShowLib.IPin outPin = DirectShowLib.DsFindPin.ByDirection(previous, DirectShowLib.PinDirection.Output, i);
			if (outPin.NotNull())
				result = this.Build(outPin, build);
			return result;
		}
Beispiel #14
0
		public override bool Build(DirectShowLib.IPin source, IBuild build)
		{
			bool result = false;
			foreach (Abstract candidate in this.Next)
				if (result = candidate.Build(source, build))
					break;
			return result;
		}
Beispiel #15
0
 /// <param name="o">IBuild instance</param>
 public SBuild(IBuild o)
 {
     link = o;
     if (link == null)
     {
         link = new SBuildEmpty();
     }
 }
        public void Setup()
        {
            _tellTheTime = Substitute.For <ITellTheTime>();
            _build       = Substitute.For <IBuild>();

            _tellTheTime.Today().Returns(new DateTime(2017, 12, 04));
            _tellTheTime.Now().Returns(new DateTime(2017, 12, 04));
        }
 private List <double> GetDurationsInMilliseconds(IBuild build, List <Build> builds)
 {
     return((from bld in builds
             let buildStep = build.GetMatchingBuildStep(bld)
                             where buildStep != null
                             select(bld.FinishDateTime - buildStep.StartDateTime).TotalMilliseconds)
            .ToList());
 }
Beispiel #18
0
        protected override bool IsBuildIncludedInternal(IBuild build, string input)
        {
            if (!StringMatcher.SearchPattern.Equals(input, StringComparison.InvariantCulture))
            {
                StringMatcher.SearchPattern = input;
            }

            return(StringMatcher.IsMatch(StringValueOfBuild(build)));
        }
        public bool IsBuildIncluded(IBuild build, string input)
        {
            if (string.IsNullOrWhiteSpace(input))
            {
                return(true);
            }

            return(IsBuildIncludedInternal(build, TrimInput(input)));
        }
Beispiel #20
0
 public Query(IQueryOptions options, IEnumerable <IRepository> repositories, IBuild build, IYaml yaml)
 {
     Options      = options;
     Repositories = repositories;
     Build        = build;
     Yaml         = yaml;
     SetQueryParameters();
     _getQuery = new Lazy <string>(() => string.Join("&", QueryParameters.Select(x => $"{x.Key}={x.Value ?? string.Empty}")));
 }
Beispiel #21
0
 public BuildViewModel(IBuild build)
 {
     _build          = build;
     _itemViewModels = new Dictionary <Slot, ItemViewModel>();
     foreach (Slot s in Enum.GetValues(typeof(Slot)))
     {
         _itemViewModels[s] = new ItemViewModel(_build.GetItem(s));
     }
 }
 public bool TryGetBuild(int _id, out IBuild _build)
 {
     _build = null;
     if (builds.ContainsKey(_id))
     {
         _build = builds[_id];
     }
     return(_build != null);
 }
Beispiel #23
0
        public void TestDeserialize()
        {
            IDictionary <CharacterClass, IEnumerable <IBuild> > builds = _serializer.Deserialize(_exampleFile);

            Assert.AreEqual(6, builds.Keys.Count, "Dictionary contains builds for 6 different classes");
            Assert.AreEqual(1, builds[CharacterClass.Crusader].Count(), "Dictionary contains exactly 1 build for crusader class");
            IBuild firstBuild = builds[CharacterClass.Crusader].First();

            Assert.AreEqual("LoN", firstBuild.Name, "The crusader build is called 'LoN'");
        }
        public virtual bool Build(DirectShowLib.IBaseFilter previous, int i, IBuild build)
        {
            bool result = false;

            DirectShowLib.IPin outPin = DirectShowLib.DsFindPin.ByDirection(previous, DirectShowLib.PinDirection.Output, i);
            if (outPin.NotNull())
            {
                result = this.Build(outPin, build);
            }
            return(result);
        }
Beispiel #25
0
 public SolutionPatcherPrep(
     ILogger logger,
     IPathToProjProvider pathToProjProvider,
     ICopyOverExtraData copyOverExtraData,
     IBuild build)
 {
     _logger            = logger;
     PathToProjProvider = pathToProjProvider;
     CopyOverExtraData  = copyOverExtraData;
     Build = build;
 }
Beispiel #26
0
        public static String GenerateTitle(this IBuild build, BuildViewStyle viewStyle)
        {
            if (viewStyle == BuildViewStyle.GroupByPullRequest)
            {
                if (build.PullRequest != null)
                {
                    return($"{build.Definition.Project.Name} - {build.PullRequest.Title} - {build.BuildNumber}");
                }
            }

            return($"{build.Definition.Project.Name} - {build.Definition.Name} - {build.BuildNumber}");
        }
		public virtual bool Build(DirectShowLib.IBaseFilter previous, IBuild build)
		{
			bool result = false;
			if (this.Output == -1)
			{
				for (int i = 0; i < 6 && !result; i++)
					result = this.Build(previous, i, build);
			}
			else
				result = this.Build(previous, this.Output.Value, build);
			return result;
		}
Beispiel #28
0
        public override bool Build(DirectShowLib.IPin source, IBuild build)
        {
            bool result = false;

            DirectShowLib.IBaseFilter filter = this.Create();
            if (filter.NotNull() && build.Graph.AddFilter(filter, this.Description) == 0 && this.PreConfiguration(build))
            {
                result = true;
                DirectShowLib.PinInfo pinInformation;
                Exception.GraphError.Check(source.QueryPinInfo(out pinInformation));
                DirectShowLib.FilterInfo filterInformation;
                Exception.GraphError.Check(pinInformation.filter.QueryFilterInfo(out filterInformation));
                switch (filterInformation.achName)
                {
                case "Capture":
                    this.CreateSource(DirectShowLib.PinCategory.Capture, pinInformation.filter, filter, build);
                    break;

                case "Source":
                    this.CreateSource(null, pinInformation.filter, filter, build);
                    break;

                default:
                    if (!(result = (this.FuzzyMatch ?
                                    0 <= build.Graph.Connect(source, DirectShowLib.DsFindPin.ByDirection(filter, DirectShowLib.PinDirection.Input, 0)) :
                                    0 == build.Graph.ConnectDirect(source, DirectShowLib.DsFindPin.ByDirection(filter, DirectShowLib.PinDirection.Input, 0), new DirectShowLib.AMMediaType()))))
                    {
                        Error.Log.Append(Error.Level.Debug, "Unable to connect.", "DirectShow was unable to connect \"" + filterInformation.achName + "\" with \"" + this.Description + "\".");
                        Exception.GraphError.Check(source.Disconnect());
                        Exception.GraphError.Check(build.Graph.RemoveFilter(filter));
                    }
                    break;
                }
                if (result &= this.PostConfiguration(build))
                {
                    if (this.WaitForOutput.Ticks > 0)
                    {
                        System.Threading.Thread.Sleep(this.WaitForOutput);
                    }
                    for (int i = 0; i < this.Followers.Length; i++)
                    {
                        foreach (Filters.Abstract candidate in this.Followers[i])
                        {
                            if (result &= candidate.Build(filter, build))
                            {
                                break;
                            }
                        }
                    }
                }
            }
            return(result);
        }
 public GitPatcherCompilation(
     ILogger logger,
     IFileSystem fs,
     IBuild build,
     IWriteShortCircuitMeta writeShortCircuitMeta,
     IShouldShortCircuitCompilation shortCircuitCompilation)
 {
     _logger = logger;
     _fs     = fs;
     _build  = build;
     _writeShortCircuitMeta   = writeShortCircuitMeta;
     _shortCircuitCompilation = shortCircuitCompilation;
 }
Beispiel #30
0
        private IBuildTreeNode BuildPath(IBuild build, IList <IBranch> branches)
        {
            var node = ConstructNode(Arrangement.GroupDefinition.None, build, branches);

            foreach (var group in GroupDefinition.Reverse())
            {
                var parent = ConstructNode(group, build, branches);
                parent.AddChild(node);
                node = parent;
            }

            return(node);
        }
Beispiel #31
0
        public override bool Build(DirectShowLib.IPin source, IBuild build)
        {
            bool result = false;

            foreach (Abstract candidate in this.Next)
            {
                if (result = candidate.Build(source, build))
                {
                    break;
                }
            }
            return(result);
        }
 public CreateProgramReleaseRequest(
     ProgramInfo program,
     SemanticVersion version,
     ProgramPackage package,
     IBuild build             = null,
     IRepositoryCommit commit = null)
 {
     Program = program ?? throw new ArgumentNullException(nameof(program));
     Package = package ?? throw new ArgumentNullException(nameof(package));
     Build   = build;
     Version = version;
     Commit  = commit;
 }
Beispiel #33
0
        protected override bool IsBuildIncludedInternal(IBuild build, string input)
        {
            var matchingKeywords = AllValueKeywords.Where(k => k.Equals(input, StringComparison.InvariantCultureIgnoreCase)).ToList();

            if (matchingKeywords.Count != 1)
            {
                return(false);
            }

            var keyword = matchingKeywords[0];

            return(LogicTuples[keyword](build));
        }
Beispiel #34
0
		public override bool Build(DirectShowLib.IPin source, IBuild build)
		{
			foreach (Filters.Abstract candidate in this.Next)
				candidate.FuzzyMatch = this.FuzzyMatch;
			bool result = false;
			foreach (Abstract candidate in this.Next)
			{
				candidate.Rate = this.Rate;
				if (result = candidate.Build(source, build))
					break;
			}
			return result;
		}
Beispiel #35
0
 public BuildArtifact(
     IBuild build,
     string name,
     string fullName,
     long?size,
     DateTimeOffset modificationDateTime)
 {
     Build                = build;
     Name                 = name;
     FullName             = fullName;
     Size                 = size;
     ModificationDateTime = modificationDateTime;
 }
        public LoginMethodLoader(IAccountLoginMethodQuery accountLoginMethodQuery, IBuild<LoginMethod, LoginMethodViewModel> loginMethodViewModelBuilder)
        {
            if (accountLoginMethodQuery == null)
            {
                throw new ArgumentNullException("accountLoginMethodQuery");
            }

            if (loginMethodViewModelBuilder == null)
            {
                throw new ArgumentNullException("loginMethodViewModelBuilder");
            }

            this.accountLoginMethodQuery = accountLoginMethodQuery;
            this.loginMethodViewModelBuilder = loginMethodViewModelBuilder;
        }
Beispiel #37
0
		public override bool Build(DirectShowLib.IPin source, IBuild build)
		{
			bool result = false;
			DirectShowLib.IBaseFilter filter;
			if (build.Graph.AddSourceFilter(this.file, "Ds.NET FileFilter", out filter) == 0)
			{
				foreach (Abstract candidate in this.Next)
					if (result = candidate.Build(filter, build))
						break;
			}
			else
			{
				Error.Log.Append(Error.Level.Debug, "Unable to open file.", "DirectShow was unable to open file \"" + this.file + "\".");
				Exception.GraphError.Check(build.Graph.RemoveFilter(filter));
			}
			return result;
		}
        private string PathFor(IBuild build, bool asFilePath)
        {
            if (build == null)
                return null;
            // Happens for current/selected builds that are not saved when Serialize is called
            if (!_names.ContainsKey(build))
                return null;
            if (build == _persistentData.RootBuild)
                return asFilePath ? _persistentData.Options.BuildsSavePath : "";

            var path = SerializationUtils.EncodeFileName(_names[build]);
            var parent = _parents[build];
            while (parent != _persistentData.RootBuild)
            {
                path = Path.Combine(SerializationUtils.EncodeFileName(_names[parent]), path);
                parent = _parents[parent];
            }
            return asFilePath ? Path.Combine(_persistentData.Options.BuildsSavePath, path) : path;
        }
		public override bool Build(DirectShowLib.IPin source, IBuild build)
		{
			bool result = false;
			DirectShowLib.IBaseFilter filter = this.Create();
			if (filter.NotNull() && build.Graph.AddFilter(filter, this.Description) == 0 && this.PreConfiguration(build))
			{
				result = true;
				DirectShowLib.PinInfo pinInformation;
				Exception.GraphError.Check(source.QueryPinInfo(out pinInformation));
				DirectShowLib.FilterInfo filterInformation;
				Exception.GraphError.Check(pinInformation.filter.QueryFilterInfo(out filterInformation));
				switch (filterInformation.achName)
				{
					case "Capture":
						this.CreateSource(DirectShowLib.PinCategory.Capture, pinInformation.filter, filter, build);
						break;
					case "Source":
						this.CreateSource(null, pinInformation.filter, filter, build);
						break;
					default:
						if (!(result = (this.FuzzyMatch ?
							0 <= build.Graph.Connect(source, DirectShowLib.DsFindPin.ByDirection(filter, DirectShowLib.PinDirection.Input, 0)) :
							0 == build.Graph.ConnectDirect(source, DirectShowLib.DsFindPin.ByDirection(filter, DirectShowLib.PinDirection.Input, 0), new DirectShowLib.AMMediaType()))))
						{
							Error.Log.Append(Error.Level.Debug, "Unable to connect.", "DirectShow was unable to connect \"" + filterInformation.achName + "\" with \"" + this.Description + "\".");
							Exception.GraphError.Check(source.Disconnect());
							Exception.GraphError.Check(build.Graph.RemoveFilter(filter));
						}
						break;
				}
				if (result &= this.PostConfiguration(build))
				{
					if (this.WaitForOutput.Ticks > 0)
						System.Threading.Thread.Sleep(this.WaitForOutput);
					for (int i = 0; i < this.Followers.Length; i++)
						foreach (Filters.Abstract candidate in this.Followers[i])
							if (result &= candidate.Build(filter, build))
								break;
				}
			}
			return result;
		}
		public override bool Build(DirectShowLib.IPin source, IBuild build)
		{
			bool result = false;
			DirectShowLib.IBaseFilter filter = this.Create();
			if (filter.NotNull())
			{
				Exception.GraphError.Check((filter as DirectShowLib.IFileSourceFilter).Load(this.file, new DirectShowLib.AMMediaType()));
				if (build.Graph.AddFilter(filter, "Asf Reader") == 0)
				{
					foreach (Abstract candidate in this.Next)
						if (result = candidate.Build(filter, build))
							break;
				}
				else
				{
					Error.Log.Append(Error.Level.Debug, "Unable to open file.", "DirectShow was unable to open file \"" + this.file + "\".");
					Exception.GraphError.Check(build.Graph.RemoveFilter(filter));
				}
			}
			return result;
		}
		public override bool Build(DirectShowLib.IPin source, IBuild build)
		{
			bool result = false;
			if (Abstract.FindCaptureDeviceNameByIdentifier(this.device).NotNull())
			{
				DirectShowLib.IBaseFilter filter = Abstract.FindCaptureDeviceByIdentifier(this.device, false);
				if (filter.NotNull() && this.SetFormat(filter))
				{
					if (build.Graph.AddFilter(filter, "Capture") == 0)
					{
						foreach (Filters.Abstract candidate in this.Next)
							if (result = candidate.Build(filter, 0, build))
								break;
					}
					else
					{
						Error.Log.Append(Error.Level.Debug, "Unable to open capture.", "DirectShow was unable to capture \"" + this.device + "\".");
						Exception.GraphError.Check(build.Graph.RemoveFilter(filter));
					}
				}
			}
			return result;
		}
		public override bool Build(DirectShowLib.IPin source, IBuild build)
		{
			this.build = build;
			this.build.OnClose += this.Dispose;
			bool result;
			if (result = base.Build(source, build))
			{
				DirectShowLib.AMMediaType media = new DirectShowLib.AMMediaType();
				Exception.GraphError.Check((this.grabber as  DirectShowLib.ISampleGrabber).GetConnectedMediaType(media));
				DirectShowLib.VideoInfoHeader header = (DirectShowLib.VideoInfoHeader)System.Runtime.InteropServices.Marshal.PtrToStructure(media.formatPtr, typeof(DirectShowLib.VideoInfoHeader));
				this.size = new Geometry2D.Integer.Size(header.BmiHeader.Width, header.BmiHeader.Height);
				this.lifetime = header.AvgTimePerFrame;
				// NOTE!!!! Here we set a default frame rate if the video does not have such information available.
				if (this.lifetime < 1000 || this.lifetime > 10000000)
					this.lifetime = 400000;
				if (this.Rate.NotNull())
				{
					double factor = (double)this.Rate / (1000 / new TimeSpan(this.lifetime).TotalMilliseconds) ;
					int code = (this.build.Graph as DirectShowLib.IMediaSeeking).SetRate(factor);
				}
			}
			return result;
		}
 public override void DeleteBuild(IBuild build)
 {
     throw new System.NotSupportedException();
 }
		public bool Build(IBuild build)
		{
			return this.Build((DirectShowLib.IPin)null, build);
		}
		protected virtual bool PostConfiguration(IBuild build) { return true; }
 private static void TreeTraverse(Action<IBuild> action, IBuild current)
 {
     action(current);
     var folder = current as BuildFolder;
     folder?.Builds.ForEach(b => TreeTraverse(action, b));
 }
 public abstract void DeleteBuild(IBuild build);
		public void Dispose()
		{
			if (this.build.NotNull())
			{
				this.build.OnClose -= this.Dispose;
				this.build = null;
			}
			if (this.grabber.NotNull())
			{
				this.grabber.SetCallback(null, 1);
				this.grabber = null;
			}
		}
 public override void DeleteBuild(IBuild build)
 {
     _serializer.DeleteBuild(build);
 }
        /// <summary>
        /// Serializes the given build.
        /// </summary>
        /// <remarks>
        /// Folders have to be serialized right after being changed to update parent information in time.
        /// 
        /// The folder builds are moved to has to be serialized before their old folder.
        /// </remarks>
        public void SerializeBuild(IBuild build)
        {
            string oldName;
            _names.TryGetValue(build, out oldName);
            var name = build.Name;
            _names[build] = name;

            var path = PathFor(build, true);
            var oldPath = path.Remove(path.Length - SerializationUtils.EncodeFileName(name).Length)
                + SerializationUtils.EncodeFileName(oldName);
            var poeBuild = build as PoEBuild;
            if (poeBuild != null)
            {
                SerializeBuild(path, poeBuild);
                if (oldName != null && oldName != name)
                {
                    File.Delete(oldPath + BuildFileExtension);
                }
            }
            else
            {
                if (oldName != null && oldName != name)
                {
                    Directory.Move(oldPath, path);
                }
                var folder = (BuildFolder)build;

                // Move builds that are in folder.Builds but have _parents set to another folder
                // from their old folder to this one.
                foreach (var b in folder.Builds)
                {
                    BuildFolder parent;
                    _parents.TryGetValue(b, out parent);
                    if (_markedForDeletion.ContainsKey(b) || (parent != null && parent != folder))
                    {
                        var isBuild = b is PoEBuild;
                        var extension = isBuild ? BuildFileExtension : "";
                        string old;
                        if (_markedForDeletion.ContainsKey(b))
                        {
                            old = _markedForDeletion[b];
                            _markedForDeletion.Remove(b);
                        }
                        else
                        {
                            old = PathFor(b, true) + extension;
                        }

                        var newPath = Path.Combine(path,
                            SerializationUtils.EncodeFileName(_names[b]) + extension);
                        if (old == newPath)
                            continue;
                        if (isBuild)
                        {
                            File.Move(old, newPath);
                        }
                        else
                        {
                            Directory.Move(old, newPath);
                        }
                    }
                }

                // Mark builds that have folder as _parents entry but are no longer in folder.Builds.
                // These will either be moved when their new folder is saved or deleted when Delete is called.
                // Skip unsaved builds (those are not contained in _names)
                foreach (var parentsEntry in _parents)
                {
                    var b = parentsEntry.Key;
                    if (parentsEntry.Value != folder
                        || !_names.ContainsKey(b)
                        || folder.Builds.Contains(b))
                        continue;
                    var extension = b is PoEBuild ? BuildFileExtension : "";
                    _markedForDeletion[b] = PathFor(b, true) + extension;
                }

                SerializeFolder(path, folder);
            }

            // Just recreate these. Easier than handling all edge cases.
            InitParents();
        }
Beispiel #51
0
        private static BuildInfo CreateBuildInfo(IBuild buildDetail)
        {
            string sha = buildDetail.Revision.Substring(buildDetail.Revision.LastIndexOf(":") + 1);

            var buildInfo = new BuildInfo
            {
                Id = buildDetail.Label,
                StartDate = buildDetail.StartDate,
                Status = (BuildInfo.BuildStatus)buildDetail.Status,
                Description = buildDetail.Label + " (" + buildDetail.Description + ")",
                CommitHashList = new[] { sha },
                Url = buildDetail.Url
            };

            return buildInfo;
        }
 public override void SaveBuild(IBuild build)
 {
     _serializer.SerializeBuild(build);
 }
		protected void CreateSource(DirectShowLib.DsGuid pinCategory, DirectShowLib.IBaseFilter source, DirectShowLib.IBaseFilter destination, IBuild build)
		{
			DirectShowLib.ICaptureGraphBuilder2 captureGraph = new DirectShowLib.CaptureGraphBuilder2() as DirectShowLib.ICaptureGraphBuilder2;
			Exception.GraphError.Check(captureGraph.SetFiltergraph(build.Graph));
			Exception.GraphError.Check(captureGraph.RenderStream(pinCategory, DirectShowLib.MediaType.Video, source, null, destination));
		}
		public abstract bool Build(DirectShowLib.IPin source, IBuild build);
 /// <summary>
 /// Deletes the given build from the filesystem.
 /// </summary>
 /// <remarks>
 /// The build's parent folder must have been saved beforehand.
 /// </remarks>
 public void DeleteBuild(IBuild build)
 {
     // Return if build was not yet saved to the filesystem.
     if (!_names.ContainsKey(build))
         return;
     string path;
     if (!_markedForDeletion.TryGetValue(build, out path))
     {
         throw new ArgumentException(
             "The build must have been removed from its parent folder and its parent folder must have been saved",
             nameof(build));
     }
     if (build is PoEBuild)
         File.Delete(path);
     else
         Directory.Delete(path, true);
     _markedForDeletion.Remove(build);
     _names.Remove(build);
 }
        /// <summary>
        /// Initialize library
        /// </summary>
        /// <param name="lib"></param>
        /// <returns></returns>
        protected bool init()
        {
            if(!Exists) {
                Log.Debug(String.Format("The Client library '{0}' is not found.", FullName));
                return false;
            }

            Assembly lib            = prepare(FullName);
            IEntryPointClient epc   = Instance<IEntryPointClient>.from(lib);

            epc.Version = new API.Version();
            epc.Core    = core;

            switch(epc.Type)
            {
                case ClientType.Dte2: {
                    epc.load(dte2);
                    break;
                }
                case ClientType.Isolated: {
                    epc.load(solutionFile, properties);
                    break;
                }
                case ClientType.Empty: {
                    epc.load();
                    break;
                }
            }

            cevent = new SEvent2(epc.Event);
            cbuild = new SBuild(epc.Build);

            return true;
        }
 public abstract void SaveBuild(IBuild build);