예제 #1
0
 /// <summary>
 ///     Hook <see cref="SyncedList.Load"/> to synchronize the admin status to the clients
 /// </summary>
 /// <param name="self"></param>
 private void SyncedList_Load(SyncedList self)
 {
     // Check if it really is the admin list
     if (ZNet.instance != null && self == ZNet.instance.m_adminList)
     {
         SynchronizeAdminStatus();
     }
 }
        private bool printAdmins(string[] args)
        {
            print("Admin ids:");
            SyncedList    ids    = (SyncedList)AccessTools.Field(typeof(ZNet), "m_adminList").GetValue(ZNet.instance);
            List <string> idList = ids.GetList();

            foreach (string id in idList)
            {
                print(id);
            }
            return(true);
        }
        private bool printPermitted(string[] args)
        {
            print("Permited player steam IDs/IPs:");
            SyncedList    ids    = (SyncedList)AccessTools.Field(typeof(ZNet), "m_permittedList").GetValue(ZNet.instance);
            List <string> idList = ids.GetList();

            foreach (string id in idList)
            {
                print(id);
            }
            return(true);
        }
 private bool UnPermit(string[] args)
 {
     if (UserSupplied(args))
     {
         string user = rebuildString(args);
         ZNet   zNet = ZNet.instance;
         print("Removing user from permited user list: " + user);
         SyncedList permittedPlayers = (SyncedList)AccessTools.Field(typeof(ZNet), "m_permittedList").GetValue(zNet);
         permittedPlayers.Remove(user);
         AccessTools.Field(typeof(ZNet), "m_permittedList").SetValue(zNet, permittedPlayers);
         return(true);
     }
     return(false);
 }
 private bool Unban(string[] args)
 {
     if (UserSupplied(args))
     {
         string user = rebuildString(args);
         ZNet   zNet = ZNet.instance;
         print("Unbanning user: "******"m_bannedList").GetValue(zNet);
         bannedPlayers.Remove(user);
         AccessTools.Field(typeof(ZNet), "m_bannedList").SetValue(zNet, bannedPlayers);
         return(true);
     }
     return(false);
 }
 private bool RemoveAdmin(string[] args)
 {
     if (UserSupplied(args))
     {
         string   user             = rebuildString(args);
         ZNet     zNet             = ZNet.instance;
         ZNetPeer peerByPlayerName = zNet.GetPeerByPlayerName(user);
         if (peerByPlayerName != null)
         {
             user = peerByPlayerName.m_socket.GetHostName();
         }
         print("Removing player from the admin list: " + user);
         SyncedList adminList = (SyncedList)AccessTools.Field(typeof(ZNet), "m_adminList").GetValue(zNet);
         adminList.Remove(user);
         AccessTools.Field(typeof(ZNet), "m_adminList").SetValue(zNet, adminList);
         return(true);
     }
     return(false);
 }
 private bool Permit(string[] args)
 {
     if (UserSupplied(args))
     {
         string   user             = rebuildString(args);
         ZNet     zNet             = ZNet.instance;
         ZNetPeer peerByPlayerName = zNet.GetPeerByPlayerName(user);
         if (peerByPlayerName != null)
         {
             user = peerByPlayerName.m_socket.GetHostName();
         }
         print("Permitting user: "******"m_permittedList").GetValue(zNet);
         permittedPlayers.Add(user);
         AccessTools.Field(typeof(ZNet), "m_permittedList").SetValue(zNet, permittedPlayers);
         return(true);
     }
     return(false);
 }
예제 #8
0
        public DownloadManagerM(DownloadManagerMV manager)
        {
            stop = false;
            this.managerMV = manager;
            String[] regexSeparateur = new String[1];
            regexSeparateur[0] = Settings.Default.regexSeparateur;
            String multipleRegexes;

            indexRegex = new Regex("index=(?<index>[0-9]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase);

            youtubeRegex = new List<Regex>();
            /*
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeVideoEmbedUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeVideoOldEmbedUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeVideoUrlAbrege, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubeRegex.Add(new Regex(Settings.Default.regexYoutubeChannelVideo, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */
            multipleRegexes = Settings.Default.allYoutubeRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                youtubeRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }

            dailymotionRegex = new List<Regex>();
            multipleRegexes = Settings.Default.allDailyMotionRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                dailymotionRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            /*dailymotionRegex.Add(new Regex(Settings.Default.regexDailyMotionVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            dailymotionRegex.Add(new Regex(Settings.Default.regexDailyMotionEmbedVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */
            justinTVRegex = new List<Regex>();
            multipleRegexes = Settings.Default.allJustinTvRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                justinTVRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            /*            justinTVRegex.Add(new Regex(Settings.Default.regexJustinTVVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            justinTVRegex.Add(new Regex(Settings.Default.regexTwitchTVVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */

            gameanyoneRegex = new List<Regex>();
            multipleRegexes = Settings.Default.regexGameanyone;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                gameanyoneRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }

            //gameanyoneRegex.Add(new Regex(Settings.Default.regexGameanyone, RegexOptions.Compiled | RegexOptions.IgnoreCase));

            giantBombRegex = new List<Regex>();
            multipleRegexes = Settings.Default.regexGiantBombVideoUrl;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                giantBombRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            //giantBombRegex.Add(new Regex(Settings.Default.regexGiantBombVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));

            gamespotRegex = new List<Regex>();
            multipleRegexes = Settings.Default.regexGamespotVideoUrl;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                gamespotRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            //gamespotRegex.Add(new Regex(Settings.Default.regexGamespotVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));

            blipTvRegex = new List<Regex>();
            multipleRegexes = Settings.Default.regexBlipTvVideoUrl;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                blipTvRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            //blipTvRegex.Add(new Regex(Settings.Default.regexBlipTvVideoUrl, RegexOptions.Compiled | RegexOptions.IgnoreCase));

            vimeoRegex = new List<Regex>();
            multipleRegexes = Settings.Default.allVimeoRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                vimeoRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            /*            vimeoRegex.Add(new Regex(Settings.Default.regexVimeo, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            vimeoRegex.Add(new Regex(Settings.Default.regexVimeoEmbed, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */
            youtubePlaylistRegex = new List<Regex>();
            multipleRegexes = Settings.Default.allYoutubePlaylistRegexes;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                youtubePlaylistRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }
            /*            youtubePlaylistRegex.Add(new Regex(Settings.Default.regexYoutubePalylist1, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubePlaylistRegex.Add(new Regex(Settings.Default.regexYoutubePalylist2, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            youtubePlaylistRegex.Add(new Regex(Settings.Default.regexYoutubePalylist3, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            */
            gametrailersRegex = new List<Regex>();
            multipleRegexes = Settings.Default.gametrailersRegex;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                gametrailersRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }

            videoUrlRegex = new List<Regex>();
            multipleRegexes = Settings.Default.videoUrlRegex;
            foreach (String singleRegex in multipleRegexes.Split(regexSeparateur, StringSplitOptions.RemoveEmptyEntries))
            {
                videoUrlRegex.Add(new Regex(singleRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase));
            }

            CheckSettings();

            var cme = new System.Net.Configuration.ConnectionManagementElement();
            cme.MaxConnection = 65000;
            System.Net.ServicePointManager.DefaultConnectionLimit = 65000;

            listeDownload = new SyncedList<Download>();
            waitingListeSegment = new SyncedList<Segment>();
            listeSegmentEnCours = new SyncedList<Segment>();
            listeBackgroundWorkers = new List<BackgroundWorker>();
            lastCheck = DateTime.Now;

            moniteur = new ClipboardMonitor(this);
            moniteur.Show();

            youtubeCookieContainer = null;
        }
예제 #9
0
 public EntityNode()
 {
     Attributes = new SyncedList <AttributeNode, Node>(Children);
     Modifiers  = new SyncedList <ModifierNode, Node>(Children);
 }
예제 #10
0
 public FunctionReturnTypeNode()
 {
     ReturnTypeAttributes = new SyncedList <AttributeNode, Node>(Children);
 }
예제 #11
0
 public CompoundTypeDeclarationNode(string identifier) : base(identifier)
 {
     Members = new SyncedList <MemberDeclarationNode, Node>(Children);
 }
예제 #12
0
 private static void SyncedList_Save(SyncedList __instance) => Instance.SyncedList_Save(__instance);
예제 #13
0
 public ConstructorNode(string identifier) : base(identifier)
 {
     Initializers = new SyncedList <ExpressionNode, Node>(Children);
 }
예제 #14
0
 // scope
 public BlockNode()
 {
     Statements = new SyncedList <StatementNode, Node>(Children);
 }
예제 #15
0
 public TemplateTypeParameterNode(string identifier)
 {
     Identifier = identifier;
     Attributes = new SyncedList <AttributeNode, Node>(Children);
 }
예제 #16
0
 public ModuleNode(string identifier)
 {
     Attributes = new SyncedList <AttributeNode, Node>(Children);
     Namespaces = new SyncedList <NamespaceDeclarationNode, Node>(Children);
     Identifier = identifier;
 }
 public NamespaceDeclarationNode(IEnumerable <string> identifiers)
 {
     Members     = new SyncedList <MemberDeclarationNode, Node>(Children);
     Identifiers = identifiers.ToArray();
 }
 public FunctionParameterNode(string name)
 {
     Attributes = new SyncedList <AttributeNode, Node>(Children);
     Name       = name;
 }
예제 #19
0
        protected SyncedList<Segment> CreateSegments(long totalSize, long segmentSize)
        {
            try
            {
                SyncedList<Segment> segments = new SyncedList<Segment>();
                long nombreSegments = totalSize / segmentSize;
                long lastSegmentSize = 0;
                for (int i = 0; i < nombreSegments; i++)
                {
                    segments.Add(new Segment(segmentSize, i * segmentSize, this, this.manager));
                }

                lastSegmentSize = totalSize % segmentSize;
                if (lastSegmentSize != 0)
                {
                    segments.Add(new Segment(lastSegmentSize, segmentSize * nombreSegments, this, this.manager));
                }
                return segments;

            }
            catch (Exception ex)
            {
                AddErrorMsg("Download.CreateSegments() ", ex);
                return null;
            }
        }
예제 #20
0
 public EnumDeclarationNode(string identifier) : base(identifier)
 {
     Members = new SyncedList <EnumMemberDeclarationNode, Node>(Children);
 }
예제 #21
0
 public BaseTypeDeclarationNode(string identifier)
 {
     BaseTypes  = new SyncedList <BaseTypeDeclarationNode, Node>(Children);
     Identifier = identifier;
 }
예제 #22
0
 public FunctionalTypeDeclarationNode(string identifier) : base(identifier)
 {
     TypeParameters = new SyncedList <TemplateTypeParameterNode, Node>(Children);
     Constraints    = new SyncedList <TypeConstraintNode, Node>(Children);
     Methods        = new SyncedList <BaseMethodNode, Node>(Children);
 }
예제 #23
0
 public Node()
 {
     Children  = new List <Node>();
     Metadatas = new SyncedList <MetadataNode, Node>(Children);
 }
예제 #24
0
 private static void SyncedList_Load(SyncedList __instance) => Instance.SyncedList_Load(__instance);
예제 #25
0
 public ProjectNode(string identifier)
 {
     Attributes = new SyncedList <AttributeNode, Node>(Children);
     Modules    = new SyncedList <ModuleNode, Node>(Children);
     Identifier = identifier;
 }
예제 #26
0
 public MemberDeclarationNode()
 {
     Attributes = new SyncedList <AttributeNode, Node>(Children);
     Modifiers  = new SyncedList <ModifierNode, Node>(Children);
 }