System.Console.WriteLine(string, params object[])

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

12458 Examples 7

19 View Source File : G.cs
License : MIT License
Project Creator : 2881099

public static void AddFreeSql(object key, string connectionString, FreeSql.DataType dataType)
        {
            if (!DataBase.ContainsKey(key))
            {
                Lazy<IFreeSql> fsql = new Lazy<IFreeSql>(() =>
                {
                    return new FreeSql.FreeSqlBuilder()
                          .UseConnectionString(dataType, connectionString)
                          .UseLazyLoading(true) //开启延时加载功能
                                                //.UseAutoSyncStructure(true) //自动同步实体结构到数据库              
                          .UseMonitorCommand(
                              cmd => Trace.WriteLine(cmd.CommandText), //监听SQL命令对象,在执行前
                              (cmd, traceLog) => Console.WriteLine(traceLog))
                          .UseLazyLoading(true)
                          .Build();
                });
                DataBase.Add(key, fsql);
            }
        }

19 View Source File : Task001.cs
License : Apache License 2.0
Project Creator : 91270

public static void Execute()
        {
            var allTables = new ToolsService().GetAllTables();

            var solutionName = "Meiam.System";

            foreach (var table in allTables)
            {
                Console.Write($"生成[{ table }]表 模型: ");
                Console.WriteLine(new ToolsService().CreateModels($"..\\..\\..\\..\\{ solutionName }.Model\\Enreplacedy",  solutionName , table, ""));
                Console.Write($"生成[{ table }]表 服务: ");
                Console.WriteLine(new ToolsService().CreateServices($"..\\..\\..\\..\\{ solutionName }.Interfaces\\Service", solutionName , table));
                Console.Write($"生成[{ table }]表 接口: ");
                Console.WriteLine(new ToolsService().CreateIServices($"..\\..\\..\\..\\{ solutionName }.Interfaces\\IService", solutionName, table));
            }

            //Console.Write($"生成DbContext: ");
            //Console.WriteLine(new ToolsService().CreateDbContext($"..\\..\\..\\..\\{ solutionName }.Core\\DbContext.cs", solutionName));
        }

19 View Source File : ScInsertUserData.cs
License : MIT License
Project Creator : 0x1000000

private static async Task InsertCustomers(IScenarioContext context)
        {
            var userTable = AllTables.GereplacedUser();
            var customerTable = AllTables.GereplacedCustomer();

            await InsertInto(customerTable, customerTable.UserId)
                .From(Select(userTable.UserId)
                    .From(userTable)
                    .Where(!Exists(SelectOne()
                        .From(customerTable)
                        .Where(customerTable.UserId == userTable.UserId))))
                .Exec(context.Database);

            context.WriteLine("Customers inserted:");

            var clCount = CustomColumnFactory.Int64("Count");

            var res = await SelectDistinct(customerTable.CustomerId, userTable.UserId, Cast(CountOneOver(), SqlType.Int64).As(clCount))
                .From(customerTable)
                .InnerJoin(userTable, @on: customerTable.UserId == userTable.UserId)
                .OrderBy(userTable.UserId)
                .OffsetFetch(0, 5)
                .QueryList(context.Database, r=> (UserId: userTable.UserId.Read(r), CustomerId: customerTable.CustomerId.Read(r), Count: clCount.Read(r)));

            foreach (var tuple in res)
            {
                Console.WriteLine(tuple);
            }
        }

19 View Source File : RepositoryTests.cs
License : MIT License
Project Creator : 2881099

[Fact]
		public void UpdateAttach() {
			var repos = g.sqlite.GetGuidRepository<AddUpdateInfo>();

			var item = new AddUpdateInfo { Id = Guid.NewGuid() };
			repos.Attach(item);

			item.replacedle = "xxx";
			repos.Update(item);
			Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(item));

			Console.WriteLine(repos.UpdateDiy.Where(a => a.Id == item.Id).Set(a => a.Clicks + 1).ToSql());
			repos.UpdateDiy.Where(a => a.Id == item.Id).Set(a => a.Clicks + 1).ExecuteAffrows();

			item = repos.Find(item.Id);
			Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(item));
		}

19 View Source File : Entry.cs
License : GNU General Public License v3.0
Project Creator : 1330-Studios

[HarmonyPostfix]
            public static void Postfix() {
                var cursorPosition = InGame.instance.inputManager.cursorPositionWorld;
                if (Input.GetKeyDown(KeyCode.LeftBracket)) {
                    run = !run;
                    if (lastX != cursorPosition.x || lastY != cursorPosition.y) {
                        Console.WriteLine("initArea.Add(new(" + Math.Round(cursorPosition.x) + ", " + Math.Round(cursorPosition.y) + "));");
                        lastX = cursorPosition.x;
                        lastY = cursorPosition.y;
                    }
                }
                if (Input.GetKeyDown(KeyCode.RightBracket)) {
                    run = !run;
                    if (lastX != cursorPosition.x || lastY != cursorPosition.y) {
                        Console.WriteLine("initPath.Add(new(){ point = new(" + Math.Round(cursorPosition.x) + ", " + Math.Round(cursorPosition.y) + "), bloonScale = 1, moabScale = 1 });");
                        lastX = cursorPosition.x;
                        lastY = cursorPosition.y;
                    }
                }

                if (Input.GetKeyDown(KeyCode.KeypadDivide)) {
                    run = !run;
                    if (lastX != cursorPosition.x || lastY != cursorPosition.y) Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
                }
            }

19 View Source File : ScenarioContext.cs
License : MIT License
Project Creator : 0x1000000

public void WriteLine(string? line)
        {
            Console.WriteLine(line);
        }

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

private static void Main(string[] args)
        {
            var train = args[0];
            var seats = int.Parse(args[1]);

            var manager = new WebTicketManager();

            var jsonResult = manager.Reserve(train, seats);

            Console.WriteLine(jsonResult.Result);

            Console.WriteLine("Type <enter> to exit.");
            Console.ReadLine();
        }

19 View Source File : ScInsertCompanies.cs
License : MIT License
Project Creator : 0x1000000

public async Task Exec(IScenarioContext context)
        {
            var company = AllTables.GereplacedCompany();

            DateTime now = DateTime.UtcNow;

            var inserted = await InsertDataInto(company, this.ReadCompanyData())
                .MapData(s => s
                    .Set(s.Target.ExternalId, s.Source.ExternalId)
                    .Set(s.Target.CompanyName, s.Source.Name))
                .AlsoInsert(s => s
                    .Set(s.Target.Modified, now)
                    .Set(s.Target.Created, now)
                    .Set(s.Target.Version, 1))
                .Output(company.CompanyId)
                .QueryList(context.Database, r=> company.CompanyId.Read(r));

            var customer = AllTables.GereplacedCustomer();

            //Insert customer
            await InsertDataInto(customer, inserted)
                .MapData(s => s.Set(s.Target.CompanyId, s.Source)).Exec(context.Database);

            context.WriteLine($"{inserted.Count} have been inserted into {nameof(TableItCustomer)}");


            var tCustomerName = new CustomerName();

            var users = await Select(CustomerNameData.GetColumns(tCustomerName))
                .From(tCustomerName)
                .Where(tCustomerName.CustomerTypeId == 1)
                .OrderBy(tCustomerName.Name)
                .OffsetFetch(0, 5)
                .QueryList(context.Database, r => CustomerNameData.Read(r, tCustomerName));

            var companies = await Select(CustomerNameData.GetColumns(tCustomerName))
                .From(tCustomerName)
                .Where(tCustomerName.CustomerTypeId == 2)
                .OrderBy(tCustomerName.CustomerId)
                .OffsetFetch(0, 5)
                .QueryList(context.Database, r => CustomerNameData.Read(r, tCustomerName));

            context.WriteLine(null);
            context.WriteLine("Top 5 Users users: ");
            context.WriteLine(null);

            foreach (var valueTuple in users)
            {
                Console.WriteLine(valueTuple);
            }
            context.WriteLine(null);
            context.WriteLine("Top 5 Users companies: ");
            context.WriteLine(null);

            foreach (var valueTuple in companies)
            {
                Console.WriteLine(valueTuple);
            }
        }

19 View Source File : OKCoinTest.cs
License : MIT License
Project Creator : aabiryukov

public static void Test()
		{
/*
			// Sell
			{
				var priceUsd = 245 * 99999;
				var CIY2USD = 0.1611;

				var client1 = new OKCoinAPI(ApiKey, ApiSecret);
				var responce = client1.PlaceOrder((double)(priceUsd / CIY2USD), -(double)2.5,
					OKCoinAPI.MarketType.BTCCNY);
				Console.WriteLine(responce);
			}
*/


			using (var wsApi = new WebSocketApi())
			{
				wsApi.OrdersDepthReceived += OnOrdersDepth;
				wsApi.Start();
				Console.ReadLine();
				wsApi.Stop();
			}

			var ticker = OKCoinAPI.GetTicker();
			Console.WriteLine("ticker.Last: " + ticker.Last);

			var orderBook = OKCoinAPI.GetOrderBook(33);
			Console.WriteLine("orderBook.Asks.Count=" + orderBook.Asks.Count);

			var client = new OKCoinAPI(ApiKey, ApiSecret);

			var info = client.GetUserInfo();
			Console.WriteLine("FreeBtc= " + info.Free.Btc);

			var orderId = client.TradeSell(300, 0.08M);
			Console.WriteLine("orderId: " + orderId);

			var orders = client.GetActiveOrders();
			Console.WriteLine("Active orders: " + orders.Count());

			var cancelResult = client.CancelOrder(orderId);
			Console.WriteLine("cancelResult: " + cancelResult);
		}

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

static async Task Main()
        {
            try
            {
                var scenario = new ScCreateTables()
                    .Then(new ScInsertUserData())
                    .Then(new ScSqlInjections())
                    .Then(new ScLike())
                    .Then(new ScDeleteCustomersByTopUser())
                    .Then(new ScInsertCompanies())
                    .Then(new ScUpdateUsers())
                    .Then(new ScUpdateUserData())
                    .Then(new ScAllColumnTypes())
                    .Then(new ScAllColumnTypesExportImport())
                    .Then(new ScSelectLogic())
                    .Then(new ScSelectTop())
                    .Then(new ScSelectSets())
                    .Then(new ScTempTables())
                    .Then(new ScCreateOrders())
                    .Then(new ScreplacedyticFunctionsOrders())
                    .Then(new ScTransactions(false))
                    .Then(new ScTransactions(true))
                    .Then(new ScMerge())
                    .Then(new ScModelSelector())
                    ;

                await ExecScenarioAll(
                    scenario: scenario,
                    msSqlConnectionString: "Data Source=(local);Initial Catalog=TestDatabase;Integrated Security=True",
                    pgSqlConnectionString: "Host=localhost;Port=5432;Username=postgres;Preplacedword=test;Database=test",
                    mySqlConnectionString: "server=127.0.0.1;uid=test;pwd=test;database=test");
            }
            catch (SqDatabaseCommandException commandException)
            {
                Console.WriteLine(commandException.CommandText);
                Console.WriteLine(commandException.InnerException);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }

19 View Source File : G.cs
License : MIT License
Project Creator : 2881099

public static Lazy<IFreeSql> GetNewFreeSql(DataBaseInfo dataBase)
        {
            var connectionString = dataBase.IsString ? dataBase.ConnectionString
                    : GetConnectionString(dataBase.DataType, dataBase.UserId, dataBase.Pwd, dataBase.Host, dataBase.DbName,
                       dataBase.Port, dataBase.ValidatorType);
            return new Lazy<IFreeSql>(() =>
             {
                 return new FreeSql.FreeSqlBuilder()
                       .UseConnectionString(dataBase.DataType, connectionString)
                       .UseLazyLoading(true) //开启延时加载功能
                                             //.UseAutoSyncStructure(true) //自动同步实体结构到数据库              
                       .UseMonitorCommand(
                           cmd => Trace.WriteLine(cmd.CommandText), //监听SQL命令对象,在执行前
                           (cmd, traceLog) => Console.WriteLine(traceLog))
                       .UseLazyLoading(true)
                       .Build();
             });
            throw new AccessViolationException("FreeSql 连接为空");
        }

19 View Source File : RouteGeneratorTest.cs
License : MIT License
Project Creator : 188867052

[Fact]
        public void TestApiRouteGenerator()
        {
            try
            {
                var routeInfos = new TestSite(nameof(Api)).GetAllRouteInfo();
                var json = JsonConvert.SerializeObject(routeInfos, Formatting.Indented);
                Console.WriteLine(json);
                DirectoryInfo di = new DirectoryInfo(Environment.CurrentDirectory);

                var file = Directory.GetFiles(di.Parent.Parent.Parent.Parent.FullName, "json.json", SearchOption.AllDirectories).FirstOrDefault();
                File.WriteAllText(file, json);
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

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

private static async Task Step11replacedyticAndWindowFunctions(ISqDatabase database)
        {
            var cUserName = CustomColumnFactory.String("Name");
            var cNum = CustomColumnFactory.Int64("Num");
            var cFirst = CustomColumnFactory.String("First");
            var cLast = CustomColumnFactory.String("Last");

            var user = new TableUser();

            await Select(
                    (user.FirstName + " " + user.LastName)
                    .As(cUserName),
                    RowNumber()
                        /*.OverParreplacedionBy(some fields)*/
                        .OverOrderBy(user.FirstName)
                        .As(cNum),
                    FirstValue(user.FirstName + " " + user.LastName)
                        /*.OverParreplacedionBy(some fields)*/
                        .OverOrderBy(user.FirstName)
                        .FrameClauseEmpty()
                        .As(cFirst),
                    LastValue(user.FirstName + " " + user.LastName)
                        /*.OverParreplacedionBy(some fields)*/
                        .OverOrderBy(user.FirstName)
                        .FrameClause(
                            FrameBorder.UnboundedPreceding,
                            FrameBorder.UnboundedFollowing)
                        .As(cLast))
                .From(user)
                .Query(database,
                    r => Console.WriteLine(
                        $"Num: {cNum.Read(r)}, Name: {cUserName.Read(r)}, " +
                        $"First: {cFirst.Read(r)}, Last: {cLast.Read(r)}"));
        }

19 View Source File : ValuesController.cs
License : MIT License
Project Creator : 2881099

[HttpGet("2")]
        async public Task<string> GetAsync([FromServices]CustomRepository repo, [FromQuery]string key)
        {
            Console.WriteLine(await repo.GetAsync(key));
            repo.Text = "Invalid value";
            Console.WriteLine(repo.Text);

            return "GetAsync OK";
        }

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

private static int Run<TOpts>(TOpts opts, Func<TOpts,Task> task)
        {
            try
            {
                task(opts).Wait();
                return 0;
            }
            catch (SqExpressCodeGenException e)
            {
                Console.WriteLine(e.Message);
                return 1;
            }
            catch (AggregateException e) when (e.InnerException is SqExpressCodeGenException sqExpressCodeGenException)
            {
                Console.Error.WriteLine(sqExpressCodeGenException.Message);
                return 1;
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Unhandled Exception: ");
                Console.Error.WriteLine(e);
                return 1;
            }
        }

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

internal static void sendConnectionRequest(byte[] loadBalanceToken, bool bAutoReconnect)
        {
            int num;
            Network.ConnectionStage = Network.eConnectionStage.Negotiating;

            if (Options.enableNLA)
            {
                // Client X.224 Connection Request PDU

                sendConnectNegotiation(
                    NegotiationProtocol.PROTOCOL_RDP |
                    NegotiationProtocol.PROTOCOL_SSL |
                    NegotiationProtocol.PROTOCOL_HYBRID,
                    loadBalanceToken);

                // Server X.224 Connection Confirm PDU
                num = receiveConnectNegotiation();


               if (((num & 1) != 0) || ((num & 2) != 0))
                    {
                        Network.ConnectionStage = Network.eConnectionStage.Securing;
                        Network.ConnectSSL();
                    }

                    if ((num & 2) != 0)
                    {
                        Network.ConnectionStage = Network.eConnectionStage.Authenticating;
                        CredSSP.Negotiate(Network.GetSSLPublicKey());
                    }
                
            }
            else
            {
                // Client X.224 Connection Request PDU
                sendConnectNegotiation(NegotiationProtocol.PROTOCOL_RDP, loadBalanceToken);

                // Server X.224 Connection Confirm PDU
                num = receiveConnectNegotiation();

                if (num != 0)
                {
                    throw new RDFatalException("Security negotiation failed!");
                }
            }
            if(Options.hash.Length>0)
                Console.WriteLine("[+] Valid:" + Options.Username + "  " + Options.hash);
            else
                Console.WriteLine("[+] Valid:" + Options.Username + "  " + Options.Preplacedword);

        }

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

private static async Task Step18ExportToJson(ISqDatabase database)
        {
            var tableUser = new TableUser(Alias.Empty);

            var selectExpr = Select(tableUser.FirstName, tableUser.LastName)
                .From(tableUser)
                .Where(tableUser.LastName == "Sturman")
                .Done();

            //Exporting
            var memoryStream = new MemoryStream();
            var jsonWriter = new Utf8JsonWriter(memoryStream);
            selectExpr.SyntaxTree().ExportToJson(jsonWriter);

            string json = Encoding.UTF8.GetString(memoryStream.ToArray());

            Console.WriteLine(json);

            //Importing
            var restored = (ExprQuerySpecification)ExprDeserializer
                .DeserializeFormJson(JsonDoreplacedent.Parse(json).RootElement);

            var result = await restored
                .QueryList(database, r => (tableUser.FirstName.Read(r), tableUser.LastName.Read(r)));

            foreach (var name in result)
            {
                Console.WriteLine(name);
            }
        }

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

static void Main(string[] args)
        {
            // ����
            Solar solar = new Solar(2020, 5, 26, 23, 42, 0);
            Console.WriteLine(solar);
            Console.WriteLine(solar.toFullString());

            // ����
            Lunar lunar = solar.getLunar();
            Console.WriteLine(lunar);
            Console.WriteLine(lunar.toFullString());

            // ����
            EightChar baZi = lunar.getEightChar();
            Console.WriteLine(baZi.getYear() + " " + baZi.getMonth() + " " + baZi.getDay() + " " + baZi.getTime());

            // ��������
            Console.WriteLine(baZi.getYearNaYin() + " " + baZi.getMonthNaYin() + " " + baZi.getDayNaYin() + " " + baZi.getTimeNaYin());

            // ��������
            Console.WriteLine(baZi.getYearWuXing() + " " + baZi.getMonthWuXing() + " " + baZi.getDayWuXing() + " " + baZi.getTimeWuXing());

            // �������ʮ��
            Console.WriteLine(baZi.getYearShiShenGan() + " " + baZi.getMonthShiShenGan() + " " + baZi.getDayShiShenGan() + " " + baZi.getTimeShiShenGan());

            // ���ֵ�֧ʮ��
            Console.WriteLine(baZi.getYearShiShenZhi()[0] + " " + baZi.getMonthShiShenZhi()[0] + " " + baZi.getDayShiShenZhi()[0] + " " + baZi.getTimeShiShenZhi()[0]);

            // ������֧ʮ��
            foreach (string s in baZi.getYearShiShenZhi())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            // ������֧ʮ��
            foreach (string s in baZi.getMonthShiShenZhi())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            // ������֧ʮ��
            foreach (string s in baZi.getDayShiShenZhi())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            // ����ʱ֧ʮ��
            foreach (string s in baZi.getTimeShiShenZhi())
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            // ����̥Ԫ
            Console.WriteLine(baZi.getTaiYuan());

            // ��������
            Console.WriteLine(baZi.getMingGong());

            // �������
            Console.WriteLine(baZi.getShenGong());

            Console.WriteLine();
            solar = new Solar(1988, 3, 20, 18, 0, 0);
            lunar = solar.getLunar();
            EightChar bazi = lunar.getEightChar();

            // ����
            Yun yun = bazi.getYun(1);
            Console.WriteLine("����" + solar.toYmdHms() + "����");
            Console.WriteLine("����" + yun.getStartYear() + "��" + yun.getStartMonth() + "����" + yun.getStartDay() + "�������");
            Console.WriteLine("����" + yun.getStartSolar().toYmd() + "������");
            Console.WriteLine();

            // �ڼ���
            List<Holiday> holidays = HolidayUtil.getHolidays(2012);
            foreach (Holiday holiday in holidays)
            {
                Console.WriteLine(holiday);
            }
            Console.WriteLine();

            // ����ת����
            List<Solar> solars = Solar.fromBaZi("����", "����", "��î", "����");
            foreach (Solar d in solars)
            {
                Console.WriteLine(d.toFullString());
            }
            Console.WriteLine();

            Console.ReadLine();
        }

19 View Source File : SteamBotController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

static void OnPersonaState(SteamFriends.PersonaStateCallback callback)
        {
            // this callback is received when the persona state (friend information) of a friend changes

            // for this sample we'll simply display the names of the friends            
            AccountController.getAccount(user).setFriendsName(new Friend() { name = callback.Name, steamFrindsID = callback.FriendID.ConvertToUInt64().ToString() });
            Console.WriteLine("State change: {0}", callback.Name);
        }

19 View Source File : BtcChinaTest.cs
License : MIT License
Project Creator : aabiryukov

public static void Test()
		{
/*
			// Sell
			{
			    Console.WriteLine("SALE Testing...");
				var priceUsd = 245 * 99999;
				var CIY2USD = 0.1611;

				var client1 = new BTCChinaAPI(ApiKey, ApiSecret);
				var responce = client1.PlaceOrder((double)(priceUsd / CIY2USD), -(double)2.5,
					BTCChinaAPI.MarketType.BTCCNY);
				Console.WriteLine(responce);
			}
*/

/*
			using (var wsApi = new BtcChinaWebSocketApi())
			{
                Console.WriteLine("Btcc: Socket starting...");
                wsApi.Start();
				Console.ReadLine();
				wsApi.Stop();
			}
*/

			var ticker = BTCChinaAPI.GetTicker();
			Console.WriteLine("ticker.Last: " + ticker.Last);

			var orderBook = BTCChinaAPI.GetOrderBook();
			Console.WriteLine("orderBook.Asks.Count=" + orderBook.Asks.Count);

			var client = new BTCChinaAPI(ApiKey, ApiSecret);
			var info = client.getAccountInfo();
			Console.WriteLine("UserName= " + info.Profile.UserName);

			var orderId = client.PlaceOrder(1, 1, BTCChinaAPI.MarketType.BTCCNY);
			Console.WriteLine("orderId: " + orderId);

			var cancelResult = client.cancelOrder(orderId);
			Console.WriteLine("cancelResult: " + cancelResult);
		}

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

static int Main(string[] args) {
			try {
				switch (System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture) {
				case System.Runtime.InteropServices.Architecture.X64:
				case System.Runtime.InteropServices.Architecture.X86:
					break;
				default:
					throw new ApplicationException($"Unsupported CPU arch: {System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture}");
				}

				var jitDasmOptions = CommandLineParser.Parse(args);
				if (!string2.IsNullOrEmpty(jitDasmOptions.LoadModule)) {
#if DEBUG
					Console.Error.WriteLine($"Trying to jit methods in module '{jitDasmOptions.LoadModule}' but JitDasm is a debug build, not a release build!");
#endif
					MethodJitter.JitMethods(jitDasmOptions.LoadModule, jitDasmOptions.TypeFilter, jitDasmOptions.MethodFilter, jitDasmOptions.RunClreplacedConstructors, jitDasmOptions.replacedemblySearchPaths);
				}
				var (bitness, methods, knownSymbols) = GetMethodsToDisreplacedemble(jitDasmOptions.Pid, jitDasmOptions.ModuleName, jitDasmOptions.TypeFilter, jitDasmOptions.MethodFilter, jitDasmOptions.HeapSearch);
				var jobs = GetJobs(methods, jitDasmOptions.OutputDir, jitDasmOptions.FileOutputKind, jitDasmOptions.FilenameFormat, out var baseDir);
				if (!string2.IsNullOrEmpty(baseDir))
					Directory.CreateDirectory(baseDir);
				var sourceDoreplacedentProvider = new SourceDoreplacedentProvider();
				using (var mdProvider = new MetadataProvider()) {
					var sourceCodeProvider = new SourceCodeProvider(mdProvider, sourceDoreplacedentProvider);
					using (var context = new DisasmJobContext(bitness, knownSymbols, sourceCodeProvider, jitDasmOptions.DisreplacedemblerOutputKind, jitDasmOptions.Diffable, jitDasmOptions.ShowAddresses, jitDasmOptions.ShowHexBytes, jitDasmOptions.ShowSourceCode)) {
						foreach (var job in jobs)
							Disreplacedemble(context, job);
					}
				}
				return 0;
			}
			catch (ShowCommandLineHelpException) {
				CommandLineParser.ShowHelp();
				return 1;
			}
			catch (CommandLineParserException ex) {
				Console.WriteLine(ex.Message);
				return 1;
			}
			catch (ApplicationException ex) {
				Console.WriteLine(ex.Message);
				return 1;
			}
			catch (ClrDiagnosticsException ex) {
				Console.WriteLine(ex.Message);
				Console.WriteLine("Make sure this process has the same bitness as the target process");
				return 1;
			}
			catch (Exception ex) {
				Console.WriteLine(ex.ToString());
				return 1;
			}
		}

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

static void Main(string[] args)
        {
            DapperFactory.CreateInstance().ConfigureServices(service =>
            {
                service.AddDapperForSQLite();
            }).ConfigureContainer(container =>
            {
                container.AddDapperForSQLite("Sqlite2", "sqlite2");
            }).ConfigureConfiguration(builder =>
            {
                builder.SetBasePath(Directory.GetCurrentDirectory());
                builder.AddJsonFile("appsettings.json");
            }).Build();

            DapperFactory.Step(dapper =>
            {
                var query = dapper.Query("select * from Contact;");
                Console.WriteLine(JsonConvert.SerializeObject(query));
            });

            var result7 = DapperFactory.Step(dapper => { return dapper.Query("select * from Contact;"); });
            Console.WriteLine(JsonConvert.SerializeObject(result7));

            DapperFactory.StepAsync(async dapper =>
            {
                var query = await dapper.QueryAsync("select * from Contact;");
                Console.WriteLine(JsonConvert.SerializeObject(query));
            }).Wait();

            var result8 = DapperFactory.StepAsync(async dapper => await dapper.QueryAsync("select * from Contact;")).Result;
            Console.WriteLine(JsonConvert.SerializeObject(result8));


            DapperFactory.Step("sqlite2", dapper =>
             {
                 var query = dapper.Query("select * from Contact;");
                 Console.WriteLine(JsonConvert.SerializeObject(query));
             });

            var result9 = DapperFactory.Step("sqlite2", dapper => { return dapper.Query("select * from Contact;"); });
            Console.WriteLine(JsonConvert.SerializeObject(result9));

            DapperFactory.StepAsync("sqlite2", async dapper =>
            {
                var query = await dapper.QueryAsync("select * from Contact;");
                Console.WriteLine(JsonConvert.SerializeObject(query));
            }).Wait();

            var result10 = DapperFactory.StepAsync("sqlite2", async dapper => await dapper.QueryAsync("select * from Contact;")).Result;
            Console.WriteLine(JsonConvert.SerializeObject(result10));



            DapperFactory.Step(context =>
            {
                var dapper = context.ResolveDapper();
                var query = dapper.Query("select * from Contact;");
                Console.WriteLine(JsonConvert.SerializeObject(query));
            });

            DapperFactory.StepAsync(async context =>
            {
                var dapper = context.ResolveDapper();
                var queryAsync = await dapper.QueryAsync("select * from Contact;");
                Console.WriteLine(JsonConvert.SerializeObject(queryAsync));
            }).Wait();

            DapperFactory.Step((context, dapper) =>
            {
                var query = dapper.Query("select * from Contact;");
                Console.WriteLine(JsonConvert.SerializeObject(query));
            });

            DapperFactory.StepAsync(async (context, dapper) =>
            {
                var query = await dapper.QueryAsync("select * from Contact;");
                Console.WriteLine(JsonConvert.SerializeObject(query));
            }).Wait();

            DapperFactory.Step("sqlite2", (context, dapper) =>
            {
                var query = dapper.Query("select * from Contact;");
                Console.WriteLine(JsonConvert.SerializeObject(query));
            });

            DapperFactory.StepAsync("sqlite2", async (context, dapper) =>
            {
                var query = await dapper.QueryAsync("select * from Contact;");
                Console.WriteLine(JsonConvert.SerializeObject(query));
            }).Wait();

            var result1 = DapperFactory.Step(context =>
            {
                var dapper = context.ResolveDapper();
                return dapper.Query("select * from Contact;");
            });
            Console.WriteLine(JsonConvert.SerializeObject(result1));

            var result2 = DapperFactory.StepAsync(context =>
            {
                var dapper = context.ResolveDapper();
                return dapper.QueryAsync("select * from Contact;");
            }).Result;
            Console.WriteLine(JsonConvert.SerializeObject(result2));

            var result3 = DapperFactory.Step((context, dapper) => dapper.Query("select * from Contact;"));
            Console.WriteLine(JsonConvert.SerializeObject(result3));

            var result4 = DapperFactory.StepAsync(async (context, dapper) => await dapper.QueryAsync("select * from Contact;")).Result;
            Console.WriteLine(JsonConvert.SerializeObject(result4));

            var result5 = DapperFactory.Step("sqlite2", (context, dapper) => dapper.Query("select * from Contact;"));
            Console.WriteLine(JsonConvert.SerializeObject(result5));

            var result6 = DapperFactory.StepAsync("sqlite2", async (context, dapper) => await dapper.QueryAsync("select * from Contact;")).Result;
            Console.WriteLine(JsonConvert.SerializeObject(result6));

            Console.ReadKey();
        }

19 View Source File : PacketDeviceSelector.cs
License : MIT License
Project Creator : 0blu

public static ICaptureDevice AskForPacketDevice()
        {
            // Retrieve the device list from the local machine
            CaptureDeviceList devices = CaptureDeviceList.Instance;

            if (devices.Count == 0)
            {
                throw new Exception("No interfaces found! Make sure WinPcap is installed.");
            }

            // Print the list
            for (int i = 0; i != devices.Count; ++i)
            {
                ICaptureDevice device = devices[i];
                Console.Write((i + 1) + ". ");
                if (device.Description != null)
                    Console.WriteLine(" (" + device.Description + ")");
                else
                    Console.WriteLine(" (No description available)");
            }

            int deviceIndex;
            do
            {
                Console.WriteLine("Enter the interface number (1-" + devices.Count + "):");
                string deviceIndexString = Console.ReadLine();
                if (!int.TryParse(deviceIndexString, out deviceIndex) ||
                    deviceIndex < 1 || deviceIndex > devices.Count)
                {
                    deviceIndex = 0;
                }
            } while (deviceIndex == 0);

            return devices[deviceIndex - 1];
        }

19 View Source File : CodeGenerator.cs
License : MIT License
Project Creator : 188867052

public bool Generate(CommondConfig config)
        {
            var context = this.modelGenerator.GenerateCodeAsync(config).Result;
            if (string.IsNullOrEmpty(context))
            {
                return false;
            }

            Console.WriteLine(context);

            string fullPath = Path.Combine(config.ProjectPath, config.OutPutFile);

            Console.WriteLine($"Writing file to {fullPath}...");
            File.WriteAllText(fullPath, context);
            Console.WriteLine("Completed.");

            return true;
        }

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

private static async Task Step4UpdatingData(ISqDatabase database)
        {
            var tUser = new TableUser();

            await Update(tUser)
                .Set(tUser.LastName, "Malloy")
                .Set(tUser.Version, tUser.Version + 1)
                .Set(tUser.ModifiedAt, GetUtcDate())
                .Where(tUser.LastName == "Maloy")
                .Exec(database);

            //Writing to console without storing in memory
            await Select(tUser.Columns)
                .From(tUser)
                .Query(database,
                    record =>
                    {
                        Console.Write(tUser.UserId.Read(record) + ",");
                        Console.Write(tUser.FirstName.Read(record) + " ");
                        Console.Write(tUser.LastName.Read(record) + ",");
                        Console.Write(tUser.Version.Read(record) + ",");
                        Console.WriteLine(tUser.ModifiedAt.Read(record).ToString("s"));
                    });
        }

19 View Source File : G.cs
License : MIT License
Project Creator : 2881099

public static void AddFreeSql(object key, DataBaseInfo dataBase)
        {
            if (!DataBase.ContainsKey(key))
            {
                var connectionString = dataBase.IsString ? dataBase.ConnectionString
                    : GetConnectionString(dataBase.DataType, dataBase.UserId, dataBase.Pwd, dataBase.Host, dataBase.DbName,
                       dataBase.Port, dataBase.ValidatorType);
                Lazy<IFreeSql> fsql = new Lazy<IFreeSql>(() =>
                {
                    var _fsql = new FreeSql.FreeSqlBuilder()
                          .UseConnectionString(dataBase.DataType, connectionString)
                          .UseLazyLoading(true) //开启延时加载功能
                          //.UseAutoSyncStructure(true) //自动同步实体结构到数据库              
                          .UseMonitorCommand(
                              cmd => Trace.WriteLine(cmd.CommandText), //监听SQL命令对象,在执行前
                              (cmd, traceLog) => Console.WriteLine(traceLog))
                          .UseLazyLoading(true)
                          .Build();
                    _fsql.Aop.CurdAfter += (s, e) =>
                    {                        
                        if (e.ElapsedMilliseconds > 200)
                        {
                            //记录日志
                            //发送短信给负责人
                        }
                    };
                    return _fsql;
                });
                DataBase.Add(key, fsql);
            }
        }

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

static async Task Start()
        {
            var mqttService = new MQTTService();

            var mqttClientOptions = new Options
            {
                Uri = new Uri("mqtt://test.mosquitto.org:8883"),
                UseTls = true,
                //IgnoreCertificateChainErrors = true,
                //IgnoreCertificateRevocationErrors = true,
                AllowUntrustedCertificates = true,

                //Uri = new Uri("ws://broker.mqttdashboard.com:8000/mqtt"),
                //Server = "broker.mqttdashboard.com",
                ////Port = 1883,
                //Port = 8000,
                //Url = "broker.mqttdashboard.com",
                //Path = "mqtt",
                ConnectionType = ConnectionType.Tcp,
                //ConnectionType = ConnectionType.WebSocket
            };

            var topic1 = new TopicFilter
            {
                QualityOfServiceLevel = QoSLevel.ExactlyOnce,
                //Topic = "PP/#"
                Topic = "/#"
            };

            var topic2 = new TopicFilter
            {
                QualityOfServiceLevel = QoSLevel.AtLeastOnce,
                Topic = "EFM/#"
                //Topic = "MQTTClientRx/Test"
            };

            var topic3 = new TopicFilter
            {
                QualityOfServiceLevel = QoSLevel.AtLeastOnce,
                Topic = "MQTTClientRx"
            };


            ITopicFilter[] topicFilters = 
            {

                topic1,
                topic2,
                topic3,
            };

            var MQTTService = mqttService.CreateObservableMQTTClient(mqttClientOptions, willMessage:null, topicFilters:topicFilters);

            var disposableMessage = MQTTService.observableMessage.Subscribe(
                msg =>
                {
                    if (msg.Topic.Contains("EFM"))
                    {
                        Console.ForegroundColor = ConsoleColor.Yellow;
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Blue;
                    }

                    Console.WriteLine($"{Encoding.UTF8.GetString(msg.Payload)}, " +
                                      $"{msg.QualityOfServiceLevel.ToString()}, " +
                                      $"Retain: {msg.Retain}, " +
                                      $"Topic: {msg.Topic}");
                },
                ex =>
                {
                    Console.WriteLine($"{ex?.Message} : inner {ex?.InnerException?.Message}");
                },
                () =>
                {
                    Console.WriteLine("Completed...");
                });

            await MQTTService.client.ConnectAsync();


            //await Task.Delay(TimeSpan.FromSeconds(2));

            //Console.ForegroundColor = ConsoleColor.Yellow;
            //Console.WriteLine($"Unsubscribe: {topic1.Topic}");
            //await MQTTService.client.UnsubscribeAsync(topic2);

            //Console.ForegroundColor = ConsoleColor.Blue;

            //await Task.Delay(TimeSpan.FromSeconds(2));

            //Console.ForegroundColor = ConsoleColor.Yellow;
            //Console.WriteLine($"Unsubscribe: {topic1.Topic}");
            //await MQTTService.client.UnsubscribeAsync(topic1);
            //Console.ForegroundColor = ConsoleColor.Blue;

            //await Task.Delay(TimeSpan.FromSeconds(2));

            //Console.ForegroundColor = ConsoleColor.Yellow;
            //Console.WriteLine($"Unsubscribe: {topic1.Topic}");
            //await MQTTService.client.SubscribeAsync(topic3);
            //Console.ForegroundColor = ConsoleColor.Blue;

            //var newMessage = new MQTTMessage
            //{
            //    Payload = Encoding.UTF8.GetBytes("Hello MQTT EO"),
            //    QualityOfServiceLevel = QoSLevel.AtLeastOnce,
            //    Retain = false,
            //    Topic = "MQTTClientRx"
            //};

            //await Task.Delay(TimeSpan.FromSeconds(2));

            //await MQTTService.client.PublishAsync(newMessage);

            //await Task.Delay(TimeSpan.FromSeconds(2));

            //await MQTTService.client.DisconnectAsync();

            //disposableMessage?.Dispose();
        }

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

private static async Task Step9SetOperations(ISqDatabase database)
        {
            var select1 = Select(1);
            var select2 = Select(2);

            var result = await select1
                .Union(select2)
                .UnionAll(select2)
                .Except(select2)
                .Intersect(select1.Union(select2))
                .QueryList(database, r => r.GetInt32(0));

            Console.WriteLine("Result Of Set Operators:");
            Console.WriteLine(result[0]);
        }

19 View Source File : RepositoryTests.cs
License : MIT License
Project Creator : 2881099

[Fact]
		public void AddUpdate() {
			var repos = g.sqlite.GetGuidRepository<AddUpdateInfo>();

			var item = repos.Insert(new AddUpdateInfo());
			Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(item));

			item = repos.Insert(new AddUpdateInfo { Id = Guid.NewGuid() });
			Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(item));

			item.replacedle = "xxx";
			repos.Update(item);
			Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(item));

			Console.WriteLine(repos.UpdateDiy.Where(a => a.Id == item.Id).Set(a => a.Clicks + 1).ToSql());
			repos.UpdateDiy.Where(a => a.Id == item.Id).Set(a => a.Clicks + 1).ExecuteAffrows();

			item = repos.Find(item.Id);
			Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(item));
		}

19 View Source File : ReaderSimpleTest.cs
License : MIT License
Project Creator : 0x1000000

[Test]
        public static async Task Main()
        {
            Console.WriteLine(await GreetGuys().Apply(new Config {Template = "Hi, {0}!"}));
            //(Hi, John!, Hi, Jose!)

            Console.WriteLine(await GreetGuys().Apply(new Config {Template = "¡Hola, {0}!" }));
            //(¡Hola, John!, ¡Hola, Jose!)
        }

19 View Source File : ValuesController.cs
License : MIT License
Project Creator : 2881099

[HttpGet("1")]
        public string Get([FromServices]CustomRepository repo, [FromQuery]string key)
        {
            Console.WriteLine(repo.Get(key));
            repo.Text = "Invalid value";
            Console.WriteLine(repo.Text);

            return "Get OK";
        }

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

private static async Task Step17ModelsSelectBuilder(ISqDatabase database)
        {
            var page = await SqModelSelectBuilder
                .Select(ModelEmptyReader.Get<TableCustomer>())
                .LeftJoin(UserName.GetReader(), on: t => t.Table.UserId == t.JoinedTable1.UserId)
                .LeftJoin(CompanyName.GetReader(), on: t => t.Table.CompanyId == t.JoinedTable2.CompanyId)
                .Find(0,
                    10,
                    filter: null,
                    order: t => Asc(IsNull(t.JoinedTable1.FirstName + t.JoinedTable1.LastName,
                        t.JoinedTable2.CompanyName)),
                    r => (r.JoinedModel1 != null ? r.JoinedModel1.FirstName + " "+ r.JoinedModel1.LastName : null) ??
                         r.JoinedModel2?.Name ?? "Unknown")
                .QueryPage(database);

            foreach (var name in page.Items)
            {
                Console.WriteLine(name);
            }
        }

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

static void Main(string[] args)
    {
        FreeSql.DynamicProxy.GetAvailableMeta(typeof(MyClreplaced)); //The first dynamic compilation was slow
        var dt = DateTime.Now;
        var pxy = new MyClreplaced { T2 = "123123" }.ToDynamicProxy();
        Console.WriteLine(pxy.Get("key"));
        Console.WriteLine(pxy.GetAsync().Result);
        pxy.Text = "testSetProp1";
        Console.WriteLine(pxy.Text);

        Console.WriteLine(DateTime.Now.Subtract(dt).TotalMilliseconds + " ms\r\n");

        dt = DateTime.Now;
        pxy = new MyClreplaced().ToDynamicProxy();
        Console.WriteLine(pxy.Get("key1"));
        Console.WriteLine(pxy.GetAsync().Result);
        pxy.Text = "testSetProp2";
        Console.WriteLine(pxy.Text);

        Console.WriteLine(DateTime.Now.Subtract(dt).TotalMilliseconds + " ms\r\n");

        var api = DynamicProxy.Resolve<IUserApi>();
        api.Add(new UserInfo { Id = "001", Remark = "add" });
        Console.WriteLine(JsonConvert.SerializeObject(api.Get<UserInfo>("001")));
    }

19 View Source File : SteamBotController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

static void OnFriendAdded(SteamFriends.FriendAddedCallback callback)
        {
            // someone accepted our friend request, or we accepted one
            Console.WriteLine("{0} is now a friend", callback.PersonaName);
        }

19 View Source File : Startup.cs
License : MIT License
Project Creator : 2881099

public void Configure(IApplicationBuilder app)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            Console.OutputEncoding = Encoding.GetEncoding("GB2312");
            Console.InputEncoding = Encoding.GetEncoding("GB2312");

            app.UseDeveloperExceptionPage();

            app.UseRouting();
            app.UseEndpoints(config => config.MapControllers());
            app.UseDefaultFiles();
            app.UseStaticFiles();

            ImHelper.Initialization(new ImClientOptions
            {
                Redis = new FreeRedis.RedisClient("127.0.0.1:6379,poolsize=10"),
                Servers = new[] { "127.0.0.1:6001" }
            });

            ImHelper.Instance.OnSend += (s, e) => 
                Console.WriteLine($"ImClient.SendMessage(server={e.Server},data={JsonConvert.SerializeObject(e.Message)})");

            ImHelper.EventBus(
                t =>
                {
                    Console.WriteLine(t.clientId + "上线了");
                    var onlineUids = ImHelper.GetClientListByOnline();
                    ImHelper.SendMessage(t.clientId, onlineUids, $"用户{t.clientId}上线了");
                }, 
                t => Console.WriteLine(t.clientId + "下线了"));
        }

19 View Source File : ScSelectSets.cs
License : MIT License
Project Creator : 0x1000000

public async Task Exec(IScenarioContext context)
        {
            var tUser = AllTables.GereplacedUser();
            var tCompany = AllTables.GereplacedCompany();

            var unionResult = await SelectTop(2, (tUser.FirstName + "-" + tUser.LastName).As("Name")).From(tUser)
                .Union(SelectTop(2, tCompany.CompanyName.As("Name")).From(tCompany))
                .QueryList(context.Database, r => r.GetString("Name"));

            Console.WriteLine("Union");
            foreach (var name in unionResult)
            {
                Console.WriteLine(name);
            }

            var exceptSet = Values(unionResult
                    .Where((i, index) => index % 2 == 0)
                    .Select(i => new ExprValue[] {Literal(i)})
                    .ToList())
                .As("EX", "Name");

            var unionExceptResult = await SelectTop(2, (tUser.FirstName + "-" + tUser.LastName).As("Name")).From(tUser)
                .Union(SelectTop(2, tCompany.CompanyName.As("Name")).From(tCompany))
                .Except(Select(exceptSet.Alias.AllColumns()).From(exceptSet))
                .QueryList(context.Database, r => r.GetString("Name"));

            Console.WriteLine();
            Console.WriteLine("Union Except");
            foreach (var name in unionExceptResult)
            {
                Console.WriteLine(name);
            }

            for (int i = 0; i < unionResult.Count; i++)
            {
                if (i % 2 != 0)
                {
                    if (unionResult[i] != unionExceptResult[i / 2])
                    {
                        throw new Exception(unionResult[i] + " != " + unionExceptResult[i / 2]);
                    }
                }
            }


        }

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

public static async Task<AuthenticationResult> Auth()
        {
            string[] scopes = new string[] { "https://graph.microsoft.com/.default" };
            IPublicClientApplication apps;
            apps = PublicClientApplicationBuilder.Create(ConfigurationManager.AppSettings["ClientId"].ToString())
                  .WithAuthority(AadAuthorityAudience.AzureAdMultipleOrgs)
                  .Build();
            var accounts = await apps.GetAccountsAsync();

            AuthenticationResult result = null;
            if (accounts.Any())
            {
                result = await apps.AcquireTokenSilent(scopes, accounts.FirstOrDefault())
                                  .ExecuteAsync();
            }
            else
            {
                try
                {
                    var securePreplacedword = new SecureString();
                    foreach (char c in ConfigurationManager.AppSettings["Preplacedword"].ToString())        // you should fetch the preplacedword
                        securePreplacedword.AppendChar(c);  // keystroke by keystroke

                    result = await apps.AcquireTokenByUsernamePreplacedword(scopes, ConfigurationManager.AppSettings["UserName"].ToString(), securePreplacedword).ExecuteAsync();
                }
                catch (MsalException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            return result;
        }

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

private static async Task Step3SelectingData(ISqDatabase database)
        {
            var tUser = new TableUser();

            var selectResult = await Select(tUser.UserId, tUser.FirstName, tUser.LastName)
                .From(tUser)
                .OrderBy(tUser.FirstName, tUser.LastName)
                .QueryList(database,
                    r => (
                        Id: tUser.UserId.Read(r),
                        FirstName: tUser.FirstName.Read(r),
                        LastName: tUser.LastName.Read(r)));

            foreach (var record in selectResult)
            {
                Console.WriteLine(record);
            }
        }

19 View Source File : Log.cs
License : MIT License
Project Creator : 52ABP

public void Write(string text)
        {
            Console.WriteLine(Clock.Now.ToString("yyyy-MM-dd HH:mm:ss") + " | " + text);
            Logger.Info(text);
        }

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

private static async Task Step19ExportToXml(ISqDatabase database)
        {
            var tableUser = new TableUser(Alias.Empty);

            var selectExpr = Select(tableUser.FirstName, tableUser.LastName)
                .From(tableUser)
                .Where(tableUser.LastName == "Sturman")
                .Done();

            //Exporting
            var stringBuilder = new StringBuilder();
            using XmlWriter writer = XmlWriter.Create(stringBuilder);
            selectExpr.SyntaxTree().ExportToXml(writer);

            //Importing
            XmlDoreplacedent doreplacedent = new XmlDoreplacedent();
            doreplacedent.LoadXml(stringBuilder.ToString());
            var restored = (ExprQuerySpecification)ExprDeserializer
                .DeserializeFormXml(doreplacedent.DoreplacedentElement!);

            var result = await restored
                .QueryList(database, r => (tableUser.FirstName.Read(r), tableUser.LastName.Read(r)));

            foreach (var name in result)
            {
                Console.WriteLine(name);
            }
        }

19 View Source File : UnityARUserAnchorExample.cs
License : MIT License
Project Creator : 734843327

public void AnchorRemoved(ARUserAnchor anchor)
	{
		if (m_Clones.Contains(anchor.identifier))
		{
            m_Clones.Remove(anchor.identifier);
            Console.WriteLine("AnchorRemovedExample: " + anchor.identifier);
		}
	}

19 View Source File : SteamBotController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

static void OnLoggedOff(SteamUser.LoggedOffCallback callback)
        {            
            Console.WriteLine("Logged off of Steam: {0}", callback.Result);
        }

19 View Source File : Scenario.cs
License : MIT License
Project Creator : 8T4

private void PrintScenarioResult(ScenarioResult scenarioResult)
        {
            var result = FeatureVariables.Replace(scenarioResult.ToString());
            Console.WriteLine(result);
            RedirectStandardOutput?.Invoke(result);
            Paradigms.Clear();
            MappedParadigms.Clear();
        }

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

static void Main(string[] args)
        {
            var a = Chromium.Grab();

            foreach (var b in a)
            {
                Console.WriteLine("Url: " + b.URL);
                Console.WriteLine("Username: " + b.UserName);
                Console.WriteLine("Preplacedword: " + b.Preplacedword);
                Console.WriteLine("Application: " + b.Application);
                Console.WriteLine("=============================");
            }

            Console.ReadKey();

        }

19 View Source File : ScSelectTop.cs
License : MIT License
Project Creator : 0x1000000

public async Task Exec(IScenarioContext context)
        {
            var tUser = AllTables.GereplacedUser();

            var top2Users = await SelectTop(2, UserEmail.GetColumns(tUser))
                .From(tUser)
                .OrderBy(tUser.FirstName)
                .QueryList(context.Database, r => UserEmail.Read(r, tUser));

            Console.WriteLine(top2Users[0]);
            Console.WriteLine(top2Users[1]);

            if (context.Dialect != SqlDialect.TSql)
            {

                top2Users = await SelectTop(2, UserEmail.GetColumns(tUser))
                    .From(tUser)
                    .OrderBy(tUser.FirstName)
                    .Offset(5)
                    .QueryList(context.Database, r => UserEmail.Read(r, tUser));

                Console.WriteLine(top2Users[0].Email);
                Console.WriteLine(top2Users[1].Email);
            }
        }

19 View Source File : SteamBotController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
        {
            bool isSteamGuard = callback.Result == EResult.AccountLogonDenied;
            bool is2FA = callback.Result == EResult.AccountLoginDeniedNeedTwoFactor;

            if (isSteamGuard || is2FA)
            {
                Console.WriteLine("This account is SteamGuard protected!");

                if (is2FA)
                {
                    Application.Current.Dispatcher.Invoke((Action)delegate
                    {
                        //Console.Write("Please enter your 2 factor auth code from your authenticator app: ");
                        // MainWindow.currentHandle.Show();
                        GetInput GI = new GetInput();
                        twoFactorAuth = GI.Show("Authentication", "Please enter your 2 factor auth code from your authenticator app below", false);
                        GI.Close();
                    });
                }
                else
                {
                    Application.Current.Dispatcher.Invoke((Action)delegate
                    {
                        //Console.Write("Please enter the auth code sent to the email at {0}: ", callback.EmailDomain);
                        //MainWindow.currentHandle.Show();
                        GetInput GI = new GetInput();
                        authCode = GI.Show("Authentication", "Please enter the auth code sent to the email at " + callback.EmailDomain, false);
                        GI.Close();
                    });
                }

                return;
            }

            if (callback.Result != EResult.OK)
            {
                Console.WriteLine("Unable to logon to Steam: {0} / {1}", callback.Result, callback.ExtendedResult);

                isRunning = false;
                return;
            }

            Console.WriteLine("Successfully logged on!");
            loggedIn = true;
            // at this point, we'd be able to perform actions on Steam
        }

19 View Source File : SteamBotController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

static void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            // at this point, the client has received it's friends list

            int friendCount = steamFriends.GetFriendCount();

            Console.WriteLine("We have {0} friends", friendCount);

            for (int x = 0; x < friendCount; x++)
            {
                // steamids identify objects that exist on the steam network, such as friends, as an example
                SteamID steamIdFriend = steamFriends.GetFriendByIndex(x);


                AccountController.getAccount(user).AddFriend(new Friend() { steamFrindsID = "" + steamIdFriend.ConvertToUInt64().ToString(), chatLog = new ArrayList(), SteamIDObject = steamIdFriend });

                // we'll just display the STEAM_ rendered version
                Console.WriteLine("Friend: {0}", steamIdFriend.Render());
            }

            // we can also iterate over our friendslist to accept or decline any pending invites
            if (SteamTwoProperties.jsonSetting.autoAddFriendSetting)
            {
                foreach (var friend in callback.FriendList)
                {
                    if (friend.Relationship == EFriendRelationship.RequestRecipient)
                    {
                        // this user has added us, let's add him back
                        steamFriends.AddFriend(friend.SteamID);
                    }
                }
            }
        }

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

private static void MainMain(string[] args) {
            LogHeader(Console.Out);
            Thread.CurrentThread.Name = "Main Thread";

            CelesteNetServerSettings settings = new();
            settings.Load();
            settings.Save();


            bool showHelp = false;
            string? logFile = "log-celestenet.txt";
            OptionSet options = new() {
                {
                    "v|loglevel:",
                    $"Change the log level, ranging from {LogLevel.CRI} ({(int) LogLevel.CRI}) to {LogLevel.DEV} ({(int) LogLevel.DEV}). Defaults to {LogLevel.INF} ({(int) LogLevel.INF}).",
                    v => {
                        if (Enum.TryParse(v, true, out LogLevel level)) {
                            Logger.Level = level;
                        } else {
                            Logger.Level--;
                        }

                        if (Logger.Level < LogLevel.DEV)
                            Logger.Level = LogLevel.DEV;
                        if (Logger.Level > LogLevel.CRI)
                            Logger.Level = LogLevel.CRI;

                        Console.WriteLine($"Log level changed to {Logger.Level}");
                    }
                },

                { "log", "Specify the file to log to.", v => { if (v != null) logFile = v; } },
                { "nolog", "Disable logging to a file.", v => { if (v != null) logFile = null; } },

                { "h|help", "Show this message and exit.", v => showHelp = v != null },
            };

            try {
                options.Parse(args);

            } catch (OptionException e) {
                Console.WriteLine(e.Message);
                Console.WriteLine("Use --help for argument info.");
                return;
            }

            if (showHelp) {
                options.WriteOptionDescriptions(Console.Out);
                return;
            }

            if (logFile == null) {
                MainRun(settings);
                return;
            }

            if (File.Exists(logFile))
                File.Delete(logFile);

            using FileStream fileStream = new(logFile, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete);
            using StreamWriter fileWriter = new(fileStream, Console.OutputEncoding);
            using LogWriter logWriter = new() {
                STDOUT = Console.Out,
                File = fileWriter
            };
            LogHeader(fileWriter);

            try {
                Console.SetOut(logWriter);
                MainRun(settings);

            } finally {
                if (logWriter.STDOUT != null) {
                    Console.SetOut(logWriter.STDOUT);
                    logWriter.STDOUT = null;
                }
            }
        }

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

private static async Task Step5DeletingData(ISqDatabase database)
        {
            var tUser = new TableUser();

            await Delete(tUser)
                .Where(tUser.FirstName.Like("May%"))
                .Output(tUser.UserId)
                .Query(database, record => Console.WriteLine("Removed user id: " + tUser.UserId.Read(record)));
        }

19 View Source File : Server.cs
License : MIT License
Project Creator : 1ZouLTReX1

private void Update()
    {
        // Network Tick.
        lock (instantiateJobs)
        {
            for (int i = 0; i < instantiateJobs.Count; i++)
            {
                (User user, ushort id) = instantiateJobs[i]; 

                var obj = Instantiate(playerPrefab, Vector3.zero, Quaternion.idenreplacedy);
                var tmpPlayer = obj.GetComponent<Player>();
                tmpPlayer.SetPlayerID(id);

                user.player = tmpPlayer;

                // Attach the Lag compensation module to the new instantiated player.
                obj.AddComponent<LagCompensationModule>().Init(user.player);
            }

            instantiateJobs.Clear();
        }

        
        lock (disconnectedClients)
        {

            foreach (var clientSock in clients.Keys)
            {
                if (clients[clientSock].player.playerContainer == null)
                {
                    OnUserDisconnect(clientSock);
                }
            }

            foreach (var disconnectedSock in disconnectedClients)
            {
                var playerId = clients[disconnectedSock].player.playerId;
                if (clients[disconnectedSock].player.playerContainer != null)
                {
                    GameObject.Destroy(clients[disconnectedSock].player.playerContainer);
                }

                lock (clients)
                {
                    clients.Remove(disconnectedSock);
                }

                lock (playerIdList)
                {
                    playerIdList.Add(playerId);
                    // return the id number to the id pool for new players to join in.
                    Console.WriteLine("Client Disconnected, Returned Player ID: " + playerId);
                    Console.WriteLine("Player Count: " + (MaximumPlayers - playerIdList.Count) + " / " + MaximumPlayers);
                }
            }

            disconnectedClients.Clear();
        }

        // Every tick we call update function which will process all the user commands and apply them to the physics world.
        serverLoop.Update(clients.Values.Select(x => x.player).ToList());

        WorldState snapshot = serverLoop.GetSnapshot();

        lock (OutputsOG)
        {
            for (int i = OutputsOG.Count - 1; i >= 0; i--)
            {
                var sock = OutputsOG[i];

                try
                {
                    SendSnapshot(sock, snapshot);
                }
                catch
                {
                    OnUserDisconnect(sock);
                }
            }
        }
    }

See More Examples