Esempio n. 1
0
        /// <summary> Go out to the session and request a list of files
        /// But we dump ones that have a name collision.
        /// Also if selectedSwf is set then we only add files
        /// that are contained within the given swf.
        /// </summary>
        internal virtual void  loadCache()
        {
            bool worked = true;             // check that all worked correctly

            System.Collections.ArrayList files = new System.Collections.ArrayList();
            SwfInfo[] swfs = Swfs;
            for (int i = 0; i < swfs.Length; i++)
            {
                if (swfs[i] != null)
                {
                    worked = loadSwfFiles(files, swfs[i])?worked:false;
                }
            }

            // trim the file list
            System.Collections.ArrayList fa = trimFileList(files);
            m_files = (SourceFile[])SupportClass.ICollectionSupport.ToArray(fa, new SourceFile[fa.Count]);

            // sort this array in place so calls to getFileList will be ordered
            ArrayUtil.sort(m_files, this);

            // mark our cache complete if all was good.
            if (worked)
            {
                m_swfsLoaded = swfs.Length;
            }
        }
Esempio n. 2
0
        /*
         * @see Flash.Tools.Debugger.Value#getMembers(Flash.Tools.Debugger.Session)
         */
        public override Variable[] getMembers(Session s)
        {
            obtainMembers(s);

            /* find out the size of the array */
            int count = getMemberCount(s);

            DVariable[] ar = new DVariable[count];

            if (count > 0)
            {
                m_members.Values.CopyTo(ar, 0);

                // sort the member list by name
                ArrayUtil.sort(ar);
            }

            return(ar);
        }
Esempio n. 3
0
        /// <summary> Return a array of SourceFiles whose names match
        /// the specified string. The array is sorted by name.
        /// The input can be mx.controls.xxx which will
        /// </summary>
        public virtual SourceFile[] getFiles(String matchString)
        {
            bool doStartsWith = false;
            bool doIndexOf    = false;
            bool doEndsWith   = false;

            bool leadingAsterisk  = matchString.StartsWith("*") && matchString.Length > 1; //$NON-NLS-1$
            bool trailingAsterisk = matchString.EndsWith("*");                             //$NON-NLS-1$
            bool usePath          = matchString.IndexOf('.') > -1;

            if (leadingAsterisk && trailingAsterisk)
            {
                matchString = matchString.Substring(1, (matchString.Length - 1) - (1));
                doIndexOf   = true;
            }
            else if (leadingAsterisk)
            {
                matchString = matchString.Substring(1);
                doEndsWith  = true;
            }
            else if (trailingAsterisk)
            {
                matchString  = matchString.Substring(0, (matchString.Length - 1) - (0));
                doStartsWith = true;
            }
            else if (usePath)
            {
                doIndexOf = true;
            }
            else
            {
                doStartsWith = true;
            }

            SourceFile[] files = FileList;
            System.Collections.ArrayList fileList = new System.Collections.ArrayList();
            int n          = files.Length;
            int exactHitAt = -1;
            // If the matchString already starts with "." (e.g. ".as" or ".mxml"), then dotMatchString
            // will be equal to matchString; otherwise, dotMatchString will be "." + matchString
            String dotMatchString = (matchString.StartsWith("."))?matchString:("." + matchString);             //$NON-NLS-1$ //$NON-NLS-2$

            for (int i = 0; i < n; i++)
            {
                SourceFile sourceFile = files[i];
                bool       pathExists = (usePath && new System.Text.RegularExpressions.Regex(@".*[/\\].*").Match(sourceFile.FullPath).Success); //$NON-NLS-1$
                String     name       = pathExists?sourceFile.FullPath:sourceFile.Name;

                // if we are using the full path string, then prefix a '.' to our matching string so that abc.as and Gabc.as don't both hit
                String match = (usePath && pathExists)?dotMatchString:matchString;

                name = name.Replace('/', '.');                 // get rid of path identifiers and use dots
                name = name.Replace('\\', '.');                // would be better to modify the input string, but we don't know which path char will be used.

                // exact match? We are done
                if (name.Equals(match))
                {
                    exactHitAt = i;
                    break;
                }
                else if (doStartsWith && name.StartsWith(match))
                {
                    fileList.Add(sourceFile);
                }
                else if (doEndsWith && name.EndsWith(match))
                {
                    fileList.Add(sourceFile);
                }
                else if (doIndexOf && name.IndexOf(match) > -1)
                {
                    fileList.Add(sourceFile);
                }
            }

            // trim all others if we have an exact file match
            if (exactHitAt > -1)
            {
                fileList.Clear();
                fileList.Add(files[exactHitAt]);
            }

            SourceFile[] fileArray = (SourceFile[])SupportClass.ICollectionSupport.ToArray(fileList, new SourceFile[fileList.Count]);
            ArrayUtil.sort(fileArray, this);
            return(fileArray);
        }