Ejemplo n.º 1
0
    // Token: 0x06000111 RID: 273 RVA: 0x00009754 File Offset: 0x00007B54
    public static void SaveImage(Texture2D texture, string fileName, string category, string fileType = "png")
    {
        string str = fileName + "_" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");

        ScreenshotManager.Instance.Awake();
        string text;

        if (fileType == "png")
        {
            byte[] array = texture.EncodeToPNG();
            text = ".png";
        }
        else
        {
            byte[] array = texture.EncodeToJPG();
            text = ".jpg";
        }
        DirectoryInfo directoryInfo = new DirectoryInfo(Application.persistentDataPath + "/MyWork");

        try
        {
            directoryInfo.GetFiles();
        }
        catch
        {
            MonoBehaviour.print("Directry Catch SucessFully Created");
            directoryInfo.Create();
        }
        string text2 = Application.persistentDataPath + "/MyWork/" + str + text;

        Debug.LogWarning("Image Saved To Path =" + text2);
        ScreenshotManager.SaveTextureToFile(text2, texture);
        ScreenshotManager.DeleteTempImage(fileName + "temp" + text);
    }