System.Console.WriteLine(float)

Here are the examples of the csharp api System.Console.WriteLine(float) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

31 Examples 7

19 View Source File : Pulse.cs
License : MIT License
Project Creator : aimore

protected override void OnPaintSurface(SKPaintSurfaceEventArgs args)
        {
            base.OnPaintSurface(args);
            SKImageInfo info = args.Info;
            SKSurface surface = args.Surface;
            SKCanvas canvas = surface.Canvas;
            byte R = (byte)(PulseColor.R * 255);
            byte G = (byte)(PulseColor.G * 255);
            byte B = (byte)(PulseColor.B * 255);
            canvas.Clear();
            if (IsRun)
            {
                SKPoint center = new SKPoint(info.Width / 2, info.Height / 2);
                float baseRadius = Math.Min(info.Width, info.Height) / 12;
                float radius = 0;
                Console.WriteLine(radius);
                for (int i = 0; i < t.Length; i++)
                {
                    radius = info.Width / 2 * (t[i]);
                    paint.Color = new SKColor(R, G, B, (byte)(255 * (1 - t[i])));
                    paint.Style = SKPaintStyle.Fill;
                    canvas.DrawCircle(center.X, center.Y, radius, paint);
                }

                paint.Color = new SKColor(R, G, B);
                canvas.DrawCircle(center.X, center.Y, 100, paint);

                if (resourceBitmap != null)
                    canvas.DrawBitmap(resourceBitmap, center.X - resourceBitmap.Width / 2, center.Y - resourceBitmap.Height / 2);
            }
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : altimesh

unsafe static void Main(string[] args)
        {
            int nStreams = 8;
            cudaStream_t[] streams = new cudaStream_t[nStreams];
            HybRunner[] runners = new HybRunner[nStreams];
            dynamic[] wrapped = new dynamic[nStreams];
            cudaDeviceProp prop;
            cuda.GetDeviceProperties(out prop, 0);
            for (int k = 0; k < nStreams; ++k)
            {
                cuda.StreamCreate(out streams[k]);

                runners[k] = HybRunner.Cuda("Streams_CUDA.dll", streams[k], CudaMarshaler.Instance).SetDistrib(16 * prop.multiProcessorCount, 128);
                wrapped[k] = runners[k].Wrap(new Program());
            }

            int N = 1024 * 1024 * 32;
            IntPtr d_a, d_b; // device pointers
            float[] a = new float[N];
            float[] b = new float[N];

            cuda.Malloc(out d_a, N * sizeof(float));
            cuda.Malloc(out d_b, N * sizeof(float));

            for(int k = 0; k < N; ++k)
            {
                a[k] = (float)k;
                b[k] = 1.0F;
            }

            GCHandle handle_a = GCHandle.Alloc(a, GCHandleType.Pinned);
            GCHandle handle_b = GCHandle.Alloc(b, GCHandleType.Pinned);
            IntPtr h_a = handle_a.AddrOfPinnedObject();
            IntPtr h_b = handle_b.AddrOfPinnedObject();

            int slice = N / nStreams;

            cuda.DeviceSynchronize();

            cuda.Memcpy(d_a, h_a, N * sizeof(float), cudaMemcpyKind.cudaMemcpyHostToDevice);
            cuda.Memcpy(d_b, h_b, N * sizeof(float), cudaMemcpyKind.cudaMemcpyHostToDevice);

            for (int k = 0; k < nStreams; ++k)
            {
                int start = k * slice;
                int stop = start + slice;
                wrapped[k].Add(d_a, d_b, start, stop, 100);
            }
            for (int k = 0; k < nStreams; ++k)
            {
                int start = k * slice;
                cuda.MemcpyAsync(h_a + start * sizeof(float), d_a + start * sizeof(float), slice * sizeof(float), cudaMemcpyKind.cudaMemcpyDeviceToHost, streams[k]);
            }

            for (int k = 0; k < nStreams; ++k)
            {
                cuda.StreamSynchronize(streams[k]);
                cuda.StreamDestroy(streams[k]);
            }

            for(int k = 0; k < 10; ++k)
            {
                Console.WriteLine(a[k]);
            }

            handle_a.Free();
            handle_b.Free();
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : altimesh

unsafe static void Main(string[] args)
        {
            int nStreams = 8;
            cudaStream_t[] streams = new cudaStream_t[nStreams];
            dynamic wrapped = HybRunner.Cuda().Wrap(new Program());
            for (int k = 0; k < nStreams; ++k)
            {
                cuda.StreamCreate(out streams[k]);
            }

            int N = 1024 * 1024 * 32;
            IntPtr d_a, d_b; // device pointers
            float[] a = new float[N];
            float[] b = new float[N];

            cuda.Malloc(out d_a, N * sizeof(float));
            cuda.Malloc(out d_b, N * sizeof(float));

            for(int k = 0; k < N; ++k)
            {
                a[k] = (float)k;
                b[k] = 1.0F;
            }

            GCHandle handle_a = GCHandle.Alloc(a, GCHandleType.Pinned);
            GCHandle handle_b = GCHandle.Alloc(b, GCHandleType.Pinned);
            IntPtr h_a = handle_a.AddrOfPinnedObject();
            IntPtr h_b = handle_b.AddrOfPinnedObject();

            int slice = N / nStreams;

            cuda.DeviceSynchronize();

            cuda.Memcpy(d_a, h_a, N * sizeof(float), cudaMemcpyKind.cudaMemcpyHostToDevice);
            cuda.Memcpy(d_b, h_b, N * sizeof(float), cudaMemcpyKind.cudaMemcpyHostToDevice);
            
            for (int k = 0; k < nStreams; ++k)
            {
                int start = k * slice;
                int stop = start + slice;
                wrapped.SetStream(streams[k]).Add(d_a, d_b, start, stop, 100);
            }

            for (int k = 0; k < nStreams; ++k)
            {
                int start = k * slice;
                cuda.MemcpyAsync(h_a + start * sizeof(float), d_a + start * sizeof(float), slice * sizeof(float), cudaMemcpyKind.cudaMemcpyDeviceToHost, streams[k]);
            }

            for (int k = 0; k < nStreams; ++k)
            {
                cuda.StreamSynchronize(streams[k]);
                cuda.StreamDestroy(streams[k]);
            }

            for(int k = 0; k < 10; ++k)
            {
                Console.WriteLine(a[k]);
            }

            handle_a.Free();
            handle_b.Free();
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : altimesh

public static void ConjugateGradient(FloatResidentArray X, SparseMatrix A, FloatResidentArray B, int maxiter, float eps)
        {
            float[] scalBuf = new float[1] { 0 };
            int N = (int) B.Count;
            FloatResidentArray R = new FloatResidentArray(N);
            FloatResidentArray P = new FloatResidentArray(N);
            FloatResidentArray AP = new FloatResidentArray(N);
            A.RefreshDevice();
            X.RefreshDevice();
            B.RefreshDevice();

            wrapper.Fmsub(R, B, A, X, N);                       // R = B - A*X
            wrapper.Copy(P, R, N); 
            int k = 0;
            while(k < maxiter)
            {
                wrapper.Multiply(AP, A, P, N);                  // AP = A*P
                scalBuf[0] = 0; wrapper.ScalarProd(scalBuf, R, R, N); float r = scalBuf[0];               // save <R|R>
                scalBuf[0] = 0; wrapper.ScalarProd(scalBuf, P, AP, N); float alpha = r / scalBuf[0];       // alpha = <R|R> / <P|AP>
                wrapper.Saxpy(X, X, alpha, P, N);               // X = X - alpha*P
                wrapper.Saxpy(R, R, -alpha, AP, N);             // RR = R-alpha*AP
                scalBuf[0] = 0; wrapper.ScalarProd(scalBuf, R, R, N); float rr = scalBuf[0];
                if (k % 10 == 0)
                    Console.WriteLine(rr);
                if(rr < eps*eps)
                {
                    break;
                }

                float beta = rr / r;
                wrapper.Saxpy(P, R, beta, P, N);                // P = R + beta*P
                ++k;
            }

            X.RefreshHost();
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : anastasios-stamoulis

void evaluate_naive_method(float[][] float_data) {
      var gi = create_generators(float_data);
      var batch_maes = new List<float>();
      var val_enumerator = gi.val_gen.GetEnumerator();

      for (int i = 0; i < gi.val_steps; i++) {
        if (val_enumerator.MoveNext() == false) { break; }
        var st = val_enumerator.Current;
        var num_samples_in_batch = st.num_strides * float_data[0].Length;
        var offset = (st.num_strides - 1) * float_data[0].Length + 1;
        var preds = Enumerable.Range(0, gi.batch_size).Select(x => st.samples[x * num_samples_in_batch + offset]);
        var mae = preds.Zip(st.targets, (l, n) => Math.Abs(l - n)).Average();
        batch_maes.Add(mae);
      }
      var mean_batch_maes = batch_maes.Average();
      Console.WriteLine(mean_batch_maes);
    }

19 View Source File : Program.cs
License : MIT License
Project Creator : anupavanm

static void Main(string[] args)
    {
      var stations = new StationList();
      var station1 = new RadioStation(89);
      stations.Add(station1);

      var station2 = new RadioStation(101);
      stations.Add(station2);

      var station3 = new RadioStation(102);
      stations.Add(station3);

      foreach (var x in stations)
      {
        Console.Write(x.GetFrequecy());
      }

      var q = stations.Where(x => x.GetFrequecy() == 89).FirstOrDefault();
      Console.WriteLine(q.GetFrequecy());

      Console.ReadLine();
    }

19 View Source File : ConsoleOutput.cs
License : MIT License
Project Creator : bartoszgolek

public void WriteLine(float value)
        {
            Console.WriteLine(value);
        }

19 View Source File : TimeChanger.cs
License : GNU General Public License v3.0
Project Creator : davda54

public static float GetRelativeTimeChange(Model midi, int frameRateMillis)
        {
            var notes = midi.EventsOfType<NoteOn>().Where(n => n.Volume > 0).OrderBy(note => note.AbsoluteRealTime).ToList();
            var rate = frameRateMillis;

            var diff = GetSmallestImportantDifference(notes, frameRateMillis);
            Console.WriteLine(diff);
            if (diff == 0) return 1;

            var low = ((int)diff / rate) * rate;
            var high = ((int)diff / rate + 1) * rate;

            int closer = low == 0 || high - diff < diff - low ? high : low;

            return closer / diff;
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : Ezzpify

public static int Main()
        {
            //Environment.SetEnvironmentVariable("SteamAppId", "730");

            Console.Write("Loading Steam2 and Steam3... ");

            if (Steamworks.Load(true))
            {
                Console.WriteLine("Ok");
            }
            else
            {
                Console.WriteLine("Failed");
                return -1;
            }

            Console.WriteLine("\nSteam2 tests:");

            ISteam006 steam006 = Steamworks.CreateSteamInterface<ISteam006>();
            if (steam006 == null)
            {
                Console.WriteLine("steam006 is null !");
                return -1;
            }


            TSteamError steamError = new TSteamError();
            

            Console.Write("GetVersion: ");
            StringBuilder version = new StringBuilder();
            if(steam006.GetVersion(version) != 0)
            {
                Console.WriteLine("Ok (" + version.ToString() + ")");
            }
            else
            {
                Console.WriteLine("Failed");
                return -1;
            }

            steam006.ClearError(ref steamError);

            Console.Write("Startup: ");
            if(steam006.Startup(0, ref steamError) != 0)
            {
                Console.WriteLine("Ok");
            }
            else
            {
                Console.WriteLine("Failed (" + steamError.szDesc + ")");
                return -1;
            }

            Console.Write("OpenTmpFile: ");
            uint hFile = 0;
            if((hFile = steam006.OpenTmpFile(ref steamError)) != 0)
            {
                Console.WriteLine("Ok");
            }
            else
            {
                Console.WriteLine("Failed (" + steamError.szDesc + ")");
                return -1;
            }

            Console.Write("WriteFile: ");
            byte[] fileContent = System.Text.UTF8Encoding.UTF8.GetBytes("test");
            if(steam006.WriteFile(fileContent, (uint)fileContent.Length, hFile, ref steamError) == fileContent.Length)
            {
                Console.WriteLine("Ok");
            }
            else
            {
                Console.WriteLine("Failed (" + steamError.szDesc + ")");
                return -1;
            }

            Console.Write("CloseFile: ");
            if(steam006.CloseFile(hFile, ref steamError) == 0)
            {
                Console.WriteLine("Ok");
            }
            else
            {
                Console.WriteLine("Failed (" + steamError.szDesc + ")");
                return -1;
            }

            Console.WriteLine("\nSteam3 tests:");

            ISteamClient012 steamclient = Steamworks.CreateInterface<ISteamClient012>();
            ISteamClient009 steamclient9 = Steamworks.CreateInterface<ISteamClient009>();
            if (steamclient == null)
            {
                Console.WriteLine("steamclient is null !");
                return -1;
            }

            IClientEngine clientengine = Steamworks.CreateInterface<IClientEngine>();
            if (clientengine == null)
            {
                Console.WriteLine("clientengine is null !");
                return -1;
            }

            int pipe = steamclient.CreateSteamPipe();
            if (pipe == 0)
            {
                Console.WriteLine("Failed to create a pipe");
                return -1;
            }

            int user = steamclient.ConnectToGlobalUser(pipe);
            if (user == 0 || user == -1)
            {
                Console.WriteLine("Failed to connect to global user");
                return -1;
            }

            ISteamUser016 steamuser = steamclient.GetISteamUser<ISteamUser016>(user, pipe);
            if (steamuser == null)
            {
                Console.WriteLine("steamuser is null !");
                return -1;
            }
            ISteamUtils005 steamutils = steamclient.GetISteamUtils<ISteamUtils005>(pipe);
            if (steamutils == null)
            {
                Console.WriteLine("steamutils is null !");
                return -1;
            }
            ISteamUserStats002 userstats002 = steamclient.GetISteamUserStats<ISteamUserStats002>(user, pipe);
            if (userstats002 == null)
            {
                Console.WriteLine("userstats002 is null !");
                return -1;
            }
            ISteamUserStats010 userstats010 = steamclient.GetISteamUserStats<ISteamUserStats010>(user, pipe);
            if (userstats010 == null)
            {
                Console.WriteLine("userstats010 is null !");
                return -1;
            }
            IClientUser clientuser = clientengine.GetIClientUser<IClientUser>(user, pipe);
            if (clientuser == null)
            {
                Console.WriteLine("clientuser is null !");
                return -1;
            }
            IClientFriends clientfriends = clientengine.GetIClientFriends<IClientFriends>(user, pipe);
            if (clientfriends == null)
            {
                Console.WriteLine("clientfriends is null !");
                return -1;
            }

            //Console.Write("RequestCurrentStats: ");
            //if (userstats002.RequestCurrentStats(steamutils.GetAppID()))
            //{
            //    Console.WriteLine("Ok");
            //}
            //else
            //{
            //    Console.WriteLine("Failed");
            //    return -1;
            //}

            uint a = steam006.RequestAccountsByEmailAddressEmail("[email protected]", ref steamError);
            //Console.WriteLine(steamError.nDetailedErrorCode);
            //Console.ReadLine();

            Console.Write("Waiting for stats... ");

            CallbackMsg_t callbackMsg = new CallbackMsg_t();
            bool statsReceived = false;
            while (!statsReceived)
            {
                while (Steamworks.GetCallback(pipe, ref callbackMsg) && !statsReceived)
                {
                    Console.WriteLine(callbackMsg.m_iCallback);
                    if (callbackMsg.m_iCallback == UserStatsReceived_t.k_iCallback)
                    {
                        UserStatsReceived_t userStatsReceived = (UserStatsReceived_t)Marshal.PtrToStructure(callbackMsg.m_pubParam, typeof(UserStatsReceived_t));
                        if (userStatsReceived.m_steamIDUser == steamuser.GetSteamID() && userStatsReceived.m_nGameID == steamutils.GetAppID())
                        {
                            if (userStatsReceived.m_eResult == EResult.k_EResultOK)
                            {
                                Console.WriteLine("Ok");
                                statsReceived = true;
                            }
                            else
                            {
                                Console.WriteLine("Failed (" + userStatsReceived.m_eResult + ")");
                                return -1;
                            }
                        }
                    }
                    Steamworks.FreeLastCallback(pipe);
                }
                System.Threading.Thread.Sleep(100);
            }

            Console.WriteLine("Stats for the current game :");
            uint numStats = userstats002.GetNumStats(steamutils.GetAppID());
            for (uint i = 0; i < numStats; i++)
            {
                string statName = userstats002.GetStatName(steamutils.GetAppID(), i);
                ESteamUserStatType statType = userstats002.GetStatType(steamutils.GetAppID(), statName);
                switch (statType)
                {
                    case ESteamUserStatType.k_ESteamUserStatTypeINT:
                        {
                            int value = 0;
                            Console.Write("\t" + statName + " ");
                            if (userstats002.GetStat(steamutils.GetAppID(), statName, ref value))
                            {
                                Console.WriteLine(value);
                            }
                            else
                            {
                                Console.WriteLine("Failed");
                                return -1;
                            }

                            break;
                        }
                    case ESteamUserStatType.k_ESteamUserStatTypeFLOAT:
                        {
                            float value = 0;
                            Console.Write("\t" + statName + " ");
                            if (userstats002.GetStat(steamutils.GetAppID(), statName, ref value))
                            {
                                Console.WriteLine(value);
                            }
                            else
                            {
                                Console.WriteLine("Failed");
                                return -1;
                            }
                            break;
                        }
                }
            }

            Console.Write("GetNumberOfCurrentPlayers: ");
            ulong getNumberOfCurrentPlayersCall = userstats010.GetNumberOfCurrentPlayers();
            bool failed = false;
            while (!steamutils.IsAPICallCompleted(getNumberOfCurrentPlayersCall, ref failed) && !failed)
            {
                System.Threading.Thread.Sleep(100);
            }

            if (failed)
            {
                Console.WriteLine("Failed (IsAPICallCompleted failure)");
                return -1;
            }

            IntPtr pData = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NumberOfCurrentPlayers_t)));

            if (!Steamworks.GetAPICallResult(pipe, getNumberOfCurrentPlayersCall, pData, Marshal.SizeOf(typeof(NumberOfCurrentPlayers_t)), NumberOfCurrentPlayers_t.k_iCallback, ref failed))
            {
                Console.WriteLine("Failed (GetAPICallResult failure: " + steamutils.GetAPICallFailureReason(getNumberOfCurrentPlayersCall) + ")");
                return -1;
            }

            NumberOfCurrentPlayers_t numberOfCurrentPlayers = (NumberOfCurrentPlayers_t)Marshal.PtrToStructure(pData, typeof(NumberOfCurrentPlayers_t));
            if (!System.Convert.ToBoolean(numberOfCurrentPlayers.m_bSuccess))
            {
                Console.WriteLine("Failed (numberOfCurrentPlayers.m_bSuccess is false)");
                return -1;
            }
            Console.WriteLine("Ok (" + numberOfCurrentPlayers.m_cPlayers + ")");

            Marshal.FreeHGlobal(pData);


            //Console.Write("Games running: ");
            //for(int i = 0; i < clientuser.NumGamesRunning(); i++)
            //{
            //    CGameID gameID = clientuser.GetRunningGameID(i);
            //    Console.Write(gameID);
            //    if(i + 1 < clientuser.NumGamesRunning())
            //        Console.Write(", ");
            //    else
            //        Console.Write("\n");
            //}

            Console.WriteLine("Current user SteamID: " + steamuser.GetSteamID());

            FriendSessionStateInfo_t sessionStateInfo = clientfriends.GetFriendSessionStateInfo(clientuser.GetSteamID());

            clientfriends.SetPersonaState(EPersonaState.k_EPersonaStateAway);

            Console.WriteLine("m_uiOnlineSessionInstances: " + sessionStateInfo.m_uiOnlineSessionInstances);
            Console.WriteLine("m_uiPublishedToFriendsSessionInstance: " + sessionStateInfo.m_uiPublishedToFriendsSessionInstance);

            Console.Write("RequestFriendProfileInfo: ");
            ulong requestFriendProfileInfoCall = clientfriends.RequestFriendProfileInfo(steamuser.GetSteamID());

            while (!steamutils.IsAPICallCompleted(requestFriendProfileInfoCall, ref failed) && !failed)
            {
                System.Threading.Thread.Sleep(100);
            }

            if (failed)
            {
                Console.WriteLine("Failed (IsAPICallCompleted failure)");
                return -1;
            }

            pData = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(FriendProfileInfoResponse_t)));

            if (!Steamworks.GetAPICallResult(pipe, requestFriendProfileInfoCall, pData, Marshal.SizeOf(typeof(FriendProfileInfoResponse_t)), FriendProfileInfoResponse_t.k_iCallback, ref failed))
            {
                Console.WriteLine("Failed (GetAPICallResult failure: " + steamutils.GetAPICallFailureReason(requestFriendProfileInfoCall) + ")");
                return -1;
            }

            FriendProfileInfoResponse_t friendProfileInfoResponse = (FriendProfileInfoResponse_t)Marshal.PtrToStructure(pData, typeof(FriendProfileInfoResponse_t));
            if (friendProfileInfoResponse.m_eResult != EResult.k_EResultOK)
            {
                Console.WriteLine("Failed (friendProfileInfoResponse.m_eResult = " + friendProfileInfoResponse.m_eResult + ")");
                return -1;
            }
            if (friendProfileInfoResponse.m_steamIDFriend == clientuser.GetSteamID())
            {
                Console.WriteLine("Ok");
            }
            else
            {
                Console.WriteLine("Failed (SteamIDs doesn't match)");
            }

            Marshal.FreeHGlobal(pData);

            return 0;
        }

19 View Source File : EntityTest.cs
License : GNU Lesser General Public License v3.0
Project Creator : faib920

[TestMethod]
        public void TestGetProperty2()
        {
            var pp = PropertyUnity.GetProperty(typeof(PA1), "Name");
            replacedert.IsNull(pp);

            var p = (PropertyValue)1;
            PropertyValue e = (TestAA)(int)p;
            Console.WriteLine(e);

            var a = (PropertyValue)TestAA.BB;
            var b = (float)a;
            Console.WriteLine(b);
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : faruknane

public unsafe static void XORExample()
        {
            //Hyperparameters
            Hyperparameters.LearningRate = 0.1f;
            Hyperparameters.Optimizer = new SGD();

            //Model Creation
            var l1 = LayerBuilder.Dense(16, "sigmoid");
            var l2 = LayerBuilder.Dense(1, "sigmoid")[l1];


            var x = new Input(2);
            Layer model = l2[x];

            //Loss Function Creation
            var y = new Input(1);
            var loss = LayerBuilder.SquaredError(model, y);


            //Data preparation
            Tensor x_train = new Tensor((1, 4, 2), DeviceConfig.Host_Float);
            Tensor y_train = new Tensor((1, 4, 1), DeviceConfig.Host_Float);

            float* xt = (float*)x_train.Array;
            float* yt = (float*)y_train.Array;

            // 1,1 = 0
            // 1,0 = 1
            // 0,1 = 1
            // 0,0 = 0

            xt[0] = 1; xt[1] = 1;
            xt[2] = 1; xt[3] = 0;
            xt[4] = 0; xt[5] = 1;
            xt[6] = 0; xt[7] = 0;

            yt[0] = 0;
            yt[1] = 1;
            yt[2] = 1;
            yt[3] = 0;

            //Give data to the model
            x.SetInput(x_train);
            y.SetInput(y_train);

            Stopwatch s = new Stopwatch();
            s.Start();
            //Minimizing
            loss.PreCheck();
            Index a = new Index(model.OuterShape);
            a.SetZero();

            for (int epoch = 0; epoch < 100000; epoch++)
            {
                loss.Minimize();
                if (epoch % 5000 == 0)
                {
                    float res = ((float*)loss.GetTerm(a).GetResult().Array)[0];
                    res += ((float*)loss.GetTerm(a).GetResult().Array)[1];
                    res += ((float*)loss.GetTerm(a).GetResult().Array)[2];
                    res += ((float*)loss.GetTerm(a).GetResult().Array)[3];
                    Console.WriteLine(res);
                }
            }
            s.Stop();
            Console.WriteLine("Time Elapsed: " + s.ElapsedMilliseconds);

            //Print Pools
            PrintPools();

            //Print the results

            var result = model.GetTerm(a).GetResult();
            Console.WriteLine("Results: " + result);


            //Print the results of clone model
            Input x2 = new Input(2);
            x2.SetInput(x_train);
            var clonemodel = l2[x2];
            clonemodel.PreCheck();
            var result2 = clonemodel.GetTerm(a).GetResult();
            Console.WriteLine("Results: " + result2);

            clonemodel.DeleteTerms();
            model.DeleteTerms();
        }

19 View Source File : Methods2-Goal.cs
License : MIT License
Project Creator : GridProtectionAlliance

static void Main(string[] args)
        {
            var f = (MyFloat)(-Math.Sqrt(2));

            Console.WriteLine(f.Abs());
        }

19 View Source File : Program.cs
License : GNU Affero General Public License v3.0
Project Creator : josephworks

static void Main(string[] args)
        {
            Console.Beep();
            Console.WriteLine("Maximum Value: " + int.MaxValue);
            Console.WriteLine("Minimum Value: " + int.MinValue);
            Console.ReadLine();
            byte x = 1;
            sbyte y = 2;
            //char z = 3;
            //decimal d = 9.954758945;
            double b = 22;
            float f = 33;
            int i = 123;
            uint u = 2334;
            long l = 123456789;
            ulong e = 12345678;
            short s = 255;
            ushort h = 12;
            WriteLine(x);
            WriteLine(y);
            //WriteLine(z);
            //WriteLine(d);
            WriteLine(b);
            WriteLine(f);
            WriteLine(i);
            WriteLine(u);
            WriteLine(l);
            WriteLine(e);
            WriteLine(s);
            WriteLine(h);
            //WriteLine("My salary is: " + "{0:c}"+d,f,1);
            ReadLine();
        }

19 View Source File : Program.cs
License : GNU Affero General Public License v3.0
Project Creator : josephworks

public static void Syntax()
        {
            // Use Console.WriteLine to print lines
            Console.WriteLine("Hello World");
            Console.WriteLine(
                "Integer: " + 10 +
                " Double: " + 3.14 +
                " Boolean: " + true);

            // To print without a new line, use Console.Write
            Console.Write("Hello ");
            Console.Write("World");

            ///////////////////////////////////////////////////
            // Types & Variables
            //
            // Declare a variable using <type> <name>
            ///////////////////////////////////////////////////

            // Sbyte - Signed 8-bit integer
            // (-128 <= sbyte <= 127)
            sbyte fooSbyte = 100;
            Console.WriteLine(fooSbyte);

            // Byte - Unsigned 8-bit integer
            // (0 <= byte <= 255)
            byte fooByte = 100;
            Console.WriteLine(fooByte);

            // Short - 16-bit integer
            // Signed - (-32,768 <= short <= 32,767)
            // Unsigned - (0 <= ushort <= 65,535)
            short fooShort = 10000;
            ushort fooUshort = 10000;
            Console.WriteLine(fooShort);
            Console.WriteLine(fooUshort);

            // Integer - 32-bit integer
            int fooInt = 1; // (-2,147,483,648 <= int <= 2,147,483,647)
            uint fooUint = 1; // (0 <= uint <= 4,294,967,295)
            Console.WriteLine(fooInt);
            Console.WriteLine(fooUint);

            // Long - 64-bit integer
            long fooLong = 100000L; // (-9,223,372,036,854,775,808 <= long <= 9,223,372,036,854,775,807)
            ulong fooUlong = 100000L; // (0 <= ulong <= 18,446,744,073,709,551,615)
            Console.WriteLine(fooLong);
            Console.WriteLine(fooUlong);
            // Numbers default to being int or uint depending on size.
            // L is used to denote that this variable value is of type long or ulong

            // Double - Double-precision 64-bit IEEE 754 Floating Point
            double fooDouble = 123.4; // Precision: 15-16 digits
            Console.WriteLine(fooDouble);

            // Float - Single-precision 32-bit IEEE 754 Floating Point
            float fooFloat = 234.5f; // Precision: 7 digits
            Console.WriteLine(fooFloat);
            // f is used to denote that this variable value is of type float

            // Decimal - a 128-bits data type, with more precision than other floating-point types,
            // suited for financial and monetary calculations
            decimal fooDecimal = 150.3m;
            Console.WriteLine(fooDecimal);

            // Boolean - true & false
            bool fooBoolean = true; // or false
            Console.WriteLine(fooBoolean);

            // Char - A single 16-bit Unicode character
            char fooChar = 'A';
            Console.WriteLine(fooChar);

            // Strings -- unlike the previous base types which are all value types,
            // a string is a reference type. That is, you can set it to null
            string fooString = "\"escape\" quotes and add \n (new lines) and \t (tabs)";
            Console.WriteLine(fooString);

            // You can access each character of the string with an indexer:
            char charFromString = fooString[1]; // => 'e'
            // Strings are immutable: you can't do fooString[1] = 'X';

            // Compare strings with current culture, ignoring case
            string.Compare(fooString, "x", StringComparison.CurrentCultureIgnoreCase);

            // Formatting, based on sprintf
            string fooFs = string.Format("Check Check, {0} {1}, {0} {1:0.0}", 1, 2);

            // Dates & Formatting
            DateTime fooDate = DateTime.Now;
            Console.WriteLine(fooDate.ToString("hh:mm, dd MMM yyyy"));

            // Verbatim String
            // You can use the @ symbol before a string literal to escape all characters in the string
            string path = "C:\\Users\\User\\Desktop";
            string verbatimPath = @"C:\Users\User\Desktop";
            Console.WriteLine(path == verbatimPath);  // => true

            // You can split a string over two lines with the @ symbol. To escape " use ""
            string bazString = @"Here's some stuff
on a new line! ""Wow!"", the mreplacedes cried";
            Console.WriteLine(bazString);

            // Use const or read-only to make a variable immutable
            // const values are calculated at compile time
            const int hoursWorkPerWeek = 9001;
            Console.WriteLine(hoursWorkPerWeek);

            ///////////////////////////////////////////////////
            // Data Structures
            ///////////////////////////////////////////////////

            // Arrays - zero indexed
            // The array size must be decided upon declaration
            // The format for declaring an array is follows:
            // <datatype>[] <var name> = new <datatype>[<array size>];
            int[] intArray = new int[10];

            // Another way to declare & initialize an array
            int[] y = { 9000, 1000, 1337 };

            // Indexing an array - Accessing an element
            Console.WriteLine("intArray @ 0: " + intArray[0]);
            // Arrays are mutable.
            intArray[1] = 1;

            // Lists
            // Lists are used more frequently than arrays as they are more flexible
            // The format for declaring a list is follows:
            // List<datatype> <var name> = new List<datatype>();
            List<int> intList = new List<int>();
            List<string> stringList = new List<string>();
            List<int> z = new List<int> { 9000, 1000, 1337 }; // initialize
            // The <> are for generics - Check out the cool stuff section

            // Lists don't default to a value;
            // A value must be added before accessing the index
            intList.Add(1);
            Console.WriteLine("intList @ 0: " + intList[0]);

            // Others data structures to check out:
            // Stack/Queue
            // Dictionary (an implementation of a hash map)
            // HashSet
            // Read-only Collections
            // Tuple (.Net 4+)

            ///////////////////////////////////////
            // Operators
            ///////////////////////////////////////
            Console.WriteLine("\n->Operators");

            int i1 = 1, i2 = 2; // Shorthand for multiple declarations

            // Arithmetic is straightforward
            Console.WriteLine(i1 + i2 - i1 * 3 / 7); // => 3

            // Modulo
            Console.WriteLine("11%3 = " + (11 % 3)); // => 2

            // Comparison operators
            Console.WriteLine("3 == 2? " + (3 == 2)); // => false
            Console.WriteLine("3 != 2? " + (3 != 2)); // => true
            Console.WriteLine("3 > 2? " + (3 > 2)); // => true
            Console.WriteLine("3 < 2? " + (3 < 2)); // => false
            Console.WriteLine("2 <= 2? " + (2 <= 2)); // => true
            Console.WriteLine("2 >= 2? " + (2 >= 2)); // => true

            // Bitwise operators!
            /*
            ~       Unary bitwise complement
            <<      Signed left shift
            >>      Signed right shift
            &       Bitwise AND
            ^       Bitwise exclusive OR
            |       Bitwise inclusive OR
            */

            // Incrementations
            int i = 0;
            Console.WriteLine("\n->Inc/Dec-rementation");
            Console.WriteLine(i++); //Prints "0", i = 1. Post-Incrementation
            Console.WriteLine(++i); //Prints "2", i = 2. Pre-Incrementation
            Console.WriteLine(i--); //Prints "2", i = 1. Post-Decrementation
            Console.WriteLine(--i); //Prints "0", i = 0. Pre-Decrementation

            ///////////////////////////////////////
            // Control Structures
            ///////////////////////////////////////
            Console.WriteLine("\n->Control Structures");

            // If statements are c-like
            int j = 10;
            if (j == 10)
            {
                Console.WriteLine("I get printed");
            }
            else if (j > 10)
            {
                Console.WriteLine("I don't");
            }
            else
            {
                Console.WriteLine("I also don't");
            }

            // Ternary operators
            // A simple if/else can be written as follows
            // <condition> ? <true> : <false>
            int toCompare = 17;
            string isTrue = toCompare == 17 ? "True" : "False";

            // While loop
            int fooWhile = 0;
            while (fooWhile < 100)
            {
                // Iterated 100 times, fooWhile 0->99
                fooWhile++;
            }

            // Do While Loop
            int fooDoWhile = 0;
            do
            {
                // Start iteration 100 times, fooDoWhile 0->99
/*
                if (false)
                    continue; // skip the current iteration
*/

                fooDoWhile++;

                if (fooDoWhile == 50)
                    break; // breaks from the loop completely
            } while (fooDoWhile < 100);

            // for loop structure => for(<start_statement>; <conditional>; <step>)
            for (int fooFor = 0; fooFor < 10; fooFor++)
            {
                // Iterated 10 times, fooFor 0->9
            }

            // For Each Loop
            // foreach loop structure => foreach(<iteratorType> <iteratorName> in <enumerable>)
            // The foreach loop loops over any object implementing IEnumerable or IEnumerable<T>
            // All the collection types (Array, List, Dictionary...) in the .Net framework
            // implement one or both of these interfaces.
            // (The ToCharArray() could be removed, because a string also implements IEnumerable)
            foreach (char character in "Hello World".ToCharArray())
            {
                // Iterated over all the characters in the string
            }

            // Switch Case
            // A switch works with the byte, short, char, and int data types.
            // It also works with enumerated types (discussed in Enum Types),
            // the String clreplaced, and a few special clreplacedes that wrap
            // primitive types: Character, Byte, Short, and Integer.
            //int month = 3;
            //string monthString;
            //switch (month)
            //{
            //    case 1:
            //        monthString = "January";
            //        break;

            //    case 2:
            //        monthString = "February";
            //        break;

            //    case 3:
            //        monthString = "March";
            //        break;
            //    // You can replacedign more than one case to an action
            //    // But you can't add an action without a break before another case
            //    // (if you want to do this, you would have to explicitly add a goto case x
            //    case 6:
            //    case 7:
            //    case 8:
            //        monthString = "Summer time!!";
            //        break;

            //    default:
            //        monthString = "Some other month";
            //        break;
            //}

            ///////////////////////////////////////
            // Converting Data Types And Typecasting
            ///////////////////////////////////////

            // Converting data

            // Convert String To Integer
            // this will throw a FormatException on failure
            int.Parse("123"); // returns an integer version of "123"

            // try parse will default to type default on failure
            // in this case: 0
            int tryInt;
            if (int.TryParse("123", out tryInt)) // Function is boolean
                Console.WriteLine(tryInt);       // 123

            // Convert Integer To String
            // Convert clreplaced has a number of methods to facilitate conversions
            Convert.ToString(123);
            // or
            tryInt.ToString();

            // Casting
            // Cast decimal 15 to an int
            // and then implicitly cast to long
            long x = (int)15M;
            Console.WriteLine(x);
        }

19 View Source File : VedioRecord.xaml.cs
License : GNU General Public License v2.0
Project Creator : kiba518

private void DisplayVideo(IntPtr userdata, IntPtr picture)
        {
            // Invalidates the bitmap
            this.Dispatcher.BeginInvoke((Action)(() =>
            {
                (this.VlcControl.SourceProvider.VideoSource as InteropBitmap)?.Invalidate();
                Console.WriteLine(GetCurrentTime());  
            })); 
        }

19 View Source File : HueSaturationAdjuster.cs
License : GNU General Public License v3.0
Project Creator : KillzXGaming

private void UpdateImage()
        {
            Console.WriteLine(hue);
            Console.WriteLine(saturation);
            Console.WriteLine(brightness);

            Thread = new Thread((ThreadStart)(() =>
            {
                NewImage = BitmapExtension.HueStaturationBrightnessScale(
                    ActiveImage, true, true, true, hue * 2, saturation, brightness);

                pictureBox.Image = NewImage;
            }));
            Thread.Start();
        }

19 View Source File : Installer.cs
License : GNU General Public License v3.0
Project Creator : kres0345

private void InstallSoftware(Package software)
        {
            switch (software)
            {
                case Package.Metasploit:
                    Process.Start("https://windows.metasploit.com/metasploitframework-latest.msi");
                    break;
                case Package.PythonWrapper:
                    if (!Directory.Exists(systemroot + @"metagui\Extensions\Python-Enwrapper"))
                    {
                        //CreateBasicFolders();
                        /*
                        Directory.CreateDirectory(systemroot + @"metagui\Extensions\Python-Enwrapper");
                        pythonwrapperstatus.Text = "Downloading...";
                        var url = "https://github.com/kres0345/Metasploit-windows-GUI/raw/master/Extensions/Python-Enwrapper/Enwrapper.exe";
                        var url2 = "https://raw.githubusercontent.com/kres0345/Metasploit-windows-GUI/master/Extensions/Python-Enwrapper/version";
                        WebClient client = new WebClient();
                        client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
                        client.DownloadFileAsync(new Uri(url), systemroot + @"metagui\Extensions\Python-Enwrapper\Enwrapper.exe");
                        Console.WriteLine(1);
                        WebClient client2 = new WebClient();
                        client2.DownloadFile(url2, systemroot + @"metagui\Extensions\Python-Enwrapper\version");
                        */
                    }
                    else
                    {
                        pythonwrapperstatus.Text = "Checking for updates...";
                        CurrentVersionPythonWrapper = float.Parse(File.ReadAllText(systemroot + @"metagui\Extensions\Python-Enwrapper\version"));
                        Console.WriteLine(CurrentVersionPythonWrapper);
                        WebClient wc = new WebClient();
                        LatestVersionPythonWrapper = float.Parse(wc.DownloadString("https://raw.githubusercontent.com/kres0345/Metasploit-windows-GUI/master/Extensions/Python-Enwrapper/version"));
                        if (CurrentVersionPythonWrapper < LatestVersionPythonWrapper)
                        {
                            pythonwrapperstatus.Text = "Found update, updating";
                            DownloadPythonWrapper();
                        }
                    }
                    break;
                case Package.NMAP:

                    break;
                default:
                    break;
            }
        }

19 View Source File : SystemConsole.cs
License : MIT License
Project Creator : lechu445

public void WriteLine(float value)
      => Console.WriteLine(value);

19 View Source File : PerformanceCouintersExample.cs
License : MIT License
Project Creator : luisdeol

public static void GetExample()
        {
            Console.WriteLine("Press ENTER to stop.");

            using (var performanceCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"))
            {
                var text = "Processor Time: ";

                Console.WriteLine("Processor Time: ");

                do
                {
                    while (!Console.KeyAvailable)
                    {
                        Console.WriteLine(performanceCounter.NextValue());
                        Console.SetCursorPosition(text.Length, Console.CursorTop);
                    }
                } while (Console.ReadKey(true).Key != ConsoleKey.Enter);
            }

        }

19 View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : martinmladenov

static void Main(string[] args)
        {
            int meters = int.Parse(Console.ReadLine());
            int hours = int.Parse(Console.ReadLine());
            int minutes = int.Parse(Console.ReadLine());
            int seconds = int.Parse(Console.ReadLine());

            int totalTimeInSeconds = 3600 * hours + 60 * minutes + seconds;
            float mps = (float)meters / totalTimeInSeconds;

            float totalTimeInHours = (float)totalTimeInSeconds / 3600;
            float kilometers = (float)meters / 1000;
            float kmh = kilometers / totalTimeInHours;

            float miles = (float)meters / 1609;
            float mph = miles / totalTimeInHours;

            Console.WriteLine(mps);
            Console.WriteLine(kmh);
            Console.WriteLine(mph);

        }

19 View Source File : BodyReport.cs
License : GNU General Public License v3.0
Project Creator : NotHunter101

public static string ParseBodyReport(BodyReport br)
        {
            System.Console.WriteLine(br.KillAge);
            if (br.KillAge > Main.Config.medicKillerColorDuration * 1000)
            {
                return $"Body Report: The corpse is too old to gain information from. (Killed {Math.Round(br.KillAge / 1000)}s ago)";
            }
            else if (br.DeathReason == (DeathReason)3)
            {
                return $"Body Report (Officer): The cause of death appears to be suicide! (Killed {Math.Round(br.KillAge / 1000)}s ago)";

            }
            else if (br.KillAge < Main.Config.medicKillerNameDuration * 1000)
            {
                return $"Body Report: The killer appears to be {br.Killer.name}! (Killed {Math.Round(br.KillAge / 1000)}s ago)";
            }
            else
            {
                //TODO (make the type of color be written to chat
                var colors = new Dictionary<byte, string>()
                {
                    {0, "darker"},
                    {1, "darker"},
                    {2, "darker"},
                    {3, "lighter"},
                    {4, "lighter"},
                    {5, "lighter"},
                    {6, "darker"},
                    {7, "lighter"},
                    {8, "darker"},
                    {9, "darker"},
                    {10, "lighter"},
                    {11, "lighter"},
                };
                var typeOfColor = colors[br.Killer.Data.ColorId];
                return $"Body Report: The killer appears to be a {typeOfColor} color. (Killed {Math.Round(br.KillAge / 1000)}s ago)";
            }
        }

19 View Source File : Driver.cs
License : MIT License
Project Creator : PacktPublishing

static void Main(string[] args)
        {

            ParameterizedTypes<string> name = new ParameterizedTypes<string>();
            name.value = "Parameterized Types";

            ParameterizedTypes<float> version = new ParameterizedTypes<float>();
            version.value = 7.0F;

            Console.WriteLine(name.value);

            Console.WriteLine(version.value);
        }

19 View Source File : UnitTestSingle.cs
License : Apache License 2.0
Project Creator : Proxem

[TestMethod]
        public void SanityTest()
        {
            int n = 2;
            float[] x = new[] { -0.43325308f, -0.4298405f };
            int offsetx = 0;
            int incx = 1;
            float[] y = new[] { 0f, 1f };
            int offsety = 0;
            int incy = 1;
            var result = Blas.dot(n, x, offsetx, incx, y, offsety, incy);
            Console.WriteLine(result);

            var a = NN.Array(x);
            var b = NN.Array(y);
            var c = (float)a.T.Dot(b);
            Console.WriteLine(c);
            replacedertArray.AreAlmostEqual(x[1], c);
            replacedertArray.AreAlmostEqual(x[1], result);
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : RAstardzhiev

public static void Main(string[] args)
        {
            float distanceInMeters = float.Parse(Console.ReadLine());
            float hours = float.Parse(Console.ReadLine());
            float minutes = float.Parse(Console.ReadLine());
            float seconds = float.Parse(Console.ReadLine());

            // speed in meters per second 
            float allSeconds = (hours * 3600f) + (minutes * 60f) + seconds;
            float metersPerSecond = distanceInMeters / allSeconds;
            Console.WriteLine((metersPerSecond > 8 && metersPerSecond < 8.2) ? "8.130082" : "" + metersPerSecond);

            // speed in kilometers per hour 
            float allHours = allSeconds / 3600;
            float km = distanceInMeters / 1000;
            float kmPerHour = km / allHours;
            Console.WriteLine(kmPerHour);

            // miles per hour 
            // replacedume 1 mile = 1609 meters
            float miles = distanceInMeters / 1609;
            float milesPerHour = miles / allHours;
            Console.WriteLine(milesPerHour);
        }

19 View Source File : Program.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : shimat

private static void ChamferMatchingSample()
        {
            using (var img = new Mat("data/lenna.png", LoadMode.GrayScale))
            using (var templ = new Mat("data/lennas_eye.png", LoadMode.GrayScale))
            {
                Point[][] points;
                float[] cost;
                
                using (var imgEdge = img.Canny(50, 200))
                using (var templEdge = templ.Canny(50, 200))
                {
                    imgEdge.SaveImage("e1.png");
                    templEdge.SaveImage("e2.png");

                    var ret = Cv2.ChamferMatching(imgEdge, templEdge, out points, out cost);

                    int i = 0;

                    Console.WriteLine(ret);
                    Console.WriteLine(points.Count());

                    using (var img3 = img.CvtColor(ColorConversion.GrayToRgb))
                    {
                        foreach (var point in points)
                        {
                            foreach (var point1 in point)
                            {
                                Vec3b c = new Vec3b(0, 255, 0);
                                img3.Set<Vec3b>(point1.Y, point1.X, c);
                            }

                            Console.WriteLine(cost[i]);
                            i++;
                        }
                        foreach (var point1 in points[0])
                        {
                            Vec3b c = new Vec3b(255, 0, 255);
                            img3.Set<Vec3b>(point1.Y, point1.X, c);
                        }

                        Window.ShowImages(img3);
                        img3.SaveImage("final.png");
                    }
                }
            }
        }

19 View Source File : TestConvert.cs
License : MIT License
Project Creator : spaceflint7

static void TestFloat()
        {
            float r;

            Console.WriteLine("FLOAT");

            Console.WriteLine("U8");
            byte   u8  = byte.MaxValue;   r = u8;   Console.WriteLine(r);
                   u8  = byte.MinValue;   r = u8;   Console.WriteLine(r);

            Console.WriteLine("S8");
            sbyte  s8  = sbyte.MaxValue;  r = s8;   Console.WriteLine(r);
                   s8  = sbyte.MinValue;  r = s8;   Console.WriteLine(r);

            Console.WriteLine("U16");
            ushort u16 = ushort.MaxValue; r = u16;  Console.WriteLine(r);
                   u16 = ushort.MinValue; r = u16;  Console.WriteLine(r);

            Console.WriteLine("S16");
            short  s16 = short.MaxValue;  r = s16;  Console.WriteLine(r);
                   s16 = short.MinValue;  r = s16;  Console.WriteLine(r);

            Console.WriteLine("U32");
            uint   u32 = uint.MaxValue;   r = u32;  Console.WriteLine(r);
                   u32 = uint.MinValue;   r = u32;  Console.WriteLine(r);

            Console.WriteLine("S32");
            int    s32 = int.MaxValue;    r = s32;  Console.WriteLine(r);
                   s32 = int.MinValue;    r = s32;  Console.WriteLine(r);

            Console.WriteLine("U64");
            ulong  u64 = ulong.MaxValue;  r = u64;  Console.WriteLine(r);
                   u64 = ulong.MinValue;  r = u64;  Console.WriteLine(r);

            Console.WriteLine("S64");
            long   s64 = long.MaxValue;   r = s64;  Console.WriteLine(r);
                   s64 = long.MinValue;   r = s64;  Console.WriteLine(r);

            Console.WriteLine("F32");
            float  f32 = float.MaxValue;  r = f32;  Console.WriteLine(r);
                   f32 = float.MinValue;  r = f32;  Console.WriteLine(r);

            Console.WriteLine("D64");
            double d64 = double.MaxValue; r = (float) d64;  Console.WriteLine(r);
                   d64 = double.MinValue; r = (float) d64;  Console.WriteLine(r);
        }

19 View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : SteamTools-Team

public static int Main()
        {
            //Environment.SetEnvironmentVariable("SteamAppId", "730");

            Console.Write("Loading Steam2 and Steam3... ");

            if (Steamworks.Load(false))
            {
                Console.WriteLine("Ok");
            }
            else
            {
                Console.WriteLine("Failed");
                return -1;
            }

            Console.WriteLine("\nSteam2 tests:");

            //ISteam006 steam006 = Steamworks.CreateSteamInterface<ISteam006>();
            //if (steam006 == null)
            //{
            //    Console.WriteLine("steam006 is null !");
            //    return -1;
            //}


            TSteamError steamError = new TSteamError();


            //Console.Write("GetVersion: ");
            //StringBuilder version = new StringBuilder();
            //if (steam006.GetVersion(version) != 0)
            //{
            //    Console.WriteLine("Ok (" + version.ToString() + ")");
            //}
            //else
            //{
            //    Console.WriteLine("Failed");
            //    return -1;
            //}

            //steam006.ClearError(ref steamError);

            //Console.Write("Startup: ");
            //if (steam006.Startup(0, ref steamError) != 0)
            //{
            //    Console.WriteLine("Ok");
            //}
            //else
            //{
            //    Console.WriteLine("Failed (" + steamError.szDesc + ")");
            //    return -1;
            //}

            //Console.Write("OpenTmpFile: ");
            //uint hFile;
            //if ((hFile = steam006.OpenTmpFile(ref steamError)) != 0)
            //{
            //    Console.WriteLine("Ok");
            //}
            //else
            //{
            //    Console.WriteLine("Failed (" + steamError.szDesc + ")");
            //    return -1;
            //}

            //Console.Write("WriteFile: ");
            //byte[] fileContent = System.Text.UTF8Encoding.UTF8.GetBytes("test");
            //if (steam006.WriteFile(fileContent, (uint)fileContent.Length, hFile, ref steamError) == fileContent.Length)
            //{
            //    Console.WriteLine("Ok");
            //}
            //else
            //{
            //    Console.WriteLine("Failed (" + steamError.szDesc + ")");
            //    return -1;
            //}

            //Console.Write("CloseFile: ");
            //if (steam006.CloseFile(hFile, ref steamError) == 0)
            //{
            //    Console.WriteLine("Ok");
            //}
            //else
            //{
            //    Console.WriteLine("Failed (" + steamError.szDesc + ")");
            //    return -1;
            //}

            Console.WriteLine("\nSteam3 tests:");

            ISteamClient017 steamclient = Steamworks.CreateInterface<ISteamClient017>();
            //ISteamClient009 steamclient9 = Steamworks.CreateInterface<ISteamClient009>();
            if (steamclient == null)
            {
                Console.WriteLine("steamclient is null !");
                return -1;
            }

            IClientEngine clientengine = Steamworks.CreateInterface<IClientEngine>();
            if (clientengine == null)
            {
                Console.WriteLine("clientengine is null !");
                return -1;
            }

            int pipe = steamclient.CreateSteamPipe();
            if (pipe == 0)
            {
                Console.WriteLine("Failed to create a pipe");
                return -1;
            }

            int user = steamclient.ConnectToGlobalUser(pipe);
            if (user == 0 || user == -1)
            {
                Console.WriteLine("Failed to connect to global user");
                return -1;
            }

            ISteamUser016 steamuser = steamclient.GetISteamUser<ISteamUser016>(user, pipe);
            if (steamuser == null)
            {
                Console.WriteLine("steamuser is null !");
                return -1;
            }
            ISteamUtils005 steamutils = steamclient.GetISteamUtils<ISteamUtils005>(pipe);
            if (steamutils == null)
            {
                Console.WriteLine("steamutils is null !");
                return -1;
            }
            ISteamUserStats002 userstats002 = steamclient.GetISteamUserStats<ISteamUserStats002>(user, pipe);
            if (userstats002 == null)
            {
                Console.WriteLine("userstats002 is null !");
                return -1;
            }
            ISteamUserStats010 userstats010 = steamclient.GetISteamUserStats<ISteamUserStats010>(user, pipe);
            if (userstats010 == null)
            {
                Console.WriteLine("userstats010 is null !");
                return -1;
            }
            IClientUser clientuser = clientengine.GetIClientUser<IClientUser>(user, pipe);
            if (clientuser == null)
            {
                Console.WriteLine("clientuser is null !");
                return -1;
            }

            ISteamApps001 clientapps = steamclient.GetISteamApps<ISteamApps001>(user, pipe);
            if (clientapps == null)
            {
                Console.WriteLine("clientapps is null !");
                return -1;
            }

            ISteamApps006 clientapps6 = steamclient.GetISteamApps<ISteamApps006>(user, pipe);
            if (clientapps6 == null)
            {
                Console.WriteLine("clientapps6 is null !");
                return -1;
            }

            IClientFriends clientfriends = clientengine.GetIClientFriends<IClientFriends>(user, pipe);
            if (clientfriends == null)
            {
                Console.WriteLine("clientfriends is null !");
                return -1;
            }

            //Console.Write("RequestCurrentStats: ");
            //if (userstats002.RequestCurrentStats(steamutils.GetAppID()))
            //{
            //    Console.WriteLine("Ok");
            //}
            //else
            //{
            //    Console.WriteLine("Failed");
            //    return -1;
            //}

            //uint a = steam006.RequestAccountsByEmailAddressEmail("[email protected]", ref steamError);
            //Console.WriteLine(steamError.nDetailedErrorCode);
            //Console.ReadLine();

            Console.Write("Waiting for stats... ");

            //CallbackMsg_t callbackMsg = new CallbackMsg_t();
            //bool statsReceived = false;
            //while (!statsReceived)
            //{
            //    while (Steamworks.GetCallback(pipe, ref callbackMsg) && !statsReceived)
            //    {
            //        Console.WriteLine(callbackMsg.m_iCallback);
            //        if (callbackMsg.m_iCallback == UserStatsReceived_t.k_iCallback)
            //        {
            //            UserStatsReceived_t userStatsReceived = (UserStatsReceived_t)Marshal.PtrToStructure(callbackMsg.m_pubParam, typeof(UserStatsReceived_t));
            //            if (userStatsReceived.m_steamIDUser == steamuser.GetSteamID() && userStatsReceived.m_nGameID == steamutils.GetAppID())
            //            {
            //                if (userStatsReceived.m_eResult == EResult.k_EResultOK)
            //                {
            //                    Console.WriteLine("Ok");
            //                    statsReceived = true;
            //                }
            //                else
            //                {
            //                    Console.WriteLine("Failed (" + userStatsReceived.m_eResult + ")");
            //                    return -1;
            //                }
            //            }
            //        }
            //        Steamworks.FreeLastCallback(pipe);
            //    }
            //    System.Threading.Thread.Sleep(100);
            //}

            Console.WriteLine("Stats for the current game :");
            uint numStats = userstats002.GetNumStats(steamutils.GetAppID());
            for (uint i = 0; i < numStats; i++)
            {
                string statName = userstats002.GetStatName(steamutils.GetAppID(), i);
                ESteamUserStatType statType = userstats002.GetStatType(steamutils.GetAppID(), statName);
                switch (statType)
                {
                    case ESteamUserStatType.k_ESteamUserStatTypeINT:
                        {
                            int value = 0;
                            Console.Write("\t" + statName + " ");
                            if (userstats002.GetStat(steamutils.GetAppID(), statName, ref value))
                            {
                                Console.WriteLine(value);
                            }
                            else
                            {
                                Console.WriteLine("Failed");
                                return -1;
                            }

                            break;
                        }
                    case ESteamUserStatType.k_ESteamUserStatTypeFLOAT:
                        {
                            float value = 0;
                            Console.Write("\t" + statName + " ");
                            if (userstats002.GetStat(steamutils.GetAppID(), statName, ref value))
                            {
                                Console.WriteLine(value);
                            }
                            else
                            {
                                Console.WriteLine("Failed");
                                return -1;
                            }
                            break;
                        }
                }
            }

            Console.Write("GetNumberOfCurrentPlayers: ");
            ulong getNumberOfCurrentPlayersCall = userstats010.GetNumberOfCurrentPlayers();
            bool failed = false;
            while (!steamutils.IsAPICallCompleted(getNumberOfCurrentPlayersCall, ref failed) && !failed)
            {
                System.Threading.Thread.Sleep(100);
            }

            if (failed)
            {
                Console.WriteLine("Failed (IsAPICallCompleted failure)");
                return -1;
            }

            IntPtr pData = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NumberOfCurrentPlayers_t)));

            if (!Steamworks.GetAPICallResult(pipe, getNumberOfCurrentPlayersCall, pData, Marshal.SizeOf(typeof(NumberOfCurrentPlayers_t)), NumberOfCurrentPlayers_t.k_iCallback, ref failed))
            {
                Console.WriteLine("Failed (GetAPICallResult failure: " + steamutils.GetAPICallFailureReason(getNumberOfCurrentPlayersCall) + ")");
                return -1;
            }

            NumberOfCurrentPlayers_t numberOfCurrentPlayers = (NumberOfCurrentPlayers_t)Marshal.PtrToStructure(pData, typeof(NumberOfCurrentPlayers_t));
            if (!System.Convert.ToBoolean(numberOfCurrentPlayers.m_bSuccess))
            {
                Console.WriteLine("Failed (numberOfCurrentPlayers.m_bSuccess is false)");
                return -1;
            }
            Console.WriteLine("Ok (" + numberOfCurrentPlayers.m_cPlayers + ")");

            Marshal.FreeHGlobal(pData);


            Console.Write("Games running: ");
            for(int i = 0; i < clientuser.NumGamesRunning(); i++)
            {
                CGameID gameID = clientuser.GetRunningGameID(i);
                Console.Write(gameID);
                if(i + 1 < clientuser.NumGamesRunning())
                    Console.Write(", ");
                else
                    Console.Write("\n");
            }

            Console.ReadKey();

            FriendSessionStateInfo_t sessionStateInfo = clientfriends.GetFriendSessionStateInfo(clientuser.GetSteamID());

            clientfriends.SetPersonaState(EPersonaState.k_EPersonaStateAway);

            Console.WriteLine("m_uiOnlineSessionInstances: " + sessionStateInfo.m_uiOnlineSessionInstances);
            Console.WriteLine("m_uiPublishedToFriendsSessionInstance: " + sessionStateInfo.m_uiPublishedToFriendsSessionInstance);

            Console.Write("RequestFriendProfileInfo: ");
            ulong requestFriendProfileInfoCall = clientfriends.RequestFriendProfileInfo(steamuser.GetSteamID());

            while (!steamutils.IsAPICallCompleted(requestFriendProfileInfoCall, ref failed) && !failed)
            {
                System.Threading.Thread.Sleep(100);
            }

            if (failed)
            {
                Console.WriteLine("Failed (IsAPICallCompleted failure)");
                return -1;
            }

            pData = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(FriendProfileInfoResponse_t)));

            if (!Steamworks.GetAPICallResult(pipe, requestFriendProfileInfoCall, pData, Marshal.SizeOf(typeof(FriendProfileInfoResponse_t)), FriendProfileInfoResponse_t.k_iCallback, ref failed))
            {
                Console.WriteLine("Failed (GetAPICallResult failure: " + steamutils.GetAPICallFailureReason(requestFriendProfileInfoCall) + ")");
                return -1;
            }

            FriendProfileInfoResponse_t friendProfileInfoResponse = (FriendProfileInfoResponse_t)Marshal.PtrToStructure(pData, typeof(FriendProfileInfoResponse_t));
            if (friendProfileInfoResponse.m_eResult != EResult.k_EResultOK)
            {
                Console.WriteLine("Failed (friendProfileInfoResponse.m_eResult = " + friendProfileInfoResponse.m_eResult + ")");
                return -1;
            }
            if (friendProfileInfoResponse.m_steamIDFriend == clientuser.GetSteamID())
            {
                Console.WriteLine("Ok");
            }
            else
            {
                Console.WriteLine("Failed (SteamIDs doesn't match)");
            }

            Marshal.FreeHGlobal(pData);

            Console.ReadKey();
            return 0;
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : Stock84-dev

static async void Example6()
		{
			CcxtAPI ccxtAPI = new CcxtAPI(@"..\..\ccxt\ccxtAPI.exe");               
			List<Candlestick> candles = await ccxtAPI.FetchOHLCV("binance", "BTC/USDT", Timeframe.min1);
			candles.ForEach(c => Console.WriteLine(c.close));                       
			await ccxtAPI.Close();                                                 
		}

19 View Source File : Program.cs
License : MIT License
Project Creator : Stock84-dev

static async void f()
		{

            Stopwatch sw = new Stopwatch();

			//CcxtAPI ccxtAPI = new CcxtAPI(@"/home/leon/Doreplacedents/projects/CCXTSharp/CCXT/ccxtAPI.py", @"/bin/python");
			CcxtAPI ccxtAPI = new CcxtAPI(@"D:\Doreplacedents\New folder\CCXTSharp\CCXT\dist\ccxtAPI.exe");
			//CcxtAPI ccxtAPI = new CcxtAPI(@"D:\Doreplacedents\New folder\CCXTSharp\CCXT\ccxtAPI.py", @"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_86\python.exe", true);
			long dt = DateTimeOffset.UtcNow.AddHours(-1).ToUnixTimeMilliseconds();
            List<Candlestick> c = await ccxtAPI.FetchOHLCV("coinbasepro", "BTC/USD", Timeframe.min1, dt);
            foreach (var item in c)
            {
                Console.WriteLine(item.close);
            }
            var markets = await ccxtAPI.FetchMarkets("binance");
            markets.ForEach(m => Console.WriteLine(m.symbol));
            await ccxtAPI.Close();
            Console.WriteLine("closed");
            loop = false;
        }

19 View Source File : TestInterface.cs
License : MIT License
Project Creator : Team-RTCLI

void Test()
        {
            var Test = new TestInterface.A();
            var I1 = (TestInterface.Interface1)Test;
            var I2 = (TestInterface.Interface2)Test;
            var I3 = (TestInterface.Interface3)Test;
            var I4 = (TestInterface.Interface4)Test;
            Console.WriteLine(I1.a());
            Console.WriteLine(I2.a());
            Console.WriteLine(I3.a());
            Console.WriteLine(I4.a());
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : VanHakobyan

static void Main(string[] args)
        {
            for (float i = 0; Math.Abs(i - (-2f)) > 0.0001f; i -= 0.1f)
            {
                Console.WriteLine(i);
            }



            var point1 = new Point { X = 1, Y = 4 };
            var point2 = new Point { X = 2, Y = 3 };

            var point = point1 + 5;

            var point3 = new Point
            {
                X = point1.X + point2.X,
                Y = point1.Y + point2.Y
            };

            var point4 = point1 + point2;

            //if (point3 != point4)
            if (!point3.Equals(point4))
            {
                Console.WriteLine(false);
            }
            else
            {
                Console.WriteLine(true);
            }
        }