示例#1
0
       /* public static string ObtainValue(string p_key)
        {
            
        }*/

        public static void loadChanges() 
        {
            CreateFile();
                configs.Clear();
                StreamReader SR = new StreamReader(path);
                while (!SR.EndOfStream)
                {
                    string[] splitter = { "=" };
                    string[] result = SR.ReadLine().Split(splitter, StringSplitOptions.None);
                    configuration t_conf = new configuration();
                    t_conf.key = result[0];
                    t_conf.value = result[1];
                    configs.Add(t_conf);

                }
                SR.Close();
            
        }
示例#2
0
 public virtual void SaveAsXMLZip(Stream stream, XmlWriterSettings xmlSettings, XbimXmlSettings xbimSettings = null, configuration configuration = null, ReportProgressDelegate progress = null)
 {
     using (var zipStream = new ZipOutputStream(stream))
     {
         var schema   = _entityFactory.SchemasIds.FirstOrDefault();
         var ext      = schema != null && schema.StartsWith("IFC") ? ".ifcxml" : ".xml";
         var newEntry = new ZipEntry("data" + ext)
         {
             DateTime = DateTime.Now
         };
         zipStream.PutNextEntry(newEntry);
         SaveAsXml(zipStream, xmlSettings, xbimSettings, configuration, progress);
     }
 }
示例#3
0
        void IModule.Install(ModuleManager manager)
        {
            _manager = manager;
            _client  = manager.Client;

            playlist _playlist   = new playlist();
            youtube  _downloader = new youtube();
            player   _player     = new player();
            logs     _logs       = new logs();
            system   _system     = new system();

            manager.CreateCommands("", group =>
            {
                //group.PublicOnly();

                //get the config file
                _config = configuration.LoadFile();

                _client.GetService <CommandService>().CreateCommand("test")
                .Alias("test")
                .Description("Placeholder for testing.")
                .Do(async e =>
                {
                    //await e.Channel.SendMessage("test");
                });

                _client.GetService <CommandService>().CreateCommand("play")
                .Alias("play")
                .Description("Adds the requested song to the queue.\rExample: !play url\rPermissions: Mods")
                .Parameter("url", ParameterType.Optional)
                .Parameter("title", ParameterType.Optional)
                .MinPermissions((int)PermissionLevel.GroupUsers)
                .Do(async e =>
                {
                    try
                    {
                        if (e.GetArg("url") == "")
                        {
                            await e.Channel.SendMessage($"{e.User.Mention}, Please give me a link so I can play the song for you.");
                            return;
                        }

                        //if return in 0 the user can add a track
                        int UserSubmit = _playlist.checkNumberOfTracksByUserSubmitted(e.User.Name);
                        if (UserSubmit == 0)
                        {
                            //add the url to the listSubmitted
                            if (e.GetArg("url").Contains("https://www.youtube.com/"))
                            {
                                string result = await _playlist.cmd_play(e.GetArg("url"), e.User.Name);

                                if (result == null)
                                {
                                    await e.Channel.SendMessage($"Sorry I wont add that url to the queue given someone blacklisted it already.");
                                }
                                else
                                {
                                    await e.Channel.SendMessage(result);
                                    _logs.logMessage("Info", "commandsPlayer.play", $"URL:{e.GetArg("url")} was submitted to the queue.", e.User.Name);
                                }
                            }
                            else
                            {
                                switch (e.GetArg("url").ToLower())
                                {
                                case "title":
                                    string searchResult = _playlist.cmd_searchLibrary(e.GetArg("url"), e.GetArg("title"), e.User.Name);


                                    if (searchResult == null)
                                    {
                                        await e.Channel.SendMessage($"Sorry I ran into a error.  Please check the log for more information.");
                                    }
                                    else if (searchResult.Contains("https://www.youtube.com/"))
                                    {
                                        string searchResultMessage = await _playlist.cmd_play(searchResult, e.User.Name);
                                        await e.Channel.SendMessage(searchResultMessage);
                                    }
                                    else
                                    {
                                        await e.Channel.SendMessage(searchResult);
                                    }
                                    break;

                                default:
                                    await e.Channel.SendMessage($"{e.User.Name},\r Please enter a valid search mode.");
                                    break;
                                }
                            }
                        }
                        else if (UserSubmit == 1)
                        {
                            await e.Channel.SendMessage($"{e.User.Name},\rYou have submitted too many tracks to the queue.  Please wait before you submit anymore.");
                        }
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlayer.play", error.ToString(), e.User.Name);
                    }
                });

                _client.GetService <CommandService>().CreateCommand("skip")
                .Alias("skip")
                .Description("Adds the requested song to the queue.\rPermissions: Everyone")
                .MinPermissions((int)PermissionLevel.GroupUsers)
                .Do(async e =>
                {
                    try
                    {
                        bool result = _player.cmd_skip();

                        if (result == true)
                        {
                            await e.Channel.SendMessage($"Skipping the track.");
                            _logs.logMessage("Info", "commandsPlayer.skip", "Track skip was requested.", e.User.Name);
                        }
                        else
                        {
                            await e.Channel.SendMessage($"Nothing is currently playing, unable to skip.");
                        }
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlayer.skip", error.ToString(), e.User.Name);
                    }
                });

                _client.GetService <CommandService>().CreateCommand("stop")
                .Alias("stop")
                .Description("Stops the music from playing.\rPermissions: Everyone")
                .MinPermissions((int)PermissionLevel.GroupUsers)
                .Do(async e =>
                {
                    try
                    {
                        bool result = _player.cmd_stop();

                        if (result == true)
                        {
                            _client.SetGame(null);
                            await e.Channel.SendMessage($"Music will be stopping.");
                            _logs.logMessage("Info", "commandsPlayer.stop", "Player was requested to stop.", e.User.Name);
                        }
                        else
                        {
                            await e.Channel.SendMessage($"Nothing is currently playing, can't stop something that isnt moving.");
                        }
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlayer.stop", error.ToString(), e.User.Name);
                    }
                });

                _client.GetService <CommandService>().CreateCommand("resume")
                .Alias("resume")
                .Description("Starts the playlist again.\rPermissions: Everyone")
                .MinPermissions((int)PermissionLevel.GroupUsers)
                .Do(async e =>
                {
                    try
                    {
                        _player.cmd_resume();

                        await e.Channel.SendMessage($"Activating the playlist again.");
                        _logs.logMessage("Info", "commandsPlayer.resume", "", e.User.Name);
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlayer.resume", error.ToString(), e.User.Name);
                    }
                });

                _client.GetService <CommandService>().CreateCommand("summon")
                .Alias("summon")
                .Description("Summons bot to current voice channel and starts playing from the library.\rPermission: Everyone")
                .MinPermissions((int)PermissionLevel.GroupUsers)
                .Do(async e =>
                {
                    try
                    {
                        Channel voiceChan = e.User.VoiceChannel;
                        await voiceChan.JoinAudio();
                        //await _playlist.startAutoPlayList(voiceChan, _client);
                        await _playlist.playAutoQueue(voiceChan, _client);
                        _logs.logMessage("Error", "commandsPlayer.summon", $"User has summoned the bot to room {voiceChan.ToString()}", e.User.Name);
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlayer.summon", error.ToString(), e.User.Name);
                    }
                });
            });
        }
示例#4
0
 public static string GetSendungenAbisZServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_sendungenAbisZ"));
 }
示例#5
0
 public static string GetRubrikenServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_rubriken"));
 }
示例#6
0
 public static string GetMeistGesehenServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_meistGesehen"));
 }
示例#7
0
 public static string GetIstMCEUpdateVerfuegbarServiceUrlServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_istMCEUpdateVerfuegbar"));
 }
 public TestableDefaultConfiguration(IEnvironment environment, configuration localConfig, ServerConfiguration serverConfig, RunTimeConfiguration runTimeConfiguration, SecurityPoliciesConfiguration securityPoliciesConfiguration, IProcessStatic processStatic, IHttpRuntimeStatic httpRuntimeStatic, IConfigurationManagerStatic configurationManagerStatic, IDnsStatic dnsStatic) : base(environment, localConfig, serverConfig, runTimeConfiguration, securityPoliciesConfiguration, processStatic, httpRuntimeStatic, configurationManagerStatic, dnsStatic)
 {
 }
 public configuration(configuration old)
 {
     name = "Device-Release";
     platformArchitecture = "armle-v7";
     asset = old.asset;
 }
示例#10
0
 public GerenciadorConfiguracao(IConfiguration configuration, string sectionName) => Load(configuration, sectionName);
示例#11
0
        public void Start()
        {
            _startup.startupCheck();

            _config = configuration.LoadFile();

            _client = new DiscordClient(x =>
            {
                x.AppName             = "C# Music Bot";
                x.AppUrl              = "https://github.com/luther38/DiscordMusicBot";
                x.AppVersion          = "0.1.4";
                x.UsePermissionsCache = true;
                //x.LogLevel = LogSeverity.Info;
                x.LogHandler = OnLogMessage;
            })
                      .UsingCommands(x =>
            {
                x.PrefixChar         = _config.Prefix;
                x.AllowMentionPrefix = true;
                x.HelpMode           = HelpMode.Public;
                x.ExecuteHandler     = OnCommandExecuted;
                x.ErrorHandler       = OnCommandError;
            })
                      .UsingModules()
                      .UsingAudio(x =>
            {
                x.Mode             = AudioMode.Outgoing;
                x.EnableEncryption = true;
                x.Bitrate          = AudioServiceConfig.MaxBitrate;
                x.BufferLength     = 10000;
            })
                      .UsingPermissionLevels(PermissionResolver);

            //this CommandsModule is tied behind discordMusicBot.src
            _client.AddModule <commandsPlayer>("commandsPlayer", ModuleFilter.ServerWhitelist);
            _client.AddModule <commandsSystem>("commandsSystem", ModuleFilter.ServerWhitelist);
            _client.AddModule <commandsPlaylist>("commandsPlaylist", ModuleFilter.ServerWhitelist);
            _client.AddModule <commandsWeb>("commandsWeb", ModuleFilter.ServerWhitelist);
            _client.GetService <AudioService>();

            //check the playlist file
            _playlist.shuffleLibrary();

            //this is used to force the bot the dc from the room if she is left alone.
            _client.UserUpdated += async(s, e) =>
            {
                //gives us more infomation for like what room the bot is in
                var bot = e.Server.FindUsers(_client.CurrentUser.Name).FirstOrDefault().VoiceChannel;

                try
                {
                    List <User> userCount = bot.Users.ToList();

                    if (userCount.Count <= 1)
                    {
                        _client.SetGame(null);
                        _player.cmd_stop();

                        //double checking to make sure she isnt in a room.
                        //Event shouldnt have flagged but reguardless double checking
                        if (bot.ToString() != null)
                        {
                            await bot.LeaveAudio();
                        }

                        //Console.WriteLine("Bot is left alone.  Music is stopping.");
                    }
                }
                catch
                {
                    //this will catch if the bot isnt summoned given bot.user.tolist will pull a null
                }
            };

            //turns the bot on and connects to discord.
            _client.ExecuteAndWait(async() =>
            {
                while (true)
                {
                    try
                    {
                        await _client.Connect(_config.Token, TokenType.Bot);
                        _client.SetGame(null);
                        _logs.logMessage("Info", "program.Start", "Connected to Discord", "system");
                        //Console.WriteLine("Connected to Discord.");
                        //await _client.ClientAPI.Send(new Discord.API.Client.Rest.HealthRequest());

                        break;
                    }
                    catch (Exception ex)
                    {
                        _client.Log.Error($"Login Failed", ex);
                        _logs.logMessage("Error", "program.Start", ex.ToString(), "system");
                        //await Task.Delay(_client.Config.FailedReconnectDelay);
                        await Task.Delay(3000);
                    }
                }
            });
        }
示例#12
0
 public virtual void SaveAsXMLZip(Stream stream, XmlWriterSettings xmlSettings, XbimXmlSettings xbimSettings = null, configuration configuration = null, ReportProgressDelegate progress = null)
 {
     using (var zipStream = new ZipArchive(stream, ZipArchiveMode.Update))
     {
         var schema   = EntityFactory.SchemasIds.FirstOrDefault();
         var ext      = schema != null && schema.StartsWith("IFC") ? ".ifcxml" : ".xml";
         var newEntry = zipStream.CreateEntry($"data{ext}");
         using (var writer = newEntry.Open())
         {
             SaveAsXml(writer, xmlSettings, xbimSettings, configuration, progress);
         }
     }
 }
 get => valueProvider(configuration, key);
        public void StoreConfiguration()
        {
            // check input parameters
            if (this.Boards.Count < 2)
            {
                throw new Exception("Invalid configuration: less than 2 boards");
            }

            // locally store the old configuration
            Configuration oldConfiguration = Configuration.LoadConfiguration(ConfigurationID);

            using (var db = new DBmodel())
            {
                // remove old configuration from DB
                if (oldConfiguration != null)
                {
                    db.configuration
                    .RemoveRange(db.configuration
                                 .Where(c => c.configuration_id.Equals(this.configurationID)));
                    db.SaveChanges();
                }

                // save each dictionary pair as a new record
                foreach (Board b in boards)
                {
                    // create a 'configuration' object that suits the DB
                    configuration DBconf = new configuration();
                    DBconf.configuration_id = ConfigurationID;
                    DBconf.board_id         = b.BoardID;
                    DBconf.x     = b.Coordinates.X;
                    DBconf.y     = b.Coordinates.Y;
                    DBconf.order = boards.IndexOf(b);
                    db.configuration.AddOrUpdate(DBconf); // needs System.Data.Entity.Migrations;
                }

                // save the changes
                db.SaveChanges();
            }

            // notify the occurence of an update in 'configuration' table, by inserting in the 'log' table
            if (oldConfiguration != null && this.ToString().Equals(oldConfiguration.ToString()))    // serialization needed just to avoid implementing Equals() method
            {
                return;
            }
            string message;

            Log.MessageType type;
            if (oldConfiguration == null)
            {
                message = "Created configuration '" + ConfigurationID + "'";
                type    = Log.MessageType.configuration_created;
            }
            else
            {
                message = "Updated configuration '" + ConfigurationID + "': ";
                type    = Log.MessageType.configuration_update;
                int diff = oldConfiguration.Boards.Count - Boards.Count; //diff = table - object = old - new
                if (diff < 0)
                {
                    message += "inserted " + diff + " new boards, ";
                }
                else if (diff > 0)
                {
                    message += "discarded " + diff + " old boards, ";
                }
                foreach (Board b in oldConfiguration.Boards)
                {
                    if (!b.Coordinates.X.Equals(Boards.Find((Board a) => { return(a.BoardID == b.BoardID); }).Coordinates.X) || !b.Coordinates.Y.Equals(Boards.Find((Board a) => { return(a.BoardID == b.BoardID); }).Coordinates.Y)) //one coordinate has changed
                    {
                        message += "board '" + b.BoardID + "' moved (" + b.Coordinates.X + "," + b.Coordinates.Y + ")->(" + Boards.Find((Board a) => { return(a.BoardID == b.BoardID); }).Coordinates.X + "," + Boards.Find((Board a) => { return(a.BoardID == b.BoardID); }).Coordinates.Y + "), ";
                    }
                }
            }
            if (message.EndsWith(", "))
            {
                message = message.Substring(0, message.Length - 2);
            }
            Log.InsertLog(this, type, message);
        }
示例#15
0
 (httpClient, new Uri(configuration[JobsServiceUrlConfigurationKey]), logger);
示例#16
0
			public configuration(configuration old)
			{
				name = "Device-Release";
				platformArchitecture = "armle-v7";
				asset = old.asset;
			}
示例#17
0
 public static void SaveConfig(string p_key, string p_value)
 {
     CreateFile();
     foreach (configuration C in configs) 
     {
         if (C.key == p_key) 
         {
             configs.Remove(C);
             break;
         }
     }
     configuration t_conf = new configuration();
     t_conf.key = p_key;
     t_conf.value = p_value;
     configs.Add(t_conf);
 }
 private void OnConfigurationDeserialized(ConfigurationDeserializedEvent configurationDeserializedEvent)
 {
     _localConfiguration = configurationDeserializedEvent.Configuration;
     UpdateLogLevel(_localConfiguration);
     UpdateAndPublishConfiguration(ConfigurationUpdateSource.Local);
 }
示例#19
0
 public static string GetGanzeSendungenServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_ganzeSendungen"));
 }
 BuildIgnoredUserAgents(configuration[nameof(PageAccessRecorderIgnoredUserAgents)]);
示例#21
0
 public static string GetLiveServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_live"));
 }
示例#22
0
 public IGremlinqOptions ConfigureValue <TValue>(GremlinqOption <TValue> option, Func <TValue, TValue> configuration) => new GremlinqOptionsImpl(_dictionary
                                                                                                                                                 .SetItem(
                                                                                                                                                     option,
                                                                                                                                                     configuration(_dictionary.TryGetValue(option, out var value)
示例#23
0
 public static string GetNavigationServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_navigation"));
 }
示例#24
0
 => WithSeekableStreamAsync(
     configuration,
     stream,
     s => InternalIdentityAsync(s, configuration ?? Configuration.Default));
示例#25
0
 public static string GetAktuellsteServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_aktuellste"));
 }
示例#26
0
 await WithSeekableStreamAsync(
     configuration,
     stream,
     s => DecodeAsync <TPixel>(s, configuration))
 .ConfigureAwait(false);
示例#27
0
 public static string GetSendungVerpasstServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_sendungVerpasst"));
 }
示例#28
0
        void IModule.Install(ModuleManager manager)
        {
            _manager = manager;
            _client  = manager.Client;

            playlist _playlist   = new playlist();
            player   _player     = new player();
            system   _system     = new system();
            youtube  _downloader = new youtube();
            logs     _logs       = new logs();

            _config = configuration.LoadFile();

            manager.CreateCommands("", group =>
            {
                _client.GetService <CommandService>().CreateCommand("shuffle")
                .Alias("shuffle")
                .Description("Adds a url to the playlist file.\rPermissions: Everyone")
                .MinPermissions((int)PermissionLevel.GroupUsers)
                .Do(async e =>
                {
                    try
                    {
                        string result = _playlist.cmd_shuffle();

                        if (result == "empty")
                        {
                            await e.Channel.SendMessage($"@{e.User.Name}\rNo songs have been submitted to be shuffled.");
                        }

                        if (result == "true")
                        {
                            await e.Channel.SendMessage($"@{e.User.Name}\rThe current queue has been shuffled.");
                        }

                        if (result == "error")
                        {
                            await e.Channel.SendMessage($"{e.User.Name}\rError please check the console for more information.");
                        }
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlaylist.shuffle", error.ToString(), e.User.Name);
                    }
                });

                _client.GetService <CommandService>().CreateCommand("np")
                .Alias("np")
                .Description("Returns infomation of current playing track.\rPermissions: Everyone")
                .MinPermissions((int)PermissionLevel.GroupUsers)
                .Parameter("flag", ParameterType.Optional)
                .Do(async e =>
                {
                    try
                    {
                        switch (e.GetArg("flag"))
                        {
                        case "remove":
                        case "r":
                            //going to remove a track from the playlist with what is currently playing.
                            bool npRemoveResult = _playlist.cmd_npRemove();
                            if (npRemoveResult == true)
                            {
                                _player.cmd_skip();
                                await e.Channel.SendMessage($"{e.User.Name}, the current playing track has been removed from the Library as requested.");
                                _logs.logMessage("Info", "commandsPlaylist.np remove", $"URL: {playlist.npUrl} was removed from the Library", e.User.Name);
                            }
                            else
                            {
                                await e.Channel.SendMessage($"{e.User.Name}, I ran into a problem with your request.  Please see the log for more details.");
                            }
                            break;

                        default:
                            string[] result = _playlist.cmd_np();
                            if (result[0] == null)
                            {
                                await e.Channel.SendMessage($"Sorry but a song is not currently playing.");
                            }
                            else
                            {
                                await e.Channel.SendMessage($"Track currently playing\rTitle: {result[0]} \rURL: {result[1]}\rUser: {result[2]}\rSource: {result[3]}");
                                _logs.logMessage("Info", "commandsPlaylist.np", $"Now playing infomation was requested. Title: {result[0]} URL: {result[1]} User: {result[2]} Source: {result[3]} ", e.User.Name);
                            }
                            break;
                        }
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlaylist.np", error.ToString(), e.User.Name);
                    }
                });

                _client.GetService <CommandService>().CreateCommand("queue")
                .Alias("queue")
                .Parameter("limit", ParameterType.Optional)
                .Description("Returns infomation of currently queued tacks.\rPermissions: Everyone")
                .MinPermissions((int)PermissionLevel.GroupUsers)
                .Do(async e =>
                {
                    try
                    {
                        int limit     = 0;
                        string result = null;

                        if (e.GetArg("limit") == "")
                        {
                            limit  = 5;
                            result = _playlist.cmd_queue(limit);
                            await e.Channel.SendMessage($"```\r{result}\r```");
                        }
                        else
                        {
                            if (int.TryParse(e.GetArg("limit"), out limit))
                            {
                                //true
                                if (limit >= 20)
                                {
                                    limit = 20;
                                }
                                result = _playlist.cmd_queue(limit);
                                await e.Channel.SendMessage($"```{result}\r```");
                            }
                            else
                            {
                                //false
                                await e.Channel.SendMessage($"Sorry the arg you passed was not a number.");
                            }
                        }
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlaylist.np", error.ToString(), e.User.Name);
                    }
                });

                _client.GetService <CommandService>().CreateCommand("playlist")
                .Alias("pl")
                .Description("Adds a url to the playlist file.\rPermissions: Mods")
                .Parameter("flag", ParameterType.Optional)
                .Parameter("url", ParameterType.Optional)
                .MinPermissions((int)PermissionLevel.GroupMods)
                .Do(async e =>
                {
                    try
                    {
                        if (e.GetArg("url") == "")
                        {
                            await e.Channel.SendMessage($"@{e.User.Name}, Unable to adjust the playlist if you dont give me a url.");
                            return;
                        }

                        switch (e.GetArg("flag"))
                        {
                        case "add":
                        case "a":
                            string title = await _system.cmd_plAdd(e.User.Name, e.GetArg("url"));

                            if (title == "dupe")
                            {
                                await e.Channel.SendMessage($"{e.User.Name},\rI found this url already in the list. :smile:\rNo change was made.");
                            }
                            else
                            {
                                await e.Channel.SendMessage($"{e.User.Name},\rTitle: {title}\rHas been added to the playlist file.");
                                _logs.logMessage("Info", "commandsPlaylist.playlist add", $"Playlist was updated. Added {title} {e.GetArg("url")}", e.User.Name);
                            }
                            break;

                        case "remove":
                        case "r":
                            string url = _system.cmd_plRemove(e.GetArg("url"));

                            if (url == "match")
                            {
                                string[] urlTitle = await _downloader.returnYoutubeTitle(e.GetArg("url"));
                                await e.Channel.SendMessage($"{e.User.Name},\rTitle: {urlTitle[0]}\rWas removed from the playlist.");
                                _logs.logMessage("Info", "commandsPlaylist.playlist remove", $"Playlist was updated. Removed {urlTitle[0]} {e.GetArg("url")}", e.User.Name);
                            }
                            else
                            {
                                await e.Channel.SendMessage($"{e.User.Name},\rUnable to find the song in the playlist.");
                            }

                            break;

                        default:
                            await e.Channel.SendMessage($"Invalid Argument\r{_config.Prefix}playlist add url\r{_config.Prefix}playlist remove url");
                            break;
                        }
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlaylist.playlist", error.ToString(), e.User.Name);
                    }
                });

                _client.GetService <CommandService>().CreateCommand("blacklist")
                .Alias("bl")
                .Description("Adds a url to the blacklist file.\rPermissions: Mods")
                .Parameter("flag", ParameterType.Optional)
                .Parameter("url", ParameterType.Optional)
                .MinPermissions((int)PermissionLevel.GroupMods)
                .Do(async e =>
                {
                    try
                    {
                        if (e.GetArg("url") == "")
                        {
                            await e.Channel.SendMessage($"@{e.User.Name}, Unable to adjust the blacklist if you dont give me a url.");
                            return;
                        }

                        switch (e.GetArg("flag"))
                        {
                        case "add":
                        case "a":
                            //parse the url and get the infomation then append to the blacklist.json
                            string title = await _system.cmd_blAdd(e.User.Name, e.GetArg("url"));

                            if (title == "dupe")
                            {
                                await e.Channel.SendMessage($"{e.User.Name},\rI found this url already in the list. :smile:\rNo change was made.");
                            }
                            else
                            {
                                //send the infomation back to the user letting them know we added it to the blacklist.
                                await e.Channel.SendMessage($"{e.User.Name}\rTitle: {title}\rHas been added to the blacklist file.");
                                _logs.logMessage("Info", "commandsPlaylist.blacklist add", $"Blacklist was updated. Added {title} {e.GetArg("url")}", e.User.Name);
                            }
                            break;

                        case "remove":
                        case "r":
                            //parse the url and get the infomation then append to the blacklist.json
                            string url = _system.cmd_blRemove(e.GetArg("url"));

                            if (url == "match")
                            {
                                string[] urlTitle = await _downloader.returnYoutubeTitle(e.GetArg("url"));
                                await e.Channel.SendMessage($"{e.User.Name}\rTitle: {urlTitle[0]}\rWas removed from the blacklist.");
                                _logs.logMessage("Info", "commandsPlaylist.blacklist remove", $"Blacklist was updated. Removed {urlTitle[0]} {e.GetArg("url")}", e.User.Name);
                            }
                            else
                            {
                                await e.Channel.SendMessage($"{e.User.Name}\rUnable to find the song in the blacklist.");
                            }

                            break;

                        default:
                            await e.Channel.SendMessage($"Invalid Argument\r{_config.Prefix}blacklist add url\r{_config.Prefix}blacklist remove url");
                            break;
                        }
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlaylist.blacklist", error.ToString(), e.User.Name);
                    }
                });

                _client.GetService <CommandService>().CreateCommand("vote")
                .Alias("v")
                .Description("Adds a url to the blacklist file.\rPermissions: Mods")
                .Parameter("flag", ParameterType.Optional)
                .MinPermissions((int)PermissionLevel.GroupMods)
                .Do(async e =>
                {
                    try
                    {
                        bool result = false;
                        switch (e.GetArg("flag"))
                        {
                        case "up":
                        case "+":
                            //parse the url and get the infomation then append to the blacklist.json
                            result = _playlist.cmd_voteUp(e.User.Id.ToString());

                            if (result == true)
                            {
                                await e.Channel.SendMessage($"{e.User.Name},\rI have updated the record for the current track to note it was voted for.");
                                _logs.logMessage("Info", "commandsPlaylist.vote up", $"User voted up for URL: {playlist.npUrl}", e.User.Name);
                            }
                            else
                            {
                                await e.Channel.SendMessage($"{e.User.Name},\rRan into a error... please check the log file for more infomation.");
                            }

                            break;

                        case "down":
                        case "-":
                            //parse the url and get the infomation then append to the blacklist.json
                            int intResult = _playlist.cmd_voteDown(e.User.Id.ToString());

                            switch (intResult)
                            {
                            case -1:
                                await e.Channel.SendMessage($"{e.User.Name},\r The track was been skipped enough that it ws removed from the library.");
                                _logs.logMessage("Info", "commandsPlaylist.vote down", $"URL: {playlist.npUrl} hit the treshhold and was removed from the library.", "System");
                                break;

                            case 0:
                                await e.Channel.SendMessage($"{e.User.Name},\rRan into a error... please check the log file for more infomation.");
                                break;

                            case 1:
                                await e.Channel.SendMessage($"{e.User.Name},\rI have updated the record for the current track to note it was down voted for.");
                                _logs.logMessage("Info", "commandsPlaylist.vote down", $"User voted down for URL: {playlist.npUrl}", e.User.Name);
                                break;

                            default:
                                break;
                            }

                            break;

                        default:
                            await e.Channel.SendMessage($"Invalid Argument\r{_config.Prefix}vote up/+ \r{_config.Prefix}vote down/-");
                            break;
                        }
                    }
                    catch (Exception error)
                    {
                        _logs.logMessage("Error", "commandsPlaylist.vote", error.ToString(), e.User.Name);
                    }
                });
            });
        }
示例#29
0
        public virtual void SaveAsXml(Stream stream, XmlWriterSettings xmlSettings, XbimXmlSettings xbimSettings = null, configuration configuration = null, ReportProgressDelegate progress = null)
        {
            using (var xmlWriter = XmlWriter.Create(stream, xmlSettings))
            {
                var schema = _entityFactory.SchemasIds.FirstOrDefault();
                switch (schema)
                {
                case "IFC2X3":
                    var writer3 = new IfcXmlWriter3();
                    writer3.Write(this, xmlWriter, GetXmlOrderedEntities(schema));
                    break;

                case "IFC4":
                    var writer4 = new XbimXmlWriter4(configuration.IFC4Add1, XbimXmlSettings.IFC4Add1);
                    writer4.Write(this, xmlWriter, GetXmlOrderedEntities(schema));
                    break;

                case "COBIE_EXPRESS":
                    var writerCobie = new XbimXmlWriter4(configuration.COBieExpress, XbimXmlSettings.COBieExpress);
                    writerCobie.Write(this, xmlWriter, GetXmlOrderedEntities(schema));
                    break;

                default:
                    var writer = new XbimXmlWriter4(configuration, xbimSettings);
                    writer.Write(this, xmlWriter);
                    break;
                }
                xmlWriter.Close();
            }
        }
示例#30
0
 public static string GetBeitragsDetailsServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_beitragsDetails"));
 }
 public TextWriterAppender(configuration.appender appender, TextWriter writer)
     : base(appender)
 {
     this.writer = writer;
 }
示例#32
0
 public static string GetTeaserServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_teaser"));
 }
示例#33
0
			public qnx(OldUnityXml.qnx old)
			{
				env = new env(old.env);

				author = old.author;
				authorId = old.authorId;
				id = old.id;
				filename = old.filename;
				name = old.name;
				description = old.description;
				publisher = old.publisher;
				versionNumber = old.versionNumber;

				int assetCount = 5, splashAssetCount = old.splashScreens.images != null ? old.splashScreens.images.Length : 0;
				assets = new asset[assetCount + splashAssetCount];
				assets[0] = new asset(old.icon.image, old.icon.image);
				assets[1] = new asset("Data", null);
				assets[2] = new asset("lib", null);
				assets[3] = new asset("SLAwards.bundle", "scoreloop/SLAwards.bundle");
				assets[4] = new asset("Release", null);
				for (int i = 0; i != splashAssetCount; ++i)
				{
					assets[assetCount+i] = new asset(old.splashScreens.images[i], old.splashScreens.images[i]);
				}

				icon = new icon(old.icon);
				splashScreens = new splashScreens(old.splashScreens);
				initialWindow = new initialWindow(old.initialWindow);
				configuration = new configuration(old);

				category = old.category;
				permissions = new permission[old.actions.Length];
				for (int i = 0; i != permissions.Length; ++i)
				{
					permissions[i] = new permission(old.actions[i]);
				}
			}
示例#34
0
 public static string GetTippsServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_tipps"));
 }
示例#35
0
 public static string GetBeitragsTrennerServiceUrl(configuration config)
 {
     return(GetSystemKeyValue(config, "serviceUrl_beitragsTrenner"));
 }
示例#36
0
 public void FromConfig(configuration config) {
   kindblock[] reqKinds = config.requiredkinds;
   foreach (kindblock reqKind in reqKinds) {
     string acp = reqKind.kind.accesscontrol;
     if (reqKind.kind.name != null) {
       /* TODO should be handled by an XML or something else */
       switch (reqKind.kind.name) {
         case "SIP-REGISTRATION":
           ACPmap.Add(12, reqKind.kind.accesscontrol.ToUpper());
           break;
         case "DISCO-REGISTRATION":
           ACPmap.Add(16, reqKind.kind.accesscontrol.ToUpper());
           break;
         case "ACCESS-CONTROL-LIST":
           ACPmap.Add(17, reqKind.kind.accesscontrol.ToUpper());
           break;
         default:
           // Nothing, ignore...
           break;
       }
     }
     else {
       UInt32 kindId = reqKind.kind.id;
       ACPmap.Add(kindId, reqKind.kind.accesscontrol.ToUpper());
     }
   }
 }