void Rate(OuyaMod ouyaMod)
 {
     ouyaMod.rate();
 }
 void Download(OuyaMod ouyaMod)
 {
     OuyaUnityPlugin.contentDownload(ouyaMod);
 }
 void Flag(OuyaMod ouyaMod)
 {
     ouyaMod.flag();
 }
 void Unpublish(OuyaMod ouyaMod)
 {
     OuyaUnityPlugin.contentUnpublish(ouyaMod);
 }
 void Delete(OuyaMod ouyaMod)
 {
     OuyaUnityPlugin.contentDelete(ouyaMod);
 }
    public void Edit(OuyaMod ouyaMod)
    {
        using (OuyaMod.Editor editor = ouyaMod.edit())
        {
            //Debug.Log("Access to Editor");

            // Required fields:
            editor.setTitle("edit title");
            editor.setCategory("edit category");
            editor.setDescription("edit description");

            // replace file
            editor.deleteFile("level.dat");

            using (OutputStream os = editor.newFile("level.dat"))
            {
                os.write(System.Text.UTF8Encoding.UTF8.GetBytes("edit file"));
                os.close();
            }

            // remove old screenshot
            List<OuyaModScreenshot> screenshots = ouyaMod.getScreenshots();
            for (int index = 0; index < screenshots.Count; ++index)
            {
                using (OuyaModScreenshot ouyaModScreenshot = screenshots[index])
                {
                    editor.removeScreenshot(ouyaModScreenshot);
                }
            }

            // add new screenshot
            if (m_bitmapScreenshots.Length > 1)
            {
                Debug.Log("Adding screenshot");
                editor.addScreenshot(m_bitmapScreenshots[1]);
            }
            else
            {
                Debug.LogError("Missing screenshot");
            }

            // remove old tags
            foreach (string tag in ouyaMod.getTags())
            {
                editor.removeTag(tag);
            }

            // Add optional tags:
            editor.addTag("edit tag");

            // Add optional metadata for your own display:
            editor.setMetadata("edit meta data");

            OuyaUnityPlugin.saveOuyaMod(ouyaMod, editor);
        }
    }
 void Publish(OuyaMod ouyaMod)
 {
     OuyaUnityPlugin.contentPublish(ouyaMod);
 }
    /// <summary>
    /// IContentUnpublishListener
    /// </summary>
    public void ContentUnpublishOnSuccess(OuyaMod ouyaMod)
    {
        m_status = string.Format("Status: {0}", MethodBase.GetCurrentMethod().Name);
        Debug.Log(m_status);

        RunSearch();
    }
 public void ContentUnpublishOnError(OuyaMod ouyaMod, int code, string reason)
 {
     m_status = string.Format("Status: {0} code={1} reason={2}", MethodBase.GetCurrentMethod().Name, code, reason);
     Debug.Log(m_status);
 }
 public void ContentDownloadOnProgress(OuyaMod ouyaMod, int progress)
 {
     m_status = string.Format("Status: {0} progress={1}", MethodBase.GetCurrentMethod().Name, progress);
     Debug.Log(m_status);
 }
 public void ContentDownloadOnFailed(OuyaMod ouyaMod)
 {
     m_status = string.Format("Status: {0}", MethodBase.GetCurrentMethod().Name);
     Debug.Log(m_status);
 }
    /// <summary>
    /// IContentDownloadListener
    /// </summary>
    public void ContentDownloadOnComplete(OuyaMod ouyaMod)
    {
        m_status = string.Format("Status: {0}", MethodBase.GetCurrentMethod().Name);
        Debug.Log(m_status);

        RunSearch();
    }
        public static void contentPublish(OuyaMod ouyaMod)
        {
#if VERBOSE_LOGGING
            Debug.Log(string.Format("Invoking {0}...", MethodBase.GetCurrentMethod().Name));
#endif
            JNIFind();

            if (_jcOuyaUnityPlugin == IntPtr.Zero)
            {
                Debug.LogError("_jcOuyaUnityPlugin is not initialized");
                return;
            }
            if (_jmContentPublish == IntPtr.Zero)
            {
                Debug.LogError("_jmContentPublish is not initialized");
                return;
            }

            IntPtr arg1 = ouyaMod.GetInstance();
            AndroidJNI.CallStaticVoidMethod(_jcOuyaUnityPlugin, _jmContentPublish, new jvalue[] { new jvalue() { l = arg1 } });
        }
        public static List<OuyaMod> getOuyaContentPublishedResults()
        {
#if VERBOSE_LOGGING
            Debug.Log(string.Format("Invoking {0}...", MethodBase.GetCurrentMethod().Name));
#endif
            JNIFind();

            if (_jcOuyaUnityPlugin == IntPtr.Zero)
            {
                Debug.LogError("_jcOuyaUnityPlugin is not initialized");
                return null;
            }
            if (_jmGetOuyaContentPublishedResults == IntPtr.Zero)
            {
                Debug.LogError("_jmGetOuyaContentPublishedResults is not initialized");
                return null;
            }

            IntPtr result = AndroidJNI.CallStaticObjectMethod(_jcOuyaUnityPlugin, _jmGetOuyaContentPublishedResults, new jvalue[0] { });
            if (result == IntPtr.Zero)
            {
                Debug.LogError("_jmGetOuyaContentPublishedResults returned null");
                return null;
            }

            List<OuyaMod> ouyaMods = new List<OuyaMod>();
            IntPtr[] resultArray = AndroidJNI.FromObjectArray(result);
            foreach (IntPtr ptr in resultArray)
            {
                IntPtr globalRef = AndroidJNI.NewGlobalRef(ptr);
                AndroidJNI.DeleteLocalRef(ptr);
                OuyaMod ouyaMod = new OuyaMod(globalRef);
                ouyaMods.Add(ouyaMod);
            }
            AndroidJNI.DeleteLocalRef(result);
            return ouyaMods;
        }