Пример #1
0
        private void AGSEditor_PreCompileGame(PreCompileGameEventArgs evArgs)
        {
            foreach (Translation translation in _agsEditor.CurrentGame.Translations)
            {
                if (File.Exists(translation.FileName))
                {
                    string compiledPath = Path.Combine(AGSEditor.OUTPUT_DIRECTORY,
                                                       Path.Combine(AGSEditor.DATA_OUTPUT_DIRECTORY, translation.CompiledFileName));

                    if ((evArgs.ForceRebuild) ||
                        (Utilities.DoesFileNeedRecompile(translation.FileName, compiledPath)))
                    {
                        try
                        {
                            CompileTranslation(translation, evArgs.Errors);
                        }
                        catch (Exception e)
                        {
                            evArgs.Errors.Add(new CompileError(string.Format("Translation '{0}' compiled with errors: \n{1}",
                                                                             translation.FileName, e.Message)));
                        }
                    }
                }
            }
        }
Пример #2
0
        private void PerformPreCompilationStepForFolder(AudioClipFolder folder, PreCompileGameEventArgs evArgs, List <AudioClip> filesToCopy, List <string> fileNamesToUpdate, int inheritedVolume, bool inheritedRepeat, AudioClipPriority inheritedPriority)
        {
            if (folder.DefaultPriority != AudioClipPriority.Inherit)
            {
                inheritedPriority = folder.DefaultPriority;
            }
            if (folder.DefaultRepeat != InheritableBool.Inherit)
            {
                inheritedRepeat = (folder.DefaultRepeat == InheritableBool.True) ? true : false;
            }
            if (folder.DefaultVolume >= 0)
            {
                inheritedVolume = folder.DefaultVolume;
            }

            foreach (AudioClip clip in folder.Items)
            {
                AddAudioClipToListIfFileNeedsToBeCopiedFromSource(clip, evArgs, filesToCopy, fileNamesToUpdate);
                SetActualAudioClipProperties(clip, inheritedVolume, inheritedRepeat, inheritedPriority);
            }

            foreach (AudioClipFolder subFolder in folder.SubFolders)
            {
                PerformPreCompilationStepForFolder(subFolder, evArgs, filesToCopy, fileNamesToUpdate, inheritedVolume, inheritedRepeat, inheritedPriority);
            }
        }
Пример #3
0
        private void _agsEditor_PreCompileGame(PreCompileGameEventArgs evArgs)
        {
            List <AudioClip> filesToCopy       = new List <AudioClip>();
            List <string>    fileNamesToUpdate = new List <string>();

            PerformPreCompilationStepForFolder(_agsEditor.CurrentGame.RootAudioClipFolder, evArgs, filesToCopy, fileNamesToUpdate, 100, false, AudioClipPriority.Normal);

            if (_agsEditor.AttemptToGetWriteAccess(fileNamesToUpdate))
            {
                for (int i = 0; i < filesToCopy.Count; i++)
                {
                    Utilities.CopyFileAndSetDestinationWritable(filesToCopy[i].SourceFileName, fileNamesToUpdate[i]);
                }
            }
        }
Пример #4
0
        private void AGSEditor_PreCompileGame(PreCompileGameEventArgs evArgs)
        {
            foreach (Translation translation in _agsEditor.CurrentGame.Translations)
            {
                if (File.Exists(translation.FileName))
                {
                    string compiledPath = Path.Combine(AGSEditor.OUTPUT_DIRECTORY, translation.CompiledFileName);

                    if ((evArgs.ForceRebuild) ||
						(Utilities.DoesFileNeedRecompile(translation.FileName, compiledPath)))
                    {
                        CompileTranslation(translation, evArgs.Errors);
                    }
                }
            }
        }
Пример #5
0
        private void AGSEditor_PreCompileGame(PreCompileGameEventArgs evArgs)
        {
            foreach (Translation translation in _agsEditor.CurrentGame.Translations)
            {
                if (File.Exists(translation.FileName))
                {
                    string compiledPath = Path.Combine(AGSEditor.OUTPUT_DIRECTORY, translation.CompiledFileName);

                    if ((evArgs.ForceRebuild) ||
                        (Utilities.DoesFileNeedRecompile(translation.FileName, compiledPath)))
                    {
                        CompileTranslation(translation, evArgs.Errors);
                    }
                }
            }
        }
Пример #6
0
        private void AddAudioClipToListIfFileNeedsToBeCopiedFromSource(AudioClip clip, PreCompileGameEventArgs evArgs, List <AudioClip> filesToCopy, List <string> fileNamesToUpdate)
        {
            string compiledFileName = clip.CacheFileName;

            if (File.Exists(clip.SourceFileName))
            {
                bool needToCopy = false;
                if ((!File.Exists(compiledFileName)) || (evArgs.ForceRebuild))
                {
                    needToCopy = true;
                }
                else if (File.GetLastWriteTimeUtc(compiledFileName) != File.GetLastWriteTimeUtc(clip.SourceFileName))
                {
                    needToCopy = true;
                }

                if (needToCopy)
                {
                    filesToCopy.Add(clip);
                    fileNamesToUpdate.Add(compiledFileName);
                }
            }
            else if (!File.Exists(compiledFileName))
            {
                evArgs.AllowCompilation = false;
                evArgs.Errors.Add(new CompileError(clip.ScriptName + " file missing: " + clip.SourceFileName));
            }
        }
Пример #7
0
        private void AGSEditor_PreCompileGame(PreCompileGameEventArgs evArgs)
        {
            if ((_loadedRoom != null) && (_loadedRoom.Modified))
            {
                evArgs.AllowCompilation = SaveRoomAndShowAnyErrors(_loadedRoom);
            }

            if (evArgs.AllowCompilation)
            {
                evArgs.AllowCompilation = RecompileAnyRoomsWhereTheScriptHasChanged(evArgs.Errors, evArgs.ForceRebuild);
            }
        }