Esempio n. 1
0
        public static void RunLambda()
        {
            //1
            Plus plus = (x, y) => x + y;

            Console.WriteLine(plus(20, 55));
            //2
            Square square = z => z * z;

            Console.WriteLine(square(25));
            //3
            Hi hi = () => Console.WriteLine("Hello");

            hi();
            //4
            int           a  = 15;
            ChangeHandler ch = (ref int n) => n *= 8;

            ch(ref a);
            Console.WriteLine(a);
            //5
            Hello message = () => Show_Message();

            message();
            //6
            int[] integers = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            int   result1  = Sum(integers, (x) => x > 5);

            Console.WriteLine(result1);
            int result2 = Sum(integers, (x) => x % 2 == 0);

            Console.WriteLine(result2);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var channel = new Channel("127.0.0.1:50052", ChannelCredentials.Insecure);

            var client = new helloMessage.helloMessageClient(channel);

            Hi hi1 = client.GetFeature(new Hi()
            {
                Count = 100, Say = "Hello 100"
            });

            Console.WriteLine($"Hi count:{hi1.Count},say:{hi1.Say}.");

            Hi hi2 = client.GetFeatureAsync(new Hi()
            {
                Count = 400, Say = "Hello 400"
            }).ResponseAsync.Result;

            Console.WriteLine($"Hi count:{hi2.Count},say:{hi2.Say}.");

            ListPerson2(client).Wait();

            ListPerson4(client).Wait();

            channel.ShutdownAsync().Wait();
            Console.WriteLine("Press any key to exit...");
            //var client = new RouteGuideClient(new Hello.RouteGuideClient(channel));

            Console.Read();
        }
Esempio n. 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Hi.GetHashCode() * 397) ^ Lo.GetHashCode());
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Enlista todos los posibles historiales, variando al jugador II.
        /// El jugador I siempre jugará 0's
        /// </summary>
        /// <returns>Un arreglo enumerando a todos los Historiales.</returns>
        /// <param name="Long">Longitud de las instancias de Historial a mostrar.</param>
        public static Historial[] ObtenerPosiblesHistorias(int Long)
        // TODO: Para evitar iteración, enumerar las historias con 2^Long (las que empiecen con 1 en expansión decimal, y convertirlos a Historiales vía función de Cantor.
        {
            List <Historial> ret = new List <Historial> ();

            if (Long == 0)
            {
                Historial H = new Historial();
                ret.Add(H);
                return(ret.ToArray());
            }
            else
            {
                // Paso recursivo
                Historial[] Iterador = ObtenerPosiblesHistorias(Long - 1);
                foreach (var H in Iterador)                   // Crear una copia para iterar
                {
                    Historial Hi;
                    Hi = (Historial)H.MemberwiseClone();                      // Si no funciona, hacer a Historial IClonable.
                    Hi.AgregaTurno(0, 0);
                    ret.Add(Hi);
                    Hi = (Historial)H.MemberwiseClone();                      // idem
                    Hi.AgregaTurno(0, 1);
                    ret.Add(Hi);
                }
                return(ret.ToArray());
            }
        }
        public void SendAnalyze(bool isEnabled, Hi logEvent, bool isRed = false, IDictionary <string, object> analyzeFields = null)
        {
            if (!isEnabled)
            {
                return;
            }

            var dateNow = DateTime.Now.ToUniversalTime();

            var prefix = "";
            var suffix = "";

            if (isRed)
            {
                prefix = "<color=red>";
                suffix = "</color>";
            }

            var extraValue  = _basicLog.HasExtras() ? prefix + "$$" + dateNow.ToString("u") + " " : "";
            var suffixValue = _basicLog.HasExtras() ? suffix : "";

            var textMessage = extraValue + Enum.GetName(typeof(Hi), logEvent) + suffixValue;

            _basicLog.Log(textMessage, analyzeFields, FinalMessage(textMessage, analyzeFields));
        }
Esempio n. 6
0
 /// <summary>
 /// ���캯��
 /// </summary>
 /// <param name="doRefresh"></param>
 public FrmUserEdit(Hi.Client.BaseForm.BaseFormList.DoRefreshHandler doRefresh)
 {
     InitializeComponent();
     this._DoRefresh = doRefresh;
     bas_org();
     SetModulePurview(this.Name);
 }
 // constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="ScramShaAuthenticator"/> class.
 /// </summary>
 /// <param name="credential">The credential.</param>
 /// <param name="hashAlgorithmName">The hash algorithm name.</param>
 /// <param name="h">The H function to use.</param>
 /// <param name="hi">The Hi function to use.</param>
 /// <param name="hmac">The Hmac function to use.</param>
 protected ScramShaAuthenticator(UsernamePasswordCredential credential,
                                 HashAlgorithmName hashAlgorithmName,
                                 H h,
                                 Hi hi,
                                 Hmac hmac)
     : this(credential, hashAlgorithmName, new DefaultRandomStringGenerator(), h, hi, hmac)
 {
 }
Esempio n. 8
0
    static void Main4()
    {
        Hi hi = () => {
            Console.WriteLine("hellow");
            Console.WriteLine("hi");
        };

        hi();
    }
Esempio n. 9
0
 protected ScramShaAuthenticator(
     UsernamePasswordCredential credential,
     HashAlgorithmName hashAlgorithmName,
     H h,
     Hi hi,
     Hmac hmac)
     : this(credential, hashAlgorithmName, h, hi, hmac, serverApi : null)
 {
 }
    static void Main()
    {
        Hi hi = () =>
        {
            Console.WriteLine("안녕하세요.");
            Console.WriteLine("반갑습니다.");
        };

        hi();
    }
Esempio n. 11
0
    void Start()
    {
        Random.InitState(1672);
        DSP.init();

        material = new Material(Visualizer);

        ac           = new AudioContext(AudioSettings.outputSampleRate);
        ac.clock.BPM = BPM;
        var l = 1.0f / 8;
        var o = 1;

        bassPtn = new List <Note>()
        {
            new Note(l, o, Note.C),
            new Note(l, o, Note.C),
            new Note(l, o, Note.G),
            new Note(l, o, Note.G),

            new Note(l, o, Note.C),
            new Note(l, o, Note.C),
            new Note(l, o, Note.G),
            new Note(l, o, Note.G),

            new Note(l, o, Note.C),
            new Note(l, o, Note.C),
            new Note(l, o, Note.G),
            new Note(l, o, Note.G),

            new Note(l, o, Note.C),
            new Note(l, o + 1, Note.C),
            new Note(l, o + 1, Note.G),
            new Note(l, o + 1, Note.F),
        };

        var oct = Note.Octave;

        padPtn = new List <Code>()
        {
            new Code(2, new int[] { 2 * oct + Note.C, 2 * oct + Note.E, 2 * oct + Note.G }),
            new Code(2, new int[] { 2 * oct + Note.F, 2 * oct + Note.A, 2 * oct + Note.C }),
        };


        //AudioClip myClip = AudioClip.Create("Song", ac.SampleRate * 2 * 8, ac.channels, ac.SampleRate, true, OnAudioRead, OnAudioSetPosition);
        //AudioSource aud = GetComponent<AudioSource>();
        //aud.clip = myClip;
        //aud.Pause();


        bd   = new BD();
        hi   = new Hi();
        bass = new Bass();
        pad  = new HarmoPad();
    }
Esempio n. 12
0
        public override Task <Hi> GetFeature(Hi request, ServerCallContext context)
        {
            //return base.GetFeature(request, context);
            Hi hi1 = request;

            Console.WriteLine($"Hi count:{hi1.Count},say:{hi1.Say}.");
            return(Task.FromResult <Hi>(new Hi()
            {
                Count = hi1.Count + 1, Say = "World!" + hi1.Count
            }));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ScramShaAuthenticator"/> class.
 /// </summary>
 /// <param name="credential">The credential.</param>
 /// <param name="hashAlgorithName">The hash algorithm name.</param>
 /// <param name="randomStringGenerator">The random string generator.</param>
 /// <param name="h">The H function to use.</param>
 /// <param name="hi">The Hi function to use.</param>
 /// <param name="hmac">The Hmac function to use.</param>
 internal ScramShaAuthenticator(
     UsernamePasswordCredential credential,
     HashAlgorithmName hashAlgorithName,
     IRandomStringGenerator randomStringGenerator,
     H h,
     Hi hi,
     Hmac hmac)
     : base(new ScramShaMechanism(credential, hashAlgorithName, randomStringGenerator, h, hi, hmac))
 {
     _databaseName = credential.Source;
 }
        static void Main(string[] args)
        {
            // 여러 줄은 중괄호로 묶음
            Hi hi = () =>
            {
                Console.WriteLine("안녕하세요");
                Console.WriteLine("오랜만입니다");
            };

            hi();
        }
Esempio n. 15
0
        private void HiHandler(Hi arg)
        {
            var sleepActor = Context.ActorOf(Props.Create <SleepActor>());
            var self       = Context.Self;

            sleepActor.Ask(new Sleep(TimeSpan.FromSeconds(2)))
            .ContinueWith(f =>
            {
                Console.WriteLine("Hi");
            }).PipeTo(self);
        }
        private void SendBase <T>(bool isEnabled, Hi logEvent, bool isRed, T logExtra)
        {
            Dictionary <string, object> analyzeFields = null;

            if (logExtra != null)
            {
                analyzeFields = new Dictionary <string, object> {
                    { "extra", logExtra }
                };
            }

            SendAnalyze(isEnabled, logEvent, isRed, analyzeFields);
        }
Esempio n. 17
0
        public void TestLoadHiCfg()
        {
            rasPi.Control.setMultiplexerConfiguration();
            Task.Delay(8000).Wait();
            hiFromFile = getFile().Result;

            Assert.AreEqual("Pure", hiFromFile.Family);

            rasPi.Control.setMultiplexerConfiguration("TestFamily", "TestModel");
            Task.Delay(8000).Wait();
            hiFromFile = getFile().Result;

            Assert.AreEqual("TestFamily", hiFromFile.Family);
        }
Esempio n. 18
0
        public void TestLoadReceiver()
        {
            Hi hiFromFile;

            rasPi.Control.setMultiplexerConfiguration();
            rasPi.Control.SetARDVoltage(ReceiverConfig.HighPowerLeft.Item1);
            Task.Delay(8000).Wait();

            hiFromFile = getFile().Result;

            Assert.AreEqual("Pure", hiFromFile.Family);
            Assert.AreEqual("312 702 S (DN)", hiFromFile.Model);
            Assert.AreEqual(ReceiverConfig.HighPowerLeft.Item1, hiFromFile.CurrentReceiver);
        }
Esempio n. 19
0
        public static void TestPersonVisitor()
        {
            Student student = new Student("Iван", "Iванов", 2);
            Printer printer = new Printer();
            Hi      hi      = new Hi();

            student.Accept(printer);
            student.Accept(hi);

            Professor professor = new Professor("Микола", "Маляр", "Миколайович", "Кiбернетики i прикладної математики");

            professor.Accept(printer);
            professor.Accept(hi);
        }
 public ClientFirst(
     byte[] bytesToSendToServer,
     string clientFirstMessageBare,
     UsernamePasswordCredential credential,
     string rPrefix,
     H h,
     Hi hi,
     Hmac hmac)
 {
     _bytesToSendToServer    = bytesToSendToServer;
     _clientFirstMessageBare = clientFirstMessageBare;
     _credential             = credential;
     _h       = h;
     _hi      = hi;
     _hmac    = hmac;
     _rPrefix = rPrefix;
 }
 public ScramShaMechanism(
     UsernamePasswordCredential credential,
     HashAlgorithmName hashAlgorithmName,
     IRandomStringGenerator randomStringGenerator,
     H h,
     Hi hi,
     Hmac hmac)
 {
     _credential = Ensure.IsNotNull(credential, nameof(credential));
     _h          = h;
     _hi         = hi;
     _hmac       = hmac;
     if (!hashAlgorithmName.ToString().StartsWith("SHA"))
     {
         throw new ArgumentException("Must specify a SHA algorithm.");
     }
     _name = $"SCRAM-SHA-{hashAlgorithmName.ToString().Substring(3)}";
     _randomStringGenerator = Ensure.IsNotNull(randomStringGenerator, nameof(randomStringGenerator));
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Lo != 0UL)
            {
                hash ^= Lo.GetHashCode();
            }
            if (Hi != 0)
            {
                hash ^= Hi.GetHashCode();
            }
            if (SignScale != 0)
            {
                hash ^= SignScale.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 23
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Lo != 0)
            {
                hash ^= Lo.GetHashCode();
            }
            if (Mid != 0)
            {
                hash ^= Mid.GetHashCode();
            }
            if (Hi != 0)
            {
                hash ^= Hi.GetHashCode();
            }
            if (SignScale != 0)
            {
                hash ^= SignScale.GetHashCode();
            }
            return(hash);
        }
Esempio n. 24
0
        public ActionResult Index()
        {
            var viewModel = new Hi();

            return(View(viewModel));
        }
Esempio n. 25
0
 public HttpResponseMessage Post([FromBody] Hi model)
 {
     return(Request.CreateResponse(HttpStatusCode.OK, model));
 }
Esempio n. 26
0
 public MainWindow()
 {
     InitializeComponent();
     Hi.Play();
 }
Esempio n. 27
0
 static void Main(string[] args)
 {
     Hi.SayHello();
 }
Esempio n. 28
0
 public void cleanUp()
 {
     hiFromFile = null;
 }
Esempio n. 29
0
 static void Main(string[] args)
 {
     Console.WriteLine("{0}" , (1 is int));
     Hi hi = new Hi();
     Console.WriteLine("{0}" , (hi is Hi));
 }
Esempio n. 30
0
File: Edit.cs Progetto: TjcJose/Hi
 /// <summary>
 /// ���캯��
 /// </summary>
 /// <param name="doRefresh"></param>
 public Frm$ClassName$Edit(Hi.Client.BaseForm.BaseFormList.DoRefreshHandler doRefresh)
 {
     InitializeComponent();
     this._DoRefresh = doRefresh;
 }
 public void Send(bool isEnabled, Hi logEvent, bool isRed = false, string logExtra = null)
 {
     SendBase(isEnabled, logEvent, isRed, logExtra == "" ? null : logExtra);
 }
 public void Send(bool isEnabled, Hi logEvent, bool isRed, int logExtra)
 {
     SendBase(isEnabled, logEvent, isRed, logExtra);
 }
Esempio n. 33
0
        /// <summary>
        /// 单击事件
        /// </summary>
        private void chk_OnCheckBoxClicked(object sender, Hi.UserControlEx.UcDataGridViewClass.DataGridViewCheckBoxHeaderEventArgs e)
        {
            foreach (DataGridViewRow dgvRow in this.ucdgv.Rows)
            {
                if (e.CheckedState)
                {
                    dgvRow.Cells[e.ColumnsIndex].Value = true;
                    this.ucdgv.Rows[dgvRow.Index].Selected = true;
                }
                else
                {
                    dgvRow.Cells[e.ColumnsIndex].Value = false;
                    this.ucdgv.Rows[dgvRow.Index].Selected = false;
                }

            }
        }