Ejemplo n.º 1
0
        private void ScanAssembly(Assembly assembly)
        {
            this.Assemblies.Add(assembly);

            foreach (var Cls in assembly.GetExportedTypes())
            {
                var Attr = Cls.GetCustomAttributes(typeof(Attributes.Entity), false);
                if (Attr.Length > 0 && this.ClassMetadata.ContainsKey(Cls.FullName) == false)
                {
                    var EntityAttr = Attr[0] as Attributes.Entity;
                    Log.Info("Entity found on " + Cls.FullName);

                    var ClsMeta = new Mapping.ClassMetadata()
                    {
                        Name      = Cls.Name,
                        TableName = EntityAttr.TableName,
                        Columns   = this.ScanClass(Cls)
                    };
                    ClsMeta.ObjectInfo = new Mapping.ObjectInfo(Cls, ClsMeta);

                    if (string.IsNullOrWhiteSpace(EntityAttr.IdFieldName) == false)
                    {
                        // Overide id column name at table level, for compatibility with some ORMs
                        ClsMeta.Columns.GetIdColumns()[0].Name = EntityAttr.IdFieldName;
                    }

                    this.ClassMetadata.Add(Cls.FullName, ClsMeta);
                }
            }


            this.FillAssociationInfo();
        }
Ejemplo n.º 2
0
        public static unsafe void Entry()
        {
            char *[]  cc = null;
            int *[]   ii = null;
            short *[] ss = null;

            var cls = new Sub2();

            cls.Foo(cc, ii);
            cls.Foo(cc, ss);

            Inf <int *[]> inf = cls;

            inf.Foo(cc, ii);

            Inf2 <short *[]> inf2 = cls;

            inf2.Foo(cc, ss);

            var cls2 = new Cls <long *[]>();

            Sub1 <int *[]> s1 = cls;

            s1.Foo(cc, ii);
            s1.Foo(cc, ss);

            new Cls <int *[]>();
        }
Ejemplo n.º 3
0
        public static void Entry()
        {
            var            c = new Cls <int, int>();
            Inf <int, int> i = c;

            i.Foo(c);
        }
Ejemplo n.º 4
0
        private void GenerateOwnFields()
        {
            IList <string> interfaces = Cls.CSharpInterfaces;

            foreach (Field of in Cls.GetOrderedFields().Where(_ => !_.NoCode))
            {
                string hideCondition   = of.Definition.GetSmartValue("qorpent-hide", "hide");
                string qorpentOverride = of.Definition.Attr("override");
                bool   hide            = interfaces.Contains(hideCondition);
                if (hide)
                {
                    continue;
                }
                bool over = interfaces.Contains(qorpentOverride);

                string name = of.Name;
                if (of.IsReference)
                {
                    GenerateRef(of);
                }
                else
                {
                    GenerateField(of, "", name, over: over);
                }
            }
        }
Ejemplo n.º 5
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            if (firstRender)
            {
                thisRef    = DotNetObjectReference.Create(this);
                clsBuilder = HtmlPropertyBuilder.CreateCssClassBuilder()
                             .Add("blazor-animation")
                             .Add(Cls?.Split(' ') ?? new string[0]);

                await JSRuntime.InvokeVoidAsync("RegisterAnimationBegin", thisRef, animationElement);

                styleBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder()
                               .Add(InitialStyle?.Split(';') ?? new string[0])
                               .AddIf(IsAbsolute, "position:absolute")
                               .Add("transition:all 1s ease");
                if (paths.Any())
                {
                    var firstStyle = paths.Peek();
                    styleBuilder.Remove("transition").Add($"transition:all {(firstStyle.Duration <= 0 ? 1000 : firstStyle.Duration)}ms ease");
                }
                MarkAsRequireRender();
                StateHasChanged();
                return;
            }
            if (!animationBegined)
            {
                animationBegined = true;
                await AnimationElementLoadAsync();
            }
        }
Ejemplo n.º 6
0
 public void Test01()
 {
     using (Cls cls = new Cls())
     {
         cls.Dispose();
     }
 }
Ejemplo n.º 7
0
        public static void Entry()
        {
            Inf <object>        i  = new Cls <string>();
            Inf <Inf <object> > ii = new Cls <Cls <string> >();

            i.Foo();
            ii.Foo();
        }
Ejemplo n.º 8
0
        private void WriteWrappers()
        {
            var wrappers = Cls.FindObjects <SqlFunction>("cs-wrap");

            foreach (var function in wrappers)
            {
                WriteWrapper(function);
            }
        }
        private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (listBox1.SelectedIndex != -1)
            {
                Cls cls = (Cls)listBox1.Items[listBox1.SelectedIndex];

                NavigationService.Navigate(new Uri("/CourseDetail.xaml?courseid=" + cls.ClassName, UriKind.Relative));
            }
        }
Ejemplo n.º 10
0
        public static void Entry()
        {
            Inf <long> i = new Cls();

            i.Foo(1.2f, (long)999999);
            Inf <char> i2 = null;

            i2.Foo(1234, 'a');
        }
Ejemplo n.º 11
0
        public static int Entry()
        {
            char *[]  cc = new char *[1];
            int *[]   ii = new int *[1];
            short *[] ss = new short *[1];

            var cls = new Sub2();

            cls.Foo(cc, ii);
            if (path != 1)
            {
                return(1);
            }

            cls.Foo(cc, ss);
            if (path != 2)
            {
                return(2);
            }

            Inf <int *[]> inf = cls;

            inf.Foo(cc, ii);
            if (path != 1)
            {
                return(3);
            }

            Inf2 <short *[]> inf2 = cls;

            inf2.Foo(cc, ss);
            if (path != 2)
            {
                return(4);
            }

            var cls2 = new Cls <long *[]>();

            Sub1 <int *[]> s1 = cls;

            s1.Foo(cc, ii);
            if (path != 1)
            {
                return(5);
            }

            s1.Foo(cc, ss);
            if (path != 2)
            {
                return(6);
            }

            new Cls <int *[]>();

            return(0);
        }
Ejemplo n.º 12
0
        public void Test1()
        {
            var a = new Cls {
                A = 123, B = 234
            };

            ObjectEx.AcceptPropValues(a, new { A = 111 });
            Assert.Equal(111, a.A);
            Assert.Equal(234, a.B);
        }
Ejemplo n.º 13
0
        public static void Entry()
        {
            Inf i = new Cls();

            i.Foo("nice");
            Res  res  = i.Foo <Res>();
            Res2 res2 = i.Foo <Res2>();

            i.Foo(res, res2);
        }
Ejemplo n.º 14
0
    static void Main(string[] args)
    {
        var cls = new Cls
        {
            prop1 = { "lorem", "ipsum", "dolor" },
            prop2 = { "lorem", "ipsum", "dolor" },
            prop3 = { "lorem", "ipsum", "dolor" },
        };

        System.Console.WriteLine(JsonConvert.SerializeObject(cls));     //Output:
    }
    static void Main(string[] args)
    {
        var cls = new Cls
        {
            prop1 = "lorem",
            prop2 = "ipsum",
            prop3 = "dolor"
        };

        System.Console.WriteLine(JsonConvert.SerializeObject(cls));
        //Output: {"prop1":"lorem","prop2":"ipsum"}
    }
Ejemplo n.º 16
0
        public static int Entry()
        {
            Inf <int, short> inf = new Cls();
            int n = inf.Foo(123);

            if (n != 123)
            {
                return(1);
            }

            return(0);
        }
Ejemplo n.º 17
0
        private void WriteGetSelectQuery()
        {
            o.WriteLine("\t\t///<summary>Implementation of PrepareSelectQuery</summary>");
            o.WriteLine("#if NOQORPENT");
            o.WriteLine("\t\tpublic string PrepareSelectQuery(object conditions = null, object hints = null) {");
            o.WriteLine("#else");
            o.WriteLine("\t\tpublic override string PrepareSelectQuery(object conditions = null, object hints = null) {");
            o.WriteLine("#endif");
            o.WriteLine("\t\t\tvar sb = new StringBuilder();");
            o.Write("\t\t\tsb.Append(\"select ");
            bool fst = true;

            foreach (Field of in Cls.GetOrderedFields().Where(_ => !_.NoSql && !_.NoCode))
            {
                if (fst)
                {
                    fst = false;
                }
                else
                {
                    o.Write(", ");
                }
                string n = of.Name.SqlQuoteName();

                string rn = n;
                if (of.IsReference)
                {
                    rn += of.ReferenceField;
                }
                rn = rn.SqlQuoteName().Replace("\"", "\\\"");
                n  = n.Replace("\"", "\\\"");
                //геометрический тип трансформируем в nvarchar(max)
                if (of.DataType.ResolveSqlDataType(DbDialect.SqlServer).Name.StartsWith("geo"))
                {
                    n = "CAST(" + n + " as nvarchar(max))";
                }
                o.Write(n);
                if (rn != n)
                {
                    o.Write(" as " + rn + "");
                }
            }
            o.Write(" from " + Cls.FullSqlName.Replace("\"", "\\\"") + " \");");
            o.WriteLine();
            o.WriteLine("\t\t\tvar where = conditions as string;");
            o.WriteLine("\t\t\tif ( null != where ) {");
            o.WriteLine("\t\t\t\tsb.Append(\" where \");");
            o.WriteLine("\t\t\t\tsb.Append(where);");
            o.WriteLine("\t\t\t}");
            o.WriteLine("\t\t\treturn sb.ToString();");
            o.WriteLine("\t\t}");
        }
Ejemplo n.º 18
0
	public int Test_Nested(Cls Nested_Cls){
		int mi_RetCode = 100;
		
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		// ACCESS NESTED FIELDS/MEMBERS
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		
		/////////////////////////////////
		// Test instance field access
		Nested_Cls.NestFldPubInst = 100;
		if(Nested_Cls.NestFldPubInst != 100)
			mi_RetCode = 0;
		
		Nested_Cls.NestFldAsmInst = 100;
		if(Nested_Cls.NestFldAsmInst != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test static field access
		Cls.NestFldPubStat = 100;
		if(Cls.NestFldPubStat != 100)
			mi_RetCode = 0;
	
		Cls.NestFldAsmStat = 100;
		if(Cls.NestFldAsmStat != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test instance method access  
		if(Nested_Cls.NestMethPubInst() != 100)
			mi_RetCode = 0;
				
		if(Nested_Cls.NestMethAsmInst() != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test static method access
		if(Cls.NestMethPubStat() != 100)
			mi_RetCode = 0;
		
		if(Cls.NestMethAsmStat() != 100)
			mi_RetCode = 0;
		
		////////////////////////////////////////////
		// Test access from within the nested class
		if(Nested_Cls.Test() != 100)
			mi_RetCode = 0;
		
		return mi_RetCode;
	}
Ejemplo n.º 19
0
        private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            
            if (listBox1.SelectedIndex != -1)
            {
                Cls selectedDept = (Cls)listBox1.Items[listBox1.SelectedIndex];

                //TextBlock tb = (TextBlock)sender;

                NavigationService.Navigate(new Uri("/ByClass.xaml?courseid=" + selectedDept.ClassName, UriKind.Relative));
                
            }
        }
Ejemplo n.º 20
0
 static void Test2()
 {
     Console.WriteLine("--- Test1");
     try
     {
         Cls obj = new Cls();
         ((I <object, Cls, string>)obj).H("aaa");
         Console.WriteLine("ok");
     }
     catch (Exception e)
     {
         Console.WriteLine("error " + e.GetType());
     }
 }
Ejemplo n.º 21
0
 static void Test1()
 {
     Console.WriteLine("--- Test1");
     try
     {
         Cls obj = new Cls();
         obj.H(obj);
         Console.WriteLine("ok");
     }
     catch (Exception e)
     {
         Console.WriteLine("error " + e.GetType());
     }
 }
Ejemplo n.º 22
0
        public static int Entry()
        {
            Inf0 <int> inf = new Cls <int>();

            inf.Foo(123);

            if (((Cls <int>)inf).field2 != 2 ||
                ((Cls <int>)inf).field1 != 0)
            {
                return(1);
            }

            return(0);
        }
Ejemplo n.º 23
0
 private void GenerateIncomeReferences()
 {
     Field[] incomerefs = Cls.GetOrderedReverse().Where(_ => _.IsReverese && !_.NoCode).ToArray();
     foreach (Field incomeref in incomerefs)
     {
         string       name    = incomeref.ReverseCollectionName;
         IBSharpClass cls     = incomeref.Table.TargetClass;
         string       clsname = cls.Name;
         if (cls.Namespace != Cls.Namespace)
         {
             clsname = cls.FullName;
         }
         GenerateField(incomeref, "ICollection<" + clsname + ">", name, "(" + incomeref.Name + "  привязка )",
                       "?? (Native" + name + " = new List<" + clsname + ">())");
     }
 }
Ejemplo n.º 24
0
    public static void Main()
    {
        var obj = new Cls()
        {
            Prop1 = "abc", Prop3 = 5
        };

        var props = obj
                    .GetType()
                    .GetProperties()
                    .Select(p => p.GetValue(obj))
                    .Where(x => x != null || (x is string && (string)x != ""))
                    .ToList();

        Console.WriteLine(string.Join(",", props));
    }
Ejemplo n.º 25
0
        private void WriteWriteAccessors()
        {
            var fields = Cls.GetOrderedFields().Where(_ => !_.NoSql && !_.NoCode).ToArray();

            if (Cls.AccessMode.HasFlag(DbAccessMode.Write))
            {
                WriteSummary("Insert a record", 2, "Affected rows");
                o.WriteLine("\t\tpublic int InsertRecord(IDbConnection connection, " + Cls.Name + " record) {");
                o.WriteLine("\t\t\tvar sqlCommand = connection.CreateCommand();");
                o.Write("\t\t\tconst string command = @\"INSERT INTO " + Cls.FullSqlName.SqlQuoteName().Replace("\"", "\"\"") + " (");
                for (var i = 0; i < fields.Length; i++)
                {
                    o.Write(fields[i].Name.ToLowerInvariant());
                    if (i != fields.Length - 1)
                    {
                        o.Write(", ");
                    }
                }
                o.Write(") VALUES (");
                for (var i = 0; i < fields.Length; i++)
                {
                    o.Write("@" + fields[i].Name.ToLowerInvariant());
                    if (i != fields.Length - 1)
                    {
                        o.Write(", ");
                    }
                }
                o.WriteLine(")\";");
                o.WriteLine("\t\t\tsqlCommand.CommandText = command;");
                for (var i = 0; i < fields.Length; i++)
                {
                    o.WriteLine("\t\t\tsqlCommand.Parameters.Add(record." + fields[i].Name + ");");
                }
                o.WriteLine("\t\t\tsqlCommand.Connection.Open();");
                o.WriteLine("\t\t\tvar affected = sqlCommand.ExecuteNonQuery();");
                o.WriteLine("\t\t\tsqlCommand.Connection.Close();");
                o.WriteLine("\t\t\treturn affected;");
                o.WriteLine("\t\t}");
            }
            if (Cls.AccessMode.HasFlag(DbAccessMode.ReadWrite))
            {
                foreach (var uniqueField in GetFields().Where(_ => _.IsUnique))
                {
                    WriteUpdateMethod(uniqueField);
                }
            }
        }
Ejemplo n.º 26
0
    static void Main(string[] args)
    {
        var cls = new Cls
        {
            prop1 = new List <string> {
                "lorem", "ipsum", "dolor"
            },
            prop2 = new List <string> {
                "lorem", "ipsum", "dolor"
            },
            prop3 = new List <string> {
                "lorem", "ipsum", "dolor"
            },
        };

        System.Console.WriteLine(JsonConvert.SerializeObject(cls));     //Output: {"prop1":["lorem"],"prop2":["lorem"],"prop3":null}
    }
Ejemplo n.º 27
0
        void TextStructVClass()
        {
            var st1 = new Srt("Struct", 0);
            var cl1 = new Cls("Class", 0);

            print(st1);
            print(cl1);

            var st2 = st1;
            var cl2 = cl1;

            cl2.Value = 1;
            st2.Value = 1;

            print(st1 + " ?= " + st2);
            print(cl1 + " ?= " + cl2);

            // Passing structs into fucntions makes a copy, which is inherently more expensive
        }
Ejemplo n.º 28
0
	public int Test_Nested(Cls Nested_Cls)
	{
		int mi_RetCode = 100;
		
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		// ACCESS NESTED FIELDS/MEMBERS
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		
		/////////////////////////////////
		// Test instance field access
		Nested_Cls.NestFldPubInst = 100;
		if(Nested_Cls.NestFldPubInst != 100)
			mi_RetCode = 0;
		
		//@csharp - Note, CSharp won't allow access of family or private members of a nested class...
		//from it's enclosing class.
		
		Nested_Cls.NestFldAsmInst = 100;
		if(Nested_Cls.NestFldAsmInst != 100)
			mi_RetCode = 0;
		
		Nested_Cls.NestFldFoaInst = 100;
		if(Nested_Cls.NestFldFoaInst != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test static field access
		Cls.NestFldPubStat = 100;
		if(Cls.NestFldPubStat != 100)
			mi_RetCode = 0;
		
		//@csharp - See last @csharp
		
		Cls.NestFldAsmStat = 100;
		if(Cls.NestFldAsmStat != 100)
			mi_RetCode = 0;
		
		Cls.NestFldFoaStat = 100;
		if(Cls.NestFldFoaStat != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test instance method access  
		if(Nested_Cls.NestMethPubInst() != 100)
			mi_RetCode = 0;
		
		//@csharp - See last @csharp
		
		if(Nested_Cls.NestMethAsmInst() != 100)
			mi_RetCode = 0;
		
		if(Nested_Cls.NestMethFoaInst() != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test static method access
		if(Cls.NestMethPubStat() != 100)
			mi_RetCode = 0;
		
		//@csharp - See last @csharp
		
		if(Cls.NestMethAsmStat() != 100)
			mi_RetCode = 0;
		
		if(Cls.NestMethFoaStat() != 100)
			mi_RetCode = 0;  
		
		/////////////////////////////////
		// Test virtual method access
		if(Nested_Cls.NestMethPubVirt() != 100)
			mi_RetCode = 0;
		
		//@csharp - See last @csharp
		
		if(Nested_Cls.NestMethAsmVirt() != 100)
			mi_RetCode = 0;
		
		if(Nested_Cls.NestMethFoaVirt() != 100)
			mi_RetCode = 0;  
		
		////////////////////////////////////////////
		// Test access from within the nested class
		if(Nested_Cls.Test() != 100)
			mi_RetCode = 0;
		
		////////////////////////////////////////////
		// Test accessing the second nested class
		if(Test_Nested2(Nested_Cls.Cls2PubInst) != 100)
			mi_RetCode = 0;
		
		if(Test_Nested2(Nested_Cls.Cls2AsmInst) != 100)
			mi_RetCode = 0;
		
		if(Test_Nested2(Nested_Cls.Cls2FoaInst) != 100)
			mi_RetCode = 0;

		return mi_RetCode;
	}
Ejemplo n.º 29
0
    public int Test_Nested(Cls Nested_Cls)
    {
        int mi_RetCode = 100;

        /////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////
        // ACCESS NESTED FIELDS/MEMBERS
        /////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////

        /////////////////////////////////
        // Test instance field access
        Nested_Cls.NestFldPubInst = 100;
        if (Nested_Cls.NestFldPubInst != 100)
        {
            mi_RetCode = 0;
        }

        //@csharp - Note, CSharp won't allow access of family or private members of a nested class...
        //from it's enclosing class.

        Nested_Cls.NestFldAsmInst = 100;
        if (Nested_Cls.NestFldAsmInst != 100)
        {
            mi_RetCode = 0;
        }

        Nested_Cls.NestFldFoaInst = 100;
        if (Nested_Cls.NestFldFoaInst != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static field access
        Cls.NestFldPubStat = 100;
        if (Cls.NestFldPubStat != 100)
        {
            mi_RetCode = 0;
        }

        //@csharp - See last @csharp

        Cls.NestFldAsmStat = 100;
        if (Cls.NestFldAsmStat != 100)
        {
            mi_RetCode = 0;
        }

        Cls.NestFldFoaStat = 100;
        if (Cls.NestFldFoaStat != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test instance method access
        if (Nested_Cls.NestMethPubInst() != 100)
        {
            mi_RetCode = 0;
        }

        //@csharp - See last @csharp

        if (Nested_Cls.NestMethAsmInst() != 100)
        {
            mi_RetCode = 0;
        }

        if (Nested_Cls.NestMethFoaInst() != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static method access
        if (Cls.NestMethPubStat() != 100)
        {
            mi_RetCode = 0;
        }

        //@csharp - See last @csharp

        if (Cls.NestMethAsmStat() != 100)
        {
            mi_RetCode = 0;
        }

        if (Cls.NestMethFoaStat() != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test virtual method access
        if (Nested_Cls.NestMethPubVirt() != 100)
        {
            mi_RetCode = 0;
        }

        //@csharp - See last @csharp

        if (Nested_Cls.NestMethAsmVirt() != 100)
        {
            mi_RetCode = 0;
        }

        if (Nested_Cls.NestMethFoaVirt() != 100)
        {
            mi_RetCode = 0;
        }

        ////////////////////////////////////////////
        // Test access from within the nested class
        if (Nested_Cls.Test() != 100)
        {
            mi_RetCode = 0;
        }

        return(mi_RetCode);
    }
Ejemplo n.º 30
0
    public int Test_Nested(Cls Nested_Cls)
    {
        int mi_RetCode = 100;

        /////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////
        // ACCESS NESTED FIELDS/MEMBERS
        /////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////

        /////////////////////////////////
        // Test instance field access
        Nested_Cls.NestFldPubInst = 100;
        if (Nested_Cls.NestFldPubInst != 100)
        {
            mi_RetCode = 0;
        }

        Nested_Cls.NestFldAsmInst = 100;
        if (Nested_Cls.NestFldAsmInst != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static field access
        Cls.NestFldPubStat = 100;
        if (Cls.NestFldPubStat != 100)
        {
            mi_RetCode = 0;
        }

        Cls.NestFldAsmStat = 100;
        if (Cls.NestFldAsmStat != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test instance method access
        if (Nested_Cls.NestMethPubInst() != 100)
        {
            mi_RetCode = 0;
        }

        if (Nested_Cls.NestMethAsmInst() != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static method access
        if (Cls.NestMethPubStat() != 100)
        {
            mi_RetCode = 0;
        }

        if (Cls.NestMethAsmStat() != 100)
        {
            mi_RetCode = 0;
        }

        ////////////////////////////////////////////
        // Test access from within the nested class
        if (Nested_Cls.Test() != 100)
        {
            mi_RetCode = 0;
        }

        return(mi_RetCode);
    }
Ejemplo n.º 31
0
 public bool IsTypeOf(int cls)
 {
     return(Cls.Equals(cls));
 }
Ejemplo n.º 32
0
        private static ClsClass GetCls(
            List <string> nmbs,
            string imageName,
            IFaultManager faultManager,
            IClsNmbManager clsNmbManager)
        {
            List <ICls>   clss    = new List <ICls>();
            List <string> present = new List <string>();

            foreach (string nmb in nmbs)
            {
                string[] individualNmbArray = nmb.Split(clsTick);
                if (individualNmbArray.Length != 2)
                {
                    faultManager.AddFault(
                        "Numbers Incorrect",
                        imageName);
                    continue;
                }

                present.Add(individualNmbArray[1]);

                // Go to nmb manager and get all associated nmbs
                //List<string> foundNmbs = new List<string>() { individualNmbArray[1] };
                List <string> foundNmbs =
                    clsNmbManager.FindAllNmbs(
                        individualNmbArray[0],
                        individualNmbArray[1]);
                bool foundCls = false;

                foreach (ICls cls in clss)
                {
                    if (cls.Name == individualNmbArray[0])
                    {
                        foreach (string foundNmb in foundNmbs)
                        {
                            cls.AddNmb(foundNmb);
                        }

                        foundCls = true;
                        break;
                    }
                }

                if (!foundCls)
                {
                    ICls newCls =
                        new Cls(
                            individualNmbArray[0]);
                    foreach (string foundNmb in foundNmbs)
                    {
                        newCls.AddNmb(foundNmb);
                    }

                    clss.Add(newCls);
                }
            }

            return
                (new ClsClass(
                     clss,
                     present));
        }