On publish validate that folder exists, preview image is under 1mb

This commit is contained in:
Garry Newman 2016-11-08 10:14:49 +00:00
parent 9d8141475f
commit 3490d05b40

View File

@ -139,7 +139,14 @@ private void PublishChanges()
workshop.ugc.SetItemDescription( UpdateHandle, Description );
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 );
}
if ( Tags != null && Tags.Count > 0 )
workshop.ugc.SetItemTags( UpdateHandle, Tags.ToArray() );
@ -148,7 +155,17 @@ private void PublishChanges()
workshop.ugc.SetItemVisibility( UpdateHandle, (SteamNative.RemoteStoragePublishedFileVisibility)(uint)Visibility.Value );
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
@ -179,7 +196,7 @@ private void OnChangesSubmitted( SteamNative.SubmitItemUpdateResult_t obj, bool
return;
}
Error = "Error publishing changes: " + obj.Result.ToString();
Error = "Error publishing changes: " + obj.Result.ToString() + " ("+ NeedToAgreeToWorkshopLegal + ")";
}
public void Delete()