Example #1
0
        private void pack_Click(object sender, System.EventArgs e)
        {
            ECMAScriptPacker p = new ECMAScriptPacker((ECMAScriptPacker.PackerEncoding)Encoding.SelectedItem, fastDecode.Checked, specialChars.Checked);

            tbResult.Text = p.Pack(tbSource.Text).Replace("\n", "\r\n");
            bSave.Enabled = true;
        }
Example #2
0
        private string pack_String(string contectstring)
        {
            Boolean          fastDecode   = true;
            Boolean          specialChars = false;
            ECMAScriptPacker p            = new ECMAScriptPacker(ECMAScriptPacker.PackerEncoding.Normal, fastDecode, specialChars);

            return(p.Pack(contectstring).Replace("\n", "\r\n"));
        }
Example #3
0
 private void pack_Click(object sender, System.EventArgs e)
 {
     ECMAScriptPacker p = new ECMAScriptPacker((ECMAScriptPacker.PackerEncoding) Encoding.SelectedItem, fastDecode.Checked, specialChars.Checked);
     tbResult.Text = p.Pack(tbSource.Text).Replace("\n", "\r\n");
     bSave.Enabled = true;
 }
 public override string Transform(string fullFileName, string text, EnvDTE.ProjectItem projectItem)
 {
     ECMAScriptPacker p = new ECMAScriptPacker(this.Settings.ChirpDeanEdwardsPackerEncoding, this.Settings.ChirpDeanEdwardsPackerFastDecode, this.Settings.ChirpDeanEdwardsPackerSpecialChars);
     return p.Pack(text);
 }
        private void encodingHandler(object thread)
        {
            while (true)
            {
                int processingIndex = NowFileIndex;
                lock (this)
                {
                    processingIndex = NowFileIndex;
                    ++NowFileIndex;
                }
                if (processingIndex >= Files.Count)
                    ((Thread)thread).Abort();
                try
                {
                    using (StreamReader fileReader = new StreamReader(Files[processingIndex].Path, FileEncoding))
                    {
                        string jsCode = fileReader.ReadToEnd();

                        ECMAScriptPacker encoder = new ECMAScriptPacker(PackerEncoding, isFastCode, isSpecialCharacters);
                        string encodeJs = encoder.Pack(jsCode).Replace("\n", "\r\n");
                        string outPutFilePath = Path.Combine(OutPutDirPath, Files[processingIndex].OutputDir.Substring(1));
                        string outPutFileDirPath = Path.GetDirectoryName(outPutFilePath);

                        if (!Directory.Exists(outPutFileDirPath))
                            Directory.CreateDirectory(outPutFileDirPath);

                        using (StreamWriter fileWriter = new StreamWriter(outPutFilePath, true, FileEncoding))
                        {
                            fileWriter.Write(encodeJs);
                        }
                    }
                    IncreaseProgress(processingIndex);
                }
                catch
                {
                    FailureFileList.Add(Files[processingIndex].Path);

                    this.Dispatcher.BeginInvoke(new ThreadStart(() =>
                    {
                        ++ProgressBar.Value;
                    }));
                }
            }
        }