//------------------------------------------------------------------------------------------------ //--------------------------------------기능 함수------------------------------------------------ //------------------------------------------------------------------------------------------------ private void SaveUnfav() { for (int i = 0; i < listBitmapImage.Count; i++) { if (listBitmapImage[i].IsDownloading) { MessageBox.Show("이미지를 로딩 중입니다.", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } for (int i = 0; i < listBitmapImage.Count; i++) { FileInstence.SaveImage(listTweet[index].mediaEntities.media[i].media_url_https, listBitmapImage[i]); } //MessageBox.Show("모든 이미지를 저장했습니다.", "알림", MessageBoxButton.OK); PacketFavorites_Destroy parameter = new PacketFavorites_Destroy(); parameter.id = listTweet[index].id; string json = WebInstence.SyncRequest(parameter); if (json.Length > 50) { listTweet[index].favorited = false; MessageBox.Show("저장, 관심글 해제 성공", "알림", MessageBoxButton.OK, MessageBoxImage.Information); } }
//최초 로딩 시 private void Dalsae_Loded(object sender, RoutedEventArgs e) { gridPreview.Visibility = Visibility.Hidden; gridPreview.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)); DalsaeInstence.LoadedMainWindow(); foreach (TreeViewManager item in dicPanel.Values) { ScrollViewer scroll = Generate.FindElementByName <ScrollViewer>(item.treeView); item.scrollViewer = scroll; } imageHome.Source = bitmapHome; imageMention.Source = bitmapMention; imageDm.Source = bitmapDM; imageFav.Source = bitmapFav; imageOpen.Source = bitmapOpen; if (FileInstence.isPatched) { MessageBoxResult mr = MessageBox.Show(this, $"달새의 오류를 자동으로 전송 하시겠습니까?{Environment.NewLine}차후 패치까지 적용 됩니다.{Environment.NewLine}어려분의 오류 보고가 달새를 더 안정적으로 만듭니다.", "알림", MessageBoxButton.YesNo, MessageBoxImage.Information); if (mr == MessageBoxResult.Yes) { DataInstence.option.isSendError = true; } else { DataInstence.option.isSendError = false; } FileInstence.UpdateOption(DataInstence.option); } }
/// <summary> /// 비디오 파일을 다 불러올 경우 발생되는 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Web_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { if (isClosed) { return; } string uri = FileInstence.GetVideoFilePath(videoFileName); mediaElement.Source = new Uri(uri, UriKind.Relative); progressBar.Visibility = Visibility.Hidden; imageMute.Source = bitmapMute; imageVolume.Source = bitmapVolume; imagePrev.Source = bitmapPrev; imageNext.Source = bitmapNext; imagePlay.Source = bitmapPlay; imagePause.Source = bitmapPause; if (isGifLoop == false) { gridBottom.Visibility = Visibility.Visible; } Start(); }
/// <summary> /// 비디오 정보를 불러와 다운로드 시작 /// </summary> private void LoadVideo() { if (tweet.mediaEntities.media.Count == 0) { return; } if (tweet.mediaEntities.media[0].video_info == null) { return; } List <Variant> listVariant = tweet.mediaEntities.media[0].video_info.variants?.OrderBy(x => x.bitrate).ToList(); bigIndex = listVariant.Count - 2; if (bigIndex < 0) { bigIndex = 0; } //for (int i = 0; i < listVariant.Count; i++)//bitrate가 가장 큰 index찾아서 화질 가장 좋은 동영상으로 틀어줌 //{ // if (listVariant[bigIndex].bitrate < listVariant[i].bitrate)//큰값 찾기 // bigIndex = i; //} if (tweet.mediaEntities.media[0].type == "animated_gif") { isGifLoop = true; } videoFileName = DateTime.Now.ToString("yyyyMMddhhmmssffffff"); FileInstence.DownloadVideo(listVariant[bigIndex].url, videoFileName, Web_DownloadProgressChanged, Web_DownloadFileCompleted); }
private void SaveWindowSizeAndLocation() { if (WindowState != WindowState.Maximized && WindowState != WindowState.Minimized) { DataInstence.SetMainWindowLocation(Left, Top, Width, Height); FileInstence.UpdateOption(DataInstence.option); } }
public App() { this.Dispatcher.UnhandledException += Dispatcher_UnhandledException; this.Dispatcher.UnhandledExceptionFilter += Dispatcher_UnhandledExceptionFilter; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; DataInstence.Init(); FileInstence.Init(); //init DalsaeInstence.Init(); //init }
public void ChangeAccount(string screen_name) { if (screen_name == FileInstence.SelectedAccountName) { return; } ct?.Cancel(); ClearClient(); FileInstence.ChangeAccount(screen_name); LoadMyInfo(); }
private void LoadAccount() { List <string> listAccount = FileInstence.GetAccountArray(); for (int i = 0; i < listAccount.Count; i++) { MenuItem item = new MenuItem(); item.Header = listAccount[i]; item.Name = listAccount[i]; item.Click += menuItemChangeAccount_Click; menuItemAccount.Items.Add(item); } }
public void ProgramClosing() { Properties.Settings.Default.Save(); //FileInstence.UpdateOption(DataInstence.option);//마지막 위치 때문에 항상 변경해야함 //if (DataInstence.isChangeUserInfo) // FileInstence.UpdateToken(DataInstence.userInfo); //FileInstence.UpdateHotkey(DataInstence.hotKey); //if (DataInstence.isChangeFollow && DataInstence.option.isLoadFollwing == false) // FileInstence.UpdateFollowList(DataInstence.dicFollwing); if (DataInstence.isChangeBlock && DataInstence.option.isLoadBlock == false) { FileInstence.UpdateBlockList(DataInstence.blockList); } }
public void ResponseOAuth(Web.ResOAuth oauth) { if (oauth.isCallBack) { DataInstence.UpdateToken(oauth); System.Diagnostics.Process.Start($"https://api.twitter.com/oauth/authorize?oauth_token={oauth.tokenStr}"); } else { DataInstence.UpdateToken(oauth); FileInstence.UpdateToken(DataInstence.userInfo); LoadMyInfo(); } }
private void Save() { for (int i = 0; i < listBitmapImage.Count; i++) { if (listBitmapImage[i].IsDownloading) { MessageBox.Show("이미지를 로딩 중입니다.", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } for (int i = 0; i < listBitmapImage.Count; i++) { FileInstence.SaveImage(listTweet[index].mediaEntities.media[i].media_url_https, listBitmapImage[i]); } MessageBox.Show("모든 이미지를 저장했습니다.", "알림", MessageBoxButton.OK, MessageBoxImage.Information); }
private void SaveImage() { if (isLoadOriginal == false) { LoadImage(true); deleSave = new DeleSaveImage(SaveImage); } else { if (CheckDownloadingImage(index)) { MessageBox.Show("이미지를 불러오는 중입니다.", "알림", MessageBoxButton.OK); return; } FileInstence.SaveImage(listMedia[index].media_url_https, listBitmapImage[index]); MessageBox.Show("이미지를 저장했습니다.", "알림", MessageBoxButton.OK); deleSave = null; } }
private void SaveImageAll() { if (isLoadOriginal == false) { LoadImage(true); deleSave = new DeleSaveImage(SaveImageAll); } else { if (CheckDownloadingImage()) { MessageBox.Show("이미지를 불러오는 중입니다.", "알림", MessageBoxButton.OK); return; } for (int i = 0; i < listMedia.Count; i++) { FileInstence.SaveImage(listMedia[i].media_url_https, listBitmapImage[i]); } MessageBox.Show("모든 이미지를 저장했습니다.", "알림", MessageBoxButton.OK); deleSave = null; } }
private void SetComboBox() { string[] arrSound = FileInstence.GetSoundList(); if (arrSound != null) { for (int i = 0; i < arrSound.Length; i++) { comboNoti.Items.Add(arrSound[i]); } comboNoti.SelectedIndex = comboNoti.Items.IndexOf(DataInstence.option.notiSound); } string[] arrSkin = FileInstence.GetSkinList(); if (arrSkin != null) { for (int i = 0; i < arrSkin.Length; i++) { comboSkin.Items.Add(arrSkin[i]); } comboSkin.SelectedIndex = comboSkin.Items.IndexOf(DataInstence.option.skinName); } }
private void Save() { Option option = DataInstence.option; if (comboFont.SelectedItem != null && comboFont.SelectedItem is FontFamily) { option.font = comboFont.SelectedItem as FontFamily; } if (comboFontSize.SelectedItem != null) { option.fontSize = (int)comboFontSize.SelectedItem; } option.isBoldFont = (bool)cbBold.IsChecked; //이미지 경로가 수정 되었을 경우에만 수정 if (option.imageFolderPath != textPath.Text) { //경로가 기본 폴더인지 체크하고 기본 폴더면 기본 폴더로 수정, 저장 if (new DirectoryInfo("Image").FullName == new DirectoryInfo(textPath.Text).FullName) { option.imageFolderPath = "Image"; } else { option.imageFolderPath = textPath.Text; } } //트윗 등록 option.isYesnoTweet = (bool)checkSendTweet.IsChecked; option.isRetweetProtectUser = (bool)checkRetweetProtect.IsChecked; option.isSendEnter = (bool)checkSendEnter.IsChecked; //이미지 뷰어 option.isShowImageTweet = (bool)checkShowTweet.IsChecked; option.isShowImageBottom = (bool)checkBottomPreview.IsChecked; option.isLoadOriginalImage = (bool)checkLoadOrg.IsChecked; //알림 option.isMuteMention = (bool)checkMute.IsChecked; option.isNotiRetweet = (bool)checkNotiMention.IsChecked; option.isShowRetweet = (bool)checkNotiTL.IsChecked; option.isPlayNoti = (bool)checkPlayNoti.IsChecked; //UI option.isSmallUI = (bool)checkSmallUI.IsChecked; option.isShowPreview = (bool)checkShowPreview.IsChecked; DalsaeManager.DalsaeInstence.ChangeSmallUI(option.isSmallUI); option.isShowPropic = (bool)checkShowPropic.IsChecked; option.isBigPropic = (bool)checkShowBigPropic.IsChecked; //시작 옵션 option.isLoadBlock = (bool)checkLoadBlock.IsChecked; option.isLoadFollwing = (bool)checkLoadFollwing.IsChecked; if (comboSkin.SelectedItem != null) { if (option.skinName != comboSkin.SelectedItem.ToString()) { option.skinName = comboSkin.SelectedItem.ToString(); FileInstence.UpdateSkin(); } } if (comboNoti.SelectedItem != null) { if (option.notiSound != comboNoti.SelectedItem.ToString()) { option.notiSound = comboNoti.SelectedItem.ToString(); DalsaeManager.DalsaeInstence.ChangeSoundNoti(option.notiSound); } } //뮤트, 하이라이트 option.listHighlight.Clear(); option.listHighlight.AddRange(arrHighlight); option.listMuteClient.Clear(); option.listMuteClient.AddRange(arrMuteClient); option.listMuteUser.Clear(); option.listMuteUser.AddRange(arrMuteUser); option.listMuteWord.Clear(); option.listMuteWord.AddRange(arrMuteWord); option.dicMuteTweet.Clear(); foreach (KeyValuePair <long, string> item in dicMuteTweet) { option.dicMuteTweet.Add(item.Key, item.Value); } FileManager.FileInstence.UpdateOption(option); }
private void buttonOk_Click(object sender, RoutedEventArgs e) { Save(); FileInstence.UpdateOption(DataInstence.option); Close(); }
public async void ResponseError(BasePacket packet, string json) { if (json == null) { return; } ClientAPIError error = JsonConvert.DeserializeObject <ClientAPIError>(json); if (error == null) { return; } if (error?.errors?.Count == 0) { return; } ///리밋 걸렸을 때 if (error.errors[0].code == 88) { if (packet.eresponse == eResponse.BLOCK_IDS) { await Task.Delay(TimeSpan.FromMinutes(1)); int? num = Task.CurrentId; PacketBlockIds bpacket = packet as PacketBlockIds; long cursor = -1; long.TryParse(bpacket.cursor.ToString(), out cursor); apiInstence.GetBlockids(cursor); } else if (packet.eresponse == eResponse.FOLLOWING_LIST) { await Task.Delay(TimeSpan.FromMinutes(1)); int?num = Task.CurrentId; PacketFollowingList fpacket = packet as PacketFollowingList; long cursor = -1; long.TryParse(fpacket.cursor.ToString(), out cursor); apiInstence.GetFollwing(DataInstence.userInfo.user.id, cursor); } } else if (error.errors[0].code == 408) { } if (error == null) { ShowMessageBox("원인 불명", "오류"); } else if (error.errors == null) { ShowMessageBox(json, "오류"); } else { if (error.errors.Count > 0) { string message = string.Empty; switch (error.errors[0].code) { case 32: ShowMessageBox("인증 오류. \r\n로그인 데이터를 초기화 합니다.\r\n다시 로그인 해 주세요.", "오류"); FileInstence.ClearAccountData(); ClearClient(); StartOAuthCertification(); break; case 34: message = "해당 유저는 없습니다."; break; case 44: message = "잘못 된 요청"; break; case 64: ShowMessageBox("계정이 일시 정지 되었습니다.", "오류"); break; case 87: ShowMessageBox("달새는 해당 동작을 할 수 없습니다.", "오류"); break; case 88: message = "불러오기 제한, 몇 분 뒤 시도해주세요."; break; case 89: ShowMessageBox("잘못되거나 만료 된 토큰. 지속될 경우 Data폴더에 Switter를 지운 후 시도해주세요", "오류"); break; case 130: case 131: message = "트위터 내부 오류"; break; case 135: ShowMessageBox("인증할 수 없습니다.", "오류"); break; case 136: ShowMessageBox("저런, 당신을 차단한 사람입니다.", "오류"); break; case 139: message = "이미 관심글에 등록 된 트윗입니다."; break; case 144: message = "삭제된 트윗입니다."; break; case 150: message = "상대방에게 쪽지를 보낼 수 없습니다."; break; case 151: message = "메시지를 보내는 중 에러가 발생했습니다"; break; case 179: message = "대화 트윗을 쓴 유저가 잠금 계정입니다."; break; case 185: ShowMessageBox("트윗 제한. 트잉여님 트윗 적당히 써주세요.", "오류"); break; case 187: message = "중복 트윗입니다. 같은 내용을 적지 말아주세요 :("; break; case 327: message = "이미 리트윗 한 트윗입니다."; break; case 323: ShowMessageBox("GIF와 이미지를 동시에 업로드 할 수 없습니다.", "오류"); break; case 324: ShowMessageBox("이미지 용량이 5mb를 넘어 업로드 할 수 없습니다.", "오류"); break; case 386: message = "트윗이 280자를 넘어 전송할 수 없습니다."; break; default: message = json; break; } if (string.IsNullOrEmpty(message)) { return; } window.AddMessage(message); } } }
public void DeleteNowAccount() { ClearClient(); FileInstence.DeleteSelectAccount(); }
private void ResponseMyInfo(User user) { User.CopyUser(DataInstence.userInfo.user, user); FileInstence.UpdateToken(DataInstence.userInfo); StartApiCalls(); }