@@ -9,16 +9,15 @@ namespace Hi3Helper.Plugin.Core.Management.Api;
99/// Entry of the launcher's news data.
1010/// </summary>
1111[ StructLayout ( LayoutKind . Sequential , Pack = 8 ) ]
12- public unsafe struct LauncherNewsEntry ( LauncherNewsEntryType newsType )
12+ public unsafe struct LauncherNewsEntry ( )
1313 : IDisposable
1414{
1515 private byte _isFreed = 0 ;
1616
1717 /// <summary>
1818 /// The type of the news entry. See <see cref="LauncherNewsEntryType"/> for the types.
1919 /// </summary>
20- public readonly LauncherNewsEntryType Type = newsType ;
21-
20+ public LauncherNewsEntryType Type = LauncherNewsEntryType . Event ;
2221 private byte * _title = null ;
2322 private byte * _description = null ;
2423 private byte * _url = null ;
@@ -51,7 +50,8 @@ public unsafe struct LauncherNewsEntry(LauncherNewsEntryType newsType)
5150 /// <param name="description">The description of the news entry.</param>
5251 /// <param name="url">The HREF/click URL of the news entry.</param>
5352 /// <param name="postDate">The short format (DD/MM) of the date for the news entry.</param>
54- public void Write ( string ? title , string ? description , string ? url , string ? postDate )
53+ /// <param name="type">Type of the news entry</param>
54+ public void Write ( string ? title , string ? description , string ? url , string ? postDate , LauncherNewsEntryType type = LauncherNewsEntryType . Event )
5555 {
5656 Utf8StringMarshaller . Free ( _title ) ;
5757 Utf8StringMarshaller . Free ( _description ) ;
@@ -62,11 +62,15 @@ public void Write(string? title, string? description, string? url, string? postD
6262 _description = Utf8StringMarshaller . ConvertToUnmanaged ( description ) ;
6363 _url = Utf8StringMarshaller . ConvertToUnmanaged ( url ) ;
6464 _postDate = Utf8StringMarshaller . ConvertToUnmanaged ( postDate ) ;
65+ Type = type ;
6566 }
6667
6768 public void Dispose ( )
6869 {
69- if ( _isFreed == 1 ) return ;
70+ if ( _isFreed == 1 )
71+ {
72+ return ;
73+ }
7074
7175 Utf8StringMarshaller . Free ( _title ) ;
7276 Utf8StringMarshaller . Free ( _description ) ;
0 commit comments