Пример #1
0
        private void buttonProcess_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            string sResult = "Error: Unknown";

            if (File.Exists(textBoxSCO.Text) == false)
            {
                MessageBox.Show(String.Format(sError, "Error: File not found."), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (SCO.isEncrypted == true)
            {
                if (checkBoxSelf.Checked == false)
                {
                    sResult = SCO.saveFileDec(textBoxTargetSCO.Text);
                }
                else
                {
                    sResult = SCO.saveFileDec(textBoxSCO.Text);
                }
                if (sResult.StartsWith("Error:"))
                {
                    MessageBox.Show(String.Format(sError, sResult), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    MessageBox.Show("The file has been successfully decoded!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                if (checkBoxSelf.Checked == false)
                {
                    sResult = SCO.saveFileEnc(textBoxTargetSCO.Text);
                }
                else
                {
                    sResult = SCO.saveFileEnc(textBoxSCO.Text);
                }
                if (sResult.StartsWith("Error:"))
                {
                    MessageBox.Show(String.Format(sError, sResult), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    MessageBox.Show("The file has been successfully encoded!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            Cursor.Current = Cursors.Default;
        }
Пример #2
0
        private void backgroundWorkerAll_DoWork(object sender, DoWorkEventArgs e)
        {
            int i = filenr; string sResult = ""; bool bResult = true;

            bResult = SCO.openSCO(listBox.Items[i].ToString());
            if (bResult == false)
            {
                multiError += "\n" + listBox.Items[i].ToString() + ": Opening SCO file failed."; return;
            }

            sResult = "";

            sResult = SCO.getSCOType(); if (sResult.StartsWith("Error:") == true)
            {
                multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
            }
            if (SCO.isEncrypted == true)
            {
                sResult = SCO.getHeaderSectionDec(); if (sResult.StartsWith("Error:") == true)
                {
                    multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
                }
            }
            else
            {
                sResult = SCO.getHeaderSectionEnc(); if (sResult.StartsWith("Error:") == true)
                {
                    multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
                }
            }
            sResult = SCO.getCodeSize(); if (sResult.StartsWith("Error:") == true)
            {
                multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
            }
            sResult = SCO.getGlobalCount(); if (sResult.StartsWith("Error:") == true)
            {
                multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
            }
            sResult = SCO.getPublicCount(); if (sResult.StartsWith("Error:") == true)
            {
                multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
            }
            sResult = SCO.getCodeFlags(); if (sResult.StartsWith("Error:") == true)
            {
                multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
            }
            sResult = SCO.getSignature(); if (sResult.StartsWith("Error:") == true)
            {
                multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
            }
            if (SCO.isEncrypted == true)
            {
                sResult = SCO.getCodeSectionDec(); if (sResult.StartsWith("Error:") == true)
                {
                    multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
                }
                sResult = SCO.getGlobalSectionDec(); if (sResult.StartsWith("Error:") == true)
                {
                    multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
                }
                sResult = SCO.getPublicSectionDec(); if (sResult.StartsWith("Error:") == true)
                {
                    multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
                }
            }
            else
            {
                sResult = SCO.getCodeSectionEnc(); if (sResult.StartsWith("Error:") == true)
                {
                    multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
                }
                sResult = SCO.getGlobalSectionEnc(); if (sResult.StartsWith("Error:") == true)
                {
                    multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
                }
                sResult = SCO.getPublicSectionEnc(); if (sResult.StartsWith("Error:") == true)
                {
                    multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
                }
            }
            bResult = SCO.closeSCO(); if (sResult.StartsWith("Error:") == true)
            {
                multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
            }
            if (SCO.isEncrypted == true)
            {
                if (checkBoxSelfAll.Checked == true)
                {
                    sResult = SCO.saveFileDec(listBox.Items[i].ToString());
                }
                else
                {
                    sResult = SCO.saveFileDec(textBoxDir.Text + "\\" + Path.GetFileName(listBox.Items[i].ToString()));
                }
            }
            else
            {
                if (checkBoxSelfAll.Checked == true)
                {
                    sResult = SCO.saveFileEnc(listBox.Items[i].ToString());
                }
                else
                {
                    sResult = SCO.saveFileEnc(textBoxDir.Text + "\\" + Path.GetFileName(listBox.Items[i].ToString()));
                }
            }
            if (sResult.StartsWith("Error:") == true)
            {
                multiError += "\n" + listBox.Items[i].ToString() + sResult.Replace("Error", ""); return;
            }
        }