Esempio n. 1
0
        public int Setup(int deviceId, DeviceType t, StreamType streamType,
                         int sampleRate, SampleFormatType format, int numChannels,
                         int dwChannelMask,
                         MMCSSCallType mmcssCall, MMThreadPriorityType threadPriority,
                         SchedulerTaskType schedulerTask, ShareMode shareMode, DataFeedMode dataFeedMode,
                         int latencyMillisec, int zeroFlushMillisec, int timePeriodHandredNanosec,
                         bool isFormatSupportedCall)
        {
            var args = new SetupArgs();

            args.deviceType               = (int)t;
            args.streamType               = (int)streamType;
            args.sampleRate               = sampleRate;
            args.sampleFormat             = (int)format;
            args.numChannels              = numChannels;
            args.dwChannelMask            = dwChannelMask;
            args.mmcssCall                = (int)mmcssCall;
            args.mmThreadPriority         = (int)threadPriority;
            args.schedulerTask            = (int)schedulerTask;
            args.shareMode                = (int)shareMode;
            args.dataFeedMode             = (int)dataFeedMode;
            args.latencyMillisec          = latencyMillisec;
            args.timePeriodHandledNanosec = timePeriodHandredNanosec;
            args.zeroFlushMillisec        = zeroFlushMillisec;
            args.isFormatSupportedCall    = isFormatSupportedCall ? 1 : 0;
            return(WasapiIO_Setup(mId, deviceId, ref args));
        }
Esempio n. 2
0
        public string Execute(SetupArgs args)
        {
            System.Console.WriteLine("Resgrid Audio Setup");
            System.Console.WriteLine("-----------------------------------------");
            System.Console.WriteLine("Please answer the following question to get the Resgrid relay application setup.");
            System.Console.WriteLine("You can always manually change values by editing the settings.json file in a text editor");
            System.Console.WriteLine("");

            System.Console.WriteLine("Please enter your Resgrid username:"******"Please enter your Resgrid password:"******"Which audio device do you want Relay to monitor?");
            int waveInDevices = WaveIn.DeviceCount;

            for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++)
            {
                WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice);
                System.Console.WriteLine($"Device {waveInDevice}: {deviceInfo.ProductName}, {deviceInfo.Channels} channels");
            }
            var audioDevice = System.Console.ReadLine();

            System.Console.WriteLine("How long, in seconds, do you want Relay to record before dispatching?");
            var audioLength = System.Console.ReadLine();

            System.Console.WriteLine("How many groups (or your department) do you want to dispatch?");
            var watcherCount    = System.Console.ReadLine();
            int watcherCountInt = int.Parse(watcherCount);

            List <Watcher> watchers = new List <Watcher>();
            int            i        = 0;

            while (i < watcherCountInt)
            {
                Watcher watcher = SetupWatcher(i);

                if (watcher != null)
                {
                    i++;
                    watchers.Add(watcher);
                }
            }

            Config config = LoadSettingsFromFile();

            config.Username    = userName;
            config.Password    = password;
            config.InputDevice = int.Parse(audioDevice);
            config.AudioLength = int.Parse(audioLength);
            config.Watchers    = watchers;

            SaveSettingsFromFile(config);

            System.Console.WriteLine("Your options have been written to the settings.json in this directory. You can also edit the file manually in a text editor.");

            return("");
        }
        public RedisSessionStateStoreProvider DataSetup(SetupArgs args)
        {
            var sessionProvider = this.CreateProvider();

            redis.Remove("Harbour/1234");
            if (args.CreateSession)
            {
                sessionProvider.CreateUninitializedItem(null, args.SessionId, args.Timeout);
            }
            return(sessionProvider);
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            char[] letters = new char[127 - 32];
            for (int i = 0; i < 127 - 32; i++)
            {
                letters[i] = (char)(i + 32);
            }
            SetupArgs setup = new SetupArgs(new LetterSet(letters))
            {
                ResetAfter       = 50,
                RotateOnInvalid  = true,
                InvalidCharacter = '?',
                RotorCount       = 3,
                UnmappedHandling = UnmappedHandling.MakeInvalid,
            };

            setup.Steckering = setup.LetterSet.RandomizeSteckering();
            Machine machine = new Machine(setup);
            bool    running = true;

            WriteTitle();
            while (running)
            {
                string command = ReadCommand();
                switch (command)
                {
                case "exit":
                    running = false;
                    break;

                case "clear":
                    Clear();
                    break;

                default:
                    string enciphered = machine.Encipher(command);
                    Console.WriteLine($"Enciphered: {enciphered}");

                    string deciphered = machine.Decipher(enciphered);
                    Console.WriteLine($"Deciphered: {deciphered}");
                    Console.WriteLine();
                    break;
                }
            }
        }
Esempio n. 5
0
        public EnigmaService()
        {
            char[] letters = new char[127 - 32 + 1];
            for (int i = 0; i < 127 - 32; i++)
            {
                letters[i] = (char)(i + 32);
            }
            letters[letters.Length - 1] = '\n';
            LetterSet letterSet = new LetterSet(letters);

            setup = new SetupArgs(letterSet)
            {
                Steckering       = letterSet.RandomizeSteckering(),
                InvalidCharacter = '?',
                ResetAfter       = 50,
                RotorCount       = 3,
                RotateOnInvalid  = true,
                UnmappedHandling = UnmappedHandling.Keep,
            };
        }
Esempio n. 6
0
 WasapiIO_Setup(int instanceId, int deviceId, ref SetupArgs args);
 private static extern int WasapiIO_Setup(int instanceId, int deviceId, ref SetupArgs args);
 public int Setup(int deviceId, DeviceType t, StreamType streamType,
     int sampleRate, SampleFormatType format, int numChannels,
     MMCSSCallType mmcssCall, MMThreadPriorityType threadPriority,
     SchedulerTaskType schedulerTask, ShareMode shareMode, DataFeedMode dataFeedMode,
     int latencyMillisec, int zeroFlushMillisec, int timePeriodHandredNanosec)
 {
     var args = new SetupArgs();
     args.deviceType = (int)t;
     args.streamType = (int)streamType;
     args.sampleRate = sampleRate;
     args.sampleFormat = (int)format;
     args.numChannels = numChannels;
     args.mmcssCall = (int)mmcssCall;
     args.mmThreadPriority = (int)threadPriority;
     args.schedulerTask = (int)schedulerTask;
     args.shareMode = (int)shareMode;
     args.dataFeedMode = (int)dataFeedMode;
     args.latencyMillisec = latencyMillisec;
     args.timePeriodHandledNanosec = timePeriodHandredNanosec;
     args.zeroFlushMillisec = zeroFlushMillisec;
     return WasapiIO_Setup(mId, deviceId, ref args);
 }