static void Main(string[] args)
        {
            //Anonymous method
            division dv = delegate(int a, int b)
            {
                return(a / b);
            };
            int d = dv.Invoke(10, 2);

            Console.WriteLine(d);
            message m = (s) =>
            {
                return("Hello\t" + s + "\tWelcome to visual Studio");
            };
            string a = m.Invoke("Mahesh");

            Console.WriteLine(a);
            add ad = (a, b) =>
            {
                return(a + b);
            };
            int c = ad.Invoke(10, 200);

            Console.WriteLine(c);
        }
示例#2
0
        static void Main(string[] args)
        {
            Rectangle    r      = new Rectangle();
            delRectangle delrec = new delRectangle(r.area);

            delrec += r.perimeter;
            delrec.Invoke(5, 10);
            r.DelegateToMethodAsParameter(delrec);
            delrec = (double x, double y) => Console.WriteLine(x / y);
            r.DelegateToMethodAsParameter(delrec);

            addNumbers       addingDelegate       = new addNumbers(sum);
            substractNumbers substractingDelegate = new substractNumbers(substract);

            addingDelegate += r.perimeter;
            addingDelegate -= sum;
            substractingDelegate(10, 4);
            addingDelegate(12, 13);

            add <int>    suma = Sum;
            add <string> con  = Concat;

            Console.WriteLine(con("This is", " Sparta!"));

            Subscriber.Registering();
            Publisher p = new Publisher();

            p.StartPublishing();
            MultiDataProcessPublisher mp = new MultiDataProcessPublisher();

            mp.StartProcess();

            Console.ReadKey();
        }
示例#3
0
        public static void Main(string[] args)
        {
            // Test Lamada
            List <string> listString = new List <string>();

            listString.Add("abc");
            listString.Add("456");
            listString.Add("bbb");
            listString.Add("iiiiiiii");

            var retList = listString.Where(u => u.Length > 4);

            foreach (string str in retList)
            {
                Console.WriteLine("str = {0}", str);
            }

            // Test Deleagte
            add myDelegate = x => x + 5;
            int ret        = myDelegate(5);

            Console.WriteLine("ret = {0}", ret);

            // ASP.NET Core MVC
            CreateHostBuilder(args).Build().Run();
        }
示例#4
0
        public Values.AddContainer AddContainer(IConnectToDB _Connect, FormCollection collection)
        {
            add addHelp = new add();

            Values.AddContainer _result = new Values.AddContainer();

            if (collection.Keys.Count > 0)
            {
                //TODO: Verify .Net Core Port
                foreach (var key in collection.Keys)
                {
                    _result = addHelp.ADD_ENTRY_Containers(_Connect, new Values.AddContainer {
                        I_CONTAINER_NAME = collection[key].ToString()
                    });
                    break;
                }

                if (_result.O_CONTAINERS_ID > 0)
                {
                    _result.O_ERR_MESS = "Container Saved!";
                }
            }
            else
            {
                _result.O_ERR_MESS = "This container already exist";
            }

            return(_result);
        }
示例#5
0
        public string EP_SAVE_FILE(IConnectToDB _Connect, string serverpath)
        {
            //C:\Users\Eminent\Documents\Projects\perception\CMS\CMS\CMS\Files\_originals\Koala.jpg
            //string strPath = HttpContext.Current.Server.MapPath("/Files/_originals/Koala.jpg");
            string strPath     = serverpath;
            string ContentType = new FileInfo(strPath).Extension;
            string ContentSize = new FileInfo(strPath).Length.ToString();
            string FileName    = new FileInfo(strPath).Name;

            FileStream fs = new FileStream(strPath, FileMode.Open, FileAccess.Read);

            byte[] longRaw = new byte[fs.Length];
            fs.Read(longRaw, 0, longRaw.Length);
            fs.Close();

            add addHelp = new add();

            //OracleBinary OraclebinaryFile = new OracleBinary(longRaw);

            return("File Added" + addHelp.ADD_ENTRY_FILE(_Connect, new Values.AddFile
            {
                I_FILE_NAME = FileName,
                I_CONTENT_TYPE = ContentType,
                I_FILE_SIZE = longRaw.Length,
                I_FILE_DATA = longRaw
            }));
        }
示例#6
0
        //C:\Users\Eminent\Documents\Projects\perception\CMS\CMS\CMS\Files\_originals\Koala.jpg
        //string strPath = HttpContext.Current.Server.MapPath("/Files/_originals/Koala.jpg");

        public Values.AddFile SaveFile(IConnectToDB _Connect, IFormFile File)
        {
            add addHelp = new add();

            string ContentType = File.ContentType;

            long?  ContentSize = File.Length;
            string FileName    = File.FileName;

            byte[] longRaw = new byte[File.Length];

            //TODO: Review .Net Core Port
            if (File.Length > 0)
            {
                using (var ms = new MemoryStream())
                {
                    File.CopyTo(ms);
                    longRaw = ms.ToArray();
                    //string s = Convert.ToBase64String(fileBytes);
                    // act on the Base64 data
                }
            }

            Values.AddFile thisFile = addHelp.ADD_ENTRY_FILE(_Connect, new Values.AddFile
            {
                I_FILE_NAME    = FileName,
                I_CONTENT_TYPE = ContentType,
                I_FILE_SIZE    = ContentSize,
                I_FILE_DATA    = longRaw
            });

            return(thisFile);
        }
示例#7
0
        public long?AddProfileEntry(IConnectToDB _Connect, long?identitiesId)
        {
            SecurityHelper securityHelper = new SecurityHelper();
            add            addHelp        = new add();
            long?          profilesId     = null;
            long?          privilegesId   = ER_Tools.ConvertToInt64(securityHelper.GetPrivID(_Connect, "ADD PROFILE"));

            //Enter profile information
            Values.AddProfiles ProfilesModel = null;
            ProfilesModel = addHelp.ADD_ENTRY_Profiles(_Connect, new Values.AddProfiles
            {
                I_IDENTITIES_ID = identitiesId,
                I_ENABLED       = 'Y',
            });
            profilesId = ProfilesModel.O_PROFILES_ID;

            //Enter profile security information
            //Values.AddProfilesSecPriv ProfilesSecPrivModel = null;
            //ProfilesSecPrivModel = addHelp.ADD_ENTRY_Profiles_Sec_Priv(_Connect, new Values.AddProfilesSecPriv
            //{
            //    I_OBJECT_TYPE = "Permission",
            //    I_PROFILES_ID = profilesId,
            //    I_PRIVILEGES_ID = privilegesId,
            //    I_ENABLED = 'Y',
            //    I_IDENTITIES_ID = identitiesId
            //});
            //profilesSecPrivId = ProfilesSecPrivModel.O_PROFILES_SEC_PRIV_ID;

            return(profilesId);
        }
示例#8
0
        protected override Task OnExecute(CommandLineApplication app)
        {
            if (Token == null)
            {
                Console.WriteLine("No token was specified");
                return(Task.CompletedTask);
            }

            Console.WriteLine("An encoded token can be included in a public repository without being automatically deleted by GitHub.");
            Console.WriteLine("These can be used in various package ecosystems like this:");

            var xmlEncoded = XmlEncode(Token);

            Console.WriteLine();
            Console.WriteLine("A NuGet `nuget.config` file:");
            Console.WriteLine(@$ "<packageSourceCredentials>
  <github>
    <add key=" "Username" " value=" "PublicToken" " />
    <add key=" "ClearTextPassword" " value=" "{xmlEncoded}" " />
  </github>
</packageSourceCredentials>");

            Console.WriteLine();
            Console.WriteLine("A Maven `settings.xml` file:");
            Console.WriteLine(@$ "<servers>
  <server>
    <id>github</id>
    <username>PublicToken</username>
    <password>{xmlEncoded}</password>
示例#9
0
        static void Main(string[] args)
        {
            Test <int> test1 = new Test <int>(5);

            test1.Write();

            Test <string> test2 = new Test <string>("Hello World!");

            test2.Write();

            List <bool>   list1 = GetInitializedList(true, 5);
            List <string> list2 = GetInitializedList("Perls", 3);

            foreach (bool value in list1)
            {
                Test <bool> test = new Test <bool>(value);
                test.Write();
            }
            foreach (string value in list2)
            {
                Test <string> test = new Test <string>(value);
                test.Write();
            }

            Perl <Program> perl = new Perl <Program>();

            add <int> sum = AddNumber;

            new Test <int>(sum(10, 20)).Write();

            add <string> conct = Concate;

            new Test <string>(conct("Hello", "World!!")).Write();
        }
示例#10
0
        protected override Task <int> OnExecuteAsyncImpl(CommandLineApplication app, CancellationToken cancellationToken)
        {
            if (Token == null)
            {
                Console.WriteLine("No token was specified");
                return(Task.FromResult(1));
            }

            Console.WriteLine("An encoded token can be included in a public repository without being automatically deleted by GitHub.");
            Console.WriteLine("These can be used in various package ecosystems like this:");

            var xmlEncoded = XmlEncode(Token);

            Console.WriteLine();
            Console.WriteLine("A NuGet `nuget.config` file:");
            Console.WriteLine(@$ "<packageSourceCredentials>
  <github>
    <add key=" "Username" " value=" "PublicToken" " />
    <add key=" "ClearTextPassword" " value=" "{xmlEncoded}" " />
  </github>
</packageSourceCredentials>");

            Console.WriteLine();
            Console.WriteLine("A Maven `pom.xml` file:");
            Console.WriteLine(@$ "<repositories>
  <repository>
    <id>github-public</id>
示例#11
0
        public void ChangePassword(IConnectToDB _Connect, Guid?uuid, string password)
        {
            _DynamicOutputProcedures DynamicOutput        = new _DynamicOutputProcedures();
            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();
            ER_Sec er_sec  = new ER_Sec();
            add    addHelp = new add();

            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "IDENTITIES_UUID_", DBType = SqlDbType.UniqueIdentifier, ParamValue = uuid
            });

            DataTable TempDataTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__ID_PASSWORD_SEARCH",
                                                                   new DataTableDotNetModelMetaData {
                columns = "ID_PASSWORD_ID,RENDITION,IDENTITIES_ID", length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                   Filters);

            DataColumnCollection _dccColumnID = TempDataTable.Columns;

            if (_dccColumnID.Contains("ID_PASSWORD_ID") && TempDataTable.Rows.Count > 0)
            {
                //Update Password
                Values.UpdateIDPassword IDPasswordModel = null;
                string hash = ER_Sec.ComputeHash(password, "SHA512", null);
                IDPasswordModel = addHelp.UPDATE_ENTRY_Identities_Password(_Connect, new Values.UpdateIDPassword
                {
                    I_ID_PASSWORD_ID = TempDataTable.Rows[0].Field <long?>("ID_PASSWORD_ID"),
                    I_OBJECT_TYPE    = "Password",
                    I_RENDITION      = TempDataTable.Rows[0].Field <long?>("RENDITION"),
                    I_PASSWORD       = er_sec.EncryptStringToBytes_Aes(hash, er_sec.GetCryptPairforID(_Connect, TempDataTable.Rows[0].Field <long?>("IDENTITIES_ID"), new ER_CRYPT_PAIR()))
                });
            }
        }
示例#12
0
        static void Main(string [] arg)
        {
            add a   = new add();
            int ans = a.Addition(5, 6);

            Console.WriteLine(ans);
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            add <int>    del = add;
            add <string> obj = concate;

            Console.WriteLine(del(10, 20));
            Console.WriteLine(obj("hello guys ", " Welcome to Bangalore"));
            Console.Read();
        }
示例#14
0
        public void Execute()
        {
            add <int> sum = AddNumber;

            Console.WriteLine(sum(10, 20));
            add <string> conct = Concate;

            Console.WriteLine(conct("Hello", "World!!"));
        }
    private void addButton_Click(object sender, EventArgs e)
    {
        var add = new add();

        if (add.ShowDialog() == System.Windows.Forms.DialogResult.OK)
        {
            this.listView1.Items.Add(add.person.Name + " " + add.person.Surname);
        }
    }
示例#16
0
        public async Task <ActionResult> add(add user)
        {
            if (user.username == null)
            {
                return(BadRequest("A username is needed for the person adding."));
            }

            SupportUsers adder = await adminRepository.getAdmin(user.username);

            if (adder == null)
            {
                return(Unauthorized("The person trying to add is not a staff member!"));
            }


            if (user.user.Username == null)
            {
                return(BadRequest("A username is needed."));
            }

            if (user.user.Name == null)
            {
                return(BadRequest("A name is needed."));
            }

            if (user.user.Surname == null)
            {
                return(BadRequest("A surname is needed."));
            }

            if (user.user.Email == null)
            {
                return(BadRequest("An email is needed."));
            }

            string password = getRandomString(10);

            user.user.Password = getHash(SHA256.Create(), password);
            user.user.Password = getHash(SHA256.Create(), user.user.Password);

            SupportUsers exists = await adminRepository.getAdmin(user.user.Username);

            if (exists == null)
            {
                string content = "Your username is " + user.user.Username + " and your temporary password you will use to sign in for the first time is " + password + ".";
                await adminRepository.addAdmin(user.user);

                await mailer.sendEmail("*****@*****.**", "Gym Moves", "Admin Account", content, emailReceiver);

                return(Ok());
            }
            else
            {
                return(BadRequest("This username is already in use"));
            }
        }
示例#17
0
 void AddText(string tx)
 {
     if (richTextBox1.InvokeRequired)
     {
         add t = new add(AddText);
         this.Invoke(t, new object[] { tx });
         return;
     }
     richTextBox1.Text += tx;
 }
示例#18
0
        public GenericDelegate()
        {
            add <int> sum = Sum;

            Console.WriteLine(sum(10, 20));

            add <string> con = Concat;

            Console.WriteLine(Concat("Hello ", "World!!"));
        }
示例#19
0
        static public void Delegate2()
        {
            add <int> sum = (int[] numArr1) => numArr1.Sum();

            Console.WriteLine(sum(10, 20));

            add <string> conct = (string[] strArr1) => string.Join("", strArr1);

            Console.WriteLine(conct("Hello ", "World!!"));
        }
        static void Main(string[] args)
        {
            add <int> Sum = AddNumber;

            Console.WriteLine("Result of addition is:" + Sum(12, 33));

            add <string> JoinStrings = Concat;

            Console.WriteLine(JoinStrings("This is ", "Generic Delegate Demo"));
        }
示例#21
0
        static void Main(string[] args)
        {
            add <int> sum = AddNumber;

            Console.WriteLine(sum(10, 20));

            add <string> conct = Concate;

            Console.WriteLine(conct("Hello", "World!!"));
        }
示例#22
0
        private void button1_Click(object sender, EventArgs e)
        {   // instanciando e pegando texto das textbox
            add cadastrar = new add(textBoxNome.Text, textBoxTelefone.Text, textBoxEmail.Text);

            MessageBox.Show(cadastrar.message);
            Consultar consulta = new Consultar();

            consulta.Show();
            Hide();
        }
        static void Main(string[] args)
        {
            add <int> sum = Sum;

            Console.WriteLine(sum(10, 20));

            add <string> con = Concat;

            Console.WriteLine(Concat("Hello ", "World!!"));
            Console.ReadKey();
        }
示例#24
0
        public void Itest()
        {
            var a     = new add();
            var text1 = a.Result(20, 10);

            var b     = new Reduce();
            var text2 = b.Result(20, 10);

            var c     = new Ride();
            var text3 = c.Result(20, 10);
        }
示例#25
0
        public static void Main()
        {
            add <int> sum = Sum;

            Console.WriteLine(sum(10, 20));

            add <string> conct = Concat;

            Console.WriteLine(conct("Hello", "World!!"));
            Console.ReadKey();
        }
示例#26
0
        static void Main(string[] args)
        {
            MyGenericClass <int> intGenericClass = new MyGenericClass <int>(10);

            int val = intGenericClass.genericMethod(200);

            add <int> sum = AddNumber;

            Console.WriteLine(sum(10, 20));

            add <string> conct = Concate;

            Console.WriteLine(conct("Hello", "World!!"));
        }
示例#27
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");

            MyDelegate del = ClassA.MethodA;

            del("Hello");

            del = ClassB.MethodB;
            del("World");

            del = (string msg) => Console.WriteLine("Called ambda expression: " + msg);
            del("Hello World");


            del = ClassA.MethodA;
            InvokeDelegate(del);

            del = ClassB.MethodB;
            InvokeDelegate(del);

            del = (string msg) => Console.WriteLine("Called lambda expression: " + msg);
            InvokeDelegate(del);

            MyDelegate del1 = ClassA.MethodA;
            MyDelegate del2 = ClassB.MethodB;

            del = del1 + del2;
            del("Combined Delegate: Hello World");

            MyDelegate del3 = (string msg) => Console.WriteLine("Called lambda expression: " + msg);

            del += del3;
            del("Combined with del3 Hello World");

            IntDelegate del4 = ClassA.MethodA;
            IntDelegate del5 = ClassB.MethodB;

            del4 += del5;
            Console.WriteLine(del4()); //return ClassB.MethodB

            add <int> sum = Sum;

            Console.WriteLine(sum(10, 20));

            add <string> concat = Concat;

            Console.WriteLine(concat("Hello ", "World "));
        }
示例#28
0
        public void receive(object sender, MessageReceivedEventArgs e)
        {
            Console.WriteLine(e.Message);
            JObject json = JObject.Parse(e.Message);
            if (json.GetValue("result").ToString() != "success") return;
            string src = json.GetValue("source").ToString();
            switch (src)
            {
                case "getPlayerLimit":
                    MessageBox.Show("The actual Player limit is: " + json.GetValue("success").ToString());
                    break;
                case "getPlayerNames":
                    clear x = new clear(clearbox);
                    this.Invoke(x);
                    JToken token = json.GetValue("success");
                    foreach (JToken f in token)
                    {
                        add c = new add(addbox);
                        this.Invoke(c, f.ToString());

                    }

                    break;
                case "getPlayer":
                    JToken pos = json.GetValue("success").SelectToken("location");
                    string posi =  "x: " + pos.SelectToken("x").ToString() + " y: " + pos.SelectToken("y").ToString() + " z: " + pos.SelectToken("z").ToString();
                    string op = Convert.ToString(json.GetValue("success").SelectToken("op"));
                    string world = json.GetValue("success").SelectToken("worldInfo").SelectToken("name").ToString();
                    string gamemode = json.GetValue("success").SelectToken("gameMode").ToString();
                    infoHandler handler = new infoHandler(addinfo);
                    this.Invoke(handler, posi, world, op, gamemode);
                    break;
                case "kickPlayer":
                    if (!mk)
                    MessageBox.Show("Player gekickt");
                    break;
                case "opPlayer":
                    MessageBox.Show("Player is OP.");
                    break;
                case "deopPlayer":
                    MessageBox.Show("Player is no longer OP");
                    break;
                default:
                    Console.WriteLine(e.Message);
                    break;
            }
        }
示例#29
0
        public void TestMethod17()
        {
            // ToString() test
            add a = new add(0, 1, 5);

            Assert.AreEqual("add r0 r1 r5", a.ToString());
            addi ai = new addi(0, 1, 5);

            Assert.AreEqual("addi r0 r1 5", ai.ToString());
            bz bz = new bz(1, 1);

            Assert.AreEqual("bz r1 1", bz.ToString());
            bge bge = new bge(1, 1);

            Assert.AreEqual("bge r1 1", bge.ToString());
            bnz bnz = new bnz(1, 1);

            Assert.AreEqual("bnz r1 1", bnz.ToString());
            ble ble = new ble(1, 1);

            Assert.AreEqual("ble r1 1", ble.ToString());
            finish f = new finish();

            Assert.AreEqual("finish", f.ToString());
            launch l = new launch(1);

            Assert.AreEqual("launch r1", l.ToString());
            ld ld = new ld(2, 1, 3);

            Assert.AreEqual("ld r2 r1 3", ld.ToString());
            mul m = new mul(1, 2, 3);

            Assert.AreEqual("mul r1 r2 r3", m.ToString());
            muli mi = new muli(1, 2, 3);

            Assert.AreEqual("muli r1 r2 3", mi.ToString());
            st s = new st(1, 2, 3);

            Assert.AreEqual("st r1 r2 3", s.ToString());
            sub sub = new sub(1, 2, 3);

            Assert.AreEqual("sub r1 r2 r3", sub.ToString());
            subi subi = new subi(1, 2, 3);

            Assert.AreEqual("subi r1 r2 3", subi.ToString());
        }
示例#30
0
文件: Program.cs 项目: Jason0952/C-
        static void Main(string[] args)
        {
            char[] splits   = new char[] { ',' };
            bool   isok     = true;
            string filename = "test03.txt";

            if (File.Exists(filename))
            {
                string[] all = File.ReadAllLines(filename);
                foreach (var v in all)
                {
                    if (v.StartsWith("695") || v.StartsWith("525"))
                    {
                        if (DateTime.TryParseExact(v.Substring(13, 8), "yyyyMMdd", null, System.Globalization.DateTimeStyles.None, out DateTime result) &&
                            DateTime.TryParseExact(v.Substring(21, 8), "yyyyMMdd", null, System.Globalization.DateTimeStyles.None, out DateTime result1))
                        {
                            add d = new add()
                            {
                                TickNumber = v,
                                FlyingDay  = result,
                                Birthday   = result1
                            };

                            try
                            {
                                data context = new data();
                                context.add.Add(d);
                                context.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("發生錯誤");
                            }
                        }
                    }
                }
            }
            var list = new data();
            var res  = list.add.ToList();

            foreach (var n in res)
            {
                Console.WriteLine(n.Birthday);
            }
            Console.ReadLine();
        }
示例#31
0
        public string MarkVerificationsForID(IConnectToDB _Connect, long identities_id, string Validation_Type)
        {
            //ER_DML er_dml = new ER_DML();
            _DynamicOutputProcedures DynamicOutput = new _DynamicOutputProcedures();
            add  addHelp  = new add();
            long?verifyId = null;

            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();

            try
            {
                Filters.Add(new DynamicModels.RootReportFilter {
                    FilterName = "IDENTITIES_ID_", DBType = SqlDbType.BigInt, ParamValue = identities_id
                });
                Filters.Add(new DynamicModels.RootReportFilter {
                    FilterName = "VALIDATION_TYPE_", DBType = SqlDbType.VarChar, SearchParamSize = -1, ParamValue = Validation_Type
                });

                DataTable _ResultSet = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__VERIFY_SEARCH",
                                                                    new DataTableDotNetModelMetaData {
                    length = -1, order = "1 asc", start = 0, verify = "T"
                },
                                                                    Filters);

                foreach (DataRow _Row in _ResultSet.Rows)
                {
                    Values.UpdateVerify VerifyModel = null;
                    VerifyModel = addHelp.UPDATE_ENTRY_Verify(_Connect, new Values.UpdateVerify
                    {
                        I_VERIFY_ID       = _Row.Field <long?>("VERIFY_ID"),
                        I_UUID            = _Row.Field <string>("UUID"),
                        I_VERIFIED        = "Y",
                        I_VALIDATION_TYPE = _Row.Field <string>("VALIDATION_TYPE")
                    });
                    verifyId = VerifyModel.O_VERIFY_ID;
                    //er_dml.OBJECT_DML(_Connect, "Update", "VERIFY", "VERIFIED", _Row.Field<Int32>("VERIFY_ID"), new Object_Value { _String = "Y" });
                }

                return("All Validations Disabled");
            }
            catch
            {
                return("Error Disabling Verifications");
            }
        }