예제 #1
0
파일: Packer.cs 프로젝트: rikkit/packer.net
        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;
        }
예제 #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"));
        }
예제 #3
0
파일: Packer.cs 프로젝트: rikkit/packer.net
 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;
 }
예제 #4
0
 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);
 }
예제 #5
0
        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;
                    }));
                }
            }
        }