Exemple #1
0
 private void AddIfExists(IList <FileLayout> existing, FileLayout fileLayout)
 {
     if (Exists(fileLayout))
     {
         existing.Add(fileLayout);
     }
 }
Exemple #2
0
            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);
                }
            }
Exemple #3
0
            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);
                }
            }
Exemple #4
0
        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);
        }
Exemple #5
0
            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
                });
            }
Exemple #6
0
            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;
            }
Exemple #7
0
        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);
            }
        }
Exemple #8
0
        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();
        }
Exemple #9
0
            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));
                }
            }
Exemple #10
0
 private bool Exists(FileLayout fileLayout)
 {
     return(fileLayout != null && _fs.fileExists(fileLayout.indexFile));
 }
Exemple #11
0
 public DataInfo(ChunkLayout chunkLayout, FileLayout fileLayout, Metadata metadata)
 {
     _chunkLayout = chunkLayout;
     _fileLayout  = fileLayout;
     _metadata    = metadata;
 }
Exemple #12
0
        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);
            }
        }
Exemple #13
0
 public BinaryAssetFolderInfo(string baseName, FileLayout oldestLayout)
 {
     this.baseName     = baseName;
     this.path_1_10    = null;
     this.oldestLayout = oldestLayout;
 }
Exemple #14
0
 public FileRecord WithRelativeVersion(FileLayout layout, string path)
 {
     AddVersion(layout, path, false);
     return(this);
 }
Exemple #15
0
 public FileRecord WithAbsoluteVersion(FileLayout layout, string path)
 {
     AddVersion(layout, path, true);
     return(this);
 }
Exemple #16
0
 protected abstract string GetBasePath(FileLayout layout);