예제 #1
0
파일: DebugActions.cs 프로젝트: mo5h/omeo
        public override void Execute(IActionContext context)
        {
            IResourceList list = Core.ResourceStore.GetAllResources("ColumnScheme");

            foreach (IResource res in list)
            {
                string type = res.GetPropText("ColumnKeyTypes");
                if (type == "Email" || type == "Article")
                {
                    int           index;
                    IResourceList descriptors = res.GetLinksOfType("ColumnDescriptor", "ColumnDescriptor");
                    foreach (IResource descr in descriptors)
                    {
                        IStringList props = descr.GetStringListProp("ColumnProps");
                        index = props.IndexOf("DisplayName");
                        if (index != -1 && props.Count > 1)
                        {
                            Core.ResourceAP.RunUniqueJob(new MyDelegate(RemoveStringListValue), props, index);
                            MessageBox.Show("Removed prop from ColumnDescriptor " + descr.Id + ", for type=" + type);
                        }
                    }

                    IStringList sortProps = res.GetStringListProp("ColumnSortProps");
                    index = sortProps.IndexOf("DisplayName");
                    if (index != -1 && sortProps.Count > 1)
                    {
                        Core.ResourceAP.RunUniqueJob(new MyDelegate(RemoveStringListValue), sortProps, index);
                        MessageBox.Show("Removed prop from ColumnScheme " + res.Id + ", for type=" + type);
                    }
                }
            }
        }
예제 #2
0
파일: MAPIFolder.cs 프로젝트: mo5h/omeo
        public static bool IsDefault(IResource folder)
        {
            Guard.NullArgument(folder, "folder");

            if (Folder.IsParentRoot(folder))
            {
                return(true);
            }
            IResource mapiStore     = GetMAPIStorage(folder);
            string    storeId       = mapiStore.GetStringProp(PROP.StoreID);
            IResource mapiInfoStore = Core.ResourceStore.FindUniqueResource(STR.MAPIInfoStore, PROP.EntryID, storeId);

            if (mapiInfoStore == null)
            {
                throw new ApplicationException("Folder.IsDefault -- MAPIStore resource result is null.");
            }

            IStringList list = mapiInfoStore.GetStringListProp(PROP.DefaultFolderEntryIDs);

            if (list == null)
            {
                throw new ApplicationException("Folder.IsDefault -- List of default store folders is NULL.");
            }
            return(list.IndexOf(folder.GetStringProp(PROP.EntryID)) != -1);
        }
예제 #3
0
파일: Conversations.cs 프로젝트: mo5h/omeo
        public string ToString(IResource convs)
        {
            StringBuilder bodyBuilder = StringBuilderPool.Alloc();

            try
            {
                bodyBuilder.Append("<conversation>");
                IStringList convsList = convs.GetStringListProp(_propConversationList);
                if (!_reverseMode)
                {
                    for (int i = 0; i < convsList.Count; ++i)
                    {
                        bodyBuilder.Append(convsList[i]);
                    }
                }
                else
                {
                    for (int i = convsList.Count - 1; i >= 0; --i)
                    {
                        bodyBuilder.Append(convsList[i]);
                    }
                }
                bodyBuilder.Append("</conversation>");
                convsList.Dispose();
                return(bodyBuilder.ToString());
            }
            finally
            {
                StringBuilderPool.Dispose(bodyBuilder);
            }
        }
예제 #4
0
        private static void SetStringListProp(IResource resource, int propId, string[] values)
        {
            bool        columnPropsOK = false;
            IStringList columnProps   = resource.GetStringListProp(propId);

            if (columnProps.Count == values.Length)
            {
                columnPropsOK = true;
                for (int i = 0; i < columnProps.Count; i++)
                {
                    if (columnProps [i] != values [i])
                    {
                        columnPropsOK = false;
                        break;
                    }
                }
            }

            if (!columnPropsOK)
            {
                columnProps.Clear();
                for (int i = 0; i < values.Length; i++)
                {
                    columnProps.Add(values [i]);
                }
            }
        }
예제 #5
0
파일: DebugActions.cs 프로젝트: mo5h/omeo
        public override void Execute(IActionContext context)
        {
            int           count = 0;
            int           resId = 0;
            IResourceList list  = Core.ResourceStore.GetAllResources("ColumnScheme");

            foreach (IResource res in list)
            {
                string type = res.GetPropText("ColumnKeyTypes");
                if (type == "Email" || type == "Article")
                {
                    IResourceList descriptors = res.GetLinksOfType("ColumnDescriptor", "ColumnDescriptor");
                    foreach (IResource descr in descriptors)
                    {
                        IStringList props = descr.GetStringListProp("ColumnProps");
                        int         index = props.IndexOf("DisplayName");
                        if (index != -1 && props.Count > 1)
                        {
                            count++;
                            if (resId == 0)
                            {
                                resId = descr.Id;
                            }
                        }
                    }
                }
            }
            MessageBox.Show("Count of such columns is " + count + " with first id = " + resId);
        }
예제 #6
0
        protected override void Execute()
        {
            if (_resource != null && _resource.IsDeleted)
            {
                return;
            }
            if (_deletedItemsId == null && _entryId == null)
            {
                return;
            }

            if (_resource == null && _deletedItemsId != null)
            {
                _resource = Core.ResourceStore.FindUniqueResource(STR.MAPIInfoStore,
                                                                  PROP.DeletedItemsEntryID, _deletedItemsId);
            }

            if (_resource == null)
            {
                _resource = Core.ResourceStore.BeginNewResource(STR.MAPIInfoStore);
            }
            else
            {
                _resource.BeginUpdate();
            }

            IStringList propList = _resource.GetStringListProp(PROP.DefaultFolderEntryIDs);

            propList.Clear();
            foreach (string entryId in _defaultFolderEntryIDs)
            {
                propList.Add(entryId);
            }
            _resource.SetProp(PROP.EntryID, _entryId);
            _resource.SetProp(PROP.DeletedItemsEntryID, _deletedItemsId);
            _resource.SetProp(PROP.JunkEmailEntryID, _junkEmailId);

            _resource.SetProp(PROP.PR_STORE_SUPPORT_MASK, _supportMask);
            _resource.SetProp(PROP.StoreSupported, _supported);
            if (!_supported)
            {
                _resource.SetProp(PROP.IgnoredFolder, 1);
                _name += " (Not supported)";
            }
            else if ((_supportMask & STORE_SUPPORT_MASK.STORE_PUBLIC_FOLDERS) != 0)
            {
                _resource.SetProp(PROP.IgnoredFolder, 1);
            }
            _resource.SetProp(Core.Props.Name, _name);
            _resource.SetProp(PROP.StoreTypeChecked, _storeTypeChecked);
            _resource.EndUpdate();
        }
예제 #7
0
        ///////////////////////////////////////////////////////////////////////

        public void Add(
            IStringList list,
            int startIndex
            )
        {
#if CACHE_STRINGLIST_TOSTRING
            InvalidateCachedString();
#endif

            for (int index = startIndex; index < list.Count; index++)
            {
                base.Add(list.GetItem(index));
            }
        }
예제 #8
0
        public void TestStringListProps()
        {
            ResourceSerializer serializer = new ResourceSerializer();
            IResource          origin     = _storage.NewResource("Email");

            origin.SetProp(_propSize, 100);
            origin.SetProp(_propReceived, DateTime.Now);
            IStringList strLst = origin.GetStringListProp(_propValueList);

            using ( strLst )
            {
                strLst.Add("One");
                strLst.Add("Two");
                strLst.Add("Three");
            }
            origin.SetProp(_propUnread, true);
            origin.SetProp(_propSimilarity, 1.0);
            ResourceNode resNode = serializer.AddResource(origin);

            foreach (IResourceProperty prop in origin.Properties)
            {
                resNode.AddProperty(prop);
            }
            serializer.GenerateXML("SerializationResult.xml");
            origin.Delete();

            StreamReader sr  = new StreamReader("SerializationResult.xml", Encoding.Default);
            string       str = Utils.StreamReaderReadToEnd(sr);

            Console.WriteLine(str);
            sr.Close();

            ResourceDeserializer deserializer = new ResourceDeserializer("SerializationResult.xml");
            ArrayList            list         = deserializer.GetSelectedResources();

            Assert.AreEqual(1, list.Count, "List must contain only one resource. Current count is [" + list.Count + "]");
            ResourceUnpack ru = (ResourceUnpack)list[0];

            origin = ru.Resource;
            Assert.IsTrue(origin.HasProp(_propValueList),
                          "Resource must contain StringList property");
            IStringList stringsList = origin.GetStringListProp(_propValueList);

            Assert.AreEqual(3, stringsList.Count, "StringList must contain three elements. Current count is [" + stringsList.Count + "]");

            Assert.AreEqual("One", stringsList [0], "StringList[ 0 ] must be equal to [One]. Current value is [" + stringsList[0] + "]");
            Assert.AreEqual("Two", stringsList [1], "StringList[ 1 ] must be equal to [Two]. Current value is [" + stringsList[1] + "]");
            Assert.AreEqual("Three", stringsList [2], "StringList[ 2 ] must be equal to [Three]. Current value is [" + stringsList[2] + "]");
        }
예제 #9
0
        private static ColumnDescriptor LoadColumnDescriptor(IResource resource)
        {
            DisplayColumnProps props = (Core.DisplayColumnManager as DisplayColumnManager).Props;

            IStringList columnPropList = resource.GetStringListProp(props.ColumnProps);

            string[] columnProps = new string [columnPropList.Count];
            for (int i = 0; i < columnPropList.Count; i++)
            {
                columnProps [i] = columnPropList [i];
            }

            int width = resource.GetIntProp(props.ColumnWidth);
            ColumnDescriptorFlags flags = (ColumnDescriptorFlags)resource.GetIntProp(props.ColumnFlags);

            return(new ColumnDescriptor(columnProps, width, flags));
        }
예제 #10
0
파일: Conversations.cs 프로젝트: mo5h/omeo
            public string GetPreviewText(IResource res, int lines)
            {
                StringBuilder builder = StringBuilderPool.Alloc();

                try
                {
                    builder.Append("<conversation>");
                    IStringList convsList = res.GetStringListProp(_manager._propConversationList);
                    if (!_manager._reverseMode)
                    {
                        for (int i = 0; i < convsList.Count && lines-- > 0; ++i)
                        {
                            builder.Append(convsList[i]);
                        }
                    }
                    else
                    {
                        for (int i = convsList.Count - 1; i >= 0 && lines-- > 0; --i)
                        {
                            builder.Append(convsList[i]);
                        }
                    }
                    convsList.Dispose();
                    builder.Append("</conversation>");
                    XmlTextReader reader = new XmlTextReader(new StringReader(builder.ToString()));
                    builder.Length = 0;
                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            if (reader.MoveToAttribute("body"))
                            {
                                builder.AppendFormat("{0}\r\n", reader.Value);
                            }
                            reader.MoveToElement();
                        }
                    }
                    return(builder.ToString());
                }
                finally
                {
                    StringBuilderPool.Dispose(builder);
                }
            }
예제 #11
0
        ///////////////////////////////////////////////////////////////////////

        public void Add(
            IStringList list,
            int startIndex
            )
        {
            for (int index = startIndex; index < list.Count; index++)
            {
                IPair <string> item = list.GetPair(index);

                if (item != null)
                {
                    Add(item);
                }
                else
                {
                    Add((IPair <string>)null);
                }
            }
        }
예제 #12
0
        private static SortSettings LoadSortSettings(IResource res, DisplayColumnProps props)
        {
            IStringList  sortPropList = res.GetStringListProp(props.ColumnSortProps);
            IntArrayList sortProps    = IntArrayListPool.Alloc();

            try
            {
                for (int i = 0; i < sortPropList.Count; i++)
                {
                    string sortPropName = sortPropList [i];
                    if (sortPropName == "DisplayName")
                    {
                        sortProps.Add(ResourceProps.DisplayName);
                    }
                    else if (sortPropName == "Type")
                    {
                        sortProps.Add(ResourceProps.Type);
                    }
                    else if (sortPropName.StartsWith("-"))
                    {
                        sortPropName = sortPropName.Substring(1);
                        if (Core.ResourceStore.PropTypes.Exist(sortPropName))
                        {
                            sortProps.Add(-Core.ResourceStore.PropTypes [sortPropName].Id);
                        }
                    }
                    else
                    {
                        if (Core.ResourceStore.PropTypes.Exist(sortPropName))
                        {
                            sortProps.Add(Core.ResourceStore.PropTypes [sortPropName].Id);
                        }
                    }
                }

                bool sortAsc = res.HasProp(props.ColumnSortAsc);
                return(new SortSettings(sortProps.ToArray(), sortAsc));
            }
            finally
            {
                IntArrayListPool.Dispose(sortProps);
            }
        }
예제 #13
0
        ///////////////////////////////////////////////////////////////////////

        public ReturnCode Add(
            IStringList arguments,
            ref Result error
            )
        {
            if (arguments == null)
            {
                error = "invalid argument list";
                return(ReturnCode.Error);
            }

            if (items == null)
            {
                error = "items not available";
                return(ReturnCode.Error);
            }

            items.Add(GetNextKey(), arguments);
            return(ReturnCode.Ok);
        }
예제 #14
0
        private static BookmarkChange[] ParseChangesLog(string profileName)
        {
            IBookmarkService service =
                (IBookmarkService)Core.PluginLoader.GetPluginService(typeof(IBookmarkService));
            IResource profileRoot = service.GetProfileRoot(
                BookmarkService.NormalizeProfileName("Mozilla/" + profileName));

            if (profileRoot != null)
            {
                Trace.WriteLine("ParseChangesLog( " + profileName + " ) : profileRoot != null");
                MozillaBookmarkProfile profile =
                    service.GetOwnerProfile(profileRoot) as MozillaBookmarkProfile;
                if (profile != null)
                {
                    Trace.WriteLine("ParseChangesLog( " + profileName + " ) : profile != null");
                    profile.IsActive = true;
                    IStringList log = profileRoot.GetStringListProp(_propChangesLog);
                    if (log.Count > 0)
                    {
                        Trace.WriteLine("ParseChangesLog( " + profileName + " ) : log.Count > 0");
                        BookmarkChange[] result = new BookmarkChange[log.Count];
                        for (int i = 0; i < result.Length; ++i)
                        {
                            string[] changeFields = log[i].Split('\x01');
                            result[i].type         = Int32.Parse(changeFields[0]);
                            result[i].id           = Int32.Parse(changeFields[1]);
                            result[i].rdfid        = changeFields[2];
                            result[i].oldparent    = changeFields[3];
                            result[i].oldparent_id = Int32.Parse(changeFields[4]);
                            result[i].parent       = changeFields[5];
                            result[i].parent_id    = Int32.Parse(changeFields[6]);
                            result[i].name         = changeFields[7];
                            result[i].url          = changeFields[8];
                        }
                        profileRoot.DeleteProp(_propChangesLog);
                        return(result);
                    }
                }
            }
            return(null);
        }
예제 #15
0
 private void UpdateProperty(int propId, IResource source, IResource target)
 {
     if (source.HasProp(propId))
     {
         if (Core.ResourceStore.PropTypes[propId].DataType != PropDataType.StringList)
         {
             target.SetProp(propId, source.GetProp(propId));
         }
         else
         {
             IStringList strList = target.GetStringListProp(propId);
             foreach (string str in source.GetStringListProp(propId))
             {
                 if (strList.IndexOf(str) == -1)
                 {
                     strList.Add(str);
                 }
             }
         }
     }
 }
예제 #16
0
파일: Debugger.cs 프로젝트: jdruin/F5Eagle
        ///////////////////////////////////////////////////////////////////////

#if BREAKPOINTS
        public ReturnCode GetBreakpointList(
            Interpreter interpreter,
            string pattern,
            bool noCase,
            ref IStringList list,
            ref Result error
            )
        {
            CheckDisposed();

            BreakpointDictionary breakpoints = Breakpoints;

            if (breakpoints != null)
            {
                list = breakpoints.ToList(pattern, noCase);
                return(ReturnCode.Ok);
            }
            else
            {
                error = "breakpoints not available";
            }

            return(ReturnCode.Error);
        }
예제 #17
0
        public void TestMixedProps()
        {
            IResource origin = _storage.NewResource("Email");
            IResource person = _storage.NewResource("Person");

            origin.AddLink(_propAuthor, person);
            origin.SetProp(_propSize, 100);
            DateTime now = DateTime.Now;

            origin.SetProp(_propReceived, now);
            IStringList strLst = origin.GetStringListProp(_propValueList);

            using ( strLst )
            {
                strLst.Add("One");
                strLst.Add("Two");
                strLst.Add("Three");
            }
            origin.SetProp(_propUnread, true);
            origin.SetProp(_propSimilarity, 1.0);
            Stream stream = ResourceBinarySerialization.Serialize(origin);

            origin.Delete();
            origin = ResourceBinarySerialization.Deserialize(stream);
            Assert.IsTrue(person.HasLink(_propAuthor, origin), "Person has no link to deserialized origin");
            Assert.AreEqual(100, origin.GetIntProp(_propSize), "Deserialized origin has invalid size");
            Assert.AreEqual(now, origin.GetDateProp(_propReceived), "Deserialized origin has invalid received date");
            strLst = origin.GetStringListProp(_propValueList);
            using ( strLst )
            {
                Assert.IsTrue(strLst.Count == 3 && strLst[0] == "One" && strLst[1] == "Two" && strLst[2] == "Three",
                              "Deserialized origin has invalid value list");
            }
            Assert.IsTrue(origin.HasProp(_propUnread), "Deserialized origin is read");
            Assert.IsTrue(origin.GetDoubleProp(_propSimilarity) == 1.0, "Deserialized origin has invalid similarity");
        }
예제 #18
0
        private void SetProperty(XmlNode propertyNode)
        {
            XmlAttribute typeAttribute = (XmlAttribute)propertyNode.Attributes.GetNamedItem("Type");
            string       strType       = typeAttribute.InnerText;
            object       value         = null;

            switch (strType)
            {
            case "Bool":
                value = Convert.ToBoolean(propertyNode.InnerText);
                break;

            case "Date":
                Tracer._Trace("Try to parse " + propertyNode.InnerText + " for " + propertyNode.Name);
                long     ticks    = Convert.ToInt64(propertyNode.InnerText);
                DateTime dateTime = new DateTime(ticks);
                if (dateTime != DateTime.MinValue)
                {
                    value = dateTime;
                }
                break;

            case "Double":
                value = Convert.ToDouble(propertyNode.InnerText);
                break;

            case "Int":
                value = Convert.ToInt32(propertyNode.InnerText);
                break;

            case "LongString":
                value = propertyNode.InnerText;
                break;

            case "String":
                value = propertyNode.InnerText;
                break;

            case "StringList":
                //  Elements of the string list are stored as separate
                //  nodes of name "StringField"
                ArrayList fields = new ArrayList();
                foreach (XmlNode node in propertyNode.ChildNodes)
                {
                    if (node.Name == "StringField")
                    {
                        fields.Add(node.InnerText);
                    }
                }

                IStringList val = _resource.GetStringListProp(propertyNode.Name);
                foreach (string str in fields)
                {
                    val.Add(str);
                }
                value = val;
                break;

            default:
                throw new ArgumentOutOfRangeException("ResourceDeserialization -- Can not process" +
                                                      " resource type [" + strType + "]");
            }
            if (value != null)
            {
                if (Core.ResourceStore.PropTypes.Exist(propertyNode.Name))
                {
                    //  String list value is set impliit through initialization of
                    //  the property content elements.
                    if (strType != "StringList")
                    {
                        _resource.SetProp(propertyNode.Name, value);
                    }
                }
            }
        }
예제 #19
0
 public Keyword(string keyexp, IStringList[] lists)
 {
     Lists = lists;
     m_Keywords = new Regex(keyexp, RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase);
 }
예제 #20
0
 private static Result FromList(
     IStringList value
     )
 {
     return(new Result((object)value));
 }
예제 #21
0
        public static IResource Deserialize(Stream stream, BeforeDeserializationDelegate beforeCheck)
        {
            if (stream.CanSeek)
            {
                stream.Position = 0;
            }
            BinaryReader reader = new BinaryReader(stream);

            using ( reader )
            {
                string    resType = reader.ReadString();
                IResource result  = Core.ResourceStore.BeginNewResource(resType);
                try
                {
                    int propCount = reader.ReadInt32();
                    for (int i = 0; i < propCount; ++i)
                    {
                        PropDataType propType = (PropDataType)reader.ReadInt32();
                        int          propId   = reader.ReadInt32();
                        switch (propType)
                        {
                        case PropDataType.Link:
                        {
                            int count = reader.ReadInt32();
                            for (int j = 0; j < count; ++j)
                            {
                                LinkResource(reader, result, propId, beforeCheck);
                            }
                            break;
                        }

                        case PropDataType.String:
                        case PropDataType.LongString:
                        {
                            result.SetProp(propId, reader.ReadString());
                            break;
                        }

                        case PropDataType.StringList:
                        {
                            int         count  = reader.ReadInt32();
                            IStringList strLst = result.GetStringListProp(propId);
                            using ( strLst )
                            {
                                for (int j = 0; j < count; ++j)
                                {
                                    strLst.Add(reader.ReadString());
                                }
                            }
                            break;
                        }

                        case PropDataType.Int:
                        {
                            result.SetProp(propId, reader.ReadInt32());
                            break;
                        }

                        case PropDataType.Date:
                        {
                            result.SetProp(propId, new DateTime(reader.ReadInt64()));
                            break;
                        }

                        case PropDataType.Bool:
                        {
                            result.SetProp(propId, true);
                            break;
                        }

                        case PropDataType.Double:
                        {
                            result.SetProp(propId, reader.ReadDouble());
                            break;
                        }

                        case PropDataType.Blob:
                        {
                            int    length = reader.ReadInt32();
                            byte[] buffer = new byte[length];
                            reader.Read(buffer, 0, length);
                            result.SetProp(propId, new JetMemoryStream(buffer, true));
                            break;
                        }
                        }
                    }
                }
                finally
                {
                    result.EndUpdate();
                }
                return(result);
            }
        }
예제 #22
0
        /**
         * User should manually close returned stream
         */
        public static Stream Serialize(IResource resource)
        {
            JetMemoryStream result = new JetMemoryStream();
            BinaryWriter    writer = new BinaryWriter(result);

            writer.Write(resource.Type);
            writer.Write(resource.Properties.Count);
            foreach (IResourceProperty prop in resource.Properties)
            {
                writer.Write((int)prop.DataType);
                int propId = prop.PropId;
                writer.Write(propId);
                switch (prop.DataType)
                {
                case PropDataType.Link:
                {
                    IResourceList links;
                    if (Core.ResourceStore.PropTypes[propId].HasFlag(PropTypeFlags.DirectedLink))
                    {
                        links = (propId < 0) ? resource.GetLinksTo(null, -propId) : resource.GetLinksFrom(null, propId);
                    }
                    else
                    {
                        links = resource.GetLinksOfType(null, propId);
                    }
                    writer.Write(links.Count);
                    foreach (IResource linked in links)
                    {
                        writer.Write(linked.Id);
                    }
                    break;
                }

                case PropDataType.String:
                case PropDataType.LongString:
                {
                    writer.Write(resource.GetPropText(propId));
                    break;
                }

                case PropDataType.StringList:
                {
                    IStringList strList = resource.GetStringListProp(propId);
                    int         count   = strList.Count;
                    writer.Write(count);
                    for (int i = 0; i < count; ++i)
                    {
                        writer.Write(strList[i]);
                    }
                    break;
                }

                case PropDataType.Int:
                {
                    writer.Write(resource.GetIntProp(propId));
                    break;
                }

                case PropDataType.Date:
                {
                    writer.Write(resource.GetDateProp(propId).Ticks);
                    break;
                }

                case PropDataType.Bool:
                {
                    /**
                     * if a resource has bool prop, then it's equal to 'true'
                     * there is no need always to write 'true' to stream :-)
                     */
                    break;
                }

                case PropDataType.Double:
                {
                    writer.Write(resource.GetDoubleProp(propId));
                    break;
                }

                case PropDataType.Blob:
                {
                    Stream stream = resource.GetBlobProp(propId);
                    writer.Write((int)stream.Length);
                    FileResourceManager.CopyStream(stream, result);
                    break;
                }

                default:
                {
                    throw new Exception("Serialized resource has properties of unknown type");
                }
                }
            }
            return(result);
        }
예제 #23
0
파일: DebugActions.cs 프로젝트: mo5h/omeo
 private static void RemoveStringListValue(IStringList props, int index)
 {
     props.RemoveAt(index);
 }
예제 #24
0
        public static bool Find(IStringList List, Hashtable DelimTable, string String, SearchOptions Options, Regex Expression, ref Point Position, out int Len)
        {
            Len = String.Length;
            if ((String != null) && (String != string.Empty))
            {
                bool flag1 = ((Options & SearchOptions.CaseSensitive) == SearchOptions.None) && (Expression == null);
                if (flag1)
                {
                    String = String.ToUpper();
                }
                string text1 = null;
                int    num1  = 0;
                int    num2  = 0;
                if ((Options & SearchOptions.BackwardSearch) == SearchOptions.None)
                {
Label_031C:
                    if (Position.Y < List.Count)
                    {
                        text1 = List[Position.Y];
                        if ((Position.X < text1.Length) || (((text1 == string.Empty) && (Position.X == 0)) && (Expression != null)))
                        {
                            if (flag1)
                            {
                                text1 = text1.ToUpper();
                            }
                            Position.X = Math.Min(Position.X, (int)(text1.Length - 1));
                            if (Expression != null)
                            {
                                Match match2 = (text1 == string.Empty) ? Expression.Match(text1) : Expression.Match(text1, Position.X);
                                if (match2.Success)
                                {
                                    Len        = match2.Length;
                                    Position.X = match2.Index;
                                }
                                else
                                {
                                    Position.X = -1;
                                }
                            }
                            else if (text1 != string.Empty)
                            {
                                Position.X = text1.IndexOf(String, Position.X);
                            }
                            else
                            {
                                Position.X = -1;
                            }
                            if (((Position.X >= 0) && ((Options & SearchOptions.WholeWordsOnly) != SearchOptions.None)) && !SyntaxStrings.IsWholeWord(DelimTable, text1, Position.X, Len, ref num1, ref num2))
                            {
                                Position.X = (Position.X == num2) ? (Position.X + 1) : num2;
                                goto Label_031C;
                            }
                            if (Position.X >= 0)
                            {
                                return(true);
                            }
                        }
                        Position.Y++;
                        Position.X = 0;
                        goto Label_031C;
                    }
                }
                else
                {
                    Position.Y = Math.Min(Position.Y, (int)(List.Count - 1));
                    while (Position.Y >= 0)
                    {
                        text1 = List[Position.Y];
                        if ((Position.X > 0) || (((text1 == string.Empty) && (Position.X == 0)) && (Expression != null)))
                        {
                            if (flag1)
                            {
                                text1 = text1.ToUpper();
                            }
                            if (Expression != null)
                            {
                                Match match1 = (text1 == string.Empty) ? Expression.Match(text1) : Expression.Match(text1, Math.Min(Position.X, (int)(text1.Length - 1)));
                                if (match1.Success)
                                {
                                    Len        = match1.Length;
                                    Position.X = match1.Index;
                                }
                                else
                                {
                                    Position.X = -1;
                                }
                            }
                            else if (text1 != string.Empty)
                            {
                                Position.X = text1.LastIndexOf(String, Math.Min((int)(Position.X - 1), (int)(text1.Length - 1)));
                            }
                            else
                            {
                                Position.X = -1;
                            }
                            if (((Position.X >= 0) && ((Options & SearchOptions.WholeWordsOnly) != SearchOptions.None)) && !SyntaxStrings.IsWholeWord(DelimTable, text1, Position.X, Len, ref num1, ref num2))
                            {
                                Position.X = num1 - 1;
                                continue;
                            }
                            if (Position.X >= 0)
                            {
                                return(true);
                            }
                        }
                        Position.Y--;
                        if (Position.Y >= 0)
                        {
                            Position.X = List[Position.Y].Length;
                        }
                    }
                }
            }
            return(false);
        }