private void cmdCompressData_Click(object sender, EventArgs e)
        {
            foreach (string strFile in Directory.GetFiles(Path.Combine(Application.StartupPath, "data"), "*.xml"))
            {
                byte[] bytFile = File.ReadAllBytes(strFile);
                bytFile = OmaeHelper.Compress(bytFile);
                File.WriteAllBytes(strFile.Replace(".xml", ".zip"), bytFile);
            }

            MessageBox.Show("Done");
        }
예제 #2
0
        private void cmdCompressData_Click(object sender, EventArgs e)
        {
            OmaeHelper objHelper = new OmaeHelper();

            foreach (string strFile in Directory.GetFiles(Path.Combine(GlobalOptions.ApplicationPath(), "data"), "*.xml"))
            {
                byte[] bytFile = File.ReadAllBytes(strFile);
                bytFile = objHelper.Compress(bytFile);
                File.WriteAllBytes(strFile.Replace(".xml", ".zip"), bytFile);
            }

            MessageBox.Show("Done");
        }
예제 #3
0
        private void cmdUpload_Click(object sender, EventArgs e)
        {
            bool blnSuccess = false;

            // Make sure a file has been selected.
            if (string.IsNullOrWhiteSpace(txtFilePath.Text))
            {
                MessageBox.Show(LanguageManager.GetString("Message_OmaeUpload_SelectFile", GlobalOptions.Language), LanguageManager.GetString("MessageTitle_OmaeUpload_SelectFile", GlobalOptions.Language), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Make sure there is at least some sort of description.
            if (string.IsNullOrWhiteSpace(txtDescription.Text))
            {
                MessageBox.Show(LanguageManager.GetString("Message_OmaeUpload_CharacterDescription", GlobalOptions.Language), LanguageManager.GetString("MessageTitle_OmaeUpload_CharacterDescription", GlobalOptions.Language), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Read the contents of the file into a byte array, the compress it.
            byte[] bytFile = OmaeHelper.Compress(File.ReadAllBytes(txtFilePath.Text));

            // Make sure the file doesn't exceed 500K in size (512,000 bytes).
            if (bytFile.Length > 512000)
            {
                MessageBox.Show(LanguageManager.GetString("Message_OmaeUpload_FileTooLarge", GlobalOptions.Language), LanguageManager.GetString("MessageTitle_OmaeUpload_FileTooLarge", GlobalOptions.Language), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            omaeSoapClient objService = OmaeHelper.GetOmaeService();

            try
            {
                cmdUpload.Enabled      = false;
                txtDescription.Enabled = false;
                string strCharacterName = cboCharacterName.Text;
                if (strCharacterName.Length > 100)
                {
                    strCharacterName = strCharacterName.Substring(0, 100);
                }
                if (objService.UploadCharacter153(_strUserName, _intCharacterID, strCharacterName, txtDescription.Text, _strMetatype, _strMetavariant, _strQualities, Convert.ToInt32(cboCharacterTypes.SelectedValue), _intCreated, bytFile))
                {
                    blnSuccess = true;
                    MessageBox.Show(LanguageManager.GetString("Message_OmaeUpload_UploadComplete", GlobalOptions.Language), LanguageManager.GetString("MessageTitle_OmaeUpload_UploadComplete", GlobalOptions.Language), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(LanguageManager.GetString("Message_OmaeUpload_UploadFailed", GlobalOptions.Language), LanguageManager.GetString("MessageTitle_OmaeUpload_UploadFailed", GlobalOptions.Language), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (EndpointNotFoundException)
            {
                MessageBox.Show(NO_CONNECTION_MESSAGE, NO_CONNECTION_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            objService.Close();
            cmdUpload.Enabled      = true;
            txtDescription.Enabled = true;

            if (blnSuccess)
            {
                DialogResult = DialogResult.OK;
            }
        }
예제 #4
0
        private void cmdCompressData_Click(object sender, EventArgs e)
        {
            OmaeHelper objHelper = new OmaeHelper();
            foreach (string strFile in Directory.GetFiles(Path.Combine(Application.StartupPath, "data"), "*.xml"))
            {
                byte[] bytFile = File.ReadAllBytes(strFile);
                bytFile = objHelper.Compress(bytFile);
                File.WriteAllBytes(strFile.Replace(".xml", ".zip"), bytFile);
            }

            MessageBox.Show("Done");
        }