DownloadMessage.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (c) 2024 Vuplex Inc. All rights reserved.
  2. //
  3. // Licensed under the Vuplex Commercial Software Library License, you may
  4. // not use this file except in compliance with the License. You may obtain
  5. // a copy of the License at
  6. //
  7. // https://vuplex.com/commercial-library-license
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma warning disable CS0649
  15. using System;
  16. using UnityEngine;
  17. namespace Vuplex.WebView.Internal {
  18. /// <summary>
  19. /// A class used internally to pass messages about downloads
  20. /// from the native plugins to the webview scripts.
  21. /// </summary>
  22. [Serializable]
  23. public class DownloadMessage {
  24. public string ContentType;
  25. public string FilePath;
  26. public string Id;
  27. public float Progress;
  28. public int Type;
  29. public string Url;
  30. public static DownloadMessage FromJson(string json) {
  31. return JsonUtility.FromJson<DownloadMessage>(json);
  32. }
  33. public DownloadChangedEventArgs ToEventArgs() {
  34. return new DownloadChangedEventArgs(ContentType, FilePath, Id, Progress, (ProgressChangeType)Type, Url);
  35. }
  36. }
  37. }