public frmMain()
        {
            InitializeComponent();
            string _namespace = MethodBase.GetCurrentMethod().ToLogFormatFullName();

            Logger.WriteInformationLog(LoggerMessages.GUI.frmMain.INIT_START, _namespace);
            GlobalClass.MainForm = this;
            frmLoading loadingForm = new frmLoading(StringConst.frmLoading.INIT_REQ_RES);
            Thread     thread      = new Thread(delegate()
            {
                this.CheckAndOrRetrieveMVPath();
                this.CheckBaseFiles();
                this.InitializePackageManagement();
                this.CheckDefaultPackages();
                loadingForm.SafeClose();
            });

            thread.Start();
            loadingForm.ShowDialog();
            InitGUIRes();
            GlobalClass.GlobalPackControls.LoadPackages(PackageManagement.GlobalPackages, _namespace);
            Logger.WriteInformationLog(LoggerMessages.GUI.frmMain.INIT_DONE, _namespace);
        }
        void ProcessCustomAssetsCommonPath(string _namespace)
        {
            if (CustomAssetPack == null || CustomAssetPack.Collections == null || CustomAssetPack.Collections.Count == 0)
            {
                btnSaveXML.Enabled       = true;
                FormattedCustomAssetPack = null;
                return;
            }

            FormattedCustomAssetPack = (RMPackage)CustomAssetPack.Clone();
            if (License != null)
            {
                FormattedCustomAssetPack.License = License.Clone();
            }
            List <RMPackFile> retrievedFiles = null;
            string            commonPath     = null;

            frmLoading loadingForm = new frmLoading(StringConst.frmLoading.FORMAT_PACK_META);
            Thread     thread      = new Thread(delegate()
            {
                commonPath = FormattedCustomAssetPack.TrimPrefixCommonPathOfFiles(out retrievedFiles, true);
                loadingForm.SafeClose();
            });

            thread.Start();
            loadingForm.ShowDialog();

            if (retrievedFiles == null || retrievedFiles.Count == 0 || ((FormattedCustomAssetPack.License == null || FormattedCustomAssetPack.License.LicenseSource != RMPackLic.Source.File) &&
                                                                        retrievedFiles.Count == 1))
            {
                btnSaveXML.Enabled = true;
                if (retrievedFiles != null && retrievedFiles.Count == 1)
                {
                    CustomAssetsCommonPath = Path.GetDirectoryName(retrievedFiles[0].Path);
                }
                return; // User did not select any assets or has selected 1 asset but the license source is not  a file.
            }



            if (string.IsNullOrWhiteSpace(commonPath))
            {
                Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPropPack.NO_COMMON_PATH, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                CustomAssetsCommonPath = null;
                btnSaveXML.Enabled     = false;
                return;
            }

            bool        allPathRelative = true;
            LogDataList warningLog      = new LogDataList();

            if (FormattedCustomAssetPack.License != null && FormattedCustomAssetPack.License.LicenseSource == RMPackLic.Source.File && !FormattedCustomAssetPack.License.NonRootedLicenseFile)
            {
                warningLog.WriteWarningLog(frmPropPackMessagse.Warning.NonCommonPathFile(License.Data, commonPath, true), _namespace);
                allPathRelative = false;
            }

            foreach (RMPackFile file in retrievedFiles)
            {
                if (!file.NonRootedPath)
                {
                    warningLog.WriteWarningLog(frmPropPackMessagse.Warning.NonCommonPathFile(file.Path, commonPath), _namespace);
                    allPathRelative = false;
                }
            }
            CustomAssetsCommonPath = commonPath;
            if (allPathRelative)
            {
                btnSaveXML.Enabled = true;
                return;
            }

            if (warningLog != null && warningLog.HasErrorsOrWarnings())
            {
                Helper.ShowMessageBox(MessageBoxStrings.General.HAS_ERRORS_WARNINGS, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                frmLogger loggerForm = new frmLogger(_logList: warningLog);
                loggerForm.StartPosition = FormStartPosition.CenterParent;
                loggerForm.ShowDialog();
            }

            btnSaveXML.Enabled = false;
        }
        void CreateZIPFile(string _namespace, bool implicitAssets)
        {
            if (implicitAssets)
            {
                if (string.IsNullOrWhiteSpace(txtAssetDir.Text))
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPropPack.NO_IMPLICIT_DIR_SEL_SAVE, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (!Directory.Exists(txtAssetDir.Text))
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPropPack.NO_IMPLICIT_DIR_SEL_SAVE, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                if (CustomAssetPack == null || CustomAssetPack.Collections == null || CustomAssetPack.Collections.Count == 0)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPropPack.NO_EXPLICIT_ASSET_SEL_SAVE, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            RMPackage finalPackage = CreatePackageFromUserDetails(true, false);

            if (finalPackage == null)
            {
                return;
            }

            saveFileDialog.FileName         = string.Empty;
            saveFileDialog.InitialDirectory = string.Empty;
            saveFileDialog.Filter           = FileDialogFilters.INSTALL_ZIP;
            if (saveFileDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            Logger.WriteInformationLog(LoggerMessages.GUI.frmPropPack.Info.SAVE_ZIP_INIT + saveFileDialog.FileName + ".", _namespace);

            RMPackage  temppackage = null;
            Thread     thread      = null;
            frmLoading loadingForm = null;
            bool       error       = false;

            if (implicitAssets)
            {
                temppackage      = new RMPackage();
                temppackage.Name = "Package Manager Probe";
                LogDataList log = null;

                loadingForm = new frmLoading(StringConst.frmLoading.RETRIEVING_ASSETS_DIR + txtAssetDir.Text + ".");
                thread      = new Thread(delegate()
                {
                    try
                    {
                        RMImplicit.RetrievePackFromDir(txtAssetDir.Text, _namespace, false, out log, ref temppackage);
                    }
                    catch (Exception ex)
                    {
                        Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPropPack.UNABLE_RETRIEVE_PACK, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Logger.WriteErrorLog(frmPropPackMessagse.Error.UnableRetrievePack(txtAssetDir.Text), _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                        error = true;
                        loadingForm.SafeClose();
                        return;
                    }
                    loadingForm.SafeClose();
                });
                thread.Start();
                loadingForm.ShowDialog();
                if (error)
                {
                    return;
                }

                if (log != null && log.HasErrorsOrWarnings())
                {
                    Helper.ShowMessageBox(MessageBoxStrings.General.HAS_ERRORS_WARNINGS, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    frmLogger loggerForm = new frmLogger(_logList: log);
                    loggerForm.StartPosition = FormStartPosition.CenterParent;
                    loggerForm.ShowDialog();
                }
            }
            else
            {
                temppackage = CustomAssetPack;
            }

            RMPackLic license = null;

            loadingForm = new frmLoading(StringConst.frmLoading.COPYING_ASSETS_TO_TEMP + temppackage + ".");
            thread      = new Thread(delegate()
            {
                try
                {
                    CopyAssetFilesToTemp(_namespace, temppackage, out license);
                }
                catch (Exception ex)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPropPack.ZIP_FILE_MAKE_ERR_GEN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPropPackMessagse.Error.ZipFileCopyAssetToTempErr(PMFileSystem.PackMan_TempMakeDir), _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                    error = true;
                    loadingForm.SafeClose();
                    return;
                }
                loadingForm.SafeClose();
            });
            thread.Start();
            loadingForm.ShowDialog();

            if (error)
            {
                CleanupMakeTemp(_namespace, false);
                return;
            }


            finalPackage.License = license;

            string xmlPath = PMFileSystem.PackMan_TempMakeDir + "\\" + Vars.INSTALL_FILE_DEFAULT_FILENAME;

            try
            {
                finalPackage.SaveToFile(xmlPath, _namespace, logMessage: new WriteAllTextLogMessages(writeFailed: frmPropPackMessagse.Error.ZipSaveXMLFailed));
            }
            catch
            {
                Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPropPack.ZIP_FILE_MAKE_ERR_GEN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                CleanupMakeTemp(_namespace, false);
                return;
            }

            loadingForm = new frmLoading(StringConst.frmLoading.CREATE_AN_ARCH_OF_PACK + saveFileDialog.FileName + ".");
            thread      = new Thread(delegate()
            {
                try
                {
                    ArchiveManagement.CreateNewZip(PMFileSystem.PackMan_TempMakeDir, saveFileDialog.FileName, _namespace);
                }
                catch (Exception ex)
                {
                    Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPropPack.ZIP_FILE_MAKE_ERR_GEN, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Logger.WriteErrorLog(frmPropPackMessagse.Error.ZIP_MAKE + saveFileDialog.FileName + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                    loadingForm.SafeClose();
                    error = true;
                    return;
                }
                loadingForm.SafeClose();
            });
            thread.Start();
            loadingForm.ShowDialog();

            if (error)
            {
                CleanupMakeTemp(_namespace, false);
                return;
            }

            MadeChanges = false;

            Helper.ShowMessageBox(MessageBoxStrings.GUI.frmPropPack.ZIP_SUCCESS + saveFileDialog.FileName + ".", MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Information);

            Logger.WriteInformationLog(LoggerMessages.GUI.frmPropPack.Info.SAVE_ZIP_SUCCESS + saveFileDialog.FileName + ".", _namespace);
        }