/// <summary> /// Creates a new SrcMLArchive. /// </summary> /// <param name="baseDirectory">The parent of <paramref name="srcMLDirectory"/>. <see cref="AbstractArchive.ArchivePath"/> will be set to <c>Path.Combine(baseDirectory, srcMLDirectory)</c></param> /// <param name="srcMLDirectory">The directory to store the SrcML files in. This will be created as a subdirectory of <paramref name="baseDirectory"/></param> /// <param name="useExistingSrcML">If True, any existing SrcML files in <see cref="AbstractArchive.ArchivePath"/> will be used. If False, these files will be deleted and potentially recreated.</param> /// <param name="generator">The SrcMLGenerator to use to convert source files to SrcML.</param> /// <param name="xmlMapping">The XmlFileNameMapping to use to map source paths to xml file paths.</param> /// <param name="scheduler">The task scheduler to for asynchronous tasks</param> public SrcMLArchive(string baseDirectory, string srcMLDirectory, bool useExistingSrcML, SrcMLGenerator generator, XmlFileNameMapping xmlMapping, TaskScheduler scheduler) : base(baseDirectory, srcMLDirectory, scheduler) { this.XmlGenerator = generator; this.xmlFileNameMapping = xmlMapping; if (!Directory.Exists(this.ArchivePath)) { Directory.CreateDirectory(this.ArchivePath); } else { if (!useExistingSrcML) { foreach (var file in Directory.GetFiles(ArchivePath, "*.xml")) { File.Delete(file); } } } }
/// <summary> /// Creates a new SrcMLArchive. The archive is created in <c>"baseDirectory\srcML"</c>. /// </summary> /// <param name="baseDirectory">the base directory</param> /// <param name="useExistingSrcML">If True, any existing SrcML files in <see cref="AbstractArchive.ArchivePath"/> will be used. If False, these files will be deleted and potentially recreated.</param> /// <param name="generator">The SrcMLGenerator to use to convert source files to SrcML.</param> /// <param name="xmlMapping">The XmlFileNameMapping to use to map source paths to xml file paths.</param> public SrcMLArchive(string baseDirectory, bool useExistingSrcML, SrcMLGenerator generator, XmlFileNameMapping xmlMapping) : this(baseDirectory, "srcML", useExistingSrcML, generator, xmlMapping, TaskScheduler.Default) { }
/// <summary> /// Creates a new SrcMLArchive. /// </summary> /// <param name="baseDirectory">The parent of <paramref name="srcMLDirectory"/>. <see cref="AbstractArchive.ArchivePath"/> will be set to <c>Path.Combine(baseDirectory, srcMLDirectory)</c></param> /// <param name="srcMLDirectory">The directory to store the SrcML files in. This will be created as a subdirectory of <paramref name="baseDirectory"/></param> /// <param name="useExistingSrcML">If True, any existing SrcML files in <see cref="AbstractArchive.ArchivePath"/> will be used. If False, these files will be deleted and potentially recreated.</param> /// <param name="generator">The SrcMLGenerator to use to convert source files to SrcML.</param> /// <param name="xmlMapping">The XmlFileNameMapping to use to map source paths to xml file paths.</param> /// <param name="scheduler">The task scheduler to for asynchronous tasks</param> public SrcMLArchive(string baseDirectory, string srcMLDirectory, bool useExistingSrcML, SrcMLGenerator generator, XmlFileNameMapping xmlMapping, TaskScheduler scheduler) : base(baseDirectory, srcMLDirectory, scheduler) { this.XmlGenerator = generator; this.xmlFileNameMapping = xmlMapping; if(!Directory.Exists(this.ArchivePath)) { Directory.CreateDirectory(this.ArchivePath); } else { if(!useExistingSrcML) { foreach(var file in Directory.GetFiles(ArchivePath, "*.xml")) { File.Delete(file); } } } }
/// <summary> /// Creates a new SrcMLArchive. The archive is created in <c>"baseDirectory\srcML"</c>. /// </summary> /// <param name="baseDirectory">the base directory</param> /// <param name="useExistingSrcML">If True, any existing SrcML files in <see cref="AbstractArchive.ArchivePath"/> will be used. If False, these files will be deleted and potentially recreated.</param> /// <param name="generator">The SrcMLGenerator to use to convert source files to SrcML.</param> /// <param name="xmlMapping">The XmlFileNameMapping to use to map source paths to xml file paths.</param> public SrcMLArchive(string baseDirectory, bool useExistingSrcML, SrcMLGenerator generator, XmlFileNameMapping xmlMapping) : this(baseDirectory, DEFAULT_ARCHIVE_DIRECTORY, useExistingSrcML, generator, xmlMapping, TaskScheduler.Default) { }