mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 06:05:46 +03:00
On publish validate that folder exists, preview image is under 1mb
This commit is contained in:
parent
9d8141475f
commit
3490d05b40
@ -139,7 +139,14 @@ private void PublishChanges()
|
|||||||
workshop.ugc.SetItemDescription( UpdateHandle, Description );
|
workshop.ugc.SetItemDescription( UpdateHandle, Description );
|
||||||
|
|
||||||
if ( Folder != null )
|
if ( Folder != null )
|
||||||
|
{
|
||||||
|
var info = new System.IO.DirectoryInfo( Folder );
|
||||||
|
|
||||||
|
if ( !info.Exists )
|
||||||
|
throw new System.Exception( $"Folder doesn't exist ({Folder})" );
|
||||||
|
|
||||||
workshop.ugc.SetItemContent( UpdateHandle, Folder );
|
workshop.ugc.SetItemContent( UpdateHandle, Folder );
|
||||||
|
}
|
||||||
|
|
||||||
if ( Tags != null && Tags.Count > 0 )
|
if ( Tags != null && Tags.Count > 0 )
|
||||||
workshop.ugc.SetItemTags( UpdateHandle, Tags.ToArray() );
|
workshop.ugc.SetItemTags( UpdateHandle, Tags.ToArray() );
|
||||||
@ -148,7 +155,17 @@ private void PublishChanges()
|
|||||||
workshop.ugc.SetItemVisibility( UpdateHandle, (SteamNative.RemoteStoragePublishedFileVisibility)(uint)Visibility.Value );
|
workshop.ugc.SetItemVisibility( UpdateHandle, (SteamNative.RemoteStoragePublishedFileVisibility)(uint)Visibility.Value );
|
||||||
|
|
||||||
if ( PreviewImage != null )
|
if ( PreviewImage != null )
|
||||||
workshop.ugc.SetItemPreview( UpdateHandle, PreviewImage ); // change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size
|
{
|
||||||
|
var info = new System.IO.FileInfo( PreviewImage );
|
||||||
|
|
||||||
|
if ( !info.Exists )
|
||||||
|
throw new System.Exception( $"PreviewImage doesn't exist ({PreviewImage})" );
|
||||||
|
|
||||||
|
if ( info.Length >= 1024 * 1024 )
|
||||||
|
throw new System.Exception( $"PreviewImage should be under 1MB ({info.Length})" );
|
||||||
|
|
||||||
|
workshop.ugc.SetItemPreview( UpdateHandle, PreviewImage );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
workshop.ugc.SetItemUpdateLanguage( UpdateId, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
|
workshop.ugc.SetItemUpdateLanguage( UpdateId, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
|
||||||
@ -179,7 +196,7 @@ private void OnChangesSubmitted( SteamNative.SubmitItemUpdateResult_t obj, bool
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error = "Error publishing changes: " + obj.Result.ToString();
|
Error = "Error publishing changes: " + obj.Result.ToString() + " ("+ NeedToAgreeToWorkshopLegal + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete()
|
public void Delete()
|
||||||
|
Loading…
Reference in New Issue
Block a user