コード例 #1
2
ファイル: AddrAssignCommand.cs プロジェクト: zesus19/c5.v1
 protected override Rpc.Serial.IInstruction BuildInstruction(Rpc.Net.Message.DuplexMessage commandMessage)
 {
     using (var scope = ObjectHost.Host.BeginLifetimeScope())
     {
         return scope.Resolve<AddrAssignInstruction>(
             new NamedParameter("command", this),
             new NamedParameter("parameter", commandMessage.GetContent<AddrAssign>()));
     }
 }
コード例 #2
0
ファイル: Node.cs プロジェクト: AdroDG/babble-cs
        private void ProcessEagerSyncRequest(Rpc rpc, EagerSyncRequest cmd)
        {
            logger.Debug("EagerSyncRequest {EagerSyncRequest}", new
            {
                cmd.FromId,
                Events = cmd.Events.Length
            });

            var success = true;

            Exception respErr;

            lock (_operationLock)
            {
                respErr = Sync(cmd.Events).Result;
            }

            if (respErr != null)
            {
                logger.Error("Sync() {error}", respErr);
                success = false;
            }

            var resp = new EagerSyncResponse
            {
                FromId  = Id,
                Success = success
            };

            rpc
            .RespondAsync(resp, respErr != null
                                        ? new NetError(resp.FromId.ToString(), respErr)
                                        : null)
            .Wait();
        }
コード例 #3
0
        public JArray getnep5decimals(string nep5Hash)
        {
            //Console.WriteLine("assetid:" + nep5Hash);

            string script = null;

            using (var sb = new ThinNeo.ScriptBuilder())
            {
                ThinNeo.Hash160 shash = new ThinNeo.Hash160(nep5Hash);

                sb.EmitParamJson(new MyJson.JsonNode_Array());
                sb.EmitParamJson(new MyJson.JsonNode_ValueString("(str)decimals"));
                sb.EmitAppCall(shash);

                var data = sb.ToArray();
                script = ThinNeo.Helper.Bytes2HexString(data);
            }
            var res = Rpc.invokescript(this.neoCliJsonRPCUrl, script).Result;
            var arr = res.GetDictItem("stack").AsList().ToArray();
            //Console.WriteLine("rpc info:"+ arr[0].ToString());
            var decimalString = arr[0].AsDict()["value"].AsString();
            int decimals      = int.Parse(decimalString);

            return(new JArray(new JObject()
            {
                { "value", decimals }
            }));
        }
コード例 #4
0
        public async Task <Result <decimal> > GetFa12AllowanceAsync(
            string holderAddress,
            string spenderAddress,
            string callingAddress,
            SecureBytes securePublicKey,
            CancellationToken cancellationToken = default)
        {
            var tokenConfig = _currency as Fa12Config;

            try
            {
                var rpc = new Rpc(_rpcNodeUri);

                var tx = new TezosTransaction
                {
                    Currency     = tokenConfig.Name,
                    From         = callingAddress,
                    To           = tokenConfig.TokenContractAddress,
                    Fee          = 0,      //token.GetAllowanceFee,
                    GasLimit     = tokenConfig.GetAllowanceGasLimit,
                    StorageLimit = 0,      //token.GetAllowanceStorageLimit,
                    Params       = CreateGetAllowanceParams(holderAddress, spenderAddress, tokenConfig.ViewContractAddress),

                    UseRun            = false,
                    UseOfflineCounter = false
                };

                _ = await tx
                    .FillOperationsAsync(
                    securePublicKey : securePublicKey,
                    tezosConfig : tokenConfig,
                    cancellationToken : cancellationToken)
                    .ConfigureAwait(false);

                var runResults = await rpc
                                 .RunOperations(tx.Head, tx.Operations)
                                 .ConfigureAwait(false);

                return(runResults
                    ?["contents"]
                       ?.LastOrDefault()
                    ?["metadata"]
                    ?["internal_operation_results"]
                    ?[0]
                    ?["result"]
                    ?["errors"]
                    ?[1]
                    ?["with"]
                    ?["args"]
                    ?[0]
                    ?["args"]
                    ?[0]
                    ?["int"]
                       ?.Value <decimal>() ?? 0);
            }
            catch (Exception e)
            {
                return(new Error(Errors.RequestError, e.Message));
            }
        }
コード例 #5
0
            public TestService(Stream stream, IServiceProvider serviceProvider) :
                base(serviceProvider, stream)
            {
                Event = new ManualResetEvent(false);

                Rpc.StartListening();
            }
コード例 #6
0
ファイル: Program.cs プロジェクト: damiansimanuk/Dev.DeltaX
        static Task TestRpcServer()
        {
            var config = new MqttConfiguration("Mqtt");

            config.ClientId = "Test JsonRpcMqtt" + Guid.NewGuid();
            config.Username = "******";
            config.Password = "******";

            var mqtt = new MqttClientHelper(config);


            var rpc = new Rpc(new JsonRpcMqttConnection(mqtt.Client, "test/", clientId: "TestRpcServer"));

            var functions = new ExampleService(rpc);

            rpc.Dispatcher.RegisterService(functions);

            mqtt.OnConnectionChange += (s, connected) => { if (connected)
                                                           {
                                                               rpc.UpdateRegisteredMethods();
                                                           }
            };

            return(mqtt.RunAsync());
        }
コード例 #7
0
        public ActionResult Wyszukaj(SearchRequest searchModel)
        {
            Session["from"] = searchModel.startStation;
            Session["to"]   = searchModel.endStation;
            Rpc rpc = new Rpc();
            SerachResponseView searchList = new SerachResponseView();

            List <SelectListItem> listSelectListItem = new List <SelectListItem>();

            foreach (Ticket ticket in Tickets.list)
            {
                SelectListItem selectListItem = new SelectListItem()
                {
                    Text     = ticket.Name,
                    Value    = ticket.Id.ToString(),
                    Selected = ticket.isSelected
                };
                listSelectListItem.Add(selectListItem);
            }

            searchList.tickets = listSelectListItem;

            List <SearchResponse> searchResponse = rpc.SendSearchRequest(searchModel);

            searchList.list = searchResponse;

            return(View("ZnalezionePolaczenia", searchList));
        }
コード例 #8
0
		public UnicodeString(Rpc.Unicode_string rus, bool zterm)
		{
			Length = rus.Length;
			MaximumLength = rus.MaximumLength;
			Buffer = rus.Buffer;
			this.Zterm = zterm;
		}
コード例 #9
0
        public async Task <Coin> OutpointToCoinAsync(InputRegistrationRequest request, CancellationToken cancellationToken)
        {
            OutPoint input = request.Input;

            if (Prison.TryGet(input, out var inmate) && (!Config.AllowNotedInputRegistration || inmate.Punishment != Punishment.Noted))
            {
                throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputBanned);
            }

            var txOutResponse = await Rpc.GetTxOutAsync(input.Hash, (int)input.N, includeMempool : true, cancellationToken).ConfigureAwait(false);

            if (txOutResponse is null)
            {
                throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputSpent);
            }
            if (txOutResponse.Confirmations == 0)
            {
                throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputUnconfirmed);
            }
            if (txOutResponse.IsCoinBase && txOutResponse.Confirmations <= 100)
            {
                throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputImmature);
            }

            return(new Coin(input, txOutResponse.TxOut));
        }
コード例 #10
0
        public SnapshotService(Stream stream, IServiceProvider serviceProvider) :
            base(serviceProvider, stream)
        {
            _gate = new object();

            Rpc.StartListening();
        }
コード例 #11
0
 internal void LoadParameters(Rpc rpc)
 {
     foreach (JsonParameterInfo infoItem in jsonParameterInfo)
     {
         rpc.Parameters.Add(GetParameter(infoItem));
     }
 }
コード例 #12
0
ファイル: SnapshotService.cs プロジェクト: khm1600/CJing
        public SnapshotService(Stream stream, IServiceProvider serviceProvider) :
            base(serviceProvider, stream)
        {
            _source = new JsonRpcAssetSource(this);

            Rpc.StartListening();
        }
コード例 #13
0
        private async Task <(RpcResponse rpcResp, NetError err)> MakeRpc(string target, object args, TimeSpan tmout)
        {
            var(peer, err) = await Router.GetPeer(target);

            if (err != null)
            {
                return(null, err);
            }

            var rpc = new Rpc {
                Command = args, RespChan = new AsyncProducerConsumerQueue <RpcResponse>()
            };

            await peer.Consumer.EnqueueAsync(rpc);

            var responseTask = rpc.RespChan.DequeueAsync();

            var timeoutTask = Task.Delay(tmout);

            var resultTask = await Task.WhenAny(responseTask, timeoutTask);

            if (resultTask == timeoutTask)
            {
                return(null, new NetError("command timed out"));
            }

            var rpcResp = responseTask.Result;

            return(rpcResp, rpcResp.Error);
        }
コード例 #14
0
        private async Task ProcessEagerSyncRequest(Rpc rpc, EagerSyncRequest cmd)
        {
            logger.Debug("EagerSyncRequest {EagerSyncRequest}", new
            {
                cmd.FromId,
                Events = cmd.Events.Length
            });

            var success = true;

            Exception respErr;

            using (await coreLock.LockAsync())
            {
                respErr = await Sync(cmd.Events);
            }

            if (respErr != null)
            {
                logger.Error("Sync() {error}", respErr);
                success = false;
            }

            var resp = new EagerSyncResponse
            {
                FromId  = Id,
                Success = success
            };

            await rpc.RespondAsync(resp, respErr != null?new NetError(resp.FromId.ToString(), respErr) : null);
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: aschet/he853control
        /// <summary>
        /// Main program.
        /// </summary>
        /// <param name="args">Command line arguments.</param>
        /// <returns>0 if no error occured.</returns>
        public static int Main(string[] args)
        {
            PrintInformation();

            Arguments arguments = new Arguments();

            try
            {
                arguments.Parse(args);
            }
            catch (Exception)
            {
                PrintUsage();
                return((int)ExitCode.Success);
            }

            if (arguments.Service)
            {
                Rpc.RegisterClient();
            }

            Device device = new Device();

            try
            {
                device.Open();

                if (arguments.CommandText == Command.On)
                {
                    device.SwitchOn(arguments.DeviceCode, arguments.Style);
                }
                else if (arguments.CommandText == Command.Off)
                {
                    device.SwitchOff(arguments.DeviceCode, arguments.Style);
                }
                else
                {
                    device.AdjustDim(arguments.DeviceCode, arguments.Style, arguments.Dim);
                }
            }
            catch (FileNotFoundException exception)
            {
                Console.WriteLine(exception.Message);
                return((int)ExitCode.DeviceNotFound);
            }
            catch (RemotingException)
            {
                Console.WriteLine("The service does not respond.");
                return((int)ExitCode.DeviceNotFound);
            }
            catch (IOException exception)
            {
                Console.WriteLine(exception.Message);
                device.Close();
                return((int)ExitCode.CommandFailed);
            }

            return((int)ExitCode.Success);
        }
コード例 #16
0
        public RemoteSymbolSearchUpdateEngine(Stream stream, IServiceProvider serviceProvider)
            : base(serviceProvider, stream)
        {
            _updateEngine = new SymbolSearchUpdateEngine(
                logService: this, progressService: this);

            Rpc.StartListening();
        }
コード例 #17
0
        public RemoteSymbolSearchUpdateEngine(Stream stream, IServiceProvider serviceProvider)
            : base(serviceProvider, stream)
        {
            _updateEngine = new SymbolSearchUpdateEngine(
                new LogService(this), updateCancellationToken: this.CancellationToken);

            Rpc.StartListening();
        }
コード例 #18
0
ファイル: ObjectLibrary.cs プロジェクト: omanamos/robotics
        public ObjectLibrary(MainController parent, Rpc.Client client)
        {
            this.objects = new SerializableDictionary<string, RecogObject>();
            this.lookupByProperty = new SerializableDictionary<string, List<RecogObject>>();
            this.knownPointClouds = new Dictionary<string, PointCloud>();
            this.unknownPointClouds = new Dictionary<string, PointCloud>();

            this.client = client;
        }
コード例 #19
0
        public async Task <string> ListAllLegendary()
        {
            Rpc rpc = new Rpc();

            List <string> args = new List <string> {
            };

            return(await rpc.CallApi("ListAllLegendary", args));
        }
コード例 #20
0
        public async Task <string> ListHeaders()
        {
            Rpc rpc = new Rpc();

            List <string> args = new List <string> {
            };

            return(await rpc.CallApi("ListHeaders", args));
        }
コード例 #21
0
        public async Task <string> ListMultType()
        {
            Rpc rpc = new Rpc();

            List <string> args = new List <string> {
            };

            return(await rpc.CallApi("ListMultType", args));
        }
コード例 #22
0
        public async Task <decimal> GetBalanceAsync(
            string address,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var rpc = new Rpc(_rpcProvider);

            return(await rpc.GetBalance(address)
                   .ConfigureAwait(false));
        }
コード例 #23
0
ファイル: RpcClient.cs プロジェクト: Sandy4321/XamarinClient
        public void GetBootstrapTableThread(object param)
        {
            int i = (int)param;

            try
            {
                TcpClient Client = new TcpClient();
                Client.Connect(ServerList[i].Item1, ServerList[i].Item2);
                byte[] result = Rpc.InvokeAndReadResponse("RpcNode.BootstrapTable",
                                                          new object[] { this.Account.address }, Client, 50);
                if (result == null)
                {
                    return;
                }
                lock (Bootstrap_mutex)
                {
                    if (Bootstrapresults.ContainsKey(result))
                    {
                        Console.WriteLine(ServerList[i].Item1 + ":" + ServerList[i].Item2);
                        Bootstrapresults[result]++;
                    }
                    else
                    {
                        Console.WriteLine(ServerList[i].Item1 + ":" + ServerList[i].Item2);
                        Bootstrapresults.Add(result, 1);
                    }
                }
            }
            catch (Exception e)
            {
                try
                {
                    TcpClient Client = new TcpClient();
                    Client.Connect(ServerList[i].Item1, ServerList[i].Item2);
                    byte[] result = Rpc.InvokeAndReadResponse("RpcNode.BootstrapTable",
                                                              new object[] { this.Account.address }, Client, 50);
                    if (result == null)
                    {
                        return;
                    }
                    lock (Bootstrap_mutex)
                    {
                        if (Bootstrapresults.ContainsKey(result))
                        {
                            Console.WriteLine(ServerList[i].Item1 + ":" + ServerList[i].Item2);
                            Bootstrapresults[result]++;
                        }
                        else
                        {
                            Console.WriteLine(ServerList[i].Item1 + ":" + ServerList[i].Item2);
                            Bootstrapresults.Add(result, 1);
                        }
                    }
                }
                catch (Exception exception) { }
            }
        }
コード例 #24
0
ファイル: GameService.cs プロジェクト: TheFuseGamer/FGMM-DM
        public GameService(ILogger logger, IEventManager events, IRpcHandler rpc, ITickManager tickManager) : base(logger, events, rpc, tickManager)
        {
            Logger.Info("Game service started.");
            Rpc.Event(DMEvents.Spawn).On <SpawnData>(OnSpawnRequested);
            Rpc.Event(DMEvents.Start).On(OnGameStarted);
            Rpc.Event(DMEvents.UpdateTimer).On <int>(OnTimerUpdated);
            Rpc.Event(ServerEvents.MissionEnded).On(OnMissionEnded);

            TickManager.Attach(MissionTimerTick);
        }
コード例 #25
0
        public RazorLanguageService(Stream stream, IServiceProvider serviceProvider)
            : base(serviceProvider, stream)
        {
            Rpc.JsonSerializer.Converters.Add(new RazorDiagnosticJsonConverter());

            // Due to this issue - https://github.com/dotnet/roslyn/issues/16900#issuecomment-277378950
            // We need to manually start the RPC connection. Otherwise we'd be opting ourselves into
            // race condition prone call paths.
            Rpc.StartListening();
        }
コード例 #26
0
        private static void Main(string[] args)
        {
            if (Rpc.HasServiceArg(args))
            {
                Rpc.RegisterClient();
            }

            Application.EnableVisualStyles();
            Application.Run(new MainWindow());
        }
コード例 #27
0
 public bool HandleTeamJoinRequest(Player player, int team)
 {
     if (GameStarted)
     {
         Rpc.Event(DMEvents.Spectate).Trigger();
         return(true);
     }
     Rpc.Event(DMEvents.UpdateTimer).Trigger(RemaingingTime);
     return(GameController.AddPlayerToTeam(player));
 }
コード例 #28
0
        public async void StartGame()
        {
            await BaseScript.Delay(0);

            Logger.Debug("Starting the game");
            foreach (Player player in AlivePlayers)
            {
                Rpc.Event(DMEvents.Start).Trigger(player);
            }
        }
コード例 #29
0
ファイル: Program.cs プロジェクト: damiansimanuk/Dev.DeltaX
        static async Task TestRpcClient()
        {
            var logger = LoggerConfig.DefaultLogger;

            var config = new MqttConfiguration("Mqtt");

            config.ClientId = "Test JsonRpcMqtt" + Guid.NewGuid();
            config.Username = "******";
            config.Password = "******";

            var mqtt = new MqttClientHelper(config);

            mqtt.ConnectAsync().Wait();

            var rpc = new Rpc(new JsonRpcMqttConnection(mqtt.Client, "test/", clientId: "TestRpcClient"));

            mqtt.OnConnectionChange += (s, connected) => { if (connected)
                                                           {
                                                               rpc.UpdateRegisteredMethods();
                                                           }
            };

            var service = rpc.GetServices <IExampleService>();

            while (mqtt.IsRunning)
            {
                var taskBroadcast  = rpc.CallAsync("SendBroadcastAsync", "hola mundo " + DateTime.Now);
                var taskBroadcast2 = service.SendBroadcastAsync("hola mundo " + DateTime.Now);
                logger.LogInformation("SendBroadcastAsync taskBroadcast:{0} {1}", taskBroadcast.Status, taskBroadcast2.Status);

                var res = service.Sumar(1, DateTime.Now.Second);
                logger.LogInformation("Sumar result:{0}", res);

                var t = service.TaskVoidAsync(1, DateTime.Now.Second);
                logger.LogInformation("TaskVoidAsync t.Status:{0}", t?.Status);
                t.Wait();
                logger.LogInformation("TaskVoidAsync t.Wait() t.Status:{0}", t?.Status);

                var t2 = service.TaskIntAsync(1, DateTime.Now.Second);
                logger.LogInformation("TaskIntAsync t2.Result:{0}", t2.Result);

                string rCall1 = service.Concatenar("ASDF", 1, 3);
                logger.LogInformation("GetCaller Concatenar Result: {0}", rCall1);

                CustObj resObj1 = service.FuncCustObj(1234, "hola FuncCustObj");
                logger.LogInformation("GetCaller FuncCustObj Result: {@0}", resObj1);

                resObj1 = service.FuncCustObj(1234, "hola FuncCustObj", new CustObj {
                    a = 23, b = new string[] { "sadf" }
                });
                logger.LogInformation("GetCaller FuncCustObj Result: {@0} {1}", resObj1, resObj1.c[0]);

                await Task.Delay(5000);
            }
        }
コード例 #30
0
ファイル: RpcClient.cs プロジェクト: Sandy4321/XamarinClient
        public void GetTransactionToAccountThread(object param)
        {
            int i = (int)param;

            try
            {
                TcpClient Client = new TcpClient();
                Client.Connect(ServerList[i].Item1, ServerList[i].Item2);
                Console.WriteLine(ServerList[i].Item1 + ":" + ServerList[i].Item2);
                byte[] result = Rpc.InvokeAndReadResponse("RpcNode.GetReceiveTxForAccount",
                                                          new object[] { this.Account.address }, Client, 50);
                if (result == null)
                {
                    return;
                }
                lock (TxIn_mutex)
                {
                    if (TxInresults.ContainsKey(result))
                    {
                        TxInresults[result]++;
                    }
                    else
                    {
                        TxInresults.Add(result, 1);
                    }
                }
            }
            catch (Exception e)
            {
                try
                {
                    TcpClient Client = new TcpClient();
                    Client.Connect(ServerList[i].Item1, ServerList[i].Item2);
                    Console.WriteLine(ServerList[i].Item1 + ":" + ServerList[i].Item2);
                    byte[] result = Rpc.InvokeAndReadResponse("RpcNode.GetReceiveTxForAccount", new object[] { this.Account.address }, Client, 50);
                    if (result == null)
                    {
                        return;
                    }
                    lock (TxIn_mutex)
                    {
                        if (TxInresults.ContainsKey(result))
                        {
                            TxInresults[result]++;
                        }
                        else
                        {
                            TxInresults.Add(result, 1);
                        }
                    }
                }
                catch (Exception exception) { }
            }
        }
コード例 #31
0
		/// <exception cref="System.IO.IOException"></exception>
		public SamrDomainHandle(DcerpcHandle handle, SamrPolicyHandle policyHandle, int access
			, Rpc.SidT sid)
		{
			MsrpcSamrOpenDomain rpc = new MsrpcSamrOpenDomain(policyHandle, access, sid, this
				);
			handle.Sendrecv(rpc);
			if (rpc.Retval != 0)
			{
				throw new SmbException(rpc.Retval, false);
			}
		}
コード例 #32
0
        public async Task <int> GetCounter(Atomex.Tezos tezos, string address)
        {
            var rpc = new Rpc(tezos.RpcNodeUri);

            var head = await rpc
                       .GetHeader()
                       .ConfigureAwait(false);

            return(await GetCounter(tezos, address, head)
                   .ConfigureAwait(false));
        }
コード例 #33
0
        public async Task <string> SearchName(string name)
        {
            Rpc rpc = new Rpc();

            List <string> args = new List <string>
            {
                name
            };

            return(await rpc.CallApi("SearchName", args));
        }
コード例 #34
0
        public void SpawnPlayer(Player player)
        {
            SpawnData spawnData = new SpawnData()
            {
                Position = Mission.Team.GetRandomSpawnPoint(),
                Skin     = Mission.Team.GetRandomSkin(),
                Loadout  = Mission.Team.Loadout
            };

            Rpc.Event(DMEvents.Spawn).Trigger(player, spawnData);
        }
コード例 #35
0
ファイル: TimeSyncCommand.cs プロジェクト: zesus19/c5.v1
 protected override Rpc.Serial.IInstruction BuildInstruction(Rpc.Net.Message.DuplexMessage commandMessage)
 {
     var instrSet = new InstructionSet(this);
     using (var scope = ObjectHost.Host.BeginLifetimeScope())
     {
         foreach(var addr in commandMessage.GetContent<TimeSync>().DestinationAddrs)
         {
             instrSet.AddInstruction(scope.Resolve<TimeSyncInstruction>(
                     new NamedParameter("command", this),
                     new NamedParameter("parameter", addr)));
         }
     }
     return instrSet;
 }
コード例 #36
0
ファイル: CardLogoutCommand.cs プロジェクト: zesus19/c5.v1
 protected override Rpc.Serial.IInstruction BuildInstruction(Rpc.Net.Message.DuplexMessage commandMessage)
 {
     var instrSet = new InstructionSet(this);
     var cardAssign = commandMessage.GetContent<CardAssign>();
     using (var scope = ObjectHost.Host.BeginLifetimeScope())
     {
         foreach (var card in cardAssign.Units)
         {
             instrSet.AddInstruction(scope.Resolve<CardLogoutInstruction>(
                 new NamedParameter("command", this),
                 new NamedParameter("parameter", card)));
         }
     }
     return instrSet;
 }
コード例 #37
0
        protected bool HasAccess(Rpc rpc, bool checkContentType = false)
        {
            if (checkContentType && Request.ContentType != string.Format("application/x-git-{0}-request", rpc.GetDescription())) {
                return false;
            }

            if (rpc == Rpc.ReceivePack) {
                return AppSettings.ReceivePack;
            }

            if (rpc == Rpc.UploadPack) {
                return AppSettings.UploadPack;
            }

            return false;
        }
コード例 #38
0
ファイル: SizeAllocCommand.cs プロジェクト: zesus19/c5.v1
 protected override Rpc.Serial.IInstruction BuildInstruction(Rpc.Net.Message.DuplexMessage commandMessage)
 {
     var instrSet = new InstructionSet(this);
     var sizeAlloc = commandMessage.GetContent<SizeAlloc>();
     using (var scope = ObjectHost.Host.BeginLifetimeScope())
     {
         instrSet.AddInstruction(scope.Resolve<SizeAllocInstruction>(
             new NamedParameter("command", this),
             new NamedParameter("parameter", sizeAlloc)));
         foreach (var unit in sizeAlloc.GradeUnits)
         {
             instrSet.AddInstruction(scope.Resolve<ClassroomProfileSyncInstruction>(
                 new NamedParameter("command", this),
                 new NamedParameter("parameter", unit)));
         }
     }
     return instrSet;
 }
コード例 #39
0
ファイル: RpcController.cs プロジェクト: tolism7/git-dot-aspx
        ActionResult ExecuteRpc(string project, Rpc rpc, Action<Repository> action)
        {
            if (!HasAccess(rpc, checkContentType: true)) {
                return new ForbiddenResult();
            }

            Response.ContentType = string.Format("application/x-git-{0}-result", rpc.GetDescription());
            WriteNoCache();

            var repository = repositories.GetRepository(project);

            if (repository == null) {
                return new NotFoundResult();
            }

            using (repository) {
                action(repository);
            }

            return new EmptyResult();
        }
コード例 #40
0
ファイル: ObjectLibrary.cs プロジェクト: omanamos/robotics
        public ObjectLibrary(MainController parent, Rpc.Client client, string path)
        {
            this.objects = new SerializableDictionary<string, RecogObject>();
            this.lookupByProperty = new Dictionary<string, List<RecogObject>>();
            this.knownPointClouds = new Dictionary<string, PointCloud>();
            this.unknownPointClouds = new Dictionary<string, PointCloud>();

            this.shut_down = false;
            this.block = false;

            this.parent = parent;
            this.client = client;

            if (System.IO.File.Exists(path))
            {
                string[] lines = System.IO.File.ReadAllLines(path);
                foreach (string line in lines)
                {
                    RecogObject obj = RecogObject.fromString(line);
                    this.addObject(obj);
                }
            }
        }
コード例 #41
0
ファイル: Samr.cs プロジェクト: Cyber-Forensic/Potato
			public SamrOpenDomain(Rpc.PolicyHandle handle, int accessMask, Rpc.SidT sid, Rpc.PolicyHandle
				 domainHandle)
			{
				this.Handle = handle;
				this.AccessMask = accessMask;
				this.Sid = sid;
				this.DomainHandle = domainHandle;
			}
コード例 #42
0
ファイル: Samr.cs プロジェクト: Cyber-Forensic/Potato
			public SamrConnect4(string systemName, int unknown, int accessMask, Rpc.PolicyHandle
				 handle)
			{
				this.SystemName = systemName;
				this.Unknown = unknown;
				this.AccessMask = accessMask;
				this.Handle = handle;
			}
コード例 #43
0
            string ProcessRpc(Rpc rpc)
            {
                if (rpc.Procedure == "subscribe") {

                    var sub = _repo.Subscribe(this, new SqlQuery(rpc.ValueType.Name, rpc.Arguments[0].ToString(), (object[])rpc.Arguments[1]));

                    lock (_subsById) {
                        _subsById[sub.Id] = sub;
                    }

                    SetHasDataToStream();

                    return sub.Id;
                }
                else if (rpc.Procedure == "unsubscribe") {

                    var subId = rpc.Arguments[0].ToString();

                    lock (_subsLock) {
                        _subsById.Remove(subId);
                    }

                    return "1";
                }
                else if (rpc.Procedure == "all") {

                    var subId = rpc.Arguments[0].ToString();
                    var sub = GetSubscription(subId);
                    sub.RequestAll();
                    SetHasDataToStream();

                    return "1";
                }
                else {
                    throw new NotSupportedException("Server RPC " + rpc.Procedure);
                }
            }
コード例 #44
0
ファイル: CardLogoutCommand.cs プロジェクト: zesus19/c5.v1
 public override void OnNotifyInstructionComplete(Rpc.Serial.IInstruction instruction)
 {
     throw new NotImplementedException();
 }
コード例 #45
0
 protected override void DoHandle(Rpc.Serial.Packet.ISerialPacket packet)
 {
     throw new NotImplementedException();
 }
コード例 #46
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="header"></param>
 public static void SetRequestHeader(Rpc.IContractModel.Header header)
 {
     Util.TracingContextHelper.SetContextItem(RequestHeaderKey, header);
 }
コード例 #47
0
ファイル: svcctl.cs プロジェクト: Cyber-Forensic/Potato
 public StartService(Rpc.PolicyHandle handle, int num_service_args, String[] service_arg_vectors) {
     this.handle = handle;
     this.num_service_args = num_service_args;
     this.service_arg_vectors = service_arg_vectors;
     this.Ptype = 0;
 }
コード例 #48
0
ファイル: SID.cs プロジェクト: istupakov/SharpCifs
        public Sid(Rpc.SidT sid, int type, string domainName, string acctName, bool decrementAuthority
			)
        {
            Revision = sid.Revision;
            SubAuthorityCount = sid.SubAuthorityCount;
            IdentifierAuthority = sid.IdentifierAuthority;
            SubAuthority = sid.SubAuthority;
            this.Type = type;
            this.DomainName = domainName;
            this.AcctName = acctName;
            if (decrementAuthority)
            {
                SubAuthorityCount--;
                SubAuthority = new int[SubAuthorityCount];
                for (int i = 0; i < SubAuthorityCount; i++)
                {
                    SubAuthority[i] = sid.SubAuthority[i];
                }
            }
        }
コード例 #49
0
ファイル: Lsarpc.cs プロジェクト: Cyber-Forensic/Potato
			public LsarLookupSids(Rpc.PolicyHandle handle, LsarSidArray sids, LsarRefDomainList
				 domains, LsarTransNameArray names, short level, int count)
			{
				this.Handle = handle;
				this.Sids = sids;
				this.Domains = domains;
				this.Names = names;
				this.Level = level;
				this.Count = count;
			}
コード例 #50
0
ファイル: Samr.cs プロジェクト: Cyber-Forensic/Potato
			public SamrGetMembersInAlias(Rpc.PolicyHandle aliasHandle, Lsarpc.LsarSidArray 
				sids)
			{
				this.AliasHandle = aliasHandle;
				this.Sids = sids;
			}
コード例 #51
0
ファイル: Samr.cs プロジェクト: Cyber-Forensic/Potato
			public SamrEnumerateAliasesInDomain(Rpc.PolicyHandle domainHandle, int resumeHandle
				, int acctFlags, SamrSamArray sam, int numEntries)
			{
				this.DomainHandle = domainHandle;
				this.ResumeHandle = resumeHandle;
				this.AcctFlags = acctFlags;
				this.Sam = sam;
				this.NumEntries = numEntries;
			}
コード例 #52
0
ファイル: Lsarpc.cs プロジェクト: Cyber-Forensic/Potato
			public LsarClose(Rpc.PolicyHandle handle)
			{
				this.Handle = handle;
			}
コード例 #53
0
ファイル: SID.cs プロジェクト: istupakov/SharpCifs
 public static byte[] ToByteArray(Rpc.SidT sid)
 {
     byte[] dst = new byte[1 + 1 + 6 + sid.SubAuthorityCount * 4];
     int di = 0;
     dst[di++] = sid.Revision;
     dst[di++] = sid.SubAuthorityCount;
     Array.Copy(sid.IdentifierAuthority, 0, dst, di, 6);
     di += 6;
     for (int ii = 0; ii < sid.SubAuthorityCount; ii++)
     {
         Encdec.Enc_uint32le(sid.SubAuthority[ii], dst, di);
         di += 4;
     }
     return dst;
 }
コード例 #54
0
ファイル: svcctl.cs プロジェクト: Cyber-Forensic/Potato
 public EnumServicesStatus(Rpc.PolicyHandle handle,
             int type,
             int state,
             int buf_size,
             byte[] service,
             int bytes_needed,
             int services_returned,
             int resume_handle) {
     this.handle = handle;
     this.type = type;
     this.state = state;
     this.buf_size = buf_size;
     this.service = service;
     this.bytes_needed = bytes_needed;
     this.services_returned = services_returned;
     this.resume_handle = resume_handle;
     this.Ptype = 0;
 }
コード例 #55
0
ファイル: Samr.cs プロジェクト: Cyber-Forensic/Potato
			public SamrOpenAlias(Rpc.PolicyHandle domainHandle, int accessMask, int rid, Rpc.PolicyHandle
				 aliasHandle)
			{
				this.DomainHandle = domainHandle;
				this.AccessMask = accessMask;
				this.Rid = rid;
				this.AliasHandle = aliasHandle;
			}
コード例 #56
0
ファイル: TestRpc.cs プロジェクト: ajinkya1221/Rpc.Dal
 public void TestIsRecordExists()
 {
     var rpcObj = new Rpc();
     var res = rpcObj.IsRecordExists("test");
     Assert.IsTrue(res);
 }
コード例 #57
0
ファイル: Samr.cs プロジェクト: Cyber-Forensic/Potato
			public SamrCloseHandle(Rpc.PolicyHandle handle)
			{
				this.Handle = handle;
			}
コード例 #58
0
ファイル: UUID.cs プロジェクト: Cyber-Forensic/Potato
		public Uuid(Rpc.UuidT uuid)
		{
			TimeLow = uuid.TimeLow;
			TimeMid = uuid.TimeMid;
			TimeHiAndVersion = uuid.TimeHiAndVersion;
			ClockSeqHiAndReserved = uuid.ClockSeqHiAndReserved;
			ClockSeqLow = uuid.ClockSeqLow;
			Node = new byte[6];
			Node[0] = uuid.Node[0];
			Node[1] = uuid.Node[1];
			Node[2] = uuid.Node[2];
			Node[3] = uuid.Node[3];
			Node[4] = uuid.Node[4];
			Node[5] = uuid.Node[5];
		}
コード例 #59
0
ファイル: Lsarpc.cs プロジェクト: Cyber-Forensic/Potato
			public LsarQueryInformationPolicy(Rpc.PolicyHandle handle, short level, NdrObject
				 info)
			{
				this.Handle = handle;
				this.Level = level;
				this.Info = info;
			}
コード例 #60
0
ファイル: Lsarpc.cs プロジェクト: Cyber-Forensic/Potato
			public LsarOpenPolicy2(string systemName, LsarObjectAttributes objectAttributes
				, int desiredAccess, Rpc.PolicyHandle policyHandle)
			{
				this.SystemName = systemName;
				this.ObjectAttributes = objectAttributes;
				this.DesiredAccess = desiredAccess;
				this.PolicyHandle = policyHandle;
			}