using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"[\s]*([\/+\s\w@'\,\.()\-\*\-\>\<\_\""]*)?[\n]*UFUNCTION[(]([\w<>\s\(\)\=\,\""\| ]*|\n]*)[\)]\n\s(virtual)*\s*(static)*\s*(\w+\&?\*?)\s(\w+)[(]([\w<>\s,&\*]*|\n]*)[)][\s]*([const]*)";
string input = @"// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include ""CoreMinimal.h""
#include ""GM_Stepper.h""
#include ""Kismet/BlueprintFunctionLibrary.h""
#include ""StepperTypes.h""
#include ""Encoder/EncodeData.h""
#include ""Components/TextBlock.h""
#include ""BFL_Stepper.generated.h""
/**
*
*/
UCLASS()
class STEPPER_API UBFL_Stepper : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
// Returns a copy of the current rendering LogPacket
// For use ONLY during render time
// Will be invalid otherwise
UFUNCTION(BlueprintPure, Category = ""Stepper|Core"")
static FLogPacket& GetCurrentLogPacket(bool& Success);
// Updates the log packet sources in memory
UFUNCTION(BlueprintCallable, Category = ""Stepper|Core"")
static bool UpdatePacket(FLogPacket NewPacket);
// Returns a copy of the requested MetaData from the relevant core
UFUNCTION(BlueprintPure, Category = ""Stepper|Core"")
static FGenericMetaTag GetMetaTag(FLogPacket ReferencePacket, FName MetaTag, bool& bIsValid);
// Returns a copy of the requested MetaData from the supplied packet
UFUNCTION(BlueprintPure, Category = ""Stepper|Core"")
static FGenericMetaTag GetMetaTag_Explicit(FLogPacket ReferencePacket, FName MetaTag, bool& bIsValid);
// Returns a logLine for this LogPacket by a LineId
UFUNCTION(BlueprintPure, Category = ""Stepper|Core"")
static bool GetLogLineInId(FLogPacket ReferencePacket, int32 inId, FActionLine& LineData);
// Returns a logLine for this LogPacket by seeking from a specific line
UFUNCTION(BlueprintPure, Category = ""Stepper|Core"")
static bool GetNextActionByType(FLogPacket ReferencePacket, FAction RefAction, FName NextActionName, bool bShouldDebug, FActionLine& Action);
// Updates the LogPacket in memory and text file
UFUNCTION(BlueprintCallable, Category = ""Stepper|Core"")
static void UpdateGenericTag(FLogPacket ReferencePacket, FGenericMetaTag MetaTag);
// Get the saved user settings
UFUNCTION(BlueprintPure, Category = ""Stepper|User Settings"")
static bool GetUserSettings(FUserSettings& Settings);
// Get the saved capture resolution
UFUNCTION(BlueprintPure, Category = ""Stepper|User Settings"")
static FIntPoint GetCaptureResolution();
// Get the saved output resolution
UFUNCTION(BlueprintPure, Category = ""Stepper|User Settings"")
static FIntPoint GetOutputResolution();
// Get the root output folder for this log
UFUNCTION(BlueprintPure, Category = ""Stepper|User Settings"")
static FString GetLogOutputFolder();
// Gets the saved resources folder
UFUNCTION(BlueprintPure, Category = ""Stepper|User Settings"")
static FString GetResourcesFolder();
// Get a reference to the active UStepperObject
// Can be nullptr
UFUNCTION(BlueprintPure, Category = ""Stepper|Statics"")
static UStepperCore* GetStepper();
// Get the currently rendered stepper frame number
// Return -1 if not rendering
UFUNCTION(BlueprintPure, Category = ""Stepper|Statics"")
static int32 GetStepperFrame();
// Checks if a file is of type ""png"", ""jpg"", ""mp4"" or ""mov""
UFUNCTION(BlueprintPure)
static bool bIsMediaFile(FString FileName);
// Get the language of the inputted log packet
UFUNCTION(BlueprintPure)
static FString GetLogLanguage(FLogPacket LogPacket);
// Get the packet's framerate
UFUNCTION(BlueprintPure, meta=(CompactNodeTitle=""FR"", Keywords = ""FrameRate, Frame, Rate""))
static FFrameRate GetPacketFrameRate(FLogPacket Packet);
// Get the rendered framerate
UFUNCTION(BlueprintPure, meta=(CompactNodeTitle=""FR"", Keywords = ""FrameRate, Frame, Rate""))
static bool GetRenderedFrameRate(FFrameRate& FrameRate);
// Get the packet's start timecode
UFUNCTION(BlueprintPure, meta=(CompactNodeTitle=""STC"", Keywords = ""Timecode, Time, Code, TC""))
static FTimecode GetPacketStartTimecode(FLogPacket Packet);
// Get the packet's end timecode
UFUNCTION(BlueprintPure, meta=(CompactNodeTitle=""ETC"", Keywords = ""Timecode, Time, Code, TC""))
static FTimecode GetPacketEndTimecode(FLogPacket Packet);
//Get the timecode data struct from the currently loaded LogPackt's MetaData
UFUNCTION(BlueprintCallable, BlueprintPure, Category = ""Stepper|XML|Helpers"")
static FTimecodeData GetPacketTimecodeData(FLogPacket Packet);
UFUNCTION()
static bool bIsDllLoaded(FString DllName);
// Get a reference to the active game mode
UFUNCTION(BlueprintCallable)
static AGM_Stepper* GetGameMode();
UFUNCTION()
static ELogRenderStatus QtChangeFile(FLogPacket& LogPacket, FCameraData& CameraData, int32 Iteration);
UFUNCTION()
static ELogRenderStatus QtChangeFile_Scatter(FLogPacket& LogPacket, FCameraData& CameraData, int32 ScatterIndex, FName ScatterTag, FTimecode ClipTc, int32 Iteration);
UFUNCTION()
static ELogRenderStatus RunQtBat(FString BatLoc, FString Dir);
UFUNCTION()
static int CheckLine(FString Line);
// Break a TextBox's text into lines
UFUNCTION(BlueprintCallable)
static void BreakTextBox(UTextBlock* TextBox, int32 MaxLineSize);
//Takes a snapshot of a widget and returns it as a render target
UFUNCTION(BlueprintCallable, Category = ""Stepper|Helpers"", meta=(DisplayName=""Render Target From Widget With Alpha""))
static UTextureRenderTarget2D* RtFromWidget_Alpha(UUserWidget* const Widget, FVector2D Size);
//Adds a prefix 0 for numbers below 10 (i.e 6 -> 06)
UFUNCTION(BlueprintCallable, BlueprintPure, Category = ""Stepper|Helpers"")
static void IntToPaddedString(int32 Int, FString& PaddedString);
};
";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx