94 lines
2.2 KiB
C#
94 lines
2.2 KiB
C#
|
|
#if TOOLS
|
||
|
|
using Godot;
|
||
|
|
using Rokojori;
|
||
|
|
using System.Diagnostics;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
using System.Linq;
|
||
|
|
|
||
|
|
|
||
|
|
namespace Rokojori.Tools
|
||
|
|
{
|
||
|
|
public enum OnlineDocsTargetType
|
||
|
|
{
|
||
|
|
Member,
|
||
|
|
Class
|
||
|
|
}
|
||
|
|
|
||
|
|
public class OnlineDocsTarget
|
||
|
|
{
|
||
|
|
public OnlineDocsTargetType type = OnlineDocsTargetType.Member;
|
||
|
|
public string memberName;
|
||
|
|
public string memberType = null ;
|
||
|
|
public List<string> parameters = null;
|
||
|
|
public string docTarget;
|
||
|
|
public bool isFunction = false;
|
||
|
|
public bool hasSignature => memberType != null;
|
||
|
|
|
||
|
|
public static readonly string Delimiter = ":::";
|
||
|
|
|
||
|
|
public static OnlineDocsTarget From( string target )
|
||
|
|
{
|
||
|
|
var odt = new OnlineDocsTarget();
|
||
|
|
|
||
|
|
if ( target.IndexOf( Delimiter ) == -1 )
|
||
|
|
{
|
||
|
|
// RJLog.Log( "No delimiter:", target );
|
||
|
|
odt.type = OnlineDocsTargetType.Class;
|
||
|
|
odt.docTarget = target;
|
||
|
|
return odt;
|
||
|
|
}
|
||
|
|
|
||
|
|
var splits = target.Split( Delimiter );
|
||
|
|
|
||
|
|
// RJLog.Log( "Splitting:", target, ">>", "'" + splits.Join( "','" ) + "'" );
|
||
|
|
|
||
|
|
odt.docTarget = splits[ 1 ];
|
||
|
|
|
||
|
|
var memberTarget = splits[ 0 ];
|
||
|
|
|
||
|
|
var typeIndex = memberTarget.IndexOf( ":" );
|
||
|
|
|
||
|
|
if ( typeIndex != -1 )
|
||
|
|
{
|
||
|
|
odt.memberType = memberTarget.Substring( typeIndex + 1 );
|
||
|
|
}
|
||
|
|
|
||
|
|
var bracketIndex = memberTarget.IndexOf( "(" );
|
||
|
|
|
||
|
|
if ( bracketIndex != -1 )
|
||
|
|
{
|
||
|
|
odt.isFunction = true;
|
||
|
|
var closingIndex = memberTarget.IndexOf( ")", bracketIndex + 1 );
|
||
|
|
odt.parameters = memberTarget.Substring( bracketIndex + 1, closingIndex ).Split( "," ).ToList();
|
||
|
|
}
|
||
|
|
|
||
|
|
var nameEndIndex = typeIndex != -1 ? typeIndex :
|
||
|
|
bracketIndex != -1 ? bracketIndex : memberTarget.Count();
|
||
|
|
|
||
|
|
odt.memberName = memberTarget.Substring( 0, nameEndIndex );
|
||
|
|
|
||
|
|
return odt;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public class OnlineDocJSONDocEntry
|
||
|
|
{
|
||
|
|
public string content;
|
||
|
|
public string target;
|
||
|
|
}
|
||
|
|
|
||
|
|
public class OnlineDocJSON
|
||
|
|
{
|
||
|
|
public string key = "";
|
||
|
|
public string sourcePath = "";
|
||
|
|
|
||
|
|
public List<OnlineDocJSONDocEntry> content = [];
|
||
|
|
|
||
|
|
public ISOTimeStamp changeDate;
|
||
|
|
public string version;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|