Ejemplo n.º 1
0
 private void ctrlDelApplicationBtn_Click(object sender, RoutedEventArgs e)
 {
     if (ctrlListApps.SelectedItem != null)
     {
         TheLauncher.DeleteApplication();
         ctrlListApps.Items.Refresh();
     }
 }
Ejemplo n.º 2
0
 private void ctrlBtnDeleteConfig_Click(object sender, RoutedEventArgs e)
 {
     if (ctrlComboConfigs.SelectedItem != null)
     {
         TheLauncher.DeleteConfig();
         ctrlComboConfigs.Items.Refresh();
     }
 }
Ejemplo n.º 3
0
        private void ctrlBtnKill_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlComboConfigs.SelectedIndex < 0)
            {
                AppLogger.Log("No config selected");
                return;
            }

            TheLauncher.ProcessCommand(Launcher.ClusterCommandType.KillApp);
        }
Ejemplo n.º 4
0
        private void ctrlBtnRun_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlListApps.SelectedIndex < 0 || ctrlComboConfigs.SelectedIndex < 0)
            {
                AppLogger.Log("No application/config selected");
                return;
            }

            TheLauncher.ProcessCommand(Launcher.ClusterCommandType.RunApp);
        }
Ejemplo n.º 5
0
        private void ctrlComboConfigs_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TheLauncher.ChangeConfigSelection(TheLauncher.SelectedConfig);

            // Check if need to upgrade the selected file
            if (File.Exists(TheLauncher.SelectedConfig))
            {
                UpgradeConfigIfNeeded(TheLauncher.SelectedConfig);
            }
        }
Ejemplo n.º 6
0
 static void Init()
 {
     FTPHost              = EditorPrefs.GetString("host");
     FTPUserName          = EditorPrefs.GetString("user");
     FTPPassword          = EditorPrefs.GetString("pass");
     Compress.LastVersion = EditorPrefs.GetString("ver");
     FilePath             = EditorPrefs.GetString("FilePath");
     window = (TheLauncher)EditorWindow.GetWindow(typeof(TheLauncher));
     window.Show();
 }
        private void ctrlBtnEventSend_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlListClusterEvents.SelectedItems.Count <= 0)
            {
                AppLogger.Log("No event selected");
                return;
            }

            TheLauncher.ProcessCommand(Launcher.ClusterCommandType.SendEvent, new object[] { ctrlListClusterEvents.SelectedItems.Cast <ClusterEvent>().ToList() });
        }
Ejemplo n.º 8
0
 private void ctrlBtnAddApplication_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
     openFileDialog.Filter = AppFileExtention;
     if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         string appPath = openFileDialog.FileName;
         TheLauncher.AddApplication(appPath);
         ctrlListApps.Items.Refresh();
     }
 }
Ejemplo n.º 9
0
 private void ctrlBtnAddConfig_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
     openFileDialog.Filter = CfgFileExtention;
     if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         string configPath = openFileDialog.FileName;
         if (!TheLauncher.Configs.Exists(x => x == configPath))
         {
             TheLauncher.AddConfig(configPath);
             ctrlComboConfigs.Items.Refresh();
         }
     }
 }
Ejemplo n.º 10
0
        private void ctrlBtnRestartComputers_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlComboConfigs.SelectedIndex < 0)
            {
                AppLogger.Log("No config selected");
                return;
            }

            DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Are you sure?", "Restart cluster nodes", MessageBoxButtons.YesNo);

            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                TheLauncher.ProcessCommand(Launcher.ClusterCommandType.RestartComputers);
            }
        }
        private void ctrlBtnRun_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlListApps.SelectedIndex < 0 || ctrlComboConfigs.SelectedIndex < 0)
            {
                AppLogger.Log("No application/config selected");
                return;
            }

            if (TheLauncher.SelectedConfig.Contains(" "))
            {
                System.Windows.Forms.MessageBox.Show("Paths with spaces currently not supported. Please make sure there is no spaces in the config path.");
                return;
            }

            TheLauncher.ProcessCommand(Launcher.ClusterCommandType.RunApp);
        }
        private void ctrlBtnAddConfig_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Filter = CfgFileExtention;
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string configPath = openFileDialog.FileName;
                if (configPath.Contains(" "))
                {
                    System.Windows.Forms.MessageBox.Show("Paths with spaces currently not supported");
                    return;
                }

                if (!TheLauncher.Configs.Exists(x => x == configPath))
                {
                    TheLauncher.AddConfig(configPath);
                    ctrlComboConfigs.Items.Refresh();
                }
            }
        }
Ejemplo n.º 13
0
        private void ctrlBtnAddEditorProject_Click(object sender, RoutedEventArgs e)
        {
            string CmdLine = String.Empty;

            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Filter = UE4EditorFileExtention;
            openFileDialog.Title  = "Select UE4 Editor";
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                CmdLine = openFileDialog.FileName;

                System.Windows.Forms.OpenFileDialog openFileDialogForProject = new System.Windows.Forms.OpenFileDialog();
                openFileDialogForProject.Filter = UE4ProjectExtention;
                openFileDialogForProject.Title  = "Select UE4 Project";
                if (openFileDialogForProject.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    CmdLine += " " + openFileDialogForProject.FileName + " -game ";
                    TheLauncher.AddApplication(CmdLine);
                    ctrlListApps.Items.Refresh();
                }
            }
        }
Ejemplo n.º 14
0
        private bool PerformConfigUpgrade(string OldFile, ref string NewFile)
        {
            AppLogger.Log("Upgrading the config file...");
            ConfigConversion.ConversionResult result = ConfigConversion.Convert(TheLauncher.SelectedConfig, Launcher.CurrentVersion);
            if (result.Success == true)
            {
                AppLogger.Log("Upgraded successfully. Auto-generated file location: " + result.NewConfigFile);
                if (!TheLauncher.Configs.Exists(x => x == result.NewConfigFile))
                {
                    TheLauncher.AddConfig(result.NewConfigFile);
                    ctrlComboConfigs.Items.Refresh();
                }

                // Make this new file selected in the GUI
                TheLauncher.SelectedConfig = result.NewConfigFile;
            }
            else
            {
                AppLogger.Log("Upgrade failed.");
            }

            NewFile = result.NewConfigFile;
            return(result.Success);
        }
Ejemplo n.º 15
0
    void OnGUI()
    {
        window   = (TheLauncher)EditorWindow.GetWindow(typeof(TheLauncher), false, null, false);
        GUI.skin = guiSkin;
        tex      = new Texture2D(1, 1, TextureFormat.RGBA32, false);
        tex.SetPixel(0, 0, new Color(0f, 0.41176f, 0.53333f));
        tex.Apply();
        boxback.normal.background          = tex;
        titleStyle.fontSize                = 20;
        titleStyle.normal.textColor        = Color.white;
        smallButtonStyle.normal.background = tex;
        smallButtonStyle.padding           = new RectOffset(5, 5, 5, 5);
        smallButtonStyle.normal.textColor  = Color.white;
        smallButtonStyle.margin            = new RectOffset(5, 5, 5, 5);
        smallButtonStyle.alignment         = TextAnchor.MiddleCenter;
        tex2 = new Texture2D(1, 1, TextureFormat.RGBA32, false);
        tex2.SetPixel(0, 0, new Color(0f, 0.71176f, 0.83333f));
        tex2.Apply();
        smallButtonStyle.hover.background = tex2;

        //Background 1
        tex = new Texture2D(1, 1, TextureFormat.RGBA32, false);
        tex.SetPixel(0, 0, new Color(0f, 0.20392f, 0.25882f));
        tex.Apply();
        GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), tex, ScaleMode.StretchToFill);
        //End Background

        //Horizontal Box: Set version
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("Set Version (as string): ");
        Compress.LastVersion = GUILayout.TextField(Compress.LastVersion);
        if (GUILayout.Button("Settings", smallButtonStyle))
        {
            showSettings = true;
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box

        //Horizontal Box: Settings
        if (showSettings)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Label("Settings", titleStyle);
            if (GUILayout.Button("Close Settings", smallButtonStyle))
            {
                showSettings = false;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Set No Log", smallButtonStyle))
            {
                DebugLevelController.DebugLogLevel = -1;
                Debug.Log("No Log");
            }
            if (GUILayout.Button("Set Log Level To: User", smallButtonStyle))
            {
                DebugLevelController.DebugLogLevel = 0;
                Debug.Log("User Level Log");
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Set Log Level To: Developer", smallButtonStyle))
            {
                DebugLevelController.DebugLogLevel = 1;
                Debug.Log("Developer Level Log");
            }
            if (GUILayout.Button("Set Log Level To: Hacker", smallButtonStyle))
            {
                DebugLevelController.DebugLogLevel = 2;
                Debug.Log("Hacker Level Log");
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
        //Horizontal Box

        //Horizontal Box: Select Build
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("\nSelect your build", titleStyle);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box

        //Horizontal Box: Subtitle
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("Must contain only build files and nothing else");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box

        if (GUILayout.Button("Select Build Folder", guiSkin.button))
        {
            SelectBuildFolder();
        }

        //Horizontal Box: Compress and upload
        GUILayout.BeginHorizontal();
        GUILayout.Box("Folder to compress: " + Compress.pathToCompress);
        GUILayout.EndHorizontal();

        if (!String.IsNullOrEmpty(Compress.pathToCompress))
        {
            if (String.IsNullOrEmpty(Compress.compressStatus))
            {
                if (GUILayout.Button("Compress"))
                {
                    bool should = EditorUtility.DisplayDialog(
                        "Compress folder",
                        "Please be aware that if you start the copmression and do some changes to your scripts and recompile, the thread will halt and unity may become unresponsive. \n" +
                        "\n The folder |  " + Compress.pathToCompress + "  | is about to be compressed and put in Project Folder/The Launcher/. " +
                        "\nDo you want to continue?",
                        "Yes, compress!",
                        "No, go back"
                        );
                    if (should)
                    {
                        CompressBuild();
                        DebugLevelController.Log("Compression Started");
                        //DebugLevelController.Log ("Compression Status:" + Compress.compressStatus);
                        FilePath = Compress.pathToUpload;
                        EditorLogGenerator.GenerateLog("Compression Started");
                        Uploader.UploadStatus = null;
                    }
                }
            }
            GUILayout.BeginHorizontal();
            GUILayout.Box("Compression Status (" + Compress.compressCount + "/" + Compress.totalFiles + ");" + Compress.compressStatus);
            GUILayout.EndHorizontal();
        }

        if (!String.IsNullOrEmpty(Compress.compressStatus))
        {
            if (GUILayout.Button("Stop Compression Thread"))
            {
                bool should = EditorUtility.DisplayDialog(
                    "Compress folder",
                    "The Launcher will attempt to stop the compression thread right now." +
                    "\nDo you want to continue?",
                    "Yes, stop!",
                    "No, go back"
                    );
                if (should)
                {
                    CompressHelper.abortThreadOnNextTry = true;
                    DebugLevelController.Log("Compression Stopped");
                    FilePath = Compress.pathToUpload;
                    EditorLogGenerator.GenerateLog("Compression Stopped");
                    Uploader.UploadStatus   = null;
                    Compress.compressStatus = null;
                }
            }
        }

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("\n---------------------------------------\n");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        //Vertical Box: FTP seciton
        GUILayout.BeginVertical(boxback);
        //Horizontal Box: FTP Upload
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("\nUpload your build\n", titleStyle);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        //Horizontal Box


        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("FTP Host:");
        FTPHost = GUILayout.TextField(FTPHost);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("FTP Username:"******"FTP Password:"******"Do not include the 'ftp://' part and should include the folder you wish to upload your game. \nEg. test.com/mygame/download/");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        if (!String.IsNullOrEmpty(FilePath))
        {
            GUILayout.BeginHorizontal();
            if (String.IsNullOrEmpty(Uploader.UploadStatus))
            {
                if (GUILayout.Button("UPLOAD"))
                {
                    bool should = EditorUtility.DisplayDialog(
                        "Upload File",
                        FilePath + "  | is about to be uploaded to '" +
                        "\n" + FTPHost
                        + "\n with username: "******"\n with password: "******"Yes, UPLOAD!",
                        "No, go back"
                        );
                    if (should)
                    {
                        Uploader.FTPHost     = FTPHost;
                        Uploader.FTPUserName = FTPUserName;
                        Uploader.FTPPassword = FTPPassword;
                        Uploader.FilePath    = FilePath;
                        Uploader.UploadFile();
                        DebugLevelController.Log("Upload Started");
                        EditorLogGenerator.GenerateLog("Upload Started");
                        should = false;
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
        //Vertical Box

        //Horizontal Box: Infos
        if (!String.IsNullOrEmpty(FilePath))
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("File to upload: " + FilePath);
            GUILayout.EndHorizontal();
        }
        GUILayout.BeginHorizontal();
        //DebugLevelController.Log (Uploader.client.IsBusy);
        GUILayout.Box(Uploader.UploadStatus);
        GUILayout.EndHorizontal();
        //Horizontal Box
        GUILayout.EndVertical();
        if (!String.IsNullOrEmpty(Uploader.UploadStatus))
        {
            if (Uploader.UploadStatus.Contains("Upload Done"))
            {
                Uploader.UploadStatus = "";
                this.Close();
                EditorUtility.DisplayDialog(
                    "Upload Done!",
                    "File was uploaded to the server. Now the window will be closed.",
                    "OK"
                    );
            }
        }
        if (!String.IsNullOrEmpty(Uploader.UploadStatus))
        {
            if (Uploader.UploadStatus.Contains("Upload Progress"))
            {
                if (GUILayout.Button("Cancel Upload"))
                {
                    Uploader.abortThreadOnNextTry = true;
                    Uploader.shouldCheck          = false;
                    Uploader.UploadStatus         = null;
                    DebugLevelController.Log("Upload Cancelled");
                    EditorLogGenerator.GenerateLog("Upload Cancelled");
                }
            }
        }
    }