예제 #1
0
        public int getMail(string[] args, bool isHash)
        {
            //命令解析器
            int EmlCount = 0;

            arguments = CommandLineArgumentParser.Parse(args);
            if (isHash)
            {
                string url      = arguments.Get("-url").Next;
                string username = arguments.Get("-username").Next;
                string hash     = arguments.Get("-hash").Next;
                this.Mail = new Mail(url, username, hash, ExchangeVersion.Exchange2013);
            }
            else
            {
                string url      = arguments.Get("-url").Next;
                string username = arguments.Get("-username").Next;
                string password = arguments.Get("-password").Next;
                this.Mail = new Mail(url, username, password);
            }
            string path = "";

            if (arguments.Get("-GetMail").Next.ToString().Equals("ALL"))
            {
                path = mail.Path + "\\folderEmails" + Util.convertFromDate(DateTime.Now);
            }
            else
            {
                path = mail.Path + "\\folderEmails" + arguments.Get("-GetMail").Next.ToString();
            }
            EmlCount = GetMailBY(args, path);
            return(EmlCount);
        }
예제 #2
0
        public int searchByTime(string[] args, bool isHash)
        {
            if (isHash)
            {
                string url      = arguments.Get("-url").Next;
                string username = arguments.Get("-username").Next;
                string hash     = arguments.Get("-hash").Next;
                this.Mail = new Mail(url, username, hash, ExchangeVersion.Exchange2013);
            }
            else
            {
                string url      = arguments.Get("-url").Next;
                string username = arguments.Get("-username").Next;
                string password = arguments.Get("-password").Next;
                this.Mail = new Mail(url, username, password);
            }
            int EmlCount = 0;
            List <SearchFilter> filter = new List <SearchFilter>();
            string time = arguments.Get("-Time").Next.ToString();

            filter.Add(Filters.filterByTimeRange(time));
            string path = mail.Path + "\\" + "[Time]" + Util.removeAllSpecialChar(time);

            EmlCount = mail.searchMail(filter, path);
            return(EmlCount);
        }
예제 #3
0
        public int  GetMailBY(string[] args, string path)
        {
            int EmlCount = 0;

            arguments = CommandLineArgumentParser.Parse(args);

            if (arguments.Get("-GetMail").Next.ToString().Equals("ALL"))
            {
                EmlCount = mail.getMail(null, path);
            }
            else
            {
                EmlCount = mail.getMail(arguments.Get("-GetMail").Next.ToString(), path);
            }
            return(EmlCount);
        }
예제 #4
0
        public int searchMail(string[] args, bool isHash)
        {
            //命令解析器
            arguments = CommandLineArgumentParser.Parse(args);
            int EmlCount = 0;

            if (isHash)
            {
                string url      = arguments.Get("-url").Next;
                string username = arguments.Get("-username").Next;
                string hash     = arguments.Get("-hash").Next;
                this.Mail = new Mail(url, username, hash, ExchangeVersion.Exchange2013);
            }
            else
            {
                string url      = arguments.Get("-url").Next;
                string username = arguments.Get("-username").Next;
                string password = arguments.Get("-password").Next;
                this.Mail = new Mail(url, username, password);
            }
            //根据参数得到过滤条件
            List <SearchFilter>         filterList = getSearchFilterList(args);
            Dictionary <string, string> map        = getFilterMap("-Search");
            string path = mail.Path + "\\" + getPartPath(map);

            if (map["ToRecipien"] == null || !map["ToRecipien"].Equals("") || map["ToRecipien"].Equals(" "))
            {
                EmlCount = mail.searchMail(filterList, path);
            }
            else
            {
                EmlCount = mail.searchMailByToRecipient(filterList, map["ToRecipien"], path);
            }
            return(EmlCount);
        }
예제 #5
0
 void IsKeyArgument(CommandLineArgumentParser arguments, ref int valid)
 {
     if (arguments.StartWith("/key"))
     {
         if (arguments.Has("-d"))
         {
             if (EntityControl.Instance.MasterEntityControllIndex == 0)
             {
                 Console.WriteLine("[无可操作实体]");
                 valid += 1;
                 return;
             }
             CommandLineArgument node   = arguments.Get("-d");
             IntVector2          vector = IntVector2.Zero;
             int    value = 0;
             string s1    = null;
             if (node != null)
             {
                 s1 = node.Take();
                 if (s1 != null && !int.TryParse(s1, out value))
                 {
                     value = 0;
                 }
             }
             string s2 = null;
             if (s1 != null && node.Next != null)
             {
                 s2 = node.Next.Take();
                 if (s2 != null && !IntVector2.TryParse(s2, out vector))
                 {
                     vector = IntVector2.Zero;
                 }
             }
             DriverOrderCode orderCode = new DriverOrderCode().SetTragerPoint(vector).SetValue(value).SetOrigin(EntityControl.Instance.MasterEntityControllIndex);
             OrderCmd        cmd       = OrderCmd.Instance(orderCode.ToBytes());
             ControlModel.NetCtrl.WhenCollectCmd(cmd.ToBytes());
             Console.WriteLine("[索引]" + orderCode.index + "[速度]" + orderCode.vector + "[旋转]" + orderCode.value + "[长度]" + cmd.ToBytes().Length);
             valid += 1; return;
         }
         Console.WriteLine("[无效指令]");
         valid += 1; return;
     }
     else
     {
         return;
     }
 }
예제 #6
0
        public string listAllFolder(string [] args, bool isHash)

        {
            string outputstring = "";

            arguments = CommandLineArgumentParser.Parse(args);
            if (isHash)
            {
                string url      = arguments.Get("-url").Next;
                string username = arguments.Get("-username").Next;
                string hash     = arguments.Get("-hash").Next;
                this.Mail = new Mail(url, username, hash, ExchangeVersion.Exchange2013);
            }
            else
            {
                string url      = arguments.Get("url").Next;
                string username = arguments.Get("-username").Next;
                string password = arguments.Get("-password").Next;
                this.Mail = new Mail(url, username, password);
            }
            outputstring += mail.listFolders();
            return(outputstring);
        }
예제 #7
0
        void IsConnectArgument(CommandLineArgumentParser arguments, ref int valid)
        {
            if (arguments.StartWith("/connect"))
            {
                if (arguments.Has("-t"))
                {
                    ServerInfo info = null;
                    if (arguments.Has("-f"))
                    {
                        foreach (var item in NetControl.Instance.ServerInfoDic)
                        {
                            if (item.Value.isValid)
                            {
                                info = item.Value;
                                NetControl.Instance.TryServerConnectTest(info);
                                valid += 1; return;
                            }
                        }
                        Console.WriteLine("未找到任何服务端");
                        valid += 1; return;
                    }
                    else
                    {
                        CommandLineArgument node = arguments.Get("-t");
                        if (node.Take() != null && node.Take() != "")
                        {
                            string     ip    = node.Take();
                            IPEndPoint point = UdpConfig.StrParseToIp(ip);
                            if (point == null)
                            {
                                point = UdpConfig.DnsToIPEndPoint(ip);
                            }
                            if (point != null)
                            {
                                NetControl.Instance.TryServerConnectTest(point);
                                valid += 1; return;
                            }
                            else
                            {
                                Console.WriteLine("无效的网络地址");
                                valid += 1; return;
                            }
                        }
                    }

                    if (info != null)
                    {
                        NetControl.Instance.TryServerConnectTest(info);
                    }
                    else
                    {
                        Console.WriteLine("未选择任何服务端");
                    }
                    valid += 1;
                    return;
                }
                if (arguments.Has("-c"))
                {
                    ServerInfo info = NetControl.Instance.CurrentConnectHost;
                    if (info != null)
                    {
                        NetControl.Instance.TryCanelConnectHost();
                    }
                    else
                    {
                        Console.WriteLine("未连接任何服务端");
                    }
                    valid += 1; return;
                }
                if (arguments.Has("-f"))
                {
                    foreach (var item in NetControl.Instance.ServerInfoDic)
                    {
                        if (item.Value.isValid)
                        {
                            NetControl.Instance.TryConnectHost(item.Value);
                            valid += 1; return;
                        }
                    }
                    Console.WriteLine("未找到任何服务端");
                    valid += 1; return;
                }
                if (arguments.Has("-i"))
                {
                    ServerInfo info = NetControl.Instance.CurrentConnectHost;
                    if (info != null)
                    {
                        Console.WriteLine("[n]" + info.name + "[d]" + info.description + "[r]" + info.remote + "[is]" + info.isSync + ":" + NodeControl.Instance.LocalPlayer.serial + "" + "[ic]" + info.isConnect + "[iv]" + info.isValid + "[io]" + info.isOvertime + "[nc]" + info.currentConnectNodeCount + "[mc]" + info.maxConnectNodeCount + "[ot]" + (TimeControl.TickTime - info.lastTime) + "ms");
                    }
                    else
                    {
                        Console.WriteLine("未连接任何服务端");
                    }
                    valid += 1;
                }
                Console.WriteLine("输入参考:\n参数 -c 取消当前连接\n参数 -f 连接第一个有效的服务端\n参数 -i 查看当前连接信息\n参数 -t[address] 尝试获取服务端信息");
                valid += 1;
            }
            else
            {
                return;
            }
        }