public DistanceMatrixResponse Run(string ID, string AddressList, bool AvoidHighways, bool AvoidTolls, bool AvoidFerries, string Mode, string Unit)
        {
            string avoid = "";

            if (AvoidHighways)
            {
                avoid = "highways|";
            }
            if (AvoidTolls)
            {
                avoid = "tolls|";
            }
            if (AvoidFerries)
            {
                avoid = "ferries|";
            }
            if (!string.IsNullOrWhiteSpace(avoid))
            {
                avoid = avoid.Remove(avoid.LastIndexOf('|'));
            }

            DistanceMatrixResponse result = GoogleAPIHelper.GetDistanceMatrix(AddressList, Mode.ToLowerInvariant(), avoid, Unit.ToLowerInvariant());

            return(result);
        }
Ejemplo n.º 2
0
    public GoogleAnalyticsAPI(ConnectionInfo info)
    {
        var initializer = GoogleAPIHelper.BuildServiceInitializer(info.PrivateKeyPath, info.ServiceAccountEmail,
                                                                  AnalyticsService.Scopes.Analytics.GetStringValue(), info.ApplicationName);

        Service = new AnalyticsService(initializer);
    }
Ejemplo n.º 3
0
        public DirectionsResponse Run(string ID, string Start, string End, string WayPoints, bool AvoidHighways, bool AvoidTolls, bool AvoidFerries, string Mode, string Unit, bool Optimize)
        {
            string avoid = "";

            if (AvoidHighways)
            {
                avoid = "highways|";
            }
            if (AvoidTolls)
            {
                avoid = "tolls|";
            }
            if (AvoidFerries)
            {
                avoid = "ferries|";
            }
            if (!string.IsNullOrWhiteSpace(avoid))
            {
                avoid = avoid.Remove(avoid.LastIndexOf('|'));
            }

            DirectionsResponse result = GoogleAPIHelper.GetDirections(Start, End, WayPoints, Mode.ToLowerInvariant(), avoid, Unit.ToLowerInvariant(), Optimize);

            return(result);
        }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (audioSource.isPlaying)
        {
            float[] spectrum = new float[256];
            AudioListener.GetSpectrumData(spectrum, 0, FFTWindow.Rectangular);
            float sum = spectrum.Sum();
            if (sum > maxSum)
            {
                maxSum = sum;
                Debug.Log(maxSum);
            }

            if (sum > 0.02)
            {
                Debug.Log(sum);
                maxSum             = 0;
                waitForEndOfSpeech = 0;
            }
            else
            {
                waitForEndOfSpeech += Time.deltaTime;
            }

            if (waitForEndOfSpeech > 2)
            {
                waitForEndOfSpeech = 0;
                Debug.Log("Microphone.End");
                Microphone.End(microphoneDevice);
                SavWav.Save("Recorded.wav", audioSource.clip);
                audioSource.volume = 1.0f;
                audioSource.Stop();

                //OnRecordSpeechFinished?.Invoke("OnRecordSpeechFinished");

                string wavFilePath   = Path.Combine(Application.persistentDataPath, "Recorded.wav");
                string base64decoded = GoogleAPIHelper.GetBase64DecodeFromWavFile(wavFilePath);

                OnRecordSpeechFinished?.Invoke(base64decoded);
            }
        }
    }