コード例 #1
0
 public void PercentConversions(string val1, string val2 = "")
 {
     CurrentConversionType = ConversionTypes.Percent;
     HideClearAllGroups();
     CurrentActiveOutput = ActiveOutput.TextOutput1;
     SetGroup(Groups.Group1, "Decimal", val1);
     SetGroup(Groups.Group2, "Percent", val2);
 }
コード例 #2
0
 public void TimeConversions(string val1, string val2 = "", string val3 = "")
 {
     CurrentConversionType = ConversionTypes.Time;
     HideClearAllGroups();
     CurrentActiveOutput = ActiveOutput.TextOutput1;
     SetGroup(Groups.Group1, "Seconds", val1);
     SetGroup(Groups.Group2, "Minutes", val2);
     SetGroup(Groups.Group3, "Hours", val3);
 }
コード例 #3
0
 public void TemperatureConversions(string val1, string val2 = "", string val3 = "")
 {
     CurrentConversionType = ConversionTypes.Temperature;
     HideClearAllGroups();
     CurrentActiveOutput = ActiveOutput.TextOutput1;
     SetGroup(Groups.Group1, "Celcius", val1);
     SetGroup(Groups.Group2, "Fahrenheit", val2);
     SetGroup(Groups.Group3, "Kelvin", val3);
 }
コード例 #4
0
 public void ProgrammerConversions(string val1, string val2 = "", string val3 = "", string val4 = "")
 {
     CurrentConversionType = ConversionTypes.Programmer;
     HideClearAllGroups();
     CurrentActiveOutput = ActiveOutput.TextOutput1;
     SetGroup(Groups.Group1, "Integer", val1);
     SetGroup(Groups.Group2, "Hexadecimal", val2);
     SetGroup(Groups.Group3, "Octal", val3);
     SetGroup(Groups.Group4, "Binary", val4);
 }
コード例 #5
0
 public void DataConversions(string val1, string val2 = "", string val3 = "", string val4 = "", string val5 = "")
 {
     CurrentConversionType = ConversionTypes.Data;
     HideClearAllGroups();
     CurrentActiveOutput = ActiveOutput.TextOutput1;
     SetGroup(Groups.Group1, "Bytes", val1);
     SetGroup(Groups.Group2, "KiloBytes", val2);
     SetGroup(Groups.Group3, "MegaBytes", val3);
     SetGroup(Groups.Group4, "GigaBytes", val4);
     SetGroup(Groups.Group5, "TeraBytes", val5);
 }
コード例 #6
0
 public void WeightConversions(string val1, string val2 = "", string val3 = "", string val4 = "", string val5 = "")
 {
     CurrentConversionType = ConversionTypes.Weight;
     HideClearAllGroups();
     CurrentActiveOutput = ActiveOutput.TextOutput1;
     SetGroup(Groups.Group1, "MilliGrams", val1);
     SetGroup(Groups.Group2, "Grams", val2);
     SetGroup(Groups.Group3, "KiloGrams", val3);
     SetGroup(Groups.Group4, "Ounces", val4);
     SetGroup(Groups.Group5, "Pounds", val5);
 }
コード例 #7
0
 public void LengthConversions(string val1, string val2 = "", string val3 = "", string val4 = "", string val5 = "", string val6 = "")
 {
     CurrentConversionType = ConversionTypes.Length;
     HideClearAllGroups();
     CurrentActiveOutput = ActiveOutput.TextOutput1;
     SetGroup(Groups.Group1, "MilliMeters", val1);
     SetGroup(Groups.Group2, "CentiMeters", val2);
     SetGroup(Groups.Group3, "Meters", val3);
     SetGroup(Groups.Group4, "KiloMeters", val4);
     SetGroup(Groups.Group5, "Inches", val5);
     SetGroup(Groups.Group6, "Feet", val6);
 }
コード例 #8
0
        public async Task <(RoundPhase currentPhase, IEnumerable <ActiveOutput> activeOutputs)> PostConfirmationAsync()
        {
            using HttpResponseMessage response = await TorClient.SendAsync(HttpMethod.Post, $"/api/v{Helpers.Constants.BackendMajorVersion}/btc/chaumiancoinjoin/confirmation?uniqueId={UniqueId}&roundId={RoundId}").ConfigureAwait(false);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                await response.ThrowRequestExceptionFromContentAsync().ConfigureAwait(false);
            }

            ConnectionConfirmationResponse resp = await response.Content.ReadAsJsonAsync <ConnectionConfirmationResponse>().ConfigureAwait(false);

            Logger.LogInfo($"Round ({RoundId}), Alice ({UniqueId}): Confirmed connection. Phase: {resp.CurrentPhase}.");

            var activeOutputs = new List <ActiveOutput>();

            if (resp.BlindedOutputSignatures != null && resp.BlindedOutputSignatures.Any())
            {
                var unblindedSignatures = new List <UnblindedSignature>();
                var blindedSignatures   = resp.BlindedOutputSignatures.ToArray();
                for (int i = 0; i < blindedSignatures.Length; i++)
                {
                    uint256            blindedSignature   = blindedSignatures[i];
                    Requester          requester          = Requesters[i];
                    UnblindedSignature unblindedSignature = requester.UnblindSignature(blindedSignature);

                    var address = RegisteredAddresses[i];

                    uint256 outputScriptHash = new uint256(Hashes.SHA256(address.ScriptPubKey.ToBytes()));
                    PubKey  signerPubKey     = SchnorrPubKeys[i].SignerPubKey;
                    if (!VerifySignature(outputScriptHash, unblindedSignature, signerPubKey))
                    {
                        throw new NotSupportedException($"Coordinator did not sign the blinded output properly for level: {i}.");
                    }

                    unblindedSignatures.Add(unblindedSignature);
                }

                for (int i = 0; i < Math.Min(unblindedSignatures.Count, RegisteredAddresses.Length); i++)
                {
                    var sig  = unblindedSignatures[i];
                    var addr = RegisteredAddresses[i];
                    var lvl  = i;

                    var actOut = new ActiveOutput(addr, sig, lvl);
                    activeOutputs.Add(actOut);
                }
            }

            return(resp.CurrentPhase, activeOutputs);
        }
コード例 #9
0
ファイル: BobClient.cs プロジェクト: zero77/WalletWasabi
        /// <returns>If the phase is still in OutputRegistration.</returns>
        public async Task <bool> PostOutputAsync(long roundId, ActiveOutput activeOutput)
        {
            Guard.MinimumAndNotNull(nameof(roundId), roundId, 0);
            Guard.NotNull(nameof(activeOutput), activeOutput);

            var request = new OutputRequest {
                OutputAddress = activeOutput.Address, UnblindedSignature = activeOutput.Signature, Level = activeOutput.MixingLevel
            };

            using var response = await TorClient.SendAsync(HttpMethod.Post, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/output?roundId={roundId}", request.ToHttpStringContent()).ConfigureAwait(false);

            if (response.StatusCode == HttpStatusCode.Conflict)
            {
                return(false);
            }
            else if (response.StatusCode != HttpStatusCode.NoContent)
            {
                await response.ThrowRequestExceptionFromContentAsync().ConfigureAwait(false);
            }

            return(true);
        }
コード例 #10
0
        /// <summary>
        /// Draws and enables the node editor
        /// </summary>
        /// <param name="e">User event</param>
        public void DoNodeEditor(Event e)
        {
            Rect _zoomrect = new Rect(new Vector2(0, 19), Window.position.size);

            Vector2 pivotscale = _zoomrect.size / 2;

            Graph.ZoomPivot = GUIScaleUtility.BeginScale(ref _zoomrect, pivotscale, Graph.Zoom, true, false);

            // Node drawing

            UnityEngine.Profiling.Profiler.BeginSample("MoonBehavior: Node Drawing");

            if (Graph.Nodes.Count > 0 && (e.type == EventType.Layout || e.type == EventType.Repaint))
            {
                DrawNodes(Graph.Nodes, _zoomrect);
            }

            UnityEngine.Profiling.Profiler.EndSample();

            // Node interaction

            UnityEngine.Profiling.Profiler.BeginSample("MoonBehavior: Node events");

            HandleNodeEvents(e, Graph);

            UnityEngine.Profiling.Profiler.EndSample();

            if (ActiveOutput != null)
            {
                MoonGUI.DrawLine(ActiveOutput.GetPosition(), e.mousePosition, new Color(1, 1, 1, 0.6f));
            }

            GUIScaleUtility.EndScale();

            HandleAddNodes(e);
            HandleContext();
        }