当前位置: 首页>>代码示例>>C#>>正文


C# CompileMessages.Add方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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)
                {
                    if (createMiniExeForDebug)
                    {
                        CreateMiniEXEForDebugging(errors);
                    }
                    else
                    {
                        CreateCompiledFiles(errors, forceRebuild);
                    }
                }
            }

            Factory.GUIController.ShowOutputPanel(errors);

            ReportErrorsIfAppropriate(errors);

            return errors;
        }
开发者ID:adventuregamestudio,项目名称:ags,代码行数:50,代码来源:AGSEditor.cs

示例6: CreateCompiledFiles

 private void CreateCompiledFiles(CompileMessages errors, bool forceRebuild)
 {
     try
     {
         BusyDialog.Show("Please wait while your game is created...", new BusyDialog.ProcessingHandler(CreateCompiledFiles), new CompileScriptsParameters(errors, forceRebuild));
     }
     catch (Exception ex)
     {
         errors.Add(new CompileError("Unexpected error: " + ex.Message));
     }
 }
开发者ID:adventuregamestudio,项目名称:ags,代码行数:11,代码来源:AGSEditor.cs

示例7: EnsureViewNamesAreUnique

        private void EnsureViewNamesAreUnique(ViewFolder folder, Dictionary<string, AGS.Types.View> viewNames, CompileMessages errors)
        {
            foreach (ViewFolder subFolder in folder.SubFolders)
            {
                EnsureViewNamesAreUnique(subFolder, viewNames, errors);
            }

            foreach (AGS.Types.View view in folder.Views)
            {
                if (!string.IsNullOrEmpty(view.Name))
                {
                    if (viewNames.ContainsKey(view.Name.ToLower()))
                    {
                        errors.Add(new CompileError("Il y a au moins deux vues qui partagent le même nom '" + view.Name + "'"));
                    }
                    else
                    {
                        viewNames.Add(view.Name.ToLower(), view);
                    }
                }
            }
        }
开发者ID:valoulef,项目名称:agsfr,代码行数:22,代码来源:AGSEditor.cs

示例8: CreateScriptsForInteraction

        private static bool CreateScriptsForInteraction(string itemName, Script script, Interactions interactions, CompileMessages errors)
        {
            bool convertedSome = false;

            for (int i = 0; i < interactions.ImportedScripts.Length; i++)
            {
                if ((interactions.ImportedScripts[i] != null) &&
                    (interactions.ImportedScripts[i].Length > 0))
                {
                    if (interactions.ImportedScripts[i].IndexOf(SINGLE_RUN_SCRIPT_TAG) >= 0)
                    {
                        // just a single Run Script -- don't wrap it in an outer
                        // function since there's no need to
                        interactions.ScriptFunctionNames[i] = interactions.ImportedScripts[i].Replace(SINGLE_RUN_SCRIPT_TAG, string.Empty).Replace("();", string.Empty).Trim();
                        convertedSome = true;
                    }
                    else
                    {
                        string funcName = itemName + "_" + interactions.FunctionSuffixes[i];
                        string funcScriptLine = "function " + funcName + "()";
                        interactions.ScriptFunctionNames[i] = funcName;
                        if (script.Text.IndexOf(funcScriptLine) >= 0)
                        {
                            errors.Add(new CompileWarning("Function " + funcName + " already exists in script and could not be created"));
                        }
                        else
                        {
                            script.Text += Environment.NewLine + funcScriptLine + Environment.NewLine;
                            script.Text += "{" + Environment.NewLine + interactions.ImportedScripts[i] + "}" + Environment.NewLine;
                            convertedSome = true;
                        }
                    }
                    interactions.ImportedScripts[i] = null;
                }
            }

            return convertedSome;
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:38,代码来源:ImportExport.cs

示例9: ImportSpriteFolders

 private static SpriteFolder ImportSpriteFolders(BinaryReader reader, Dictionary<int,Sprite> spriteList, CompileMessages importErrors)
 {
     const string DUMMY_FOLDER_NAME = "$$TEMPNAME";
     Dictionary<int, SpriteFolder> spriteFolders = new Dictionary<int, SpriteFolder>();
     int spriteFolderCount = reader.ReadInt32();
     // First, create an object for all of them (since folder 2
     // might have folder 15 as its parent, all objects need
     // to be there from the start).
     for (int i = 0; i < spriteFolderCount; i++)
     {
         spriteFolders.Add(i, new SpriteFolder(DUMMY_FOLDER_NAME));
     }
     for (int i = 0; i < spriteFolderCount; i++)
     {
         int numItems = reader.ReadInt32();
         for (int j = 0; j < 240; j++)
         {
             int spriteNum = reader.ReadInt16();
             if ((j < numItems) && (spriteNum >= 0))
             {
                 if (spriteList.ContainsKey(spriteNum))
                 {
                     spriteFolders[i].Sprites.Add(spriteList[spriteNum]);
                     spriteList.Remove(spriteNum);
                 }
                 else
                 {
                     importErrors.Add(new CompileWarning("Sprite " + spriteNum + " not found whilst importing the sprite folder list"));
                 }
             }
         }
         int parentFolder = reader.ReadInt16();
         if (parentFolder >= 0)
         {
             if (!spriteFolders.ContainsKey(parentFolder))
             {
                 throw new AGS.Types.InvalidDataException("Invalid sprite folder structure found: folder " + i + " has parent " + parentFolder);
             }
             spriteFolders[parentFolder].SubFolders.Add(spriteFolders[i]);
         }
         string folderName = ReadNullTerminatedString(reader, 30);
         if (folderName.Contains("\0"))
         {
             folderName = folderName.TrimEnd('\0');
         }
         spriteFolders[i].Name = folderName;
     }
     return spriteFolders[0];
 }
开发者ID:sonneveld,项目名称:agscj,代码行数:49,代码来源:ImportExport.cs

示例10: EnsureViewNamesAreUnique

        private void EnsureViewNamesAreUnique(ViewFolder folder, Dictionary<string, AGS.Types.View> viewNames, CompileMessages errors)
        {
            foreach (ViewFolder subFolder in folder.SubFolders)
            {
                EnsureViewNamesAreUnique(subFolder, viewNames, errors);
            }

            foreach (AGS.Types.View view in folder.Views)
            {
                if (!string.IsNullOrEmpty(view.Name))
                {
                    if (viewNames.ContainsKey(view.Name.ToLower()))
                    {
                        errors.Add(new CompileError("There are two or more views with the same name '" + view.Name + "'"));
                    }
                    else
                    {
                        viewNames.Add(view.Name.ToLower(), view);
                    }
                }
            }
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:22,代码来源:AGSEditor.cs

示例11: 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

示例12: RaiseDialogScriptCompileWarning

 private void RaiseDialogScriptCompileWarning(string errorMsg, CompileMessages errors)
 {
     errors.Add(new CompileWarning(errorMsg, "Dialog " + _currentDialog.ID, _currentLineNumber));
 }
开发者ID:Aquilon96,项目名称:ags,代码行数:4,代码来源:DialogScriptConverter.cs

示例13: CreateCompiledFiles

        private void CreateCompiledFiles(string sourceEXE, CompileMessages errors, bool forceRebuild)
        {
            try
            {
                string newExeName = this.CompiledEXEFileName;
                File.Copy(sourceEXE, newExeName, true);

                if (File.Exists(CUSTOM_ICON_FILE_NAME))
                {
                    try
                    {
                        Factory.NativeProxy.UpdateFileIcon(newExeName, CUSTOM_ICON_FILE_NAME);
                    }
                    catch (AGSEditorException ex)
                    {
                        Factory.GUIController.ShowMessage("An problem occurred setting your custom icon onto the EXE file. The error was: " + ex.Message, MessageBoxIcon.Warning);
                    }
                }

                try
                {
                    UpdateVistaGameExplorerResources(newExeName);
                }
                catch (Exception ex)
                {
                    errors.Add(new CompileError("Unable to register for Vista Game Explorer: " + ex.Message));
                }

                try
                {
                    Factory.NativeProxy.UpdateFileVersionInfo(newExeName, _game.Settings.DeveloperName, _game.Settings.GameName);
                }
                catch (Exception ex)
                {
                    errors.Add(new CompileError("Unable to set EXE name/description: " + ex.Message));
                }

                BusyDialog.Show("Please wait while your game is created...", new BusyDialog.ProcessingHandler(CreateCompiledFiles), forceRebuild);

                foreach (Plugin plugin in _game.Plugins)
                {
                    File.Copy(Path.Combine(this.EditorDirectory, plugin.FileName), OUTPUT_DIRECTORY + "\\" + plugin.FileName, true);
                }
            }
            catch (Exception ex)
            {
                errors.Add(new CompileError("Unexpected error: " + ex.Message));
            }
        }
开发者ID:sonneveld,项目名称:agscj,代码行数:49,代码来源:AGSEditor.cs

示例14: UpdateAllTranslationsWithNewDefaultText

        private void UpdateAllTranslationsWithNewDefaultText(Dictionary<string, string> textChanges, CompileMessages errors)
        {
            foreach (Translation otherTranslation in _agsEditor.CurrentGame.Translations)
            {
                otherTranslation.LoadData();
                Dictionary<string, string> newTranslation = new Dictionary<string, string>();

                foreach (string sourceLine in otherTranslation.TranslatedLines.Keys)
                {
                    string otherTranslationOfThisLine = otherTranslation.TranslatedLines[sourceLine];
                    string newKeyName = null;
                    if ((textChanges.ContainsKey(sourceLine)) && (textChanges[sourceLine].Length > 0))
                    {
                        newKeyName = textChanges[sourceLine];

                        if (newTranslation.ContainsKey(newKeyName))
                        {
                            if (!string.IsNullOrEmpty(otherTranslationOfThisLine))
                            {
                                errors.Add(new CompileWarning("Text '" + newKeyName + "' already has a translation; '" + sourceLine + "' translation will be lost"));
                            }
                            newKeyName = null;
                        }
                    }
                    else if (!newTranslation.ContainsKey(sourceLine))
                    {
                        newKeyName = sourceLine;
                    }

                    if (newKeyName != null)
                    {
                        if (newKeyName == otherTranslationOfThisLine)
                        {
                            newTranslation.Add(newKeyName, string.Empty);
                        }
                        else
                        {
                            newTranslation.Add(newKeyName, otherTranslationOfThisLine);
                        }
                    }
                }

                otherTranslation.TranslatedLines = newTranslation;
                otherTranslation.Modified = true;
                otherTranslation.SaveData();
            }
        }
开发者ID:smarinel,项目名称:ags-web,代码行数:47,代码来源:TranslationsComponent.cs

示例15: CompileTranslation

        private void CompileTranslation(Translation translation, CompileMessages errors)
        {
            translation.LoadData();

            if (translation.TranslatedLines.Count < 1)
            {
                errors.Add(new CompileError("Translation " + translation.FileName + " appears to be empty. You must update the source before compiling.", translation.FileName, 1));
                return;
            }

            string compiledFile = Path.Combine(AGSEditor.OUTPUT_DIRECTORY, translation.CompiledFileName);
            bool foundTranslatedLine = false;

            using (BinaryWriter bw = new BinaryWriter(new FileStream(compiledFile, FileMode.Create, FileAccess.Write)))
            {
                bw.Write(Encoding.ASCII.GetBytes(COMPILED_TRANSLATION_FILE_SIGNATURE));
                bw.Write(TRANSLATION_BLOCK_GAME_ID);
                byte[] gameName = Factory.NativeProxy.TransformStringToBytes(_agsEditor.CurrentGame.Settings.GameName);
                bw.Write(gameName.Length + 4);
                bw.Write(_agsEditor.CurrentGame.Settings.UniqueID);
                bw.Write(gameName);
                bw.Write(TRANSLATION_BLOCK_TRANSLATION_DATA);
                long offsetOfBlockSize = bw.BaseStream.Position;
                bw.Write((int)0);
                foreach (string line in translation.TranslatedLines.Keys)
                {
                    if (translation.TranslatedLines[line].Length > 0)
                    {
                        foundTranslatedLine = true;
                        bw.Write(Factory.NativeProxy.TransformStringToBytes(ConvertEscapedCharacters(line)));
                        bw.Write(Factory.NativeProxy.TransformStringToBytes(ConvertEscapedCharacters(translation.TranslatedLines[line])));
                    }
                }
                bw.Write(Factory.NativeProxy.TransformStringToBytes(string.Empty));
                bw.Write(Factory.NativeProxy.TransformStringToBytes(string.Empty));
                long mainBlockSize = (bw.BaseStream.Position - offsetOfBlockSize) - 4;
                bw.Write(TRANSLATION_BLOCK_OPTIONS);
                bw.Write((int)12);
                bw.Write(translation.NormalFont ?? -1);
                bw.Write(translation.SpeechFont ?? -1);
                bw.Write((translation.RightToLeftText == true) ? 2 : ((translation.RightToLeftText == false) ? 1 : -1));
                bw.Write(TRANSLATION_BLOCK_END_OF_FILE);
                bw.Write((int)0);
                bw.Seek((int)offsetOfBlockSize, SeekOrigin.Begin);
                bw.Write((int)mainBlockSize);
                bw.Close();
            }

            if (!foundTranslatedLine)
            {
                errors.Add(new CompileError("Translation " + translation.FileName + " did not appear to have any translated lines. Make sure you translate some text before compiling the translation.", translation.FileName, 1));
                File.Delete(compiledFile);
            }
        }
开发者ID:smarinel,项目名称:ags-web,代码行数:54,代码来源:TranslationsComponent.cs


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