static void Main(string[] args) { ClientCore client = new ClientCore(); //这样不传参,尝试调用空参就会出错 //还有个bug就是服务端下线时接收到的东西全是\0\0\0跳不出while循环 //List<string> solve = client.RequestAlgorithm("GetLongStr"); //尝试一下传输图片 打成二进制 //List<string> solve = client.RequestAlgorithm("PlusAndMinor", "6", "8"); //问题:用utf8编码和解码过的byte数组具有不同的长度 byte[] imageb = IOHelper.ReadBinaryFile(@"D:\数据\图片_照片\IMG_20180302_200425.jpg"); byte[] image2b = IOHelper.ReadBinaryFile(@"C:\Users\Xiblade\Desktop\test.jpg"); Console.WriteLine(imageb.Length); /* * string s = System.Text.Encoding.UTF8.GetString(imageb); * imageb = System.Text.Encoding.UTF8.GetBytes(s); * Console.WriteLine(imageb.Length); */ //客户端已经完成了发送二进制文件的部分 byte[] filename_b = System.Text.Encoding.UTF8.GetBytes("20173154"); List <string> solve = client.RequestAlgorithm("HandlePicture", filename_b.ToList <byte>(), imageb.ToList <byte>(), image2b.ToList <byte>()); Console.ReadKey(); }
/// <summary> /// Creates a new instance of <see cref="AttributeExchange"/>. /// </summary> /// <param name="client">Parent <see cref="ClientCore"/> object to attach.</param> public AttributeExchange(ClientCore client) { _Parent = client.StateContainer; _Parent.RegisterPlugIn(this); Mode = AttributeExchangeMode.Fetch; _RequestData = new List<AttributeExchangeItem>(); }
public void DeviceAndInstallRegister() { FirstStartSetupController.Instance.RedoSetup(true); var serverId = new EntityId(1, 1, 1, 0); // start DevCore.Init(serverId, false, true); // servercore won't receive commands //DevCore.DevInstance.simulationInstances[serverId].IsConnected = false; //var clientCore = DevCore.DevInstance.simulationInstances[serverId]; // start the client ClientCore.Init(); // Device and Installation should now exist Assert.AreNotEqual(default(EntityId), ConfigController.DeviceId); Assert.AreNotEqual(default(EntityId), ConfigController.InstallationId); // enable network DevCore.DevInstance.simulationInstances[serverId].IsConnected = true; // cause an update that will attempt to send offline queue // Device and Installation should have online ids Logger.Log($"DeviceId: {ConfigController.DeviceId}"); Logger.Log($"InstallationId: {ConfigController.InstallationId}"); }
public PageMessager() { InitializeComponent(); ClientCore clientCore = ClientCore.GetCore(); clientCore.AddMessage += (sender, message) => PanelMessage.Invoke(() => { UserControl element; if (message.Name == ClientCore.NameUser) { element = new ControlMessagRevers(message) { Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 218, 187)) } } ; else { element = new ControlMessag(message) { Foreground = Foreground = Brushes.LightBlue } }; element.Margin = new Thickness(5); PanelMessage.Children.Add(element); }); new Thread(() => clientCore.ReceiveMessage()).Start(); }
private static void DeleteClient() { var response = ClientCore.DeleteAsync(mClient).ConfigureAwait(false).GetAwaiter().GetResult(); response.Should().NotBeNull(); response.Success.Should().BeTrue(); }
private void BtnJoinOnClick(object sender, RoutedEventArgs e) { PanelOfClient.Visibility = Visibility.Collapsed; ProgressRing.Visibility = Visibility.Visible; if (!ValidationAdress(TbAdress.Text)) { PrintAndReturnButton("Ошибка", "Неверный IP адрес"); return; } byte[] ipAdress = getIpAdress(TbAdress.Text); int port = int.Parse(NumPort.Value.ToString()); string login = TbLogin.Text; ClientCore client; new Thread(() => { client = ClientCore.InicializeClient(ipAdress, port); if (client == null) { ClientCore.RemoveClient(); MessageOnError(null, "Что-то пошло не так, попробуйте снова"); return; } client.Error -= MessageOnError; client.Error += MessageOnError; client.Join -= OpenPageServer; client.Join += OpenPageServer; client.JoinServer(login); }).Start(); }
static void Main() { var client = new ClientCore(); Console.WriteLine(""); Console.WriteLine("Utilizando a Factory 1:"); var factory1 = new ConcreteFactory1(); client.Run(factory1); Console.WriteLine(""); Console.WriteLine("Utilizando a Factory 2:"); var factory2 = new ConcreteFactory2(); client.Run(factory2); Console.WriteLine(""); Console.WriteLine("Utilizando a Factory 3:"); var factory3 = new ConcreteFactory3(); client.Run(factory3); }
public Survey(Complaint comp1, int id, ClientCore services) { InitializeComponent(); this.comp = comp1; this.userId = id; this.services = services; this.textBox2.Text = comp1.shortDescription; }
public Config(ClientCore core) { _core = core; InitializeComponent(); saveButton.Enabled = false; }
// Start is called before the first frame update void Start() { // add the new Commands via the extention Coflnet.Core.CoreExtentions.Commands.Add(new TenfaitExtention()); // "boot it up" ClientCore.Init(); }
public void GetAllClientsTest() { var response = ClientCore.GetAllAsync().ConfigureAwait(false).GetAwaiter().GetResult(); response.Should().NotBeNull(); response.Data.Should().NotBeNull(); response.Data.Count.Should().NotBe(0); }
private async UniTaskVoid V() { ClientCore.Start(); ClientCore.SendMessageToMyCoreNode(MsgType.Enhanced, null); var c = await ClientCore.ReceiveCertification(); Debugger.Log(c); }
private static void CreateClient() { mClient = EntityHelper.GenerateClient(); mClient.CurrencyId = mCurrency.Id; var response = ClientCore.CreateAsync(mClient, true).ConfigureAwait(false).GetAwaiter().GetResult(); AssertObjects(response, mClient); }
public void UpdateClientTest() { var newClient = EntityHelper.GenerateClient(); newClient.Id = mClient.Id; newClient.CurrencyId = mClient.CurrencyId; var response = ClientCore.UpdateAsync(newClient, true).ConfigureAwait(false).GetAwaiter().GetResult(); AssertObjects(response, newClient); }
private void OnEnable() { issuerManager.SetTimeStamp(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); var id = Hash.GetCertificateId(PhoneId.GetImei(), issuerManager.HolderName, issuerManager.TimeStamp); Debugger.Log(id); var certificate = Certificate.CreateCertificate(id, issuerManager.IssuerName, issuerManager.TimeStamp, issuerManager.Category, issuerManager.Result); ClientCore.Start(); ClientCore.SendMessageToMyCoreNode(MsgType.NewTransaction, certificate); }
public async Task <IHttpActionResult> Create([FromBody] Client client) { try { var response = await ClientCore.CreateAsync(client).ConfigureAwait(false); return(Json(response)); } catch (Exception e) { LogHelper.LogException <ClientController>(e); return(Ok(ResponseFactory.CreateResponse(false, ResponseCode.Error))); } }
private async UniTaskVoid Verify() { ClientCore.Start(); ClientCore.SendMessageToMyCoreNode(MsgType.Enhanced, verifierManager.CertificateId); var certification = await ClientCore.ReceiveCertification(); verifierManager.SetCertification(certification); var hash = Hash.GetHash(verifierManager.CertificateId + verifierManager.HolderName + verifierManager.IssueDate); if (hash != verifierManager.Hash) { NotificationSystem.ShowDialog("エラー", "IDが違います", "ok"); } }
/// <summary> /// Initialized the global <see cref="CoflnetCore.Instance"/> as a `devCore`. /// Will reset the development enviroment when called again (to support multiple unit tests) /// </summary> /// <param name="id">Application/Server Id to use</param> /// <param name="preventDefaultScreens"><c>true</c> when default settings (dummys) should NOT be set such as <see cref="DummyPrivacyScreen"/></param> /// <param name="preventInit"><c>true</c> when The Inits of Client and Server-Cores should not be invoked and client should be prepared like a fresh install</param> public static void Init(EntityId id, bool preventDefaultScreens = false, bool preventInit = false) { //[Deprecated] ConfigController.ActiveUserId = id; // sets the primary managing server ConfigController.ApplicationSettings.id = id.FullServerId; if (!preventDefaultScreens) { SetupDefaults(); } // to have instances loaded var toLoadInstance = ClientCore.ClientInstance; var serverInstance = ServerCore.ServerInstance; if (DevInstance == null) { DevInstance = new DevCore(); DevInstance.simulationInstances = new Dictionary <EntityId, SimulationInstance> (); CoflnetCore.Instance = DevInstance; } else { // reset if there was an devinstance bevore DevInstance.simulationInstances.Clear(); ServerCore.ServerInstance = new ServerCoreProxy(); ClientCore.ClientInstance = new ClientCoreProxy(); } DevInstance.AddServerCore(id.FullServerId); if (!id.IsServer) { DevInstance.AddClientCore(id); } else { DevInstance.AddClientCore(EntityId.Default); } if (!preventInit) { ServerCore.Init(); ClientCore.Init(); } }
public async Task <IHttpActionResult> GetAll() { try { var response = await ClientCore.GetAllAsync(new[] { nameof(Client.Currency) }); return(Ok(response)); } catch (Exception e) { LogHelper.LogException <ClientController>(e); return(Ok(ResponseFactory.CreateResponse(false, ResponseCode.Error))); } }
/// <summary> /// Производит конфигурацию сервисов.. /// </summary> private void Configurate() { XmlConfigurator.Configure(); ClientCore.SetConfiguration(new ClientConfiguration()); ClientCore.Instance.DataStore.DeployIfNeeded(); ClientCore.Instance.ApplicationNeedExit += ApplicationNeedExit; MainWindow window = new MainWindow(); ArmController.Instance.SetMainWindow(window); ArmController.Instance.ShowAuthForm(); window.Show(); }
public async Task <IHttpActionResult> Get() { try { var productsResponse = await ProductCore.GetAllAsync().ConfigureAwait(false); var ordersResponse = await OrderCore.GetAllAsync().ConfigureAwait(false); var orderItemsResponse = await OrderItemCore.GetAllAsync().ConfigureAwait(false); var clientsResponse = await ClientCore.GetAllAsync().ConfigureAwait(false); var paymentsResponse = await PayrollCore.GetAllAsync().ConfigureAwait(false); if (!productsResponse.Success || !orderItemsResponse.Success || !orderItemsResponse.Success || !clientsResponse.Success || !paymentsResponse.Success) { return(Ok(ResponseFactory.CreateResponse(false, ResponseCode.Error))); } var totalIncomeValue = paymentsResponse.Data.Sum(payment => payment.Value); var totalOrdersValue = orderItemsResponse.Data.Sum(orderItem => orderItem.Price * orderItem.Quantity); var model = new SummaryModel { NumberOfClients = clientsResponse.Data.Count, NumberOfOrders = ordersResponse.Data.Count, NumberOfPayments = paymentsResponse.Data.Count, NumberOfProducts = productsResponse.Data.Count, TotalIncomeValue = totalIncomeValue, TotalOrdersValue = totalOrdersValue }; return(Ok(ResponseFactory <SummaryModel> .CreateResponse(true, ResponseCode.Success, model))); } catch (Exception e) { LogHelper.LogException <SummaryController>(e); return(Ok(ResponseFactory <SummaryModel> .CreateResponse(false, ResponseCode.Error))); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); ConfigManager.initConfigManager(); var auth = new Authenticator(LoginCallback); _core = new ClientCore(auth); SetupReactions(_core); _core.AboutToAuthenticate += SetupAuthErrorReactions; _core.AboutToAutoUpdate += Setup; var launched = _core.Launch(); if (!launched) { Close(); } }
public Security(ClientCore core) { _core = core; InitializeComponent(); userList.Enabled = false; permissionList.Enabled = false; revokeButton.Enabled = false; grantButton.Enabled = false; availablePermissionList.Enabled = false; newPasswordText.Enabled = false; confirmNewPasswordText.Enabled = false; setPasswordButton.Enabled = false; addUserButton.Enabled = false; deleteUserButton.Enabled = false; addToAllowButton.Tag = 0; addToDenyButton.Tag = Command.ConfigUseValueMask; removeFromAllowButton.Tag = Command.ConfigModeMask; removeFromDenyButton.Tag = Command.ConfigUseValueMask | Command.ConfigModeMask; }
public AudioWall(ClientCore core, TrackList tl) { this._core = core; this._tl = tl; InitializeComponent(); // Don't initialise this array _before_ initialising the component; // else, OnResize will trip a null-pointer exception. buttons = new BAPSFormControls.BAPSButton[20]; for (int i = 0; i < 5; i++) { for (int j = 0; j < 4; j++) { var bapsButton = new BAPSFormControls.BAPSButton { BackColor = Color.Transparent, DialogResult = DialogResult.None, Font = new Font("Segoe UI", 14.25f, FontStyle.Regular, GraphicsUnit.Point, 0), HighlightColor = Color.Red, Highlighted = false, Location = new Point(((i + 1) * 12) + (i * 190), ((j + 1) * 12) + (j * 170)), Name = string.Concat("bapsButton", ((5 * j) + i).ToString()), Size = new Size(190, 170), TabIndex = 0, Text = string.Concat("bapsButton", ((5 * j) + i).ToString()), Tag = 1, Enabled = false }; bapsButton.TabIndex = (5 * j) + i; bapsButton.Click += audioWallClick; buttons[(5 * j) + i] = bapsButton; Controls.Add(bapsButton); } } refreshWall(); }
private void Start() { ClientCore.Start(); var transaction = new List <Dictionary <string, object> >() { new Dictionary <string, object>() { { "@context", new List <string>() { "https://hoge", "https://hoge/hoge" } }, { "id", "https://id/huga" }, { "type", new List <string>() { "VerifiableCredential", "AntibodyTestCredential" } }, { "issuer", "https://issuer/piyo" }, { "issuerDate", null }, { "credentialSubject", new List <string>() { "did:example:xyzzy", "SARS-CoV-2" } } }, new Dictionary <string, object>() { { "proof", null } } }; Observable.Interval(TimeSpan.FromSeconds(10)) .Subscribe(x => { transaction[0]["issuerDate"] = DateTime.Now; ClientCore.SendMessageToMyCoreNode(MsgType.NewTransaction, Json.Serialize(transaction)); }) .AddTo(this); }
public ClientUI(ClientCore services) { InitializeComponent(); this.services = services; }
/// <summary> /// Creates an instance of AuthenticationPolicy extension. /// </summary> /// <param name="client">The parent <see cref="ClientCore"/> object.</param> public AuthenticationPolicy(ClientCore client) { _Parent = client.StateContainer; _Parent.RegisterPlugIn(this); _PreferredPolicies = new List<Uri>(); }
private void OnCurrentPathRefresh(object sender, ClientCore.EventArg.CurrentFilePathRefreshEventArgs e) { CurrentPath = e.Path; }
/// <summary> /// Creates a new SimpleRegistration plugin and registers it with an <see cref="ClientCore"/> object. /// </summary> /// <param name="client">The <see cref="ClientCore"/> object to attach.</param> public SimpleRegistration(ClientCore client) { _RequiredFields = new List<string>(); _OptionalFields = new List<string>(); _Parent = client.StateContainer; _Parent.RegisterPlugIn(this); }
/// <summary> /// Create a new instance of Yadis. /// </summary> /// <param name="client">Parent <see cref="ClientCore" /> object.</param> public Yadis(ClientCore client) { Parent = client.StateContainer; Parent.RegisterPlugIn(this); }
// Use this for initialization void Start() { Instance = this; installEvents(); }
public InstallService(ClientCore coreInstance) { this.clientCoreInstance = coreInstance; }
public Object Evaluate(ClientCore host, IDictionary<String, String> args) { throw new NotImplementedException(); }
public DeviceService(ClientCore coreInstance) { this.clientCoreInstance = coreInstance; }
public void GetClientTest() { var response = ClientCore.GetAsync(mClient.Id).ConfigureAwait(false).GetAwaiter().GetResult(); AssertObjects(response, mClient); }
public void InitializeMockData() { try { Task.Run(async() => { var existingProducts = await ProductCore.GetAllAsync().ConfigureAwait(false); if (existingProducts.Data != null && existingProducts.Data.Count != 0) { return; } var products = await ProductCore.CreateAsync(mProducts, true).ConfigureAwait(false); var existingClients = await ClientCore.GetAllAsync().ConfigureAwait(false); if (existingClients.Data != null && existingClients.Data.Count != 0) { return; } var currencies = await CurrencyCore.GetAllAsync().ConfigureAwait(false); if (!currencies.Success || currencies.Data == null || currencies.Data.Count == 0) { return; } var currency = currencies.Data.FirstOrDefault(c => c.Name == "RON"); if (currency == null) { return; } foreach (var client in mClients) { client.CurrencyId = currency.Id; } var clients = await ClientCore.CreateAsync(mClients, true).ConfigureAwait(false); var existingOrders = await OrderCore.GetAllAsync().ConfigureAwait(false); if (existingOrders.Data != null && existingOrders.Data.Count != 0) { return; } int nr = 0; List <Order> newOrders = new List <Order>(); foreach (var client in clients.Data) { if (products.Data.Count >= 6) { for (int i = 0; i < 2; i++) { nr++; var o = new Order() { Id = Guid.NewGuid(), CurrencyId = currency.Id, ClientId = client.Id, SaleType = i, Status = 0, Date = DateTime.Now.AddDays(-nr).AddHours(-nr), OrderItems = new List <OrderItem>() }; for (int k = i + nr / 2; k < 6; k += 1) { o.OrderItems.Add(new OrderItem() { Id = Guid.NewGuid(), OrderId = o.Id, ProductId = products.Data.ElementAt(k).Id, Price = products.Data.ElementAt(k).Price, Quantity = k + 1 }); } newOrders.Add(o); } } } var orders = await OrderCore.CreateAsync(newOrders, true, new[] { nameof(Order.OrderItems) }).ConfigureAwait(false); var payrolls = new List <Payroll>(); if (orders.Data.Count > 3) { for (int i = 0; i < 3; i++) { var payroll = new Payroll() { Id = Guid.NewGuid(), ClientId = clients.Data.ElementAt(i).Id, OrderId = orders.Data.ElementAt(i).Id, Date = DateTime.Now.AddDays(-i), Value = orders.Data.ElementAt(i).OrderItems.Sum(p => p.Price * p.Quantity), }; payrolls.Add(payroll); } } await PayrollCore.CreateAsync(payrolls, true).ConfigureAwait(false); }).ConfigureAwait(false).GetAwaiter().GetResult(); } catch (Exception ex) { // ignored } }
/// <summary> /// Creates a new Authentication plugin and registers it with ClientCore object. /// </summary> /// <param name="client">The <see cref="ClientCore"/> object to attach.</param> public IdentityAuthentication(ClientCore client) { _Parent = client.StateContainer; _Parent.RegisterPlugIn(this); }
public ServerTreePane(ClientCore client) { this.Client = client; InitializeComponent(); }
/// <summary> /// Create a new instance of OAuthExtension. /// </summary> /// <param name="core">The OpenIdClient to use.</param> /// <param name="oauthClient">The OAuth Consumer to use.</param> public OAuthExtension(ClientCore core, OAuthClient oauthClient) { _Parent = core.StateContainer; _Parent.RegisterPlugIn(this); OAuthClient = oauthClient; }
private static void Main(String[] args) { _parameters = ConfigurationManager.AppSettings.AllKeys .ToDictionary(k => k, k => ConfigurationManager.AppSettings[k]); foreach (Match match in args .TakeWhile(s => s != "--") .Select(s => Regex.Match(s, "(-(?<key>[a-zA-Z0-9_]*)(=(?<value>(\"[^\"]*\")|('[^']*')|(.*)))?)*")) .Where(m => m.Success) ) { _parameters[match.Groups["key"].Value] = match.Groups["value"].Success ? match.Groups["value"].Value : "true"; } if (AppDomain.CurrentDomain.IsDefaultAppDomain()) { Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); AppDomain domain = AppDomain.CreateDomain( "MetaTweetClient.exe:run", AppDomain.CurrentDomain.Evidence, new AppDomainSetup() { ApplicationBase = Path.GetFullPath(_parameters["init_base"]), PrivateBinPath = _parameters["init_probe"], PrivateBinPathProbe = "true", ApplicationName = "MetaTweetClient", LoaderOptimization = LoaderOptimization.MultiDomainHost, } ); domain.ExecuteAssembly(Assembly.GetExecutingAssembly().Location, args); return; } String cultureString; Thread.CurrentThread.CurrentCulture = _parameters.ContainsKey("culture") ? String.IsNullOrEmpty(cultureString = _parameters["culture"]) ? Thread.CurrentThread.CurrentCulture : cultureString == "invaliant" ? CultureInfo.InvariantCulture : CultureInfo.GetCultureInfo(cultureString) : CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory; Application.ThreadException += (sender, e) => new ThreadExceptionDialog(e.Exception) .ShowDialog(); using (ClientCore client = new ClientCore()) { client.Initialize(_parameters); client.Run(); } }