public void Initialize() { Answer ans = Database.SendGetAnswer("INFO"); if (ans.Info != Inf.OK) { PermissionDenied.Visible = true; PermissionDenied.Text = ans.Message; return; } PermissionDenied.Visible = false; TimerUpdate.Stop(); CPUChart.Series[0].Points.Clear(); RAMChart.Series[0].Points.Clear(); QueryChart.Series[0].Points.Clear(); if (MainForm.ServerInformation.Count != 0) { info = MainForm.ServerInformation.Last(); RAMChart.ChartAreas[0].AxisY.Maximum = info.TotalMemory; TimeStart.Text = DateTime.Now.AddSeconds(-info.UpTime).ToString("yyyy/MM/dd hh:mm:ss"); } TimerUpdate.Start(); foreach (InfoClass inf in MainForm.ServerInformation) { AddToCharts(inf); if (inf.TotalMemory > RAMChart.ChartAreas[0].AxisY.Maximum) { RAMChart.ChartAreas[0].AxisY.Maximum = inf.TotalMemory; } } }
public string get(List<InfoClass.Image> ImgUrl, InfoClass.news news, List<InfoClass.Video> Video, InfoClass.GroupList GroupList, InfoClass.GroupPost GroupPost, InfoClass.account account) { StringBuilder result = new StringBuilder(); //Браковщик if (GroupList.BreakMedia) { if (ImgUrl != null && !GroupList.photo || news.Audio != null && !GroupList.audio || news.Poll != null && !GroupList.poll || Video != null && !GroupList.video) { ImgUrl = null; news = null; GroupList = null; GroupPost = null; account = null; result = null; Video = null; return null; } } //Загружаем фотографию if (ImgUrl != null && GroupList.photo) { if (account.UploadPhoto) { string ResultImg = new engine.VK_API.Upload().get(ImgUrl, GroupPost, GroupList, account); if (ResultImg != null) { result.Append(ResultImg); ResultImg = null; } } else { foreach (InfoClass.Image img in ImgUrl) { if (img.owner_id != null && img.pid != null) { result.Append("photo" + img.owner_id + "_" + img.pid + ","); } } } } //Обработка аудио if (news.Audio != null && GroupList.audio) result.Append(news.Audio); //Обработка голосования if (news.Poll != null && GroupList.poll) result.Append(news.Poll); //Обработка видео if (Video != null && GroupList.video) { foreach (InfoClass.Video video in Video) { if (video.media_id != null && video.owner_id != null) result.Append("video" + video.owner_id + "_" + video.media_id + ","); } } //Очистка ресурсов и возврат данных ImgUrl = null; news = null; GroupList = null; GroupPost = null; account = null; Video = null; return result.ToString().Replace(",", "").Replace(" ", "").Trim() == "" ? null : Regex.Replace(result.ToString(), ",$", ""); }
public void put(InfoClass.GroupList GroupList, InfoClass.GroupPost GroupPost, InfoClass.account account, string message, string attachments, string post_id, string source_id) { if (message == null && attachments == null || GroupList.AttachmentsNullBlock && attachments == null || GroupList.AttachmentsNullBlock && (!attachments.Contains("photo") && !attachments.Contains("video"))) { Console.WriteLine("info: Новость https://vk.com/wall{0}_{1} забракована в WallPost.cs, UserID: {2}, ID: {3}, группа: https://vk.com/public{4}", source_id, post_id, account.UserID, account.id, GroupPost.GroupID.Replace("-", "")); GroupList = null; message = null; attachments = null; GroupPost = null; account = null; post_id = null; source_id = null; } else { Console.WriteLine("info: {5} https://vk.com/wall{0}_{1}, UserID: {3}, ID: {4}, группа https://vk.com/public{2}", source_id, post_id, GroupPost.GroupID.Replace("-", ""), account.UserID, account.id, (GroupList.ModerationNews ? "Отправляем в модерацию новость" : "Публикуем новость")); string tmp = new PostAPI().post("https://api.vk.com/method/wall.post", ("owner_id=" + GroupPost.GroupID + (message != null ? "&message=" + HttpUtility.UrlEncode(message) : "") + (attachments == null ? "" : "&attachments=" + attachments) + "&from_group=1&access_token=" + (GroupList.ModerationNews ? account.ModerationToken : account.token)), source_id, post_id, account.UserID, GroupList.GroupID); string s = new Regex("post_id\":([0-9]+)").Match(tmp).Groups[1].Value.Trim(); //Ставим ключевые слова для фотографии if (account.KeyPhoto != 0 && s != "" && account.UploadPhoto) new PhotoEdit().put(GroupPost.GroupID, s, account, post_id, source_id, GroupList.ModerationNews); s = null; tmp = null; //Чистим ресурсы GroupList = null; message = null; attachments = null; GroupPost = null; post_id = null; source_id = null; //Ждем между новостями int sleep = new Random().Next(account.RandomStart, account.RandomNext); System.Threading.Thread.Sleep(1000 * sleep); account = null; } }
public void put(string GroupID, string MediaID, InfoClass.account account, string post_id, string source_id, bool moderation) { if (GroupID == null || MediaID == null) return; //Загружаем данные по новости List<MediaDB> media = get(GroupID, MediaID, (moderation ? account.ModerationToken : account.token)); if (media == null) return; if (media.Count == 0) { media = null; return; } //Меняем описание для фотографии foreach (MediaDB m in media) { string aes = account.KeyAES != null ? "private:" + new engine.AES256(account.KeyAES).Encrypt(string.Format("{0}_{1}", source_id, post_id)) + "\n" : ""; new PostAPI().post("https://api.vk.com/method/photos.edit", ("owner_id=" + m.owner_id + "&photo_id=" + m.pid + "&caption=" + HttpUtility.UrlEncode(aes + ProcessingText.get(account.GroupKey, account.KeyPhoto, account)) + "&access_token=" + (moderation ? account.ModerationToken : account.token)), null, null, (moderation ? account.ModerationID : account.UserID), GroupID); aes = null; Thread.Sleep(500); } //Чистим ресурсы media = null; GroupID = null; MediaID = null; account = null; source_id = null; post_id = null; }
public List<InfoClass.Image> get(List<InfoClass.Image> Image, InfoClass.account account) { List<InfoClass.Image> tmp = new List<InfoClass.Image> { }; foreach (InfoClass.Image img in Image) { if (img.src_big != null) { //Сохраняем картинку в byte[] byte[] ImageBig = new WebClient().DownloadData(img.src_big); FileStream ImgStream = null; try { //Сохраняем картинку на диск ImgStream = new FileStream(conf.DirImgTmp + account.id + ".jpg", FileMode.Create, FileAccess.ReadWrite); ImgStream.Write(ImageBig, 0, ImageBig.Length); } catch { } finally { ImageBig = null; if (ImgStream != null) { ImgStream.Close(); ImgStream.Dispose(); ImgStream = null; } } //Если дубликата нету то добавляем картинку в список загружаемых фотографий if (!new CheckIMG().get(account)) { //Выбираем самую большую фотографию string BigImg = null; if (img.src_xxbig != null) BigImg = img.src_xxbig; else if (img.src_xbig != null) BigImg = img.src_xbig; else if (img.src_big != null) BigImg = img.src_big; //Добовляем данные в массив tmp.Add(new InfoClass.Image { owner_id = img.owner_id, pid = img.pid, src_big = BigImg, text = img.text }); //Чистим ресурсы BigImg = null; } } } //Возвращаем результат Image = null; account = null; return tmp.Count == 0 ? (tmp = null) : tmp; }
public static void InfoPrintf(string mess, InfoClass Class) { string A = ""; switch (Class) { case InfoClass.Debug: { if (ClasslBool.Debug) { Console.WriteLine("\r\n ========= DebugBeginning =========" + "\r\n[Debug] " + DateTime.Now.ToString("MM-dd HH:mm:ss") + ": " + mess + "\r\n=========DebugEnd========="); A = "=========DebugBeginning=========" + "\r\n[Debug] " + DateTime.Now.ToString("MM-dd HH:mm:ss") + ": " + mess + "\r\n=========DebugEnd========="; } } break; case InfoClass.系统错误信息: { if (ClasslBool.系统错误信息) { Console.WriteLine("\r\n ========= SysteErrorInfoBeginning =========" + "\r\n[SysteErrorInfo]: " + mess + "\r\n=========SysteErrorInfoEnd========="); A = "\r\n=========SysteErrorInfoBeginning=========" + "\r\n[SysteErrorInfo]: " + mess + "\r\n=========SysteErrorInfoEnd========="; } } break; case InfoClass.杂项提示: { if (ClasslBool.杂项提示) { Console.WriteLine("[Info]: " + mess); A = "\r\n[Info]: " + mess; } } break; case InfoClass.载必要提示: { if (ClasslBool.载必要提示) { Console.WriteLine("[下载系统消息]" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ": " + mess); A = "\r\n[下载系统消息]" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ": " + mess; } } break; } if (ClasslBool.输出到文件 && A.Length > 2) { OutToFile(A); } }
public void AddToCharts(InfoClass info) { CPULabel.Text = String.Format("{0}%", info.CPU); OZUAllLabel.Text = String.Format("{0} МБ", info.TotalMemory); OZULabel.Text = String.Format("{0} МБ", info.UsedMemory); OZUFreeLabel.Text = String.Format("{0} МБ", info.TotalMemory - info.UsedMemory); QuerySec.Text = String.Format("{0}", info.QuerySec); QueryMin.Text = String.Format("{0}", info.QueryMin); QueryStart.Text = String.Format("{0}", info.QueryTotal); TimeWork.Text = String.Format("{0}", TimeSpan.FromSeconds(info.UpTime)); CPUChart.Series[0].Points.AddXY(info.time, info.CPU); RAMChart.Series[0].Points.AddXY(info.time, info.UsedMemory); QueryChart.Series[0].Points.AddXY(info.time, info.QuerySec); }
public ActionResult Create(InfoClass infoClass) { InfoClass @class = new InfoClass { Info_Class = infoClass.Info_Class }; var temp = InfoClassBll.Add(@class); if (temp == true) { return(RedirectToAction("Index")); } return(View(infoClass)); }
private Task get(InfoClass.account account) { return new Task(() => { Console.WriteLine("info: Старт потока, UserID: {0}, ID: {1}", account.UserID, account.id); //Загружаем список групп for (int i = 0; i < account.GroupList.Count; i++) { InfoClass.GroupList GroupList = (account.GroupList[i] as InfoClass.GroupList); if (GroupList == null) { GroupList = null; continue; } //Получаем и публикуем новости foreach (InfoClass.news news in new engine.VK_API.news().get(account, GroupList)) { //Создаем если нужно папку для проверки картинок на дубликаты if (!Directory.Exists(conf.DirImgTmp)) Directory.CreateDirectory(conf.DirImgTmp); //Проверяем на дубликаты фотографии и видео, после чего возвращаем новые данные List<InfoClass.Image> ImgUrl = new CreateIMG().get(news.img, account); List<InfoClass.Video> video = new CreateVideo().get(news.Video, account, GroupList.GroupID); foreach (InfoClass.GroupPost GroupPost in account.GroupPost) { //Получаем фотографии, опросы, аудио, видио и обрабатываем текст string MessageURL = account.URL_Text != null ? account.URL_Text : ""; string KeyText = account.KeyText != 0 ? "\n" + ProcessingText.get(account.GroupKey, account.KeyText, account) : MessageURL; string NewsText = GroupList.text ? news.Text : null; string message = account.KeyWall != 0 ? (NewsText == null ? ProcessingText.get(account.GroupKey, account.KeyWall, account) : (new TextReplace().get(NewsText, account.ReplaceTag) + KeyText)) : (NewsText == null ? KeyText : (new TextReplace().get(NewsText, account.ReplaceTag) + KeyText)); string attachments = new Attachments().get(ImgUrl, news, video, GroupList, GroupPost, account); //Публикуем новость и чистим ресурсы new engine.VK_API.WallPost().put(GroupList, GroupPost, account, (message == null || message.Replace(" ", "").Trim() == "" ? null : Regex.Replace(Regex.Replace(message, "[\n]+#", "\n#"), "\n[\n ]+", "\n\n")), attachments, news.post_id, news.source_id); attachments = null; message = null; NewsText = null; MessageURL = null; KeyText = null; } ImgUrl = null; } GroupList = null; } //Завершаем поток Console.WriteLine("info: Поток завершен, UserID: {0}, ID: {1}", account.UserID, account.id); account = null; }); }
public void get(List<string> TempTag, InfoClass.account account) { List<string> tmp = new List<string> { }; if (TempTag.Count == 0) { TempTag = null; account = null; return; } //Вытаскиваем теги foreach (string s in TempTag) tmp.AddRange(GetTag(s)); //Создаем папку если нужно if (!Directory.Exists(conf.DirTag)) Directory.CreateDirectory(conf.DirTag); //Записываем новые теги foreach (string s1 in tmp) { //Проверяем по хеш тегам bool dublicat = false; foreach(string s2 in account.Tag) { if (s1.ToLower().Trim() == s2.Trim()) dublicat = true; } //Проверяем по нашим хеш тегам if (!dublicat) { foreach (string s2 in account.GroupKey) { if (s1.ToLower().Replace("#", "").Trim() == s2.Replace("#", "").ToLower().Trim()) dublicat = true; } } //Добовляем новые хеш теги if (!dublicat) { account.Tag.Add(s1.ToLower().Trim()); File.AppendAllText(conf.DirTag + account.id, s1.Trim() + Environment.NewLine); } } //Чистим ресурсы tmp = null; TempTag = null; account = null; }
public void put(string video_id, InfoClass.account account, string GroupID) { //Получаем информацию по видео MediaDB media = get(video_id, account.UserID, account.token); //Работа с текстом string title = (media.title == null ? "Not Title" : new TextReplace().get(media.title, account.ReplaceTag)); string description = media.description == null ? ProcessingText.get(account.GroupKey, account.KeyVideo, account) : (new TextReplace().get(media.description, account.ReplaceTag) + "\n\n" + ProcessingText.get(account.GroupKey, account.KeyText, account)); //Меняем описание и название видио new PostAPI().post("https://api.vk.com/method/video.edit", ("owner_id=" + account.UserID + "&video_id=" + video_id + "&name=" + HttpUtility.UrlEncode(title) + "&desc=" + HttpUtility.UrlEncode(Regex.Replace(description, @"[\n\r]+", "\n")) + "&access_token=" + account.token), null, null, account.UserID, GroupID); //Чистим ресурсы video_id = null; account = null; GroupID = null; media = null; title = null; description = null; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); infoScript = GetComponent <InfoClass> (); InitInfo(); }
public string get(List<InfoClass.Image> ImgUrl, InfoClass.GroupPost GroupPost, InfoClass.GroupList GroupList, InfoClass.account account) { try { //Наш результат StringBuilder result = new StringBuilder(); //Если картинок нету if (ImgUrl == null) { ImgUrl = null; GroupPost = null; account = null; result = null; return null; } //Загружаем все картинки foreach (InfoClass.Image s in ImgUrl) { //Загружаем картинку и получаем данные с хешем string photo = HttpUploadPhoto(s.src_big, (GroupList.ModerationNews ? GroupPost.ModerationUploadURL : GroupPost.UploadURL)); if (photo == null) continue; //Если была ошибка во время загрузки картинки, то переходим на следующею картинку //Работа с данными GroupCollection g = new Regex("\"server\":([0-9]+),\"photo\":\"(.*)\",\"hash\":\"([a-zA-Z0-9]+)\"").Match(photo.Replace("\\", "").Replace(" ", "")).Groups; string tmp = new PostAPI().post("https://api.vk.com/method/photos.saveWallPhoto", ("group_id=" + GroupPost.GroupID.Replace("-", "").Trim() + "&server=" + g[1].Value + "&photo=" + HttpUtility.UrlEncode(g[2].Value) + new Regex("(&gid=[0-9]+)&").Match(GroupList.ModerationNews ? GroupPost.ModerationUploadURL : GroupPost.UploadURL).Groups[1].Value + "&hash=" + g[3].Value + "&access_token=" + (GroupList.ModerationNews ? account.ModerationToken : account.token)), null, null, account.UserID, GroupList.GroupID); string res = new Regex("id\":\"([a-zA-Z-_0-9]+)").Match(tmp).Groups[1].Value + ","; //Добовляем результат if (res.Replace(",", "").Replace(" ", "").Trim() != "") result.Append(new Regex("id\":\"([a-zA-Z-_0-9]+)").Match(tmp).Groups[1].Value + ","); //Чистим ресурсы photo = null; g = null; tmp = null; res = null; } //Возвращаем результат всех фотографий ImgUrl = null; GroupPost = null; GroupList = null; account = null; return result.ToString().Replace(",", "").Replace(" ", "").Trim() == "" ? null : result.ToString(); } catch (Exception e) { Console.WriteLine("error: Ошибка во время сохранения фотографий на сервере загрузки, UserID: {0}, ID: {1}, группа: {2}", account.UserID, account.id, GroupList.GroupID); if (e != null) Console.WriteLine("Код ошибки: {1}{0}{1}{1}", e, Environment.NewLine); return null; } }
public static string get(List<string> key, int count, InfoClass.account account) { if (key == null || key.Count == 0) { key = null; account = null; return ""; } //Если надо вернуть все ключи if (key.Count <= count) { StringBuilder res = new StringBuilder(); foreach (string s in key) res.Append(s + " "); key = null; account = null; return res.ToString().Replace("<br>", "\n").Trim(); } //Возвращаем рандомовские ключи string result = ""; Random rng = new Random(); for (int i = 0, x = 0; i < count; x++) { string s = key[rng.Next(0, key.Count)].Trim(); if (!result.Contains(s.Replace("#", "").Trim())) { result += s.Trim() + " "; i++; } else if (x > 1000) break; s = null; } //Возвращаем результат string MessageURL = account.URL_Text != null ? account.URL_Text : ""; key = null; rng = null; account = null; return result.Replace("<br>", "\n").Trim() + MessageURL; }
public string this[InfoClass cat] { get { switch (cat) { case InfoClass.Fundamentacion: return(this.Fundamentacion); case InfoClass.Descripcion: return(this.Descripcion); case InfoClass.Configuracion: return(this.Configuracion); case InfoClass.Resultados: return(this.Resultados); default: return(""); } } }
private void btn_MouseEnter(object sender, MouseEventArgs e) { string str; str = sender.GetType().GetProperties()[37].GetValue(sender).ToString(); foreach (var i in InfoClass.Default()) { if (i.BtnName.Equals(str)) { lblCategory.Content = i.Category; _header = i.Category; _btn = str; lstView.Items.Clear(); foreach (string s in i.Lst) { ListBoxItem item = new ListViewItem(); item.Content = s; lstView.Items.Add(item); } break; } } }
public bool get(InfoClass.account account) { //Получаем hash текущего изображения ulong hash = 0; ph_dct_imagehash(conf.DirImgTmp + account.id + ".jpg", ref hash); //Ищем дубликаты из сохраненных хешей foreach (ulong i in account.HashPhoto) { //Скажем так, разница фотографий до 6 процентов (хотя тут слегка другой принцип) if (ph_hamming_distance(i, hash) < 7) { return true; } } //Если дубликатов нету то добавляем текущий hash и записываем в файл account.HashPhoto.Add(hash); Directory.CreateDirectory(conf.DirHashPhoto); File.AppendAllText(conf.DirHashPhoto + account.id, hash.ToString() + Environment.NewLine); //Возвращаем результат return false; }
public IncludeTemporaryListsOptionsExtension() { Info = new InfoClass(this); }
public List<InfoClass.news> get(InfoClass.account account, InfoClass.GroupList GroupList) { List<string> TempTag = new List<string> { }; List<InfoClass.news> News = new List<InfoClass.news> { }; try { string captcha = ""; //XElement.Parse(); Refresh: XDocument xml = XDocument.Load("https://api.vk.com/method/wall.get.xml?owner_id=" + GroupList.GroupID + captcha + "&count=10&filter=owner&access_token=" + account.token); foreach (XElement el in xml.Root.Elements()) { if (el.Name.ToString().ToLower() == "error_msg" && el.Value.ToLower().Replace(" ", "") == "userauthorizationfailed:invalidaccess_token.") { Console.WriteLine("error: XML news.cs вернул ошибку: {0}, UserID: {1}, ID: {2}, группа: {3}", el.Value, account.UserID, account.id, GroupList.GroupID); break; } else if (el.Name.ToString().ToLower() == "captcha_img") { Console.WriteLine("info: Разгадываем капчу в news.cs, ID аккаунта: {0}, группа: {1}", account.UserID, GroupList.GroupID); captcha = new Antigate().get(el.Value); goto Refresh; } else if (el.Name.ToString().ToLower() == "post") { InfoClass.news tmp = new InfoClass.news(); foreach (XElement el_post in el.Elements()) { if (el_post.Name.ToString().ToLower() == "from_id" || el_post.Name.ToString().ToLower() == "to_id") { if (int.Parse(el_post.Value) >= 0) { tmp = null; break; //Переходим в следующий item } else tmp.source_id = el_post.Value; } if (el_post.Name.ToString().ToLower() == "post_id" || el_post.Name.ToString().ToLower() == "id") { tmp.post_id = el_post.Value; } else if (el_post.Name.ToString().ToLower() == "date") { tmp.Date = int.Parse(el_post.Value); if (GroupList.LastTime > tmp.Date) { tmp = null; break; //Переходим в следующий item } } else if (el_post.Name.ToString().ToLower() == "post_type" && el_post.Value.ToString().ToLower() != "post") { tmp = null; break; //Переходим в следующий item } else if (el_post.Name.ToString().ToLower() == "message" || el_post.Name.ToString().ToLower() == "text") { //Проверяем текст if (el_post.Value.Trim() != "") if (!new CheckSpam().get(el_post.Value, account.StopWords)) { TempTag.Add(tmp.Text = el_post.Value.Replace("<br>", "\n").Replace("\r", "").Replace("&", "")); } else { tmp = null; break; //Переходим в следующий item } } else if (el_post.Name.ToString().ToLower() == "attachments") { foreach (XElement el_attachments in el_post.Elements()) { InfoClass.Image img = new InfoClass.Image(); foreach (XElement el_attachment in el_attachments.Elements()) { if (el_attachment.Name.ToString().ToLower() == "photo") { foreach (XElement el_photo in el_attachment.Elements()) { switch (el_photo.Name.ToString().ToLower()) { case "pid": img.pid = el_photo.Value; break; case "owner_id": img.owner_id = el_photo.Value; break; case "src": img.src = el_photo.Value; break; case "src_big": img.src_big = el_photo.Value; break; case "src_small": img.src_small = el_photo.Value; break; case "src_xbig": img.src_xbig = el_photo.Value; break; case "src_xxbig": img.src_xxbig = el_photo.Value; break; case "text": TempTag.Add(img.text = el_photo.Value); break; } } } else if (el_attachment.Name.ToString().ToLower() == "poll") { foreach (XElement el_poll in el_attachment.Elements()) { if (el_poll.Name.ToString().ToLower() == "poll_id" && tmp.source_id != null) { tmp.Poll = "poll" + tmp.source_id + "_" + el_poll.Value + ","; } } } else if (el_attachment.Name.ToString().ToLower() == "video") { InfoClass.Video video = new InfoClass.Video(); foreach (XElement el_video in el_attachment.Elements()) switch (el_video.Name.ToString().ToLower()) { case "vid": video.media_id = el_video.Value; break; case "owner_id": video.owner_id = el_video.Value; break; case "image": video.img = el_video.Value; break; case "description": TempTag.Add(el_video.Value); break; } //Добовляем видео if (video.img != null && video.media_id != null && video.owner_id != null) { tmp.Video.Add(new InfoClass.Video { img = video.img, media_id = video.media_id, owner_id = video.owner_id }); } video = null; } else if (el_attachment.Name.ToString().ToLower() == "audio") { string owner_id = null, media_id = null; foreach (XElement el_audio in el_attachment.Elements()) switch (el_audio.Name.ToString().ToLower()) { case "aid": media_id = el_audio.Value; break; case "owner_id": owner_id = el_audio.Value; break; } if (owner_id != null && media_id != null) tmp.Audio = (tmp.Audio == null ? "" : tmp.Audio) + "audio" + owner_id + "_" + media_id + ","; owner_id = null; media_id = null; } else if (el_attachment.Name.ToString().ToLower() != "type") { img = null; goto Break; //Бракуем новость если в ней есть неизвестная хрень } } tmp.img.Add(img); img = null; } } } if (tmp != null) News.Add(tmp); Break: tmp = null; } } new ParserTAG().get(TempTag, account); TempTag = null; captcha = null; xml = null; } catch (FileNotFoundException) { } catch (Exception e) { Console.WriteLine("error: Ошибка получения новостей, UsreID: {0}, ID: {1}, группа: {2}", account.UserID, account.id, GroupList.GroupID); if (e != null) Console.WriteLine("Код ошибки: {1}{0}{1}{1}", e, Environment.NewLine); } catch { } //Записываем LastTime string dir = conf.DirLastTime + account.id; if (News.Count != 0 && File.Exists(dir)) { string s = File.ReadAllText(dir).Replace(" ", ""); GroupList.LastTime = (News[0] as InfoClass.news).Date + 1; if (new Regex(GroupList.GroupID + ":[0-9]+").Match(s).Success) File.WriteAllText(dir, Regex.Replace(s, (GroupList.GroupID + ":[0-9]+"), string.Format("{0}:{1}", GroupList.GroupID, GroupList.LastTime))); else File.AppendAllText(dir, string.Format("{0}:{1}{2}", GroupList.GroupID, GroupList.LastTime, Environment.NewLine)); //Дописываем новые данные s = null; } else if (News.Count != 0 && !File.Exists(dir)) { //Создаем новый файл и пишем в него данные Directory.CreateDirectory(conf.DirLastTime); GroupList.LastTime = (News[0] as InfoClass.news).Date + 1; File.WriteAllText(dir, string.Format("{0}:{1}", GroupList.GroupID, GroupList.LastTime) + Environment.NewLine); } //Чистим ресурсы account = null; GroupList = null; dir = null; return News; }
public static extern BBool GetFileInfo(IntPtr fileOrArchiveHandle, InfoClass infoClass, IntPtr fileInfo, int fileInfoSize, ref int lengthNeeded);
internal static extern bool SetInformationJobObject( IntPtr job, InfoClass infoType, IntPtr jobObjectInfo, uint jobObjectInfoLength);
private static extern bool QueryInformationJobObject( IntPtr hJob, InfoClass jobObjectInformationClass, out IntPtr lpJobObjectInfo, uint cbJobObjectInfoLength, IntPtr lpReturnLength);
private static extern bool QueryInformationJobObject( IntPtr hJob, InfoClass JobObjectInformationClass, out IntPtr lpJobObjectInfo, uint cbJobObjectInfoLength, IntPtr lpReturnLength);
internal static extern bool QueryInformationJobObject( IntPtr job, InfoClass jobObjectInformationClass, out IntPtr jobObjectInfo, uint jobObjectInfoLength, IntPtr returnLength);
public List<InfoClass.Video> get(List<InfoClass.Video> v, InfoClass.account account, string GroupID) { List<InfoClass.Video> result = new List<InfoClass.Video> { }; foreach (InfoClass.Video video in v) { //Сохраняем картинку в byte[] WebClient wc = new WebClient(); byte[] ImageBig = wc.DownloadData(video.img); FileStream ImgStream = null; try { //Сохраняем картинку на диск ImgStream = new FileStream(conf.DirImgTmp + account.id + ".jpg", FileMode.Create, FileAccess.ReadWrite); ImgStream.Write(ImageBig, 0, ImageBig.Length); } catch { } finally { wc.Dispose(); wc = null; ImageBig = null; if (ImgStream != null) { ImgStream.Close(); ImgStream.Dispose(); ImgStream = null; } } //Если дубликата нету то добавляем картинку в список загружаемых фотографий if (!new CheckIMG().get(account) && video.media_id != null && video.owner_id != null) { if (account.AddVideo) { string video_id = new engine.VK_API.VideoADD().get(video.media_id, video.owner_id, account.token, account.UserID, GroupID); if (video_id != null && account.UserID != null) { //Редактируем Видео if (account.CreateDescVideo) new VK_API.VideoEdit().put(video_id, account, GroupID); //Добовляем данные в лист result.Add(new InfoClass.Video { img = video.img, media_id = video_id, owner_id = account.UserID }); } video_id = null; } else { //Добовляем данные оригинального видео в лист result.Add(new InfoClass.Video { img = video.img, media_id = video.media_id, owner_id = video.owner_id }); } } Thread.Sleep(500); } //Возвращаем результат v = null; account = null; GroupID = null; return result.Count == 0 ? (result =null) : result; }
public ActionResult Edit(InfoClass infoClass) { InfoClassBll.Edit(infoClass); return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { InfoClass infoClass = InfoClassBll.GetById(id); return(View(infoClass)); }
public string GetInfoToPublish(string test, InfoClass tipo) { return(test.Equals(string.Empty)? string.Empty : elementsInfo[test][tipo]); }
public static extern bool QuerySessionInformation(IntPtr hServer, int sessionId, InfoClass infoClass, out IntPtr pBuffer, out int bytesReturned);