• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CompileMessages类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CompileMessages的典型用法代码示例。如果您正苦于以下问题:C# CompileMessages类的具体用法?C# CompileMessages怎么用?C# CompileMessages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CompileMessages类属于命名空间,在下文中一共展示了CompileMessages类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConvertGameDialogScripts

        public string ConvertGameDialogScripts(Game game, CompileMessages errors, bool rebuildAll)
        {
            int stringBuilderCapacity = 1000 * game.RootDialogFolder.GetAllItemsCount() + _DefaultDialogScriptsScript.Length;
            StringBuilder sb = new StringBuilder(_DefaultDialogScriptsScript, stringBuilderCapacity);

            foreach (Dialog dialog in game.RootDialogFolder.AllItemsFlat)
            {
                sb.AppendLine(AGS.CScript.Compiler.Constants.NEW_SCRIPT_MARKER + "Dialog " + dialog.ID + "\"");

                if ((dialog.CachedConvertedScript == null) ||
                    (dialog.ScriptChangedSinceLastConverted) ||
                    (rebuildAll))
                {
                    int errorCountBefore = errors.Count;
                    this.ConvertDialogScriptToRealScript(dialog, game, errors);

                    if (errors.Count > errorCountBefore)
                    {
                        dialog.ScriptChangedSinceLastConverted = true;
                    }
                    else
                    {
                        dialog.ScriptChangedSinceLastConverted = false;
                    }
                }

                sb.Append(dialog.CachedConvertedScript);
            }

            return sb.ToString();
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:31,代码来源:DialogScriptConverter.cs


示例2: NumberSpeechLines

        public CompileMessages NumberSpeechLines(Game game, bool includeNarrator, bool combineIdenticalLines, bool removeNumbering, int? characterID)
        {
            _speechableFunctionCalls = GetFunctionCallsToProcessForSpeech(includeNarrator);

            _errors = new CompileMessages();
            _game = game;
            _includeNarrator = includeNarrator;
            _combineIdenticalLines = combineIdenticalLines;
            _removeNumbering = removeNumbering;
            _characterID = characterID;

            if (Factory.AGSEditor.AttemptToGetWriteAccess(SPEECH_REFERENCE_FILE_NAME))
            {
                using (_referenceFile = new StreamWriter(SPEECH_REFERENCE_FILE_NAME, false))
                {
                    _referenceFile.WriteLine("// AGS auto-numbered speech lines output. This file was automatically generated.");
                    PerformNumbering(game);
                }
            }
            else
            {
                _errors.Add(new CompileError("unable to create file " + SPEECH_REFERENCE_FILE_NAME));
            }

            return _errors;
        }
开发者ID:smarinel,项目名称:ags-web,代码行数:26,代码来源:SpeechLinesNumbering.cs


示例3: ConvertDialogScriptToRealScript

        public void ConvertDialogScriptToRealScript(Dialog dialog, Game game, CompileMessages errors)
        {
            string thisLine;
            _currentlyInsideCodeArea = false;
            _hadFirstEntryPoint = false;
            _game = game;
            _currentDialog = dialog;
            _existingEntryPoints.Clear();
            _currentLineNumber = 0;

            StringReader sr = new StringReader(dialog.Script);
            StringWriter sw = new StringWriter();
            sw.Write(string.Format("function _run_dialog{0}(int entryPoint) {1} ", dialog.ID, "{"));
            while ((thisLine = sr.ReadLine()) != null)
            {
                _currentLineNumber++;
                try
                {
                    ConvertDialogScriptLine(thisLine, sw, errors);
                }
                catch (CompileMessage ex)
                {
                    errors.Add(ex);
                }
            }
            if (_currentlyInsideCodeArea)
            {
                sw.WriteLine("}");
            }
            sw.WriteLine("return RUN_DIALOG_RETURN; }"); // end the function
            dialog.CachedConvertedScript = sw.ToString();
            sw.Close();
            sr.Close();
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:34,代码来源:DialogScriptConverter.cs


示例4: VoiceActorScriptProcessor

 public VoiceActorScriptProcessor(Game game, CompileMessages errors,
     Dictionary<string, FunctionCallType> speechableFunctionCalls)
     : base(game, errors, false, false, speechableFunctionCalls)
 {
     _linesByCharacter = new Dictionary<int, Dictionary<string, string>>();
     _linesInOrder = new List<GameTextLine>();
 }
开发者ID:smarinel,项目名称:ags-web,代码行数:7,代码来源:VoiceActorScriptProcessor.cs


示例5: CreateInteractionScripts

        public static bool CreateInteractionScripts(Room room, CompileMessages errors)
        {
            Script theScript = room.Script;
            bool convertedSome = CreateScriptsForInteraction("room", theScript, room.Interactions, errors);

            foreach (RoomHotspot hotspot in room.Hotspots)
            {
                if (hotspot.Name.Length < 1)
                {
                    hotspot.Name = "hHotspot" + hotspot.ID;
                }
                convertedSome |= CreateScriptsForInteraction(hotspot.Name, theScript, hotspot.Interactions, errors);
            }
            foreach (RoomObject obj in room.Objects)
            {
                if (obj.Name.Length < 1)
                {
                    obj.Name = "oObject" + obj.ID;
                }
                convertedSome |= CreateScriptsForInteraction(obj.Name, theScript, obj.Interactions, errors);
            }
            foreach (RoomRegion region in room.Regions)
            {
                string useName = "region" + region.ID;
                convertedSome |= CreateScriptsForInteraction(useName, theScript, region.Interactions, errors);
            }
            return convertedSome;
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:28,代码来源:ImportExport.cs


示例6: GameSpeechProcessor

 public GameSpeechProcessor(Game game, CompileMessages errors, bool makesChanges, bool processHotspotAndObjectDescriptions)
 {
     _game = game;
     _errors = errors;
     _makesChanges = makesChanges;
     _processHotspotAndObjectDescriptions = processHotspotAndObjectDescriptions;
 }
开发者ID:sonneveld,项目名称:agscj,代码行数:7,代码来源:GameSpeechProcessor.cs


示例7: CompilePAMFile

        private SpeechLipSyncLine CompilePAMFile(string fileName, CompileMessages errors)
        {
            SpeechLipSyncLine syncDataForThisFile = new SpeechLipSyncLine();
            syncDataForThisFile.FileName = Path.GetFileNameWithoutExtension(fileName);

            string thisLine;
            bool inMainSection = false;
            int lineNumber = 0;

            StreamReader sr = new StreamReader(fileName);
            while ((thisLine = sr.ReadLine()) != null)
            {
                lineNumber++;
                if (thisLine.ToLower().StartsWith("[speech]"))
                {
                    inMainSection = true;
                    continue;
                }
                if (inMainSection)
                {
                    if (thisLine.TrimStart().StartsWith("["))
                    {
                        // moved onto another section
                        break;
                    }
                    if (thisLine.IndexOf(':') > 0)
                    {
                        string[] parts = thisLine.Split(':');
                        // Convert from Pamela XPOS into milliseconds
                        int milliSeconds = ((Convert.ToInt32(parts[0]) / 15) * 1000) / 24;
                        string phenomeCode = parts[1].Trim().ToUpper();
                        int frameID = FindFrameNumberForPhenome(phenomeCode);
                        if (frameID < 0)
                        {
                            string friendlyFileName = Path.GetFileName(fileName);
                            errors.Add(new CompileError("No frame found to match phenome code '" + phenomeCode + "'", friendlyFileName, lineNumber));
                        }
                        else
                        {
                            syncDataForThisFile.Phenomes.Add(new SpeechLipSyncPhenome(milliSeconds, (short)frameID));
                        }
                    }
                }
            }
            sr.Close();
            syncDataForThisFile.Phenomes.Sort();

            // The PAM file contains start times: Convert to end times
            for (int i = 0; i < syncDataForThisFile.Phenomes.Count - 1; i++)
            {
                syncDataForThisFile.Phenomes[i].EndTimeOffset = syncDataForThisFile.Phenomes[i + 1].EndTimeOffset;
            }

            if (syncDataForThisFile.Phenomes.Count > 1)
            {
                syncDataForThisFile.Phenomes[syncDataForThisFile.Phenomes.Count - 1].EndTimeOffset = syncDataForThisFile.Phenomes[syncDataForThisFile.Phenomes.Count - 2].EndTimeOffset + 1000;
            }

            return syncDataForThisFile;
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:60,代码来源:SpeechComponent.cs


示例8: ProcessAllGameText

        public static void ProcessAllGameText(IGameTextProcessor processor, Game game, CompileMessages errors)
        {
            foreach (Dialog dialog in game.RootDialogFolder.AllItemsFlat)
            {
                foreach (DialogOption option in dialog.Options)
                {
                    option.Text = processor.ProcessText(option.Text, GameTextType.DialogOption, game.PlayerCharacter.ID);
                }

                dialog.Script = processor.ProcessText(dialog.Script, GameTextType.DialogScript);
            }

            foreach (ScriptAndHeader script in game.RootScriptFolder.AllItemsFlat)
            {                                
                string newScript = processor.ProcessText(script.Script.Text, GameTextType.Script);
                if (newScript != script.Script.Text)
                {
                    // Only cause it to flag Modified if we changed it
                    script.Script.Text = newScript;
                }                
            }

            foreach (GUI gui in game.RootGUIFolder.AllItemsFlat)
            {
                foreach (GUIControl control in gui.Controls)
                {
                    GUILabel label = control as GUILabel;
                    if (label != null)
                    {
                        label.Text = processor.ProcessText(label.Text, GameTextType.ItemDescription);
                    }
                    else
                    {
                        GUIButton button = control as GUIButton;
                        if (button != null)
                        {
                            button.Text = processor.ProcessText(button.Text, GameTextType.ItemDescription);
                        }
                    }
                }
            }

            foreach (Character character in game.RootCharacterFolder.AllItemsFlat)
            {
                character.RealName = processor.ProcessText(character.RealName, GameTextType.ItemDescription);
            }

            foreach (InventoryItem item in game.RootInventoryItemFolder.AllItemsFlat)
            {
                item.Description = processor.ProcessText(item.Description, GameTextType.ItemDescription);
            }

			for (int i = 0; i < game.GlobalMessages.Length; i++)
			{
				game.GlobalMessages[i] = processor.ProcessText(game.GlobalMessages[i], GameTextType.Message);
			}

            Factory.AGSEditor.RunProcessAllGameTextsEvent(processor, errors);
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:59,代码来源:TextProcessingHelper.cs


示例9: ProcessAllGameText

        public static void ProcessAllGameText(IGameTextProcessor processor, Game game, CompileMessages errors)
        {
            foreach (Dialog dialog in game.Dialogs)
            {
                foreach (DialogOption option in dialog.Options)
                {
                    option.Text = processor.ProcessText(option.Text, GameTextType.DialogOption, game.PlayerCharacter.ID);
                }

                dialog.Script = processor.ProcessText(dialog.Script, GameTextType.DialogScript);
            }

            foreach (Script script in game.Scripts)
            {
                if (!script.IsHeader)
                {
                    string newScript = processor.ProcessText(script.Text, GameTextType.Script);
                    if (newScript != script.Text)
                    {
                        // Only cause it to flag Modified if we changed it
                        script.Text = newScript;
                    }
                }
            }

            foreach (GUI gui in game.GUIs)
            {
                foreach (GUIControl control in gui.Controls)
                {
                    if (control is GUILabel)
                    {
                        ((GUILabel)control).Text = processor.ProcessText(((GUILabel)control).Text, GameTextType.ItemDescription);
                    }
                    else if (control is GUIButton)
                    {
                        ((GUIButton)control).Text = processor.ProcessText(((GUIButton)control).Text, GameTextType.ItemDescription);
                    }
                }
            }

            foreach (Character character in game.Characters)
            {
                character.RealName = processor.ProcessText(character.RealName, GameTextType.ItemDescription);
            }

            foreach (InventoryItem item in game.InventoryItems)
            {
                item.Description = processor.ProcessText(item.Description, GameTextType.ItemDescription);
            }

            for (int i = 0; i < game.GlobalMessages.Length; i++)
            {
                game.GlobalMessages[i] = processor.ProcessText(game.GlobalMessages[i], GameTextType.Message);
            }

            Factory.AGSEditor.RunProcessAllGameTextsEvent(processor, errors);
        }
开发者ID:smarinel,项目名称:ags-web,代码行数:57,代码来源:TextProcessingHelper.cs


示例10: ReplaceAllGameText

        public static CompileMessages ReplaceAllGameText(Game game, Translation withTranslation)
        {
            CompileMessages errors = new CompileMessages();

            TextImportProcessor processor = new TextImportProcessor(game, errors, withTranslation.TranslatedLines);

            TextProcessingHelper.ProcessAllGameText(processor, game, errors);

            return errors;
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:10,代码来源:TextImporter.cs


示例11: CreateTranslationList

        public CompileMessages CreateTranslationList(Game game)
        {
            CompileMessages errors = new CompileMessages();

            TranslationSourceProcessor processor = new TranslationSourceProcessor(game, errors);

            TextProcessingHelper.ProcessAllGameText(processor, game, errors);

            _linesForTranslation = processor.LinesForTranslation;

            return errors;
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:12,代码来源:TranslationGenerator.cs


示例12: CreateVoiceActingScript

		public CompileMessages CreateVoiceActingScript(Game game)
		{
			CompileMessages errors = new CompileMessages();

			VoiceActorScriptProcessor processor = new VoiceActorScriptProcessor(game, errors, GetFunctionCallsToProcessForSpeech(true));

			TextProcessingHelper.ProcessAllGameText(processor, game, errors);

			_linesByCharacter = processor.LinesByCharacter;
			_linesInOrder = processor.LinesInOrder;

			return errors;
		}
开发者ID:Aquilon96,项目名称:ags,代码行数:13,代码来源:VoiceActorScriptGenerator.cs


示例13: Build

 public override bool Build(CompileMessages errors, bool forceRebuild)
 {
     if (!base.Build(errors, forceRebuild)) return false;
     try
     {
         string baseGameFileName = Factory.AGSEditor.BaseGameFileName;
         string exeFileName = baseGameFileName + ".exe";
         IBuildTarget targetWin = BuildTargetsInfo.FindBuildTargetByName("Windows");
         if (targetWin == null)
         {
             errors.Add(new CompileError("Debug build depends on Windows build target being available! Your AGS installation may be corrupted!"));
             return false;
         }
         string compiledEXE = targetWin.GetCompiledPath(exeFileName);
         string sourceEXE = Path.Combine(Factory.AGSEditor.EditorDirectory, AGSEditor.ENGINE_EXE_FILE_NAME);
         Utilities.DeleteFileIfExists(compiledEXE);
         File.Copy(sourceEXE, exeFileName, true);
         BusyDialog.Show("Please wait while we prepare to run the game...", new BusyDialog.ProcessingHandler(CreateDebugFiles), errors);
         if (errors.HasErrors)
         {
             return false;
         }
         Utilities.DeleteFileIfExists(GetDebugPath(exeFileName));
         File.Move(exeFileName, GetDebugPath(exeFileName));
         // copy configuration from Compiled folder to use with Debugging
         string cfgFilePath = targetWin.GetCompiledPath(AGSEditor.CONFIG_FILE_NAME);
         if (File.Exists(cfgFilePath))
         {
             File.Copy(cfgFilePath, GetDebugPath(AGSEditor.CONFIG_FILE_NAME), true);
         }
         else
         {
             cfgFilePath = Path.Combine(AGSEditor.OUTPUT_DIRECTORY, Path.Combine(AGSEditor.DATA_OUTPUT_DIRECTORY, AGSEditor.CONFIG_FILE_NAME));
             if (File.Exists(cfgFilePath))
             {
                 File.Copy(cfgFilePath, GetDebugPath(AGSEditor.CONFIG_FILE_NAME), true);
             }
         }
         foreach (Plugin plugin in Factory.AGSEditor.CurrentGame.Plugins)
         {
             File.Copy(Path.Combine(Factory.AGSEditor.EditorDirectory, plugin.FileName), GetDebugPath(plugin.FileName), true);
         }
     }
     catch (Exception ex)
     {
         errors.Add(new CompileError("Unexpected error: " + ex.Message));
         return false;
     }
     return true;
 }
开发者ID:CisBetter,项目名称:ags,代码行数:50,代码来源:BuildTargetDebug.cs


示例14: Build

 public override bool Build(CompileMessages errors, bool forceRebuild)
 {
     if (!base.Build(errors, forceRebuild)) return false;
     string compiledDataDir = Path.Combine(AGSEditor.OUTPUT_DIRECTORY, AGSEditor.DATA_OUTPUT_DIRECTORY);
     string baseGameFileName = Factory.AGSEditor.BaseGameFileName;
     string newExeName = GetCompiledPath(baseGameFileName + ".exe");
     string sourceEXE = Path.Combine(Factory.AGSEditor.EditorDirectory, AGSEditor.ENGINE_EXE_FILE_NAME);
     File.Copy(sourceEXE, newExeName, true);
     UpdateWindowsEXE(newExeName, errors);
     CreateCompiledSetupProgram();
     Environment.CurrentDirectory = Factory.AGSEditor.CurrentGame.DirectoryPath;
     foreach (string fileName in Utilities.GetDirectoryFileList(compiledDataDir, "*"))
     {
         if (fileName.EndsWith(".ags"))
         {
             using (FileStream ostream = File.Open(GetCompiledPath(baseGameFileName + ".exe"), FileMode.Append,
                 FileAccess.Write))
             {
                 int startPosition = (int)ostream.Position;
                 using (FileStream istream = File.Open(fileName, FileMode.Open, FileAccess.Read))
                 {
                     const int bufferSize = 4096;
                     byte[] buffer = new byte[bufferSize];
                     for (int count = istream.Read(buffer, 0, bufferSize); count > 0;
                         count = istream.Read(buffer, 0, bufferSize))
                     {
                         ostream.Write(buffer, 0, count);
                     }
                 }
                 // write the offset into the EXE where the first data file resides
                 ostream.Write(BitConverter.GetBytes(startPosition), 0, 4);
                 // write the CLIB end signature so the engine knows this is a valid EXE
                 ostream.Write(Encoding.UTF8.GetBytes(NativeConstants.CLIB_END_SIGNATURE.ToCharArray()), 0,
                     NativeConstants.CLIB_END_SIGNATURE.Length);
             }
         }
         else if (!fileName.EndsWith(AGSEditor.CONFIG_FILE_NAME))
         {
             Utilities.CreateHardLink(GetCompiledPath(Path.GetFileName(fileName)), fileName, true);
         }
     }
     // Update config file with current game parameters
     Factory.AGSEditor.WriteConfigFile(GetCompiledPath());
     // Copy Windows plugins
     CopyPlugins(errors);
     return true;
 }
开发者ID:CisBetter,项目名称:ags,代码行数:47,代码来源:BuildTargetWindows.cs


示例15: SpeechLineProcessor

        public SpeechLineProcessor(Game game, bool includeNarrator, bool combineIdenticalLines, 
            bool removeNumbering, int? characterID,
            Dictionary<string, FunctionCallType> speechableFunctionCalls, 
            CompileMessages errors, StreamWriter referenceFile)
            : base(game, errors, true, false, speechableFunctionCalls)
        {
            _speechLineCount = new Dictionary<int, int>();
            _combineIdenticalLines = combineIdenticalLines;
            _includeNarrator = includeNarrator;
            _referenceFile = referenceFile;
            _removeNumbering = removeNumbering;
            _characterID = characterID;

            if (combineIdenticalLines)
            {
                _existingLines = new Dictionary<int, Dictionary<string, string>>();
            }
        }
开发者ID:smarinel,项目名称:ags-web,代码行数:18,代码来源:SpeechLineProcessor.cs


示例16: Build

 public override bool Build(CompileMessages errors, bool forceRebuild)
 {
     if (!base.Build(errors, forceRebuild)) return false;
     Factory.AGSEditor.SetMODMusicFlag();
     DeleteAnyExistingSplitResourceFiles();
     if (!DataFileWriter.SaveThisGameToFile(AGSEditor.COMPILED_DTA_FILE_NAME, Factory.AGSEditor.CurrentGame, errors))
     {
         return false;
     }
     string errorMsg = DataFileWriter.MakeDataFile(ConstructFileListForDataFile(), Factory.AGSEditor.CurrentGame.Settings.SplitResources * 1000000,
         Factory.AGSEditor.BaseGameFileName, true);
     if (errorMsg != null)
     {
         errors.Add(new CompileError(errorMsg));
     }
     File.Delete(AGSEditor.COMPILED_DTA_FILE_NAME);
     CreateAudioVOXFile(forceRebuild);
     // Update config file with current game parameters
     Factory.AGSEditor.WriteConfigFile(GetCompiledPath());
     return true;
 }
开发者ID:CisBetter,项目名称:ags,代码行数:21,代码来源:BuildTargetDataFile.cs


示例17: CompileGame

        public CompileMessages CompileGame(bool forceRebuild, bool createMiniExeForDebug)
        {
            Factory.GUIController.ClearOutputPanel();
            CompileMessages errors = new CompileMessages();

            Utilities.EnsureStandardSubFoldersExist();

            if (PreCompileGame != null)
            {
                PreCompileGameEventArgs evArgs = new PreCompileGameEventArgs(forceRebuild);
                evArgs.Errors = errors;

                PreCompileGame(evArgs);

                if (!evArgs.AllowCompilation)
                {
                    Factory.GUIController.ShowOutputPanel(errors);
                    ReportErrorsIfAppropriate(errors);
                    return errors;
                }
            }

            RunPreCompilationChecks(errors);

            if (!errors.HasErrors)
            {
                CompileMessage result = (CompileMessage)BusyDialog.Show("Please wait while your scripts are compiled...", new BusyDialog.ProcessingHandler(CompileScripts), new CompileScriptsParameters(errors, forceRebuild));
                if (result != null)
                {
                    errors.Add(result);
                }
                else if (!errors.HasErrors)
                {
                    string sourceEXE = Path.Combine(this.EditorDirectory, ENGINE_EXE_FILE_NAME);
                    if (!File.Exists(sourceEXE))
                    {
                        errors.Add(new CompileError("Cannot find the file '" + sourceEXE + "'. This file is required in order to compile your game."));
                    }
                    else if (createMiniExeForDebug)
                    {
                        CreateMiniEXEForDebugging(sourceEXE, errors);
                    }
                    else
                    {
                        CreateCompiledFiles(sourceEXE, errors, forceRebuild);
                    }
                }
            }

            Factory.GUIController.ShowOutputPanel(errors);

            ReportErrorsIfAppropriate(errors);

            return errors;
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:55,代码来源:AGSEditor.cs


示例18: _agsEditor_ExtraCompilationStep

        private void _agsEditor_ExtraCompilationStep(CompileMessages errors)
        {
            string[] pamFileList = ConstructFileListForSyncData();

            if (DoesTargetFileNeedRebuild(LIP_SYNC_DATA_OUTPUT, pamFileList, _pamFileStatus))
            {
                CompilePAMFiles(errors);

                UpdateVOXFileStatusWithCurrentFileTimes(pamFileList, _pamFileStatus);
            }
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:11,代码来源:SpeechComponent.cs


示例19: CompilePAMFiles

        private void CompilePAMFiles(CompileMessages errors)
        {
            List<SpeechLipSyncLine> lipSyncDataLines = new List<SpeechLipSyncLine>();

            foreach (string fileName in Utilities.GetDirectoryFileList(Directory.GetCurrentDirectory(), PAM_FILE_FILTER))
            {
                lipSyncDataLines.Add(CompilePAMFile(fileName, errors));
            }

            if (File.Exists(LIP_SYNC_DATA_OUTPUT))
            {
                File.Delete(LIP_SYNC_DATA_OUTPUT);
            }

            if ((!errors.HasErrors) && (lipSyncDataLines.Count > 0))
            {
                BinaryWriter bw = new BinaryWriter(new FileStream(LIP_SYNC_DATA_OUTPUT, FileMode.Create, FileAccess.Write));
                bw.Write((int)4);
                bw.Write(lipSyncDataLines.Count);

                foreach (SpeechLipSyncLine line in lipSyncDataLines)
                {
                    bw.Write((short)line.Phenomes.Count);

                    byte[] fileNameBytes = Encoding.Default.GetBytes(line.FileName);
                    byte[] paddedFileNameBytes = new byte[14];
                    Array.Copy(fileNameBytes, paddedFileNameBytes, fileNameBytes.Length);
                    paddedFileNameBytes[fileNameBytes.Length] = 0;
                    bw.Write(paddedFileNameBytes);

                    for (int i = 0; i < line.Phenomes.Count; i++)
                    {
                        bw.Write((int)line.Phenomes[i].EndTimeOffset);
                    }
                    for (int i = 0; i < line.Phenomes.Count; i++)
                    {
                        bw.Write((short)line.Phenomes[i].Frame);
                    }
                }

                bw.Close();
            }
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:43,代码来源:SpeechComponent.cs


示例20: Build

        public override bool Build(CompileMessages errors, bool forceRebuild)
        {
            if (!base.Build(errors, forceRebuild)) return false;
            if (!CheckPluginsHaveSharedLibraries())
            {
                errors.Add(new CompileError("Could not build for Linux due to missing plugins."));
                return false;
            }
            foreach (string fileName in Directory.GetFiles(Path.Combine(AGSEditor.OUTPUT_DIRECTORY, AGSEditor.DATA_OUTPUT_DIRECTORY)))
            {
                if ((!fileName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) &&
                    (!Path.GetFileName(fileName).Equals("winsetup.exe", StringComparison.OrdinalIgnoreCase)) &&
                    (!Path.GetFileName(fileName).Equals(AGSEditor.CONFIG_FILE_NAME, StringComparison.OrdinalIgnoreCase)))
                {
                    Utilities.CreateHardLink(GetCompiledPath(LINUX_DATA_DIR, Path.GetFileName(fileName)), fileName, true);
                }
            }
            // Update config file with current game parameters
            Factory.AGSEditor.WriteConfigFile(GetCompiledPath(LINUX_DATA_DIR));

            foreach (KeyValuePair<string, string> pair in GetRequiredLibraryPaths())
            {
                string fileName = pair.Value;
                if (!fileName.EndsWith(pair.Key)) fileName = Path.Combine(fileName, pair.Key);
                string folderName = null;
                if ((!fileName.EndsWith("ags32")) && (!fileName.EndsWith("ags64")))
                {
                    // the engine files belong in the LINUX_DATA_DIR, but the other libs
                    // should have lib32 or lib64 subdirectories as part of their name
                    folderName = Path.GetFileName(Path.GetDirectoryName(fileName).TrimEnd(Path.DirectorySeparatorChar));
                }
                Utilities.CreateHardLink(GetCompiledPath(LINUX_DATA_DIR, folderName, Path.GetFileName(fileName)),
                    fileName, true);
            }
            string linuxDataLib32Dir = GetCompiledPath(LINUX_DATA_DIR, LINUX_LIB32_DIR);
            string linuxDataLib64Dir = GetCompiledPath(LINUX_DATA_DIR, LINUX_LIB64_DIR);
            string editorLinuxDir = Path.Combine(Factory.AGSEditor.EditorDirectory, LINUX_DIR);
            string editorLinuxLib32Dir = Path.Combine(editorLinuxDir, LINUX_LIB32_DIR);
            string editorLinuxLib64Dir = Path.Combine(editorLinuxDir, LINUX_LIB64_DIR);
            foreach (string soName in _plugins)
            {
                Utilities.CreateHardLink(Path.Combine(linuxDataLib32Dir, soName),
                    Path.Combine(editorLinuxLib32Dir, soName), true);
                Utilities.CreateHardLink(Path.Combine(linuxDataLib64Dir, soName),
                    Path.Combine(editorLinuxLib64Dir, soName), true);
            }
            string scriptFileName = GetCompiledPath(Factory.AGSEditor.BaseGameFileName.Replace(" ", "")); // strip whitespace from script name
            string scriptText =
            @"#!/bin/sh
            SCRIPTPATH=""$(dirname ""$(readlink -f $0)"")""

            if test ""[email protected]"" = ""x-h"" -o ""[email protected]"" = ""x--help""
              then
            echo ""Usage:"" ""$(basename ""$(readlink -f $0)"")"" ""[<ags options>]""
            echo """"
            fi

            if test $(uname -m) = x86_64
              then" + GetSymLinkScriptForEachPlugin(true) +
            @"
              else" + GetSymLinkScriptForEachPlugin(false) +
            @"
            fi
            ";
            scriptText = scriptText.Replace("\r\n", "\n"); // make sure script has UNIX line endings
            FileStream stream = File.Create(scriptFileName);
            byte[] bytes = Encoding.UTF8.GetBytes(scriptText);
            stream.Write(bytes, 0, bytes.Length);
            stream.Close();
            return true;
        }
开发者ID:CisBetter,项目名称:ags,代码行数:71,代码来源:BuildTargetLinux.cs



注:本文中的CompileMessages类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Compiler类代码示例发布时间:2022-05-24
下一篇:
C# CompilationUnit类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap