Esempio n. 1
0
        private static void SynchronizeAll()
        {
            var dontSynchronizeProject = The.Workspace.ProjectJson["DontSynchronizeProject"] as bool?;

            if (dontSynchronizeProject != null && dontSynchronizeProject.Value)
            {
                return;
            }
            var fileEnumerator = new ScanOptimizedFileEnumerator(
                The.Workspace.ProjectDirectory,
                CsprojSynchronization.SkipUnwantedDirectoriesPredicate,
                cutDirectoryPrefix: false
                );

            foreach (var target in The.Workspace.Targets)
            {
                var limeProj = CsprojSynchronization.ToUnixSlashes(The.Workspace.GetLimeCsprojFilePath(target.Platform));
                CsprojSynchronization.SynchronizeProject(limeProj);
                using (new DirectoryChanger(The.Workspace.ProjectDirectory)) {
                    var dirInfo = new System.IO.DirectoryInfo(The.Workspace.ProjectDirectory);
                    foreach (var fileInfo in fileEnumerator.Enumerate(The.Workspace.GetPlatformSuffix(target.Platform) + ".csproj"))
                    {
                        CsprojSynchronization.SynchronizeProject(fileInfo.Path);
                    }
                    ;
                    if (target.ProjectPath != null)
                    {
                        foreach (var targetCsprojFile in fileEnumerator.Enumerate(Path.GetFileName(target.ProjectPath)))
                        {
                            CsprojSynchronization.SynchronizeProject(targetCsprojFile.Path);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        protected virtual void ExtractTexts()
        {
            bool ScanFilter(DirectoryInfo directoryInfo)
            {
                if (directoryInfo.Name == "bin")
                {
                    return(false);
                }
                if (directoryInfo.Name == "obj")
                {
                    return(false);
                }
                if (directoryInfo.Name == ".svn")
                {
                    return(false);
                }
                if (directoryInfo.Name == ".git")
                {
                    return(false);
                }
                if (directoryInfo.Name == ".vs")
                {
                    return(false);
                }
                if (directoryInfo.Name == "Citrus")
                {
                    return(false);
                }
                return(true);
            }

            var sourceFiles = new ScanOptimizedFileEnumerator(The.Workspace.ProjectDirectory, ScanFilter);

            using (new DirectoryChanger(The.Workspace.ProjectDirectory)) {
                foreach (var fileInfo in sourceFiles.Enumerate(".cs"))
                {
                    var content = File.ReadAllText(fileInfo.Path, Encoding.UTF8);
                    ProcessSourceFile(fileInfo.Path, content);
                }
            }
            foreach (var file in AssetBundle.Current.EnumerateFiles(null, ".json"))
            {
                // First of all scan lines like this: "[]..."
                var content = AssetBundle.Current.ReadAllText(file, Encoding.UTF8);
                ProcessSourceFile(file, content);
                // Then like this: Text "..."
                if (!ShouldLocalizeOnlyTaggedSceneTexts())
                {
                    ProcessSceneFile(file, content);
                }
            }
            foreach (var file in AssetBundle.Current.EnumerateFiles(null, ".tan"))
            {
                var content = AssetBundle.Current.ReadAllText(file, Encoding.UTF8);
                ProcessTanFile(file, content);
            }
        }
Esempio n. 3
0
        private void ExtractTexts()
        {
            Predicate <DirectoryInfo> scanFilter = (directoryInfo) => {
                if (directoryInfo.Name == "bin")
                {
                    return(false);
                }
                if (directoryInfo.Name == "obj")
                {
                    return(false);
                }
                if (directoryInfo.Name == ".svn")
                {
                    return(false);
                }
                if (directoryInfo.Name == ".git")
                {
                    return(false);
                }
                if (directoryInfo.Name == ".vs")
                {
                    return(false);
                }
                if (directoryInfo.Name == "Citrus")
                {
                    return(false);
                }
                return(true);
            };
            var sourceFiles = new ScanOptimizedFileEnumerator(The.Workspace.ProjectDirectory, scanFilter);

            using (new DirectoryChanger(The.Workspace.ProjectDirectory)) {
                var files = sourceFiles.Enumerate(".cs");
                foreach (var fileInfo in files)
                {
                    ProcessSourceFile(fileInfo.Path);
                }
            }
            using (new DirectoryChanger(The.Workspace.AssetsDirectory)) {
                var files = The.Workspace.AssetFiles.Enumerate(".scene").Concat(The.Workspace.AssetFiles.Enumerate(".tan"));
                foreach (var fileInfo in files)
                {
                    // First of all scan lines like this: "[]..."
                    ProcessSourceFile(fileInfo.Path);
                    // Then like this: Text "..."
                    if (!ShouldLocalizeOnlyTaggedSceneTexts())
                    {
                        ProcessSceneFile(fileInfo.Path);
                    }
                }
            }
        }