本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
}
示例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);
}
}
}
}
示例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;
}
示例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];
}
示例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);
}
}
}
}
示例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;
}
示例12: RaiseDialogScriptCompileWarning
private void RaiseDialogScriptCompileWarning(string errorMsg, CompileMessages errors)
{
errors.Add(new CompileWarning(errorMsg, "Dialog " + _currentDialog.ID, _currentLineNumber));
}
示例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));
}
}
示例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();
}
}
示例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);
}
}