private void AddIfExists(IList <FileLayout> existing, FileLayout fileLayout) { if (Exists(fileLayout)) { existing.Add(fileLayout); } }
protected override string GetBasePath(FileLayout layout) { BinaryAssetFolderInfo info = platform.GetBinaryAssetFolder(platform.GetBuildTargets().First()); if (layout < info.oldestLayout) { return(null); } switch (layout) { case FileLayout.Release_1_10: return("Plugins/FMOD/Wrapper"); case FileLayout.Release_2_0: return("Plugins/FMOD/src/Runtime/wrapper"); case FileLayout.Release_2_1: case FileLayout.Release_2_2: return($"{RuntimeUtils.PluginBasePath}/platforms/{info.baseName}/src"); default: throw new ArgumentException("Unrecognised file layout: " + layout); } }
protected override string GetBasePath(FileLayout layout) { BinaryAssetFolderInfo info = platform.GetBinaryAssetFolder(buildTarget); if (layout < info.oldestLayout) { return(null); } switch (layout) { case FileLayout.Release_1_10: return(info.path_1_10); case FileLayout.Release_2_0: return(string.Format("Plugins/FMOD/lib/{0}", info.baseName)); case FileLayout.Release_2_1: case FileLayout.Release_2_2: return($"{RuntimeUtils.PluginBasePath}/platforms/{info.baseName}/lib"); default: throw new ArgumentException("Unrecognised file layout: " + layout); } }
internal TemporalIndexFiles(IndexDirectoryStructure directoryStructure, StoreIndexDescriptor descriptor, FileSystemAbstraction fs) { this._fs = fs; File indexDirectory = directoryStructure.DirectoryForIndex(descriptor.Id); this._date = new FileLayout <DateIndexKey>(new File(indexDirectory, "date"), new DateLayout(), ValueGroup.DATE); this._localTime = new FileLayout <LocalTimeIndexKey>(new File(indexDirectory, "localTime"), new LocalTimeLayout(), ValueGroup.LOCAL_TIME); this._zonedTime = new FileLayout <ZonedTimeIndexKey>(new File(indexDirectory, "zonedTime"), new ZonedTimeLayout(), ValueGroup.ZONED_TIME); this._localDateTime = new FileLayout <LocalDateTimeIndexKey>(new File(indexDirectory, "localDateTime"), new LocalDateTimeLayout(), ValueGroup.LOCAL_DATE_TIME); this._zonedDateTime = new FileLayout <ZonedDateTimeIndexKey>(new File(indexDirectory, "zonedDateTime"), new ZonedDateTimeLayout(), ValueGroup.ZONED_DATE_TIME); this._duration = new FileLayout <DurationIndexKey>(new File(indexDirectory, "duration"), new DurationLayout(), ValueGroup.DURATION); }
private void AddVersion(FileLayout layout, string path, bool absolute) { if (pathVersions == null) { pathVersions = new Dictionary <FileLayout, PathInfo>(); } pathVersions.Add(layout, new PathInfo() { path = path, absolute = absolute }); }
public void GetPath(FileLayout layout, out string path, out bool absolute) { if (pathVersions != null) { PathInfo pathForLayout; if (pathVersions.TryGetValue(layout, out pathForLayout)) { absolute = pathForLayout.absolute; path = pathForLayout.path; return; } } absolute = false; path = latestPath; }
public virtual void Localize(CultureInfo cultureInfo, FileLayout fileLayout) { foreach (var file in Files) { if (!file.CanLocalizeFile()) { continue; } var html = file.Localize(cultureInfo); string path = GenerateFileName(file, cultureInfo, fileLayout); if (BaseDirectory != null) { path = Path.Combine(BaseDirectory.FullName, path); } Directory.CreateDirectory(Path.GetDirectoryName(path)); File.WriteAllText(path, html); } }
static void Main() { var lp = new LayoutPers(); var file = new FileLayout(@"C:\TestFile\ProvaFile.txt", "track", lp); var zuck = new LayoutPers(); file.AddLayout("zuck", zuck); lp.ResetFields(true); zuck.ResetFields(true); zuck.Field("numericoField").NumberDecimalSeparator = "."; lp.Field("TRACREC").StringValue = "00"; zuck.Field("TRACREC").StringValue = "01"; lp.Field("Field1").StringValue = "lp"; zuck.Field("Field1").StringValue = "zuck"; zuck.Field("Field2").StringValue = "xxx"; lp.Field("numericoField").NumericValue = 0.1M; zuck.Field("numericoField").NumericValue = 100; if (file.WriteLine()) { Console.WriteLine("something goes wrong..."); } if (file.WriteLine("zuck")) { Console.WriteLine("qualcosa è andato storto"); } Console.WriteLine("hit any key to continue..."); Console.ReadLine(); }
private string GetLocation(FileLayout layout) { string basePath = GetBasePath(layout); if (basePath == null) { return(null); } bool absolute; string path; fileRecord.GetPath(layout, out path, out absolute); if (absolute) { return(path); } else { return(string.Format("{0}/{1}", basePath, path)); } }
private bool Exists(FileLayout fileLayout) { return(fileLayout != null && _fs.fileExists(fileLayout.indexFile)); }
public DataInfo(ChunkLayout chunkLayout, FileLayout fileLayout, Metadata metadata) { _chunkLayout = chunkLayout; _fileLayout = fileLayout; _metadata = metadata; }
protected virtual string GenerateFileName(HtmlFile file, CultureInfo cultureInfo, FileLayout fileLayout) { var path = file.Path; if (string.IsNullOrEmpty(path)) { return(path); } switch (fileLayout) { case FileLayout.Extensions: return(Path.GetFileNameWithoutExtension(path) + "." + cultureInfo.Name + Path.GetExtension(path)); case FileLayout.SubDirectory: return(Path.Combine(Path.GetDirectoryName(path), cultureInfo.Name, Path.GetFileName(path))); default: throw new ArgumentOutOfRangeException(nameof(fileLayout), fileLayout, null); } }
public BinaryAssetFolderInfo(string baseName, FileLayout oldestLayout) { this.baseName = baseName; this.path_1_10 = null; this.oldestLayout = oldestLayout; }
public FileRecord WithRelativeVersion(FileLayout layout, string path) { AddVersion(layout, path, false); return(this); }
public FileRecord WithAbsoluteVersion(FileLayout layout, string path) { AddVersion(layout, path, true); return(this); }
protected abstract string GetBasePath(FileLayout layout);