Ejemplo n.º 1
0
    public void ChangePackage()
    {
        int index = packages.IndexOf(CurrentPackage);

        if ((index + 1) >= packages.Count)
        {
            FinishProgress();
        }
        else
        {
            CurrentPackage = packages[index + 1];
            CurrentPackage.StartTask();
            UpdateHint();
        }
    }
Ejemplo n.º 2
0
        protected void radTabJNPTopMenu_DataBound(object sender, EventArgs e)
        {
            switch (this.TopMenuType)
            {
            case enumTopMenuType.JAMenu:
            case enumTopMenuType.CRMenu:
            case enumTopMenuType.JQMenu:
            case enumTopMenuType.ApprovalMenu:

                if (CurrentPackage != null)
                {
                    //checking  document exists or not

                    long crid = CurrentPackage.CRID;
                    long jqid = CurrentPackage.JQID;
                    //CR inactive /does not exist then CR tab should not be visible
                    if (CurrentPackage.HasActiveCR() == false)
                    {
                        RadTab crtab = this.radTabJNPTopMenu.FindTabByValue("CategoryRating");
                        if (crtab != null)
                        {
                            crtab.Visible = false;
                        }
                    }
                }
                break;

            default:
                break;
            }

            //moved this condition outside the switch statement as it only applies to JQMenu
            if (this.TopMenuType == enumTopMenuType.JQMenu)
            {
                RadTab jqtab = this.radTabJNPTopMenu.FindTabByValue("JobQuestionnaire");
                if (jqtab != null)
                {
                    if (base.IsAdmin)
                    {
                        jqtab.NavigateUrl = "~/JQ/Qualifications.aspx";
                    }
                    else
                    {
                        jqtab.NavigateUrl = "~/JQ/JQKSA.aspx";
                    }
                }
            }
        }
        private void ResourceDownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (ResourceInstallStepUpdate != null)
            {
                ResourceInstallStepUpdate(this, new MobileResourceInstallEventArgs {
                    StepNumber = CurrentStep++
                });
            }

            if (ResourceInstallProgress != null)
            {
                ResourceInstallProgress(this, new MobileResourceInstallEventArgs {
                    Action = "Extracting", CurrentPackage = CurrentPackage.Name, ProgressCurrentFile = 0, ProgressTotalFiles = 0
                });
            }

            ExtractResource(Path.Combine(MobilePath, CurrentPackage.File), Path.Combine(MobilePath, CurrentPackage.Path));

            if (CurrentPackage.PostAction != null)
            {
                CurrentPackage.PostAction();
            }

            if (_packages.Count > 0)
            {
                InstallPackage(_packages.Dequeue());
            }
            else
            {
                CreateReadme();
                CreateStartShortcut();
                CreateIndex();

                if (ResourceInstallComplete != null)
                {
                    ResourceInstallComplete(this, new MobileResourceInstallEventArgs());
                }
            }
        }
Ejemplo n.º 4
0
        private void MenuRenameSTBL_Click(object sender, EventArgs e)
        {
            string scriptName = null;

            foreach (ListItem item in ContentList.Items)
            {
                if (item is S3SAListItem)
                {
                    scriptName = item.Text;
                    break;
                }
            }

            TextInput dialog = new TextInput("HashName and Prefix", scriptName);

            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            string[] results = dialog.Result.Split(' ');

            ulong result = FNV64.GetHash(results[0]);

            string orig = result.ToString("X16");

            int origValue = int.Parse(orig.Substring(0, 2), System.Globalization.NumberStyles.HexNumber, null);

            if (origValue < STBL.Count)
            {
                result++;

                orig = result.ToString("X16");
            }

            string part = orig.Substring(2);

            string prefix = null;

            if (results.Length > 1)
            {
                prefix = results[1] + " ";
            }

            foreach (string aPrefix in STBL.Keys)
            {
                ulong instance = Convert.ToUInt64("0x" + aPrefix + part, 16);

                bool found = false;
                foreach (IResourceIndexEntry entry in CurrentPackage.FindAll(key => ((key.ResourceType == (uint)ResourceType.STBL))))
                {
                    string instanceStr = entry["Instance"];

                    if (instanceStr.Substring(2, 2) == aPrefix)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    STBLListItem stblItem = new STBLListItem();

                    if (stblItem.AddNew(instance, CurrentPackage, true))
                    {
                        ContentList.Items.Add(stblItem);
                    }
                }
            }

            foreach (ListItem item in ContentList.Items)
            {
                if (!(item is STBLListItem))
                {
                    continue;
                }

                item.Instance = "0x" + STBL.GetPrefix(item.Instance) + part;

                item.Name = "Strings " + prefix + STBL.GetProperName(item.Instance);

                sChanged = true;
            }
        }
Ejemplo n.º 5
0
        private bool SavePackage(bool prompt)
        {
            if (CurrentPackage == null)
            {
                return(true);
            }

            SavePreview();

            Application.UseWaitCursor = true;
            Application.DoEvents();
            try
            {
                if (sChanged)
                {
                    DialogResult result = DialogResult.Yes;
                    if (prompt)
                    {
                        result = MessageBox.Show("Do you wish to save your changes?", "Save", MessageBoxButtons.YesNoCancel);
                    }

                    switch (result)
                    {
                    case DialogResult.Yes:
                        IResourceIndexEntry keyEntry = CurrentPackage.Find(key => key.ResourceType == (uint)ResourceType._KEY);
                        if (keyEntry != null)
                        {
                            Dictionary <ulong, bool> existing = new Dictionary <ulong, bool>();

                            IList <IResourceIndexEntry> list = CurrentPackage.FindAll(value => { return(true); });
                            foreach (IResourceIndexEntry entry in list)
                            {
                                if (existing.ContainsKey(entry.Instance))
                                {
                                    continue;
                                }

                                existing.Add(entry.Instance, true);
                            }

                            NameMapResource.NameMapResource keyResource = CreateKeyResource(CurrentPackage) as NameMapResource.NameMapResource;

                            List <ulong> badKeys = new List <ulong>();

                            foreach (KeyValuePair <ulong, string> element in keyResource)
                            {
                                if (!existing.ContainsKey(element.Key))
                                {
                                    badKeys.Add(element.Key);
                                }
                            }

                            foreach (ulong key in badKeys)
                            {
                                keyResource.Remove(key);
                            }

                            CurrentPackage.ReplaceResource(keyEntry, keyResource);
                        }

                        CurrentPackage.SavePackage();

                        OnListElements(CurrentPackage);
                        break;

                    case DialogResult.No:
                        break;

                    case DialogResult.Cancel:
                        return(false);
                    }
                }
            }
            finally
            {
                Application.UseWaitCursor = false;
            }

            return(true);
        }
Ejemplo n.º 6
0
 public Task <IDictionary <string, float> > ProcessInkAsync(IList <InkStroke> strokes)
 {
     return(CurrentPackage.EvaluateAsync(strokes));
 }
Ejemplo n.º 7
0
        private void resourceImportAsDBC()
        {
            if (allowList.Count == 0)
            {
                allowList.AddRange(xmlList);
                allowList.AddRange(stblList);
                allowList.AddRange(nmapList);
            }
            try
            {
                this.Enabled = false;
                DialogResult dr = importPackagesDialog.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }

                AutoSaveState autoSaveState = AutoSaveState.Always;
                if (S4PIDemoFE.Properties.Settings.Default.AskDBCAutoSave)
                {
                    autoSaveState = AutoSaveState.Ask;
                }
                importPackagesCommon(importPackagesDialog.FileNames, importPackagesDialog.Title, DuplicateHandling.allow, true,
                                     useNames: true,
                                     dupsList: allowList,
                                     autoSaveState: autoSaveState);

                browserWidget1.Visible = false;
                lbProgress.Text        = "Doing DBC clean up...";

                Application.DoEvents();
                DateTime now = DateTime.UtcNow;
                IList <IResourceIndexEntry> lrie = dupsOnly(CurrentPackage.FindAll(x => stblList.Contains(x.ResourceType)));
                foreach (IResourceIndexEntry dup in lrie)
                {
                    IList <IResourceIndexEntry> ldups   = CurrentPackage.FindAll(rie => ((IResourceKey)dup).Equals(rie));
                    IResourceIndexEntry         newRie  = NewResource(dup, null, DuplicateHandling.allow, true);
                    IDictionary <ulong, string> newStbl = (IDictionary <ulong, string>)s4pi.WrapperDealer.WrapperDealer.GetResource(0, CurrentPackage, newRie);
                    foreach (IResourceIndexEntry rie in ldups)
                    {
                        IDictionary <ulong, string> oldStbl = (IDictionary <ulong, string>)s4pi.WrapperDealer.WrapperDealer.GetResource(0, CurrentPackage, rie);
                        foreach (var kvp in oldStbl)
                        {
                            if (!newStbl.ContainsKey(kvp.Key))
                            {
                                newStbl.Add(kvp);
                            }
                        }
                        rie.IsDeleted = true;
                        if (now.AddMilliseconds(100) < DateTime.UtcNow)
                        {
                            Application.DoEvents(); now = DateTime.UtcNow;
                        }
                    }
                    CurrentPackage.ReplaceResource(newRie, (IResource)newStbl);
                    browserWidget1.Add(newRie, false);
                }

                // Get rid of Sims3Pack resource that sneak in
                CurrentPackage.FindAll(x =>
                {
                    if (now.AddMilliseconds(100) < DateTime.UtcNow)
                    {
                        Application.DoEvents(); now = DateTime.UtcNow;
                    }
                    if (deleteList.Contains(x.ResourceType))
                    {
                        x.IsDeleted = true; return(false);
                    }
                    return(false);
                });

                // If there are any remaining duplicate XMLs, give up - they're too messy to fix automatically
                if (dupsOnly(CurrentPackage.FindAll(x => xmlList.Contains(x.ResourceType))).Count > 0)
                {
                    CopyableMessageBox.Show("Manual merge of XML files required.");
                }
            }
            finally { browserWidget1.Visible = true; lbProgress.Text = ""; Application.DoEvents(); this.Enabled = true; }
        }
Ejemplo n.º 8
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            string docFormat = "";

            if (Request.QueryString["documentformat"] != null)
            {
                docFormat = Request.QueryString["documentformat"].ToString();
            }

            if (docFormat == "DOC")
            {
                docFormat = "DOCX";
            }

            if (this.StaffingObjectID > 0 && this.DocumentTypeID > 0)
            {
                string docName = string.Empty;

                switch (DocumentTypeID)
                {
                case enumDocumentType.JNP:
                    JNPReports.JobAnalysis currentJNPWorkflowComments = new JNPReports.JobAnalysis();
                    docName = string.Format("JobAnalysis{0}." + docFormat, StaffingObjectID);
                    currentJNPWorkflowComments.ReportParameters["jNPID"].Value = StaffingObjectID;
                    currentJNPWorkflowComments.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];
                    currentJNPWorkflowComments.ReportParameters["jAID"].Value = Request.QueryString["jaid"];

                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, currentJNPWorkflowComments);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, currentJNPWorkflowComments);
                    }

                    break;

                case enumDocumentType.JA:
                    JNPReports.JobAnalysis currentJobAnalysisDoc = new JNPReports.JobAnalysis();
                    docName = string.Format("JobAnalysis{0}." + docFormat, StaffingObjectID);
                    currentJobAnalysisDoc.ReportParameters["jNPID"].Value = StaffingObjectID;
                    currentJobAnalysisDoc.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];
                    currentJobAnalysisDoc.ReportParameters["jAID"].Value = Request.QueryString["jaid"];


                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, currentJobAnalysisDoc);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, currentJobAnalysisDoc);
                    }

                    break;

                case enumDocumentType.CR:
                    JNPReports.CategoryRating currentCategoryRatingdoc = new JNPReports.CategoryRating();
                    docName = string.Format("CategoryRating{0}." + docFormat, StaffingObjectID);
                    currentCategoryRatingdoc.ReportParameters["jNPID"].Value = StaffingObjectID;
                    currentCategoryRatingdoc.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];
                    currentCategoryRatingdoc.ReportParameters["jAID"].Value = Request.QueryString["jaid"];
                    currentCategoryRatingdoc.ReportParameters["cRID"].Value = Request.QueryString["crid"];

                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, currentCategoryRatingdoc);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, currentCategoryRatingdoc);
                    }

                    break;

                case enumDocumentType.JQ:
                    if ((DocumentFormat == enumDocumentFormat.PDF) || (DocumentFormat == enumDocumentFormat.DOCX))
                    {
                        JNPReports.JobQuestionaire currentJobQuestionairePDFDoc = new JNPReports.JobQuestionaire();
                        docName = string.Format("JobQuestionaire{0}." + docFormat, StaffingObjectID);
                        currentJobQuestionairePDFDoc.ReportParameters["jNPID"].Value = StaffingObjectID;
                        currentJobQuestionairePDFDoc.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];

                        if (docFormat == enumDocumentFormat.DOCX.ToString())
                        {
                            ControlUtility.ExportToDoc(docName, currentJobQuestionairePDFDoc);
                        }
                        if (docFormat == enumDocumentFormat.PDF.ToString())
                        {
                            ControlUtility.ExportToPDF(docName, currentJobQuestionairePDFDoc);
                        }
                    }
                    else if (DocumentFormat == enumDocumentFormat.UTF8)
                    {
                        JQManager jqManager = new JQManager();
                        docName = string.Format("JobQuestionaire{0}.txt", StaffingObjectID);
                        string jobQuestionnaireUTF8Doc = jqManager.CreateUTF8JobQuestionnaireReport(StaffingObjectID);
                        ControlUtility.ExportToUTF8(docName, jobQuestionnaireUTF8Doc);
                    }
                    break;

                case enumDocumentType.Comments:
                    JNPReports.JNPComments jnpWorkflowComments = new JNPReports.JNPComments();
                    docName = string.Format("JAXComments{0}." + docFormat, StaffingObjectID);
                    jnpWorkflowComments.ReportParameters["jNPID"].Value = StaffingObjectID;
                    jnpWorkflowComments.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];

                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, jnpWorkflowComments);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, jnpWorkflowComments);
                    }

                    break;

                case enumDocumentType.All:
                    bool CRActive = false;
                    long crid     = Convert.ToInt64(Request.QueryString["crid"]);
                    if (CurrentPackage != null)
                    {
                        CRActive = CurrentPackage.HasActiveCR();

                        //updating order if printing in edit mode by clicking Print All button from within the package
                        if (CurrentNavMode != enumNavigationMode.View)
                        {
                            JQManager jm = new JQManager();
                            // load Factors
                            JQFactorCollection listFactors = jm.GetJQFactorCollectionByJQID(CurrentPackage.JQID);
                            jm.UpdateOrder(CurrentPackage.JQID, listFactors, CurrentUser.UserID);
                        }
                    }
                    else
                    {
                        if (crid > 0)
                        {
                            HCMS.Business.CR.CategoryRating categoryRating = HCMS.Business.CR.CategoryRatingManager.GetByID(crid);
                            CRActive = (bool)categoryRating.IsActive;
                        }
                        else
                        {
                            CRActive = false;
                        }
                    }
                    JNPReports.JNPReport JNPReportAllDoc = new JNPReports.JNPReport();
                    docName = string.Format("JNPReportAll{0}." + docFormat, StaffingObjectID);

                    if (!CRActive)
                    {
                        JNPReportAllDoc.subReportCR.Visible         = false;
                        JNPReportAllDoc.groupHeaderSection3.Visible = false;
                    }

                    JNPReportAllDoc.ReportParameters["jNPID"].Value = StaffingObjectID;
                    JNPReportAllDoc.ReportParameters["documentObjectTypeId"].Value = enumDocumentType.All;
                    JNPReportAllDoc.ReportParameters["jAID"].Value = Request.QueryString["jaid"];
                    JNPReportAllDoc.ReportParameters["cRID"].Value = crid;

                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, JNPReportAllDoc);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, JNPReportAllDoc);
                    }

                    break;

                default:
                    break;
                }
            }

            base.Page_Load(sender, e);
        }