Example #1
0
 private void UninstallCurrentVersion()
 {
     if (NPNFUpgradeUlti.UninstallCurrentVersion())
     {
         CurrentPhase = UpgreadePhase.Import_Latest_Version;
     }
 }
Example #2
0
 private void UpdateUIDownload()
 {
     if (downloadRequest != null)
     {
         downloadProgress = downloadRequest.progress;
         if (downloadRequest.isDone)
         {
             if (string.IsNullOrEmpty(downloadRequest.error))
             {
                 downloadProgress = 1f;
                 NPNFUpgradeUlti.SaveFile(downloadRequest.bytes);
                 CurrentPhase = UpgreadePhase.Uninstall_Current_Version;
                 downloadRequest.Dispose();
                 downloadRequest = null;
             }
             else
             {
                 string error = downloadRequest.error;
                 downloadRequest.Dispose();
                 downloadRequest = null;
                 if (EditorUtility.DisplayDialog("Download NPNF SDK Latest Version", error, "Retry", "Close"))
                 {
                     downloadRequest = new WWW(latestUrlSDK);
                 }
                 else
                 {
                     this.Close();
                 }
             }
         }
     }
 }
Example #3
0
        private void CheckLatestVersion()
        {
            string latestVersion;

            if (!NPNFUpgradeUlti.GetLatestVersion(out latestVersion, out latestUrlSDK))
            {
                EditorUtility.DisplayDialog("Check for New Version", "Can not check versions, network fault", "Close");
                this.Close();
                return;
            }

            Version current = new Version(NPNFSettings.SDK_VERSION);
            Version latest  = new Version(latestVersion);

            if (latest.CompareTo(current) > 0)
            {
                bool pick = EditorUtility.DisplayDialog("Check for New Version", "There is a new version of NPNF SDK available for upgrade", "Upgrade", "Later");
                if (pick)
                {
                    CurrentPhase = UpgreadePhase.Download_Latest_SDK;
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                EditorUtility.DisplayDialog("Check for New Version", "No newer version found. You are already using the latest version", "OK");
                this.Close();
            }
        }
Example #4
0
        private void RenderDetails()
        {
            GUILayout.Space(20f);
            //Line 1
            EditorGUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();
                EditorGUILayout.BeginVertical();
                {
                    foreach (Enum _e in Enum.GetValues(typeof(UpgreadePhase)))
                    {
                        UpgreadePhase e = (UpgreadePhase)_e;
                        EditorGUILayout.BeginHorizontal();
                        {
                            if ((int)CurrentPhase > (int)e)
                            {
                                GUI.color = Color.green;
                            }
                            else if (CurrentPhase == e)
                            {
                                GUI.color = Color.yellow;
                            }

                            EditorGUILayout.LabelField(string.Format("{0}. {1}", (int)e, e.ToString().Replace("_", " ")));

                            GUI.color = Color.white;
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
                EditorGUILayout.EndVertical();

                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(20f);

            //Line 2
            EditorGUILayout.BeginHorizontal();
            {
                GUILayout.Space(20f);
                Rect r = EditorGUILayout.BeginVertical();
                EditorGUI.ProgressBar(r, downloadProgress, "Download... - " + decimal.Round(new Decimal(downloadProgress * 100f), 1) + " %");
                GUILayout.Space(20f);
                EditorGUILayout.EndVertical();
                GUILayout.Space(20f);
            }
            EditorGUILayout.EndHorizontal();
        }
        private void CheckLatestVersion()
        {
            string latestVersion;
            if(!NPNFUpgradeUlti.GetLatestVersion(out latestVersion, out latestUrlSDK))
            {
                EditorUtility.DisplayDialog("Check for New Version", "Can not check versions, network fault", "Close");
                this.Close();
                return;
            }

            Version current = new Version(NPNFSettings.SDK_VERSION);
            Version latest = new Version(latestVersion);

            if (latest.CompareTo(current) > 0)
            {
                bool pick = EditorUtility.DisplayDialog("Check for New Version", "There is a new version of NPNF SDK available for upgrade", "Upgrade", "Later");
                if (pick)
                    CurrentPhase = UpgreadePhase.Download_Latest_SDK;
                else
                    this.Close();
            }
            else
            {
                EditorUtility.DisplayDialog("Check for New Version", "No newer version found. You are already using the latest version", "OK");
                this.Close();
            }
        }
 private void UpdateUIDownload()
 {
     if(downloadRequest != null)
     {
         downloadProgress = downloadRequest.progress;
         if(downloadRequest.isDone)
         {
             if (string.IsNullOrEmpty(downloadRequest.error))
             {
                 downloadProgress = 1f;
                 NPNFUpgradeUlti.SaveFile(downloadRequest.bytes);
                 CurrentPhase = UpgreadePhase.Uninstall_Current_Version;
                 downloadRequest.Dispose();
                 downloadRequest = null;
             }
             else
             {
                 string error = downloadRequest.error;
                 downloadRequest.Dispose();
                 downloadRequest = null;
                 if (EditorUtility.DisplayDialog("Download NPNF SDK Latest Version", error, "Retry", "Close"))
                     downloadRequest = new WWW(latestUrlSDK);
                 else
                     this.Close();
             }
         }
     }
 }
 private void UninstallCurrentVersion()
 {
     if (NPNFUpgradeUlti.UninstallCurrentVersion())
         CurrentPhase = UpgreadePhase.Import_Latest_Version;
 }