Example #1
0
        //////////////////////////////////////////////////

        public void CopyTo(Object Source, Object Dest, String[] PropertiesToOmit)
        {
            if (Source == null || Dest == null)
            {
                return;
            }

            if (unsensitive)
            {
#if !NET20
                PropertiesToOmit = PropertiesToOmit.Select(i => i.ToUpper()).ToArray();
#else
                PropertiesToOmit = Linq2.From(PropertiesToOmit).Select(i => i.ToUpper()).ToArray();
#endif
            }

            foreach (var property in GetPropertyinfos(Source))
            {
                if (PropertiesToOmit != null && PropertiesToOmit.Length > 0)
                {
                    if (Linq2.Contains(PropertiesToOmit, unsensitive ? property.Name.ToUpper() : property.Name))
                    {
                        continue;
                    }
                }

                if (Attribute.IsDefined(property, typeof(NoCloneAttribute)))
                {
                    continue;
                }

                try
                {
                    SetValue(
                        Dest,
                        property.Name,
                        GetValue(Source, property.Name));
                }
                catch
                {
                    throw;
                }
            }
        }
Example #2
0
        ////////////////////

        public static Boolean Is(
#if !NET20
            this
#endif
            Type Type, Type Subclass)
        {
            if (Subclass.IsInterface)
            {
#if !NET20
                return(Type.GetInterfaces().Contains(Subclass));
#else
                return(Linq2.Contains(Type.GetInterfaces(), Subclass));
#endif
            }
            else
            {
                return(PrivIs(Type, Subclass));
            }
        }
Example #3
0
        ////////////////////////////////////////////

        private CodeLines GetLines(IList <Char> Chars)
        {
            CodeLines outChars = new CodeLines();

            CodeLine currentLine = new CodeLine();

            outChars.Add(currentLine);
            Boolean wasCommentStart = false;

            for (Int32 i = 0; i <= Chars.Count; i++)
            {
                {
                    OnpOnpStringFindResult firstNext = StringHelper.FirstNextIndex(
                        Chars, i,
                        new[] { DynLanuageSymbols.NewLineChars, DynLanuageSymbols.DepthBegin, DynLanuageSymbols.DepthEnd },
                        false);

                    // gdy nie znalazł znaku nowej linii
                    if (firstNext == null || firstNext.Index < 0)
                    {
                        OnpOnpStringFindResult commentStartNext = StringHelper.FirstNextIndex(
                            Chars, i,
                            new[] { DynLanuageSymbols.Comment1StartSymbol },
                            false);

                        if (commentStartNext == null || commentStartNext.Index < 0)
                        {
                            for (var j = i; j < Chars.Count; j++)
                            {
                                var ch = Chars[j];
#if !SPACES_FOR_DEPTH
                                if (currentLine.Count > 0 || !Char.IsWhiteSpace(ch))
#endif
                                currentLine.Add(ch);
                            }
                        }
                        else
                        {
                            for (var j = i; j < commentStartNext.Index; j++)
                            {
                                var ch = Chars[j];
#if !SPACES_FOR_DEPTH
                                if (currentLine.Count > 0 || !Char.IsWhiteSpace(ch))
#endif
                                currentLine.Add(ch);
                            }
                            wasCommentStart = true;
                        }
                        break;
                    }
                    // gdy znalazł znak nowej linii
                    else
                    {
#if !NET20
                        if (DynLanuageSymbols.NewLineChars.Contains(firstNext.Chars) ||
                            DynLanuageSymbols.DepthBegin.Contains(firstNext.Chars) ||
                            DynLanuageSymbols.DepthEnd.Contains(firstNext.Chars))
#else
                        if (Linq2.Contains(DynLanuageSymbols.NewLineChars, firstNext.Chars) ||
                            Linq2.Contains(DynLanuageSymbols.DepthBegin, firstNext.Chars) ||
                            Linq2.Contains(DynLanuageSymbols.DepthEnd, firstNext.Chars))
#endif
                        {
                            OnpOnpStringFindResult commentStartNext = StringHelper.FirstNextIndex(
                                Chars, i, firstNext.Index,
                                new[] { DynLanuageSymbols.Comment1StartSymbol },
                                false);

                            if (commentStartNext == null || commentStartNext.Index < 0)
                            {
                                for (var j = i; j < firstNext.Index; j++)
                                {
                                    var ch = Chars[j];
#if !SPACES_FOR_DEPTH
                                    if (currentLine.Count > 0 || !Char.IsWhiteSpace(ch))
#endif
                                    currentLine.Add(ch);
                                }
                            }
                            else
                            {
                                for (var j = i; j < commentStartNext.Index; j++)
                                {
                                    var ch = Chars[j];
#if !SPACES_FOR_DEPTH
                                    if (currentLine.Count > 0 || !Char.IsWhiteSpace(ch))
#endif
                                    currentLine.Add(ch);
                                }
                                wasCommentStart = true;
                            }
#if !NET20
                            if (DynLanuageSymbols.DepthBegin.Contains(firstNext.Chars) ||
                                DynLanuageSymbols.DepthEnd.Contains(firstNext.Chars))
#else
                            if (Linq2.Contains(DynLanuageSymbols.DepthBegin, firstNext.Chars) ||
                                Linq2.Contains(DynLanuageSymbols.DepthEnd, firstNext.Chars))
#endif
                            {
                                if (currentLine.Count > 0)
                                {
                                    currentLine = new CodeLine();
                                    outChars.Add(currentLine);
                                }
                                currentLine.AddRange(firstNext.Chars);
                            }

                            i = firstNext.Index + firstNext.Chars.Length - 1;

                            currentLine = new CodeLine();
                            outChars.Add(currentLine);
                            wasCommentStart = false;
                        }
                    }
                }
            }

            return(outChars);
        }