Example #1
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users    = new UsersCategory(this);
            Friends  = new FriendsCategory(this);
            Status   = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups   = new GroupsCategory(this);
            Audio    = new AudioCategory(this);
            Wall     = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils    = new UtilsCategory(this);
            Fave     = new FaveCategory(this);
            Video    = new VideoCategory(this);
            Account  = new AccountCategory(this);
            Photo    = new PhotoCategory(this);
            Docs     = new DocsCategory(this);
            Likes    = new LikesCategory(this);
            Pages    = new PagesCategory(this);
            Gifts    = new GiftsCategory(this);
            Apps     = new AppsCategory(this);
            NewsFeed = new NewsFeedCategory(this);
            Stats    = new StatsCategory(this);
            Auth     = new AuthCategory(this);

            RequestsPerSecond = 3;
        }
Example #2
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users = new UsersCategory(this);
            Friends = new FriendsCategory(this);
            Status = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups = new GroupsCategory(this);
            Audio = new AudioCategory(this);
            Wall = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils = new UtilsCategory(this);
            Fave = new FaveCategory(this);
            Video = new VideoCategory(this);
            Account = new AccountCategory(this);
            Photo = new PhotoCategory(this);
            Docs = new DocsCategory(this);
            Likes = new LikesCategory(this);
            Pages = new PagesCategory(this);
            Gifts = new GiftsCategory(this);
            Apps = new AppsCategory(this);
            NewsFeed = new NewsFeedCategory(this);
            Stats = new StatsCategory(this);
            Auth = new AuthCategory(this);
            Markets = new MarketsCategory(this);
            Execute = new ExecuteCategory(this);

            RequestsPerSecond = 3;
        }
Example #3
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi(ICaptchaSolver captchaSolver = null)
        {
            Browser = new Browser();

            Users    = new UsersCategory(this);
            Friends  = new FriendsCategory(this);
            Status   = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups   = new GroupsCategory(this);
            Audio    = new AudioCategory(this);
            Wall     = new WallCategory(this);
            Board    = new BoardCategory(this);
            Database = new DatabaseCategory(this);
            Utils    = new UtilsCategory(this);
            Fave     = new FaveCategory(this);
            Video    = new VideoCategory(this);
            Account  = new AccountCategory(this);
            Photo    = new PhotoCategory(this);
            Docs     = new DocsCategory(this);
            Likes    = new LikesCategory(this);
            Pages    = new PagesCategory(this);
            Gifts    = new GiftsCategory(this);
            Apps     = new AppsCategory(this);
            NewsFeed = new NewsFeedCategory(this);
            Stats    = new StatsCategory(this);
            Auth     = new AuthCategory(this);
            Markets  = new MarketsCategory(this);
            Execute  = new ExecuteCategory(this);

            RequestsPerSecond = 3;

            MaxCaptchaRecognitionCount = 5;
            _captchaSolver             = captchaSolver;
        }
Example #4
0
        /// <summary>
        /// 获取所有category 或者 根据父类获取category
        /// </summary>
        /// <param name="parentCategoryId"></param>
        /// <returns></returns>
        public List <WallCategory> GetWallCategory(int parentCategoryId = 0, bool isRoot = false)
        {
            List <WallCategory> wcList = new List <WallCategory>();
            string sql = string.Empty;

            if (parentCategoryId != 0)
            {
                sql = string.Format("select * from WallCategory where ParentCategoryId = {0}  order by id desc", parentCategoryId);
            }
            else
            {
                sql = string.Format("select * from WallCategory {0} order by id desc", isRoot ? "where ParentCategoryId is null" : "");
            }
            using (SqlDataReader dr = SQLHelper.ExecuteReader(sql))
            {
                while (dr.Read())
                {
                    WallCategory wcFile = new WallCategory();
                    wcFile.Id               = int.Parse(dr["Id"].ToString());
                    wcFile.CategoryName     = dr["CategoryName"].ToString();
                    wcFile.ParentCategoryId = dr["ParentCategoryId"] is DBNull ? 0 : int.Parse(dr["ParentCategoryId"].ToString());
                    wcFile.UpdateDate       = DateTime.Parse(dr["UpdateDate"].ToString());
                    wcFile.Owner            = dr["Owner"].ToString();
                    wcList.Add(wcFile);
                }
                dr.Close();
            }
            return(wcList);
        }
Example #5
0
        /// <summary>
        /// 更新category
        /// </summary>
        /// <param name="wc"></param>
        /// <returns></returns>
        public int UpdateWallCategory(WallCategory wc)
        {
            string sql = string.Format("update WallCategory set CategoryName=@CategoryName,UpdateDate=getDate(),Owner=@Owner where Id=@Id");

            SqlParameter[] cmdParams = new SqlParameter[3];
            cmdParams[0] = new SqlParameter("@CategoryName", wc.CategoryName);
            cmdParams[1] = new SqlParameter("@Owner", wc.Owner);
            cmdParams[2] = new SqlParameter("@Id", wc.Id);

            return(SQLHelper.ExecuteNonQuery(sql, cmdParams));
        }
Example #6
0
File: VkApi.cs Project: ShamilS/vk
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users    = new UsersCategory(this);
            Friends  = new FriendsCategory(this);
            Status   = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups   = new GroupsCategory(this);
            Audio    = new AudioCategory(this);
            Wall     = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils    = new UtilsCategory(this);
            Fave     = new FaveCategory(this);
            Video    = new VideoCategory(this);
            Account  = new AccountCategory(this);
        }
Example #7
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            ServicePointManager.ServerCertificateValidationCallback = new PositiveCertificatePolicy().ServerCertificateValidationCallback;

            Browser = new Browser();

            Users    = new UsersCategory(this);
            Friends  = new FriendsCategory(this);
            Status   = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups   = new GroupsCategory(this);
            Audio    = new AudioCategory(this);
            Wall     = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils    = new UtilsCategory(this);
            Fave     = new FaveCategory(this);
            Video    = new VideoCategory(this);
            Account  = new AccountCategory(this);
            Likes    = new LikesCategory(this);
            Photo    = new PhotoCategory(this);
        }
Example #8
0
        public WallCategory GetWallCategoryById(int categoryId)
        {
            string sql = string.Format("select * from WallCategory where Id = {0}", categoryId);

            WallCategory wcFile = null;

            using (SqlDataReader dr = SQLHelper.ExecuteReader(sql))
            {
                if (dr.Read())
                {
                    wcFile                  = new WallCategory();
                    wcFile.Id               = int.Parse(dr["Id"].ToString());
                    wcFile.CategoryName     = dr["CategoryName"].ToString();
                    wcFile.ParentCategoryId = dr["ParentCategoryId"] is DBNull ? 0 : int.Parse(dr["ParentCategoryId"].ToString());
                    wcFile.UpdateDate       = DateTime.Parse(dr["UpdateDate"].ToString());
                    wcFile.Owner            = dr["Owner"].ToString();
                }
                dr.Close();
            }
            return(wcFile);
        }
Example #9
0
        /// <summary>
        /// 添加Wall Category
        /// </summary>
        /// <param name="wc"></param>
        /// <returns></returns>
        public int Save(WallCategory wc)
        {
            string sql = string.Format("insert WallCategory values(@CategoryName,@ParentCategoryId,getDate(),@Owner);select id = SCOPE_IDENTITY();");

            SqlParameter[] cmdParams = new SqlParameter[3];
            cmdParams[0] = new SqlParameter("@CategoryName", wc.CategoryName);
            object parentCategory;

            if (wc.ParentCategoryId == 0)
            {
                parentCategory = DBNull.Value;
            }
            else
            {
                parentCategory = wc.ParentCategoryId;
            }
            cmdParams[1] = new SqlParameter("@ParentCategoryId", parentCategory);
            cmdParams[2] = new SqlParameter("@Owner", wc.Owner);

            return(int.Parse(SQLHelper.ExecuteScalar(sql, cmdParams).ToString()));
        }
Example #10
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users    = new UsersCategory(this);
            Friends  = new FriendsCategory(this);
            Status   = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups   = new GroupsCategory(this);
            Audio    = new AudioCategory(this);
            Wall     = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils    = new UtilsCategory(this);
            Fave     = new FaveCategory(this);
            Video    = new VideoCategory(this);
            Account  = new AccountCategory(this);
            Photo    = new PhotoCategory(this);
            Docs     = new DocsCategory(this);

            RequestsPerSecond = 3;
            AutoTokenRefresh  = false;
        }
Example #11
0
 public void SetUp()
 {
     _defaultWall = new WallCategory(new VkApi());
 }
Example #12
0
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users = new UsersCategory(this);
            Friends = new FriendsCategory(this);
            Status = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups = new GroupsCategory(this);
            Audio = new AudioCategory(this);
            Wall = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils = new UtilsCategory(this);
            Fave = new FaveCategory(this);
            Video = new VideoCategory(this);
			Account = new AccountCategory(this);
            Photo = new PhotoCategory(this);
            Docs = new DocsCategory(this);
            Likes = new LikesCategory(this);
			
            RequestsPerSecond = 3;
        }
Example #13
0
 internal WallCategoryExtended(WallCategory wallCategory, VkApi vk)
 {
     _wall = wallCategory;
     _vk = vk;
 }
Example #14
0
File: VkApi.cs Project: justloot/vk
        /// <summary>
        /// Инициализирует новый экземпляр класса <see cref="VkApi"/>.
        /// </summary>
        public VkApi()
        {
            Browser = new Browser();

            Users = new UsersCategory(this);
            Friends = new FriendsCategory(this);
            Status = new StatusCategory(this);
            Messages = new MessagesCategory(this);
            Groups = new GroupsCategory(this);
            Audio = new AudioCategory(this);
            Wall = new WallCategory(this);
            Database = new DatabaseCategory(this);
            Utils = new UtilsCategory(this);
            Fave = new FaveCategory(this);
            Video = new VideoCategory(this);
			Account = new AccountCategory(this);

            ApiVersion = "5.9";
        }