1 |
import flash.data.EncryptedLocalStore; |
2 |
import flash.desktop.Clipboard; |
3 |
import flash.desktop.ClipboardFormats; |
4 |
import flash.desktop.NativeApplication; |
5 |
import flash.desktop.NativeDragManager; |
6 |
import flash.display.NativeMenu; |
7 |
import flash.display.NativeMenuItem; |
8 |
import flash.display.NativeWindowDisplayState; |
9 |
import flash.errors.IOError; |
10 |
import flash.events.ContextMenuEvent; |
11 |
import flash.events.ErrorEvent; |
12 |
import flash.events.Event; |
13 |
import flash.events.FocusEvent; |
14 |
import flash.events.HTTPStatusEvent; |
15 |
import flash.events.IOErrorEvent; |
16 |
import flash.events.KeyboardEvent; |
17 |
import flash.events.MouseEvent; |
18 |
import flash.events.NativeDragEvent; |
19 |
import flash.events.TimerEvent; |
20 |
import flash.filesystem.File; |
21 |
import flash.geom.Rectangle; |
22 |
import flash.globalization.LocaleID; |
23 |
import flash.globalization.NumberFormatter; |
24 |
import flash.net.FileFilter; |
25 |
import flash.net.URLLoader; |
26 |
import flash.net.URLRequest; |
27 |
import flash.net.URLRequestDefaults; |
28 |
import flash.net.navigateToURL; |
29 |
import flash.text.Font; |
30 |
import flash.ui.ContextMenuItem; |
31 |
import flash.ui.Keyboard; |
32 |
import flash.utils.ByteArray; |
33 |
import flash.utils.Timer; |
34 |
|
35 |
import mx.collections.ArrayCollection; |
36 |
import mx.collections.ICollectionView; |
37 |
import mx.collections.Sort; |
38 |
import mx.collections.SortField; |
39 |
import mx.containers.Canvas; |
40 |
import mx.controls.Alert; |
41 |
import mx.controls.CheckBox; |
42 |
import mx.controls.ComboBox; |
43 |
import mx.controls.DataGrid; |
44 |
import mx.controls.TextInput; |
45 |
import mx.controls.TileList; |
46 |
import mx.controls.dataGridClasses.DataGridItemRenderer; |
47 |
import mx.controls.dataGridClasses.DataGridListData; |
48 |
import mx.controls.listClasses.IListItemRenderer; |
49 |
import mx.controls.treeClasses.TreeItemRenderer; |
50 |
import mx.core.Application; |
51 |
import mx.core.ClassFactory; |
52 |
import mx.core.FlexGlobals; |
53 |
import mx.core.FlexLoader; |
54 |
import mx.core.UITextField; |
55 |
import mx.events.AIREvent; |
56 |
import mx.events.CloseEvent; |
57 |
import mx.events.FlexEvent; |
58 |
import mx.events.FlexNativeWindowBoundsEvent; |
59 |
import mx.events.IndexChangedEvent; |
60 |
import mx.events.ListEvent; |
61 |
import mx.events.ResizeEvent; |
62 |
import mx.events.SliderEvent; |
63 |
import mx.managers.PopUpManager; |
64 |
|
65 |
import org.mineap.nicovideo4as.Login; |
66 |
import org.mineap.nicovideo4as.UserAgentManager; |
67 |
import org.mineap.nicovideo4as.analyzer.SearchResultAnalyzer; |
68 |
import org.mineap.nicovideo4as.loader.RankingLoader; |
69 |
import org.mineap.nicovideo4as.model.search.SearchType; |
70 |
import org.mineap.nicovideo4as.util.HtmlUtil; |
71 |
import org.mineap.nndd.Access2Nico; |
72 |
import org.mineap.nndd.LogManager; |
73 |
import org.mineap.nndd.Message; |
74 |
import org.mineap.nndd.NNDDMyListAdder; |
75 |
import org.mineap.nndd.NNDDMyListLoader; |
76 |
import org.mineap.nndd.NNDDSearchListRenewer; |
77 |
import org.mineap.nndd.RenewDownloadManager; |
78 |
import org.mineap.nndd.SystemTrayIconManager; |
79 |
import org.mineap.nndd.download.DownloadManager; |
80 |
import org.mineap.nndd.download.ScheduleManager; |
81 |
import org.mineap.nndd.downloadedList.DownloadedListManager; |
82 |
import org.mineap.nndd.event.LibraryLoadEvent; |
83 |
import org.mineap.nndd.event.MyListRenewProgressEvent; |
84 |
import org.mineap.nndd.history.HistoryManager; |
85 |
import org.mineap.nndd.library.ILibraryManager; |
86 |
import org.mineap.nndd.library.LibraryManagerBuilder; |
87 |
import org.mineap.nndd.library.LibraryTreeBuilder; |
88 |
import org.mineap.nndd.library.LocalVideoInfoLoader; |
89 |
import org.mineap.nndd.library.namedarray.NamedArrayLibraryManager; |
90 |
import org.mineap.nndd.library.sqlite.SQLiteLibraryManager; |
91 |
import org.mineap.nndd.model.MyListSortType; |
92 |
import org.mineap.nndd.model.NNDDSearchSortType; |
93 |
import org.mineap.nndd.model.NNDDSearchType; |
94 |
import org.mineap.nndd.model.NNDDVideo; |
95 |
import org.mineap.nndd.model.PlayList; |
96 |
import org.mineap.nndd.model.RssType; |
97 |
import org.mineap.nndd.model.Schedule; |
98 |
import org.mineap.nndd.model.SearchItem; |
99 |
import org.mineap.nndd.model.SearchSortString; |
100 |
import org.mineap.nndd.model.SearchTypeString; |
101 |
import org.mineap.nndd.model.tree.ITreeItem; |
102 |
import org.mineap.nndd.model.tree.TreeFileItem; |
103 |
import org.mineap.nndd.model.tree.TreeFolderItem; |
104 |
import org.mineap.nndd.myList.MyList; |
105 |
import org.mineap.nndd.myList.MyListBuilder; |
106 |
import org.mineap.nndd.myList.MyListHistoryManager; |
107 |
import org.mineap.nndd.myList.MyListManager; |
108 |
import org.mineap.nndd.myList.MyListRenewScheduler; |
109 |
import org.mineap.nndd.myList.MyListTreeItemRenderer; |
110 |
import org.mineap.nndd.nativeProcessPlayer.NativeProcessPlayerManager; |
111 |
import org.mineap.nndd.playList.PlayListDataGridBuilder; |
112 |
import org.mineap.nndd.playList.PlayListManager; |
113 |
import org.mineap.nndd.player.PlayerController; |
114 |
import org.mineap.nndd.player.PlayerManager; |
115 |
import org.mineap.nndd.ranking.RankingListBuilder; |
116 |
import org.mineap.nndd.search.SearchItemManager; |
117 |
import org.mineap.nndd.server.ServerManager; |
118 |
import org.mineap.nndd.tag.NgTagManager; |
119 |
import org.mineap.nndd.tag.TagManager; |
120 |
import org.mineap.nndd.user.UserManager; |
121 |
import org.mineap.nndd.util.ConfFileUtil; |
122 |
import org.mineap.nndd.util.DataGridColumnWidthUtil; |
123 |
import org.mineap.nndd.util.DateUtil; |
124 |
import org.mineap.nndd.util.LibraryUtil; |
125 |
import org.mineap.nndd.util.MyListUtil; |
126 |
import org.mineap.nndd.util.PathMaker; |
127 |
import org.mineap.nndd.util.ShortUrlChecker; |
128 |
import org.mineap.nndd.util.TreeDataBuilder; |
129 |
import org.mineap.nndd.util.WebServiceAccessUtil; |
130 |
import org.mineap.nndd.versionCheck.VersionCheckerFactory; |
131 |
import org.mineap.nndd.versionCheck.VersionUtil; |
132 |
import org.mineap.nndd.view.LoadingPicture; |
133 |
import org.mineap.util.config.ConfUtil; |
134 |
import org.mineap.util.config.ConfigManager; |
135 |
import org.mineap.util.font.FontUtil; |
136 |
|
137 |
private var nndd:NNDD; |
138 |
private var downloadedListManager:DownloadedListManager; |
139 |
private var playListManager:PlayListManager; |
140 |
private var libraryManager:ILibraryManager; |
141 |
private var tagManager:TagManager; |
142 |
private var ngTagManager:NgTagManager; |
143 |
private var logManager:LogManager; |
144 |
private var loading:LoadingPicture; |
145 |
private var downloadManager:DownloadManager; |
146 |
private var scheduleManager:ScheduleManager; |
147 |
private var historyManager:HistoryManager; |
148 |
|
149 |
private var renewDownloadManager:RenewDownloadManager; |
150 |
private var rankingLoader:RankingLoader; |
151 |
private var nnddSearchListRenewer:NNDDSearchListRenewer; |
152 |
|
153 |
private var _nnddMyListLoader:NNDDMyListLoader; |
154 |
private var _myListManager:MyListManager; |
155 |
private var _searchItemManager:SearchItemManager; |
156 |
private var _myListAdder:NNDDMyListAdder; |
157 |
|
158 |
private var loginDialog:LoginDialog; |
159 |
private var loadingWindow:LoadWindow; |
160 |
|
161 |
private var _libraryDir:File; |
162 |
private var _selectedLibraryFile:File; |
163 |
|
164 |
private var playingVideoPath:String; |
165 |
|
166 |
public static const RANKING_AND_SERACH_TAB_NUM:int = 0; |
167 |
public static const SEARCH_TAB_NUM:int = 1 |
168 |
public static const MYLIST_TAB_NUM:int = 2; |
169 |
public static const DOWNLOAD_LIST_TAB_NUM:int = 3; |
170 |
public static const LIBRARY_LIST_TAB_NUM:int = 4; |
171 |
public static const HISTORY_LIST_TAB_NUM:int = 5; |
172 |
public static const OPTION_TAB_NUM:int = 6; |
173 |
|
174 |
public var version:String = ""; |
175 |
|
176 |
private var logString:String = ""; |
177 |
|
178 |
//private var urlList:Array = new Array(); |
179 |
private var categoryList:Array = new Array(); |
180 |
|
181 |
private var isVersionCheckEnable:Boolean = true; |
182 |
|
183 |
private var isUseDownloadDir:Boolean = false; |
184 |
|
185 |
private var isFirstTimePlayerActiveEvent:Boolean = true; |
186 |
|
187 |
private var isRankingRenewAtStart:Boolean = false; |
188 |
|
189 |
private var rankingPageIndex:int = 0; |
190 |
private var searchPageIndex:int = 0; |
191 |
private var myListPageIndex:int = 1; |
192 |
|
193 |
private var lastRect:Rectangle = new Rectangle(); |
194 |
private var lastCanvasPlaylistHight:int = -1; |
195 |
private var lastCanvasTagTileListHight:int = -1; |
196 |
|
197 |
private var isArgumentBoot:Boolean = false; |
198 |
private var argumentURL:String = ""; |
199 |
|
200 |
private var isAutoLogin:Boolean = false; |
201 |
|
202 |
private var isSayHappyNewYear:Boolean = false; |
203 |
|
204 |
private var isAutoDownload:Boolean = true; |
205 |
|
206 |
private var isRankingWatching:Boolean = true; |
207 |
|
208 |
private var isEnableEcoCheck:Boolean = true; |
209 |
|
210 |
private var isSkipEconomy:Boolean = false; |
211 |
|
212 |
private var isShowOnlyNowLibraryTag:Boolean = true; |
213 |
|
214 |
private var isOutStreamingPlayerUse:Boolean = false; |
215 |
|
216 |
private var isPrecedenceDownloadedVideo:Boolean = true; |
217 |
|
218 |
private var isDoubleClickOnVideoPlay:Boolean = true; |
219 |
|
220 |
private var libraryDataGridSortFieldName:String = ""; |
221 |
|
222 |
private var libraryDataGridSortDescending:Boolean = false; |
223 |
|
224 |
private var isEnableLibrary:Boolean = true; |
225 |
|
226 |
private var isCtrlKeyPush:Boolean = false; |
227 |
|
228 |
private var isAddedDefSearchItems:Boolean = false; |
229 |
|
230 |
private var _exitProcessCompleted:Boolean = false; |
231 |
|
232 |
private var isAlwaysEconomy:Boolean = false; |
233 |
|
234 |
private var isDisEnableAutoExit:Boolean = false; |
235 |
|
236 |
private var isAppendComment:Boolean = false; |
237 |
|
238 |
private var mylistRenewOnScheduleEnable:Boolean = true; |
239 |
|
240 |
private var myListRenewOnBootTime:Boolean = false; |
241 |
|
242 |
private var isCloseNNDDWindowWhenLogin:Boolean = false; |
243 |
|
244 |
private var selectedMyListFolder:Boolean = false; |
245 |
|
246 |
private var isSaveSearchHistory:Boolean = true; |
247 |
|
248 |
private var isSaveMyListHistory:Boolean = true; |
249 |
|
250 |
private var saveCommentMaxCount:Number = 10000; |
251 |
|
252 |
private var textInput_url_foculsIn:Boolean = false; |
253 |
|
254 |
private var showAll:Boolean = false; |
255 |
|
256 |
private var isEnableNativePlayer:Boolean = false; |
257 |
|
258 |
private var useAppDirLibFile:Boolean = false; |
259 |
|
260 |
private var isOpenPlayerOnBoot:Boolean = false; |
261 |
|
262 |
private var downloadRetryMaxCount:int = 2; |
263 |
|
264 |
private var useOldTypeCommentGet:Boolean = true; |
265 |
|
266 |
private var useAppDirSystemFile:Boolean = false; |
267 |
|
268 |
private var allowOtherNNDDConnection:Boolean = false; |
269 |
|
270 |
private var enableShareVideoInfo:Boolean = false; |
271 |
|
272 |
private var enableShareMyListInfo:Boolean = false; |
273 |
|
274 |
private var allowGetOtherNNDDInfo:Boolean = false; |
275 |
|
276 |
private var enableSyncMyListYetPlay:Boolean = false; |
277 |
|
278 |
private var isRowHeightSync:Boolean = true; |
279 |
|
280 |
private var period:int = 0; |
281 |
private var target:int = 0; |
282 |
|
283 |
private var lastTagWidth:int = -1; |
284 |
|
285 |
private var lastCategoryListWidth:int = -1; |
286 |
private var lastMyListSummaryWidth:int = -1; |
287 |
private var lastMyListHeight:int = -1; |
288 |
private var lastLibraryWidth:int = -1; |
289 |
private var lastSearchItemListWidth:int = -1; |
290 |
|
291 |
private var thumbImageSize:Number = -1; |
292 |
private var thumbImgSizeForSearch:Number = -1; |
293 |
private var thumbImgSizeForMyList:Number = -1; |
294 |
private var thumbImgSizeForDLList:Number = -1; |
295 |
private var thumbImgSizeForLibrary:Number = -1; |
296 |
private var thumbImgSizeHistory:Number = -1; |
297 |
|
298 |
private var myListRenewScheduleTime:Number = 30; |
299 |
|
300 |
private var loadWindow:LoadWindow = null; |
301 |
|
302 |
[Bindable] |
303 |
private var rankingProvider:ArrayCollection = new ArrayCollection(); |
304 |
[Bindable] |
305 |
private var searchProvider:ArrayCollection = new ArrayCollection(); |
306 |
[Bindable] |
307 |
private var downloadedProvider:ArrayCollection = new ArrayCollection(); |
308 |
[Bindable] |
309 |
private var categoryListProvider:Array = new Array(); |
310 |
[Bindable] |
311 |
private var searchSortListProvider:Array = SearchSortString.NICO_SEARCH_SORT_TEXT_ARRAY; |
312 |
[Bindable] |
313 |
private var myListItemProvider:ArrayCollection = new ArrayCollection(); |
314 |
[Bindable] |
315 |
private var myListProvider:Array = new Array(); |
316 |
[Bindable] |
317 |
private var rankingPageCountProvider:Array = new Array(); |
318 |
[Bindable] |
319 |
private var searchListProvider:Array = new Array(); |
320 |
[Bindable] |
321 |
private var searchPageCountProvider:Array = new Array(); |
322 |
[Bindable] |
323 |
private var serchTypeProvider:Array = SearchTypeString.NICO_SEARCH_TYPE_TEXT; |
324 |
[Bindable] |
325 |
private var downloadProvider:ArrayCollection = new ArrayCollection(); |
326 |
[Bindable] |
327 |
private var tagProvider:Array = new Array(); |
328 |
[Bindable] |
329 |
private var ngTagProvider:Array = new Array(); |
330 |
[Bindable] |
331 |
private var historyProvider:ArrayCollection = new ArrayCollection(); |
332 |
[Bindable] |
333 |
private var myListRenewScheduleTimeProvider:Array = MyListRenewScheduler.MyListRenewScheduleTimeArray; |
334 |
[Bindable] |
335 |
private var myListStatusProvider:String = new String(); |
336 |
[Bindable] |
337 |
private var myListStatsToolTip:String = new String(); |
338 |
[Bindable] |
339 |
private var fontDataProvider:Array = new Array(); |
340 |
[Bindable] |
341 |
private var searchHistoryProvider:Array = new Array(); |
342 |
[Bindable] |
343 |
private var fontSizeDataProvider:Array = new Array("���","���","���","������"); |
344 |
[Bindable] |
345 |
private var string_localPort:String = "12300"; |
346 |
[Bindable] |
347 |
private var string_remoteNNDDAddress:String = ""; |
348 |
[Bindable] |
349 |
private var string_remoteNNDDPort:String = "12300"; |
350 |
|
351 |
|
352 |
|
353 |
/** |
354 |
* ������������������������������<br> |
355 |
* ������������������������������������������������������������������������������������������<br> |
356 |
* ���LoginDialog������������������������������<br> |
357 |
* ���PlayerController������������������������������<br> |
358 |
* ���DownloadedListManager������������������������������<br> |
359 |
* @param nndd |
360 |
* |
361 |
*/ |
362 |
public function initNNDD(nndd:NNDD):void |
363 |
{ |
364 |
|
365 |
// ������������������������������ |
366 |
var confFileUtil:ConfFileUtil = new ConfFileUtil(); |
367 |
confFileUtil.checkExistAndCopy(); |
368 |
|
369 |
|
370 |
/*������������������������SQLite*/ |
371 |
var libraryType:String = LibraryManagerBuilder.LIBRARY_TYPE_SQL; |
372 |
var confType:String = ConfigManager.getInstance().getItem("libraryType"); |
373 |
if(confType != null){ |
374 |
if(confType == LibraryManagerBuilder.LIBRARY_TYPE_SQL){ |
375 |
/* ���������SQL���������������������������SQL��������������� */ |
376 |
libraryType = LibraryManagerBuilder.LIBRARY_TYPE_SQL; |
377 |
}else if(confType == LibraryManagerBuilder.LIBRARY_TYPE_NAMED_ARRAY){ |
378 |
/* ���������NamedArray��������������������������������������� */ |
379 |
libraryType = LibraryManagerBuilder.LIBRARY_TYPE_NAMED_ARRAY; |
380 |
} |
381 |
} |
382 |
LibraryManagerBuilder.instance.libraryType = libraryType; |
383 |
this.libraryManager = LibraryManagerBuilder.instance.libraryManager; |
384 |
|
385 |
var useSystemFileStr:String = ConfigManager.getInstance().getItem("useAppDirSystemFile"); |
386 |
if (useSystemFileStr != null) |
387 |
{ |
388 |
var useSystemFile:Boolean = ConfUtil.parseBoolean(useSystemFileStr); |
389 |
this.useAppDirSystemFile = useSystemFile; |
390 |
if (useSystemFile) |
391 |
{ |
392 |
this.libraryManager.useAppDirSystemFile = useSystemFile; |
393 |
} |
394 |
} |
395 |
|
396 |
/*���������������������������������������*/ |
397 |
this.nndd = nndd; |
398 |
|
399 |
this.version = VersionUtil.instance.versionNumber; |
400 |
|
401 |
this.title = "NNDD - v" + VersionUtil.instance.versionLabel; |
402 |
|
403 |
var userAgent:String = URLRequestDefaults.userAgent + " NNDD/" + this.version; |
404 |
|
405 |
// ���������������������������������������������userAgent���������������������UserAgent������������������������������? |
406 |
UserAgentManager.instance.userAgent = userAgent; |
407 |
// URLRequestDefaults.userAgent = userAgent; |
408 |
|
409 |
NativeApplication.nativeApplication.addEventListener(Event.EXITING, exitingEventHandler); |
410 |
|
411 |
/* ��������� */ |
412 |
LogManager.instance.initialize(textArea_log); |
413 |
logManager = LogManager.instance; |
414 |
|
415 |
/* ��������������������������������������������� */ |
416 |
readStore(); |
417 |
|
418 |
/* ��������������������������� */ |
419 |
// VersionChecker.instance.init(this.isVersionCheckEnable); |
420 |
VersionCheckerFactory.create().init(this.isVersionCheckEnable); |
421 |
|
422 |
// var startDate:Date = new Date(2009, 0, 1); |
423 |
// var lastDate:Date = new Date(2009, 0, 4); |
424 |
// var nowDate:Date = new Date(); |
425 |
// if(nowDate.getTime() > startDate.getTime() && nowDate.getTime() < lastDate.getTime() && !isSayHappyNewYear){ |
426 |
// Alert.show("������������������������������������������������\n������������������������������������������������������"); |
427 |
// isSayHappyNewYear = true; |
428 |
// } |
429 |
|
430 |
/* ������������������������ */ |
431 |
this.tagManager = TagManager.instance; |
432 |
this.tagManager.initialize(tagProvider); |
433 |
|
434 |
this.ngTagManager = NgTagManager.instance; |
435 |
this.ngTagManager.initialize(ngTagProvider); |
436 |
|
437 |
/* ��������������������������������������� */ |
438 |
// this.libraryManager = LibraryManagerBuilder.instance.libraryManager; |
439 |
|
440 |
//���������������������������������������������������(������������������������������������������������) |
441 |
if(!_libraryDir.exists){ |
442 |
|
443 |
// ������������������������ |
444 |
Alert.show(Message.M_LIBRARY_FILE_NOT_FOUND + this._libraryDir.nativePath, Message.M_ERROR); |
445 |
this._libraryDir = libraryManager.defaultLibraryDir; |
446 |
|
447 |
} |
448 |
|
449 |
|
450 |
//��������������������������������������������������������������������������� |
451 |
this.libraryManager.useAppDirLibFile = this.useAppDirLibFile; |
452 |
if(true == this.useAppDirLibFile){ |
453 |
//��������������������������������������������������������� |
454 |
if(this.libraryManager.libraryFile.exists){ |
455 |
//��������������������������������������������������������������� |
456 |
}else{ |
457 |
//������������������������������������������ |
458 |
this.libraryManager.useAppDirLibFile = false; |
459 |
|
460 |
//���������������������������������(SQL)��������������������������������������������������������� |
461 |
var oldLibFile:File = _libraryDir.resolvePath("system/").resolvePath(SQLiteLibraryManager.LIBRARY_FILE_NAME); |
462 |
var oldXMLLibFile:File = _libraryDir.resolvePath("system/").resolvePath(NamedArrayLibraryManager.LIBRARY_FILE_NAME); |
463 |
|
464 |
this.libraryManager.useAppDirLibFile = true; |
465 |
var newLibFile:File = File.applicationStorageDirectory.resolvePath(SQLiteLibraryManager.LIBRARY_FILE_NAME); |
466 |
if(oldLibFile.exists && !newLibFile.exists){ |
467 |
oldLibFile.copyTo(newLibFile); |
468 |
logManager.addLog("������������������������������������������������(������������������:" + File.applicationStorageDirectory.resolvePath(SQLiteLibraryManager.LIBRARY_FILE_NAME).nativePath + ")"); |
469 |
} |
470 |
|
471 |
//���������������������������������(XML)��������������������������������������������������������� |
472 |
var newXMLFile:File = File.applicationStorageDirectory.resolvePath(NamedArrayLibraryManager.LIBRARY_FILE_NAME); |
473 |
if(oldXMLLibFile.exists && !newXMLFile.exists){ |
474 |
oldXMLLibFile.copyTo(newXMLFile); |
475 |
} |
476 |
|
477 |
// oldLibFile.moveToTrash(); |
478 |
} |
479 |
} |
480 |
|
481 |
|
482 |
this.libraryManager.changeLibraryDir(this._libraryDir, false); |
483 |
|
484 |
this.ngTagManager.loadNgTags(); |
485 |
|
486 |
//��������������������������������������������������������������������������������������������������� |
487 |
var isSuccess:Boolean = this.libraryManager.loadLibrary(); |
488 |
this.libraryManager.addEventListener(LibraryLoadEvent.LIBRARY_LOAD_COMPLETE, libraryLoadCompleteEventHandler); |
489 |
if(!isSuccess){ |
490 |
//��������������������������������������������������������� |
491 |
var file:File = libraryManager.libraryDir.resolvePath(NamedArrayLibraryManager.LIBRARY_FILE_NAME); |
492 |
|
493 |
//���������������������������������(XML)��������������� |
494 |
if(file.exists){ |
495 |
//��������������������������� |
496 |
try{ |
497 |
file.copyTo(libraryManager.systemFileDir.resolvePath(NamedArrayLibraryManager.LIBRARY_FILE_NAME)); |
498 |
isSuccess = this.libraryManager.loadLibrary(); |
499 |
}catch(error:Error){ |
500 |
trace(error.getStackTrace()); |
501 |
} |
502 |
} |
503 |
|
504 |
//��������������������������������������������������������� |
505 |
if(!isSuccess){ |
506 |
//������������������������������������������������������������������������������������������������������������ |
507 |
askAndRenewAtBootTime(); |
508 |
} |
509 |
} |
510 |
|
511 |
/* ������������������������������������������������ */ |
512 |
this.downloadedListManager = DownloadedListManager.instance; |
513 |
this.downloadedListManager.initialize(downloadedProvider); |
514 |
|
515 |
/* ������������������������������������ */ |
516 |
this.playListManager = PlayListManager.instance; |
517 |
this.playListManager.initialize(); |
518 |
this.playListManager.readPlayListSummary(libraryManager.playListDir); |
519 |
|
520 |
/* ��������������������������������� */ |
521 |
this._myListManager = MyListManager.instance; |
522 |
this._myListManager.initialize(myListProvider); |
523 |
isSuccess = this._myListManager.readMyListSummary(libraryManager.systemFileDir); |
524 |
if(isSuccess){ |
525 |
renewMyListUnPlayCount(); |
526 |
} |
527 |
|
528 |
MyListRenewScheduler.instance.updateNNDDServerAccessSetting(this.allowGetOtherNNDDInfo, this.string_remoteNNDDAddress, int(this.string_remoteNNDDPort)); |
529 |
MyListRenewScheduler.instance.addEventListener(Event.COMPLETE, function(event:Event):void{ |
530 |
renewMyListUnPlayCount(); |
531 |
var date:Date = new Date(); |
532 |
myListStatusProvider = "������������(" + DateUtil.getDateString(date) + ")"; |
533 |
myListStatsToolTip = null; |
534 |
}); |
535 |
MyListRenewScheduler.instance.addEventListener(MyListRenewProgressEvent.MYLIST_RENEW_PROGRESS, function(event:MyListRenewProgressEvent):void{ |
536 |
myListStatusRenew(event.bytesLoaded, event.bytesTotal, event.renewingMyListId); |
537 |
}); |
538 |
|
539 |
/* ������������������������������ */ |
540 |
this._searchItemManager = new SearchItemManager(searchListProvider, logManager); |
541 |
isSuccess = this._searchItemManager.readSearchItems(libraryManager.systemFileDir); |
542 |
if(!isAddedDefSearchItems){ |
543 |
this._searchItemManager.addDefSearchItems(); |
544 |
isAddedDefSearchItems = true; |
545 |
} |
546 |
|
547 |
/* ��������������������������������� */ |
548 |
this.downloadManager = new DownloadManager(downloadProvider, downloadedListManager, UserManager.instance.user, UserManager.instance.password, canvas_queue, |
549 |
rankingProvider, searchProvider, myListItemProvider, logManager); |
550 |
this.downloadManager.isAlwaysEconomy = this.isAlwaysEconomy; |
551 |
this.downloadManager.isAppendComment = this.isAppendComment; |
552 |
this.downloadManager.isUseDownloadDir = this.isUseDownloadDir; |
553 |
|
554 |
/* ������������ */ |
555 |
HistoryManager.initialize(historyProvider); |
556 |
this.historyManager = HistoryManager.instance; |
557 |
this.historyManager.loadHistory(); |
558 |
|
559 |
var menu:NativeMenu = this.nativeApplication.menu; |
560 |
if(menu != null){ |
561 |
var menuItem:NativeMenuItem = menu.items[2]; |
562 |
var isExists:Boolean = false; |
563 |
if(menuItem != null){ |
564 |
menuItem = menuItem.submenu.items[2]; |
565 |
if(menuItem != null){ |
566 |
//Mac��������������������������������������� |
567 |
isExists = true; |
568 |
} |
569 |
} |
570 |
} |
571 |
if(isExists){ |
572 |
menuItem.addEventListener(Event.SELECT, queueMenuHandler); |
573 |
}else{ |
574 |
//Windows���Linux������������������������ |
575 |
this.addEventListener(AIREvent.WINDOW_COMPLETE, function(event:Event):void{ |
576 |
stage.addEventListener(KeyboardEvent.KEY_UP, queueKeyUpHandler); |
577 |
stage.addEventListener(KeyboardEvent.KEY_DOWN, queueKeyDownHandler); |
578 |
}); |
579 |
} |
580 |
|
581 |
this.addEventListener(AIREvent.WINDOW_COMPLETE, function(event:Event):void{ |
582 |
//��������������������������������� |
583 |
if(isRankingRenewAtStart){ |
584 |
rankingRenewButtonClicked(); |
585 |
}else{ |
586 |
var value:Object = ConfigManager.getInstance().getItem("selectedTabIndex"); |
587 |
if(value != null){ |
588 |
viewstack1.selectedIndex = int(value); |
589 |
} |
590 |
} |
591 |
|
592 |
if(lastCategoryListWidth != -1){ |
593 |
list_categoryList.width = lastCategoryListWidth; |
594 |
}else{ |
595 |
lastCategoryListWidth = list_categoryList.width; |
596 |
} |
597 |
|
598 |
}); |
599 |
|
600 |
/* ������������������ or Dock��������� */ |
601 |
var trayIconManager:SystemTrayIconManager = new SystemTrayIconManager(); |
602 |
trayIconManager.setTrayIcon(); |
603 |
|
604 |
|
605 |
// ������������������������������������Image |
606 |
thumbImageView.visible = false; |
607 |
thumbImageView.alpha = 0.9; |
608 |
// this.addChild(thumbImageView); |
609 |
this.addElement(thumbImageView); |
610 |
|
611 |
|
612 |
PlayerManager.instance.updateNNDDServerSetting(this.allowGetOtherNNDDInfo, this.string_remoteNNDDAddress, int(this.string_remoteNNDDPort)); |
613 |
if(this.isOpenPlayerOnBoot && !this.isEnableNativePlayer) |
614 |
{ |
615 |
// PlayerManager.instance.getLastPlayerController(); |
616 |
playerOpen(); |
617 |
} |
618 |
|
619 |
if (allowOtherNNDDConnection) |
620 |
{ |
621 |
var port:int = 12300; |
622 |
if (string_localPort != null && int(string_localPort) <= 65535) |
623 |
{ |
624 |
port = int(string_localPort); |
625 |
} |
626 |
|
627 |
ServerManager.instance.startServer(port, enableShareVideoInfo, enableShareMyListInfo, enableSyncMyListYetPlay); |
628 |
} |
629 |
|
630 |
} |
631 |
|
632 |
public function myListStatusRenew(loaded:Number, total:Number, myListId:String):void{ |
633 |
if(tree_myList != null){ |
634 |
// var openItems:Object = tree_myList.openItems; |
635 |
// var selectedIndex:int = tree_myList.selectedIndex; |
636 |
// |
637 |
// tree_myList.addEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteEventHandler); |
638 |
// |
639 |
// tree_myList.dataProvider = tree_myList.dataProvider; |
640 |
// |
641 |
// function updateCompleteEventHandler(event:Event):void{ |
642 |
// tree_myList.openItems = openItems; |
643 |
// tree_myList.selectedIndex = selectedIndex; |
644 |
// if(selectedIndex > 0){ |
645 |
// tree_myList.scrollToIndex(selectedIndex); |
646 |
// } |
647 |
// tree_myList.removeEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteEventHandler); |
648 |
// } |
649 |
tree_myList.invalidateList(); |
650 |
tree_myList.validateNow(); |
651 |
|
652 |
} |
653 |
|
654 |
var str:String = ""; |
655 |
if (myListId.indexOf(" ") != -1) |
656 |
{ |
657 |
str = myListId.substring(0, myListId.indexOf(" ")); |
658 |
} |
659 |
|
660 |
myListStatusProvider = "���������" + "(" + loaded + "/" + total + "):" + str; |
661 |
myListStatsToolTip = "���������" + "(" + loaded + "/" + total + "):" + myListId; |
662 |
} |
663 |
|
664 |
public function renewMyListUnPlayCount(tree_myListRenew:Boolean = true):void{ |
665 |
var count:int = MyListManager.instance.countUnPlayVideosFromAll(); |
666 |
|
667 |
if (tree_myList != null) |
668 |
{ |
669 |
tree_myList.invalidateList(); |
670 |
tree_myList.validateNow(); |
671 |
} |
672 |
|
673 |
if(count == 0){ |
674 |
canvas_myList.label = "���������������"; |
675 |
}else{ |
676 |
canvas_myList.label = "���������������(" + count + ")"; |
677 |
} |
678 |
} |
679 |
|
680 |
public function askAndRenewAtBootTime():void{ |
681 |
Alert.show("������������������������������������������������\n������������������������������������������������\n(���������������������������������������������������������������������������������������������������������������������������������)\n\n������������������������:" + libraryManager.libraryDir.nativePath, Message.M_MESSAGE, (Alert.YES | Alert.NO), null, function(event:CloseEvent):void{ |
682 |
if(event.detail == Alert.YES){ |
683 |
renewAndShowDialog(libraryManager.libraryDir, true) |
684 |
} |
685 |
}, null, Alert.YES); |
686 |
} |
687 |
|
688 |
private function renewAndShowDialog(file:File, withSubDir:Boolean):void{ |
689 |
loadWindow = PopUpManager.createPopUp(nndd, LoadWindow, true) as LoadWindow; |
690 |
loadWindow.label_loadingInfo.text = "���������������������������"; |
691 |
loadWindow.progressBar_loading.label = "���������..."; |
692 |
PopUpManager.centerPopUp(loadWindow); |
693 |
|
694 |
var timer:Timer = new Timer(200, 1); |
695 |
|
696 |
timer.addEventListener(TimerEvent.TIMER_COMPLETE, function(event:Event):void{ |
697 |
|
698 |
libraryManager.addEventListener(LibraryLoadEvent.LIBRARY_LOADING, libraryLoadingEventHandler); |
699 |
libraryManager.addEventListener(LibraryLoadEvent.LIBRARY_LOAD_COMPLETE, libraryLoadCompleteEventHandler); |
700 |
libraryManager.renewLibrary(file, withSubDir); |
701 |
|
702 |
}); |
703 |
|
704 |
timer.start(); |
705 |
|
706 |
} |
707 |
|
708 |
private function libraryLoadingEventHandler(event:LibraryLoadEvent):void{ |
709 |
if(loadWindow != null){ |
710 |
loadWindow.label_loadingInfo.text = "���������������������������(" + event.completeVideoCount + "/" + event.totalVideoCount + ")"; |
711 |
} |
712 |
} |
713 |
|
714 |
private function libraryLoadCompleteEventHandler(event:LibraryLoadEvent):void{ |
715 |
if(loadWindow != null){ |
716 |
PopUpManager.removePopUp(loadWindow); |
717 |
} |
718 |
libraryManager.removeEventListener(LibraryLoadEvent.LIBRARY_LOADING, libraryLoadingEventHandler); |
719 |
libraryManager.removeEventListener(LibraryLoadEvent.LIBRARY_LOAD_COMPLETE, libraryLoadCompleteEventHandler); |
720 |
|
721 |
if(viewStack.selectedIndex == LIBRARY_LIST_TAB_NUM){ |
722 |
tabChanged(); |
723 |
} |
724 |
|
725 |
logManager.addLog("������������������������:" + libraryManager.libraryDir.nativePath); |
726 |
if(loadWindow != null){ |
727 |
Alert.show("������������������������������������������������", Message.M_MESSAGE); |
728 |
} |
729 |
} |
730 |
|
731 |
public function versionCheck():void{ |
732 |
|
733 |
/* ��������������������������� */ |
734 |
// VersionChecker.instance.checkUpdate(true); |
735 |
VersionCheckerFactory.create().checkUpdate(true); |
736 |
} |
737 |
|
738 |
/** |
739 |
* ������������������������������������������������������������������ |
740 |
* @param event |
741 |
* |
742 |
*/ |
743 |
private function dataGridContextMenuSelectHandler(event:ContextMenuEvent):void{ |
744 |
var dataGrid:DataGrid = DataGrid(event.contextMenuOwner); |
745 |
if(dataGrid != null && dataGrid.dataProvider.length > 0){ |
746 |
if(event.mouseTarget is DataGridItemRenderer){ |
747 |
var newSelectedItem:Object = null; |
748 |
if((event.mouseTarget as DataGridItemRenderer).data != null){ |
749 |
newSelectedItem = (event.mouseTarget as DataGridItemRenderer).data; |
750 |
} |
751 |
if (newSelectedItem == null) |
752 |
{ |
753 |
return; |
754 |
} |
755 |
if(dataGrid.selectedIndices.length > 1){ |
756 |
//��������������� |
757 |
var selectedItems:Array = dataGrid.selectedItems; |
758 |
|
759 |
var isExist:Boolean = false; |
760 |
for each(var item:Object in selectedItems){ |
761 |
if(item == newSelectedItem){ |
762 |
isExist = true; |
763 |
break; |
764 |
} |
765 |
} |
766 |
|
767 |
if(!isExist){ |
768 |
selectedItems.push(newSelectedItem); |
769 |
} |
770 |
dataGrid.selectedItems = selectedItems; |
771 |
}else{ |
772 |
//��������������� |
773 |
dataGrid.selectedItem = newSelectedItem; |
774 |
} |
775 |
|
776 |
|
777 |
} else if (event.mouseTarget is FlexLoader) |
778 |
{ |
779 |
var newSelectedIndex:int = -1; |
780 |
var flexLoader:FlexLoader = (event.mouseTarget as FlexLoader); |
781 |
if (flexLoader.parent.hasOwnProperty("listData")) { |
782 |
var object:Object = flexLoader.parent; |
783 |
newSelectedIndex = (object.listData as DataGridListData).rowIndex; |
784 |
} |
785 |
|
786 |
if (newSelectedIndex == -1) |
787 |
{ |
788 |
return; |
789 |
} |
790 |
|
791 |
if(dataGrid.selectedIndices.length > 1){ |
792 |
//��������������� |
793 |
var selectedIndices:Array = dataGrid.selectedIndices; |
794 |
|
795 |
var isExist:Boolean = false; |
796 |
for each(var index:int in selectedIndices){ |
797 |
if(index == newSelectedIndex){ |
798 |
isExist = true; |
799 |
break; |
800 |
} |
801 |
} |
802 |
|
803 |
if(!isExist){ |
804 |
selectedIndices.push(newSelectedIndex); |
805 |
} |
806 |
dataGrid.selectedIndices = selectedIndices; |
807 |
}else{ |
808 |
//��������������� |
809 |
dataGrid.selectedIndex = newSelectedIndex; |
810 |
} |
811 |
|
812 |
} |
813 |
|
814 |
|
815 |
} |
816 |
} |
817 |
|
818 |
|
819 |
/** |
820 |
* ���URL��������������������������������������������������������������������������������������� |
821 |
* @param event |
822 |
* |
823 |
*/ |
824 |
private function copyUrl(event:ContextMenuEvent):void{ |
825 |
|
826 |
var videoId:String = getVideoIdDataGridContextEvent(event); |
827 |
|
828 |
if(videoId != null && videoId){ |
829 |
var url:String = "http://www.nicovideo.jp/watch/" + videoId; |
830 |
if(url.indexOf("http://") != -1){ |
831 |
Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, url); |
832 |
} |
833 |
} |
834 |
} |
835 |
|
836 |
private function selectAll(event:ContextMenuEvent):void |
837 |
{ |
838 |
var datagrid:DataGrid = (event.contextMenuOwner as DataGrid); |
839 |
if (datagrid != null) |
840 |
{ |
841 |
var view:ICollectionView = (datagrid.dataProvider as ICollectionView); |
842 |
if (view == null) |
843 |
{ |
844 |
return; |
845 |
} |
846 |
|
847 |
var array:Array = new Array(); |
848 |
for(var index:int=0; index < view.length; index++) |
849 |
{ |
850 |
array.push(index); |
851 |
} |
852 |
datagrid.selectedIndices = array; |
853 |
} |
854 |
} |
855 |
|
856 |
|
857 |
private function openNicoSound(event:ContextMenuEvent):void{ |
858 |
var videoId:String = getVideoIdDataGridContextEvent(event); |
859 |
if(videoId != null){ |
860 |
WebServiceAccessUtil.openNicoSound(videoId); |
861 |
} |
862 |
} |
863 |
|
864 |
private function openWebBrowserForContextMenu(event:ContextMenuEvent):void{ |
865 |
var videoId:String = getVideoIdDataGridContextEvent(event); |
866 |
if(videoId != null){ |
867 |
WebServiceAccessUtil.openNiconicoDougaForVideo(videoId); |
868 |
} |
869 |
} |
870 |
|
871 |
private function getVideoIdDataGridContextEvent(event:ContextMenuEvent):String{ |
872 |
var videoId:String = null; |
873 |
var dataGrid:DataGrid = DataGrid(event.contextMenuOwner); |
874 |
if(dataGrid != null && dataGrid.dataProvider.length > 0){ |
875 |
var object:Object = null; |
876 |
if(event.mouseTarget is DataGridItemRenderer && (event.mouseTarget as DataGridItemRenderer).data != null){ |
877 |
|
878 |
object = (event.mouseTarget as DataGridItemRenderer).data; |
879 |
|
880 |
} else if (event.mouseTarget is FlexLoader) { |
881 |
var newSelectedIndex:int = -1; |
882 |
var flexLoader:FlexLoader = (event.mouseTarget as FlexLoader); |
883 |
if (flexLoader.parent.hasOwnProperty("listData")) { |
884 |
var obj:Object = flexLoader.parent; |
885 |
newSelectedIndex = (obj.listData as DataGridListData).rowIndex; |
886 |
} |
887 |
if (newSelectedIndex != -1) { |
888 |
object = dataGrid.dataProvider[newSelectedIndex]; |
889 |
} |
890 |
} |
891 |
|
892 |
var url:String = object.dataGridColumn_nicoVideoUrl; |
893 |
if(url == null || url == "" || url == "undefined"){ |
894 |
url = object.dataGridColumn_videoUrl; |
895 |
} |
896 |
if(url == null || url == "" || url == "undefined"){ |
897 |
url = object.col_videoUrl; |
898 |
} |
899 |
if(url == null || url == "" || url == "undefined"){ |
900 |
url = object.dataGridColumn_videoName; |
901 |
} |
902 |
videoId = PathMaker.getVideoID(url); |
903 |
|
904 |
|
905 |
|
906 |
} |
907 |
return videoId; |
908 |
} |
909 |
|
910 |
|
911 |
/** |
912 |
* ������������������������������������������������������������������������������������������������ |
913 |
* @param event |
914 |
* |
915 |
*/ |
916 |
private function rankingItemHandler(event:ContextMenuEvent):void{ |
917 |
var dataGrid:DataGrid = DataGrid(event.contextMenuOwner); |
918 |
if(dataGrid != null && dataGrid.dataProvider.length > 0){ |
919 |
var obj:Object = dataGrid.selectedItem; |
920 |
var videoPath:String = obj.dataGridColumn_videoPath; |
921 |
if(videoPath == null || videoPath == ""){ |
922 |
videoPath = obj.dataGridColumn_nicoVideoUrl; |
923 |
} |
924 |
if(videoPath != null && videoPath != ""){ |
925 |
if((event.target as ContextMenuItem).label == Message.L_RANKING_MENU_ITEM_LABEL_PLAY){ |
926 |
this.playingVideoPath = videoPath; |
927 |
playMovie(this.playingVideoPath, -1); |
928 |
}else if((event.target as ContextMenuItem).label == Message.L_RANKING_MENU_ITEM_LABEL_STREAMING_PLAY){ |
929 |
this.playingVideoPath = obj.dataGridColumn_nicoVideoUrl; |
930 |
this.videoStreamingPlayStart(this.playingVideoPath); |
931 |
}else if((event.target as ContextMenuItem).label == Message.L_RANKING_MENU_ITEM_LABEL_ADD_DL_LIST){ |
932 |
|
933 |
var itemIndices:Array = dataGrid.selectedIndices; |
934 |
itemIndices.reverse(); |
935 |
|
936 |
var i:int = 0; |
937 |
for each(var index:int in itemIndices){ |
938 |
|
939 |
var video:NNDDVideo = new NNDDVideo(rankingProvider[index].dataGridColumn_nicoVideoUrl, rankingProvider[index].dataGridColumn_videoName); |
940 |
addDownloadList(video, itemIndices[i]); |
941 |
|
942 |
i++; |
943 |
} |
944 |
} |
945 |
} |
946 |
} |
947 |
} |
948 |
|
949 |
/** |
950 |
* ��������������������������������������������������������� |
951 |
* @param event |
952 |
* |
953 |
*/ |
954 |
private function searchItemHandler(event:ContextMenuEvent):void{ |
955 |
var dataGrid:DataGrid = DataGrid(event.contextMenuOwner); |
956 |
if(dataGrid != null && dataGrid.dataProvider.length > 0){ |
957 |
var obj:Object = dataGrid.selectedItem; |
958 |
if (obj != null) { |
959 |
var videoPath:String = obj.dataGridColumn_videoPath; |
960 |
if(videoPath == null || videoPath == ""){ |
961 |
videoPath = obj.dataGridColumn_nicoVideoUrl; |
962 |
} |
963 |
if(videoPath != null && videoPath != ""){ |
964 |
if((event.target as ContextMenuItem).label == Message.L_RANKING_MENU_ITEM_LABEL_PLAY){ |
965 |
this.playingVideoPath = videoPath; |
966 |
playMovie(this.playingVideoPath, -1); |
967 |
}else if((event.target as ContextMenuItem).label == Message.L_RANKING_MENU_ITEM_LABEL_STREAMING_PLAY){ |
968 |
this.playingVideoPath = obj.dataGridColumn_nicoVideoUrl; |
969 |
this.videoStreamingPlayStart(this.playingVideoPath); |
970 |
}else if((event.target as ContextMenuItem).label == Message.L_RANKING_MENU_ITEM_LABEL_ADD_DL_LIST){ |
971 |
|
972 |
var itemIndices:Array = dataGrid.selectedIndices; |
973 |
itemIndices.reverse(); |
974 |
|
975 |
var i:int = 0; |
976 |
for each(var index:int in itemIndices){ |
977 |
|
978 |
var video:NNDDVideo = new NNDDVideo(searchProvider[index].dataGridColumn_nicoVideoUrl, searchProvider[index].dataGridColumn_videoName); |
979 |
addDownloadListForSearch(video, itemIndices[i]); |
980 |
|
981 |
i++; |
982 |
} |
983 |
} |
984 |
} |
985 |
} |
986 |
} |
987 |
} |
988 |
|
989 |
/** |
990 |
* ������������������������������������������������������������������������ |
991 |
* @param event |
992 |
* |
993 |
*/ |
994 |
private function myListItemHandler(event:ContextMenuEvent):void{ |
995 |
var dataGrid:DataGrid = DataGrid(event.contextMenuOwner); |
996 |
if(dataGrid != null && dataGrid.dataProvider.length > 0){ |
997 |
if(event.mouseTarget is DataGridItemRenderer && (event.mouseTarget as DataGridItemRenderer).data != null){ |
998 |
var videoName:String = (event.mouseTarget as DataGridItemRenderer).data.dataGridColumn_videoName; |
999 |
var myListId:String = (event.mouseTarget as DataGridItemRenderer).data.dataGridColumn_myListId; |
1000 |
var type:RssType = (event.mouseTarget as DataGridItemRenderer).data.dataGridColumn_type; |
1001 |
|
1002 |
if((event.target as ContextMenuItem).label == Message.L_RANKING_MENU_ITEM_LABEL_PLAY){ |
1003 |
var videoLocalPath:String = (event.mouseTarget as DataGridItemRenderer).data.dataGridColumn_videoLocalPath; |
1004 |
if(videoLocalPath != null){ |
1005 |
//������������������������������������������ |
1006 |
if(myListId != null){ |
1007 |
var vector:Vector.<String> = new Vector.<String>(); |
1008 |
vector.splice(0, 0, PathMaker.getVideoID(videoLocalPath)); |
1009 |
_myListManager.updatePlayedAndSave(myListId, type, vector, true); |
1010 |
} |
1011 |
|
1012 |
if(!selectedMyListFolder){ |
1013 |
var xml:XML = MyListManager.instance.readLocalMyList(myListId, type); |
1014 |
if(xml != null){ |
1015 |
myListRenew(myListId, xml); |
1016 |
} |
1017 |
}else{ |
1018 |
if(tree_myList.selectedItem != null){ |
1019 |
var name:String = tree_myList.selectedItem.label; |
1020 |
myListRenewForName(name); |
1021 |
} |
1022 |
} |
1023 |
|
1024 |
playMovie(videoLocalPath, -1); |
1025 |
} |
1026 |
}else if((event.target as ContextMenuItem).label == Message.L_RANKING_MENU_ITEM_LABEL_STREAMING_PLAY){ |
1027 |
var videoUrl:String = (event.mouseTarget as DataGridItemRenderer).data.dataGridColumn_videoUrl; |
1028 |
if(videoUrl != null){ |
1029 |
//������������������������������������������ |
1030 |
if(myListId != null){ |
1031 |
var vector:Vector.<String> = new Vector.<String>(); |
1032 |
vector.splice(0, 0, PathMaker.getVideoID(videoUrl)); |
1033 |
_myListManager.updatePlayedAndSave(myListId, type, vector, true); |
1034 |
} |
1035 |
|
1036 |
if(!selectedMyListFolder){ |
1037 |
var xml:XML = MyListManager.instance.readLocalMyList(myListId, type); |
1038 |
if(xml != null){ |
1039 |
myListRenew(myListId, xml); |
1040 |
} |
1041 |
}else{ |
1042 |
if(tree_myList.selectedItem != null){ |
1043 |
var name:String = tree_myList.selectedItem.label;; |
1044 |
myListRenewForName(name); |
1045 |
} |
1046 |
} |
1047 |
|
1048 |
videoStreamingPlayStart(videoUrl); |
1049 |
} |
1050 |
}else if((event.target as ContextMenuItem).label == Message.L_RANKING_MENU_ITEM_LABEL_ADD_DL_LIST){ |
1051 |
|
1052 |
addDownloadListButtonClickedForMyList(); |
1053 |
|
1054 |
}else if((event.target as ContextMenuItem).label == Message.L_MYLIST_MENU_ITEM_LABEL_SET_PLAYED |
1055 |
|| (event.target as ContextMenuItem).label == Message.L_MYLIST_MENU_ITEM_LABEL_SET_UNPLAY){ |
1056 |
|
1057 |
// ���������������/��������������� |
1058 |
|
1059 |
var isPlayed:Boolean = false; |
1060 |
if((event.target as ContextMenuItem).label == Message.L_MYLIST_MENU_ITEM_LABEL_SET_PLAYED) |
1061 |
{ |
1062 |
isPlayed = true; |
1063 |
} |
1064 |
else if((event.target as ContextMenuItem).label == Message.L_MYLIST_MENU_ITEM_LABEL_SET_UNPLAY) |
1065 |
{ |
1066 |
isPlayed = false; |
1067 |
} |
1068 |
|
1069 |
var items:Array = dataGrid.selectedItems; |
1070 |
var vector:Vector.<String> = new Vector.<String>(); |
1071 |
myListId = dataGrid.selectedItem.dataGridColumn_myListId; |
1072 |
|
1073 |
// ��������������������������������������������������������������������������������� |
1074 |
for each(var item:Object in items){ |
1075 |
var videoId:String = item.dataGridColumn_videoId; |
1076 |
var tempListId:String = item.dataGridColumn_myListId; |
1077 |
|
1078 |
if(tempListId != myListId){ |
1079 |
try{ |
1080 |
MyListManager.instance.updatePlayedAndSave(myListId, type, vector, isPlayed); |
1081 |
}catch(error:Error){ |
1082 |
trace(error.getStackTrace()); |
1083 |
} |
1084 |
vector.splice(0, vector.length); |
1085 |
myListId = tempListId; |
1086 |
} |
1087 |
|
1088 |
if(videoId != null){ |
1089 |
vector.splice(0, 0, videoId); |
1090 |
} |
1091 |
|
1092 |
} |
1093 |
|
1094 |
// ������������������������������������������ |
1095 |
try{ |
1096 |
MyListManager.instance.updatePlayedAndSave(myListId, type, vector, isPlayed); |
1097 |
}catch(error:Error){ |
1098 |
trace(error.getStackTrace()); |
1099 |
} |
1100 |
|
1101 |
var myListBuilder:MyListBuilder = new MyListBuilder(); |
1102 |
var scrollIndex:int = dataGrid.verticalScrollPosition; |
1103 |
if(!selectedMyListFolder){ |
1104 |
var xml:XML = MyListManager.instance.readLocalMyList(myListId, type); |
1105 |
if(xml != null){ |
1106 |
myListItemProvider = myListBuilder.getMyListArrayCollection(myListId, xml); |
1107 |
if (tree_myList.selectedItem != null) { |
1108 |
var name:String = tree_myList.selectedItem.label; |
1109 |
myListRenewForName(name); |
1110 |
} |
1111 |
} |
1112 |
}else{ |
1113 |
if(tree_myList.selectedItem != null){ |
1114 |
var name:String = tree_myList.selectedItem.label; |
1115 |
myListRenewForName(name); |
1116 |
} |
1117 |
} |
1118 |
|
1119 |
renewMyListUnPlayCount(); |
1120 |
|
1121 |
dataGrid.scrollToIndex(scrollIndex); |
1122 |
} |
1123 |
} |
1124 |
} |
1125 |
} |
1126 |
|
1127 |
|
1128 |
/** |
1129 |
* ������������������������������������������������������������������������������������������������������������ |
1130 |
* @param event |
1131 |
* |
1132 |
*/ |
1133 |
private function queueItemHandler(event:ContextMenuEvent):void{ |
1134 |
var dataGrid:DataGrid = DataGrid(event.contextMenuOwner); |
1135 |
if(dataGrid != null && dataGrid.dataProvider.length > 0){ |
1136 |
if((event.target as ContextMenuItem).label == Message.L_DOWNLOADED_MENU_ITEM_LABEL_PLAY_BY_QUEUE){ |
1137 |
if((event.mouseTarget as DataGridItemRenderer).data != null && (event.mouseTarget as DataGridItemRenderer).data.hasOwnProperty("col_downloadedPath")){ |
1138 |
this.playingVideoPath = (event.mouseTarget as DataGridItemRenderer).data.col_downloadedPath; |
1139 |
if(this.playingVideoPath != null){ |
1140 |
playMovie(this.playingVideoPath, -1); |
1141 |
} |
1142 |
} |
1143 |
}else{ |
1144 |
if(dataGrid_downloadList.selectedIndices.length > 0){ |
1145 |
downloadManager.deleteSelectedItems(dataGrid_downloadList.selectedIndices); |
1146 |
} |
1147 |
} |
1148 |
} |
1149 |
} |
1150 |
|
1151 |
/** |
1152 |
* |
1153 |
* @param event |
1154 |
* |
1155 |
*/ |
1156 |
private function downloadItemHandler(event:ContextMenuEvent):void{ |
1157 |
var dataGrid:DataGrid = DataGrid(event.contextMenuOwner); |
1158 |
if(dataGrid != null && dataGrid.dataProvider.length > 0){ |
1159 |
if(event.mouseTarget is DataGridItemRenderer && (event.mouseTarget as DataGridItemRenderer).data != null){ |
1160 |
var videoPath:String = (event.mouseTarget as DataGridItemRenderer).data.col_downloadedPath |
1161 |
if(videoPath != null && videoPath != ""){ |
1162 |
this.playingVideoPath = videoPath; |
1163 |
playMovie(this.playingVideoPath, -1); |
1164 |
} |
1165 |
} |
1166 |
} |
1167 |
} |
1168 |
|
1169 |
/** |
1170 |
* ������������������������������������������������������������������������������������������������������������������ |
1171 |
* @param event |
1172 |
* |
1173 |
*/ |
1174 |
private function downloadedItemHandler(event:ContextMenuEvent):void { |
1175 |
var dataGrid:DataGrid = DataGrid(event.contextMenuOwner); |
1176 |
if(dataGrid != null && dataGrid.dataProvider.length > 0){ |
1177 |
if(event.mouseTarget is DataGridItemRenderer && (event.mouseTarget as DataGridItemRenderer).data != null |
1178 |
&& (event.mouseTarget as DataGridItemRenderer).data.hasOwnProperty("dataGridColumn_videoPath")){ |
1179 |
if((event.target as ContextMenuItem).label == Message.L_DOWNLOADED_MENU_ITEM_LABEL_PLAY){ |
1180 |
if(this.playListManager.isSelectedPlayList){ |
1181 |
var pIndex:int = playListManager.getPlayListIndexByName(tree_library.selectedItem.label); |
1182 |
this.playMovie((event.mouseTarget as DataGridItemRenderer).data.dataGridColumn_videoPath, |
1183 |
dataGrid_downloaded.selectedIndex, playListManager.getPlayList(pIndex)); |
1184 |
}else{ |
1185 |
this.playMovie((event.mouseTarget as DataGridItemRenderer).data.dataGridColumn_videoPath, -1); |
1186 |
} |
1187 |
}else if((event.target as ContextMenuItem).label == Message.L_DOWNLOADED_MENU_ITEM_LABEL_DELETE){ |
1188 |
|
1189 |
//���������������������������������URL |
1190 |
// var targetVideoPath:String = (event.mouseTarget as DataGridItemRenderer).data.dataGridColumn_videoPath; |
1191 |
|
1192 |
//������������������������URL |
1193 |
var indices:Array = dataGrid_downloaded.selectedIndices; |
1194 |
indices.reverse(); |
1195 |
if(indices.length > 0 && indices[0] > -1){ |
1196 |
var urls:Array = new Array(indices.length); |
1197 |
var isExist:Boolean = false; |
1198 |
for(var i:int=indices.length-1; -1 < i; i--){ |
1199 |
urls[i] = this.downloadedListManager.getVideoPath(indices[i]); |
1200 |
// if(urls[i] == targetVideoPath){ |
1201 |
// isExist = true; |
1202 |
// } |
1203 |
} |
1204 |
// if(!isExist){ |
1205 |
// urls.push(targetVideoPath); |
1206 |
// } |
1207 |
// |
1208 |
deleteVideo(urls,indices); |
1209 |
} |
1210 |
}else if((event.target as ContextMenuItem).label == Message.L_DOWNLOADED_MENU_ITEM_LABEL_EDIT){ |
1211 |
var isExists:Boolean = false; |
1212 |
|
1213 |
var url:String = (event.mouseTarget as DataGridItemRenderer).data.dataGridColumn_videoPath; |
1214 |
var video:NNDDVideo = this.libraryManager.isExist(LibraryUtil.getVideoKey(url)); |
1215 |
|
1216 |
if(video == null && url.indexOf("http://") == -1){ |
1217 |
//������������������������������������������������������������������������ |
1218 |
video = new LocalVideoInfoLoader().loadInfo(url); |
1219 |
isExists = false; |
1220 |
}else if(video == null && playListManager.isSelectedPlayList){ |
1221 |
//��������������������������������������������������� |
1222 |
Alert.show("������������������������������������������������������������������������������������������������������������", Message.M_MESSAGE); |
1223 |
return; |
1224 |
}else{ |
1225 |
isExists = true; |
1226 |
} |
1227 |
|
1228 |
var videoEditDialog:VideoEditDialog = PopUpManager.createPopUp(this, VideoEditDialog, true) as VideoEditDialog; |
1229 |
PopUpManager.centerPopUp(videoEditDialog); |
1230 |
videoEditDialog.init(video, logManager); |
1231 |
|
1232 |
videoEditDialog.addEventListener(Event.COMPLETE, function(event:Event):void{ |
1233 |
try{ |
1234 |
// ��������������������������������������������������� |
1235 |
// if(videoEditDialog.oldVideo.uri != videoEditDialog.newVideo.uri){ |
1236 |
// (new File(videoEditDialog.oldVideo.uri)).moveTo(new File(videoEditDialog.newVideo.uri)); |
1237 |
// } |
1238 |
if(dataGrid_downloaded.selectedItem != null){ |
1239 |
dataGrid_downloaded.selectedItem.dataGridColumn_videoName = videoEditDialog.newVideo.file.name; |
1240 |
dataGrid_downloaded.selectedItem.dataGridColumn_videoPath = videoEditDialog.newVideo.getDecodeUrl(); |
1241 |
} |
1242 |
if(libraryManager.update(videoEditDialog.newVideo, true)){ |
1243 |
// ������ |
1244 |
}else{ |
1245 |
// ������������������ID������������������ |
1246 |
libraryManager.remove(videoEditDialog.oldVideo.key, true); |
1247 |
libraryManager.add(videoEditDialog.newVideo, true); |
1248 |
} |
1249 |
}catch(error:IOError){ |
1250 |
Alert.show("������������������������������������������������" + error, Message.M_ERROR) |
1251 |
logManager.addLog("���������������������������������:" + error + ":" + error.getStackTrace()); |
1252 |
} |
1253 |
downloadedListManager.refresh(); |
1254 |
PopUpManager.removePopUp(videoEditDialog); |
1255 |
}); |
1256 |
videoEditDialog.addEventListener(Event.CANCEL, function(event:Event):void{ |
1257 |
if(isExists == false){ |
1258 |
//��������������������������������������������������� |
1259 |
libraryManager.add(video, true); |
1260 |
} |
1261 |
PopUpManager.removePopUp(videoEditDialog); |
1262 |
}); |
1263 |
} |
1264 |
} |
1265 |
} |
1266 |
} |
1267 |
|
1268 |
/** |
1269 |
* |
1270 |
* @param event |
1271 |
* |
1272 |
*/ |
1273 |
private function myListTreeItemHandler(event:ContextMenuEvent):void |
1274 |
{ |
1275 |
if ((event.target as ContextMenuItem).label == Message.L_MYLIST_TREE_RENEW) |
1276 |
{ |
1277 |
myListPageIndex = 1; |
1278 |
|
1279 |
var name:String = (event.mouseTarget as UITextField).text; |
1280 |
|
1281 |
if (name != null && name.length > 0) |
1282 |
{ |
1283 |
textinput_mylist.text = this._myListManager.getUrl(name); |
1284 |
|
1285 |
this.myListRenewButtonClicked(event); |
1286 |
|
1287 |
if(textinput_mylist.text == null || textinput_mylist.text == ""){ |
1288 |
textinput_mylist.text = name; |
1289 |
} |
1290 |
} |
1291 |
} |
1292 |
else if ((event.target as ContextMenuItem).label == Message.L_MYLIST_TREE_RENEW_ALL) |
1293 |
{ |
1294 |
myListRenewNow(); |
1295 |
} |
1296 |
} |
1297 |
|
1298 |
/** |
1299 |
* ��������������������������������������������������������������������������������������������������������� |
1300 |
* @param event |
1301 |
* |
1302 |
*/ |
1303 |
private function fileSystemTreeItemHandler(event:ContextMenuEvent):void{ |
1304 |
|
1305 |
if((event.target as ContextMenuItem).label == Message.L_FILE_SYSTEM_TREE_MENU_ITEM_LABEL_RENEW |
1306 |
|| (event.target as ContextMenuItem).label == Message.L_FILE_SYSTEM_TREE_MENU_ITEM_LABEL_RENEW_WITH_SUBDIR){ |
1307 |
|
1308 |
var file:File = null; |
1309 |
|
1310 |
if((event.mouseTarget is DataGridItemRenderer)){ |
1311 |
|
1312 |
var item:ITreeItem = (tree_library.selectedItem as ITreeItem); |
1313 |
|
1314 |
if(item == null){ |
1315 |
file = libraryManager.libraryDir; |
1316 |
}else{ |
1317 |
file = item.file; |
1318 |
} |
1319 |
|
1320 |
}else if((event.mouseTarget as UITextField) != null && (event.mouseTarget as UITextField).owner != null |
1321 |
&& ((event.mouseTarget as UITextField).owner is TreeItemRenderer)){ |
1322 |
var object:Object = ((event.mouseTarget as UITextField).owner as TreeItemRenderer).data; |
1323 |
if(object != null && object is TreeFolderItem){ |
1324 |
file = (object as TreeFolderItem).file; |
1325 |
} |
1326 |
} |
1327 |
|
1328 |
if(file != null){ |
1329 |
|
1330 |
if((event.target as ContextMenuItem).label == Message.L_FILE_SYSTEM_TREE_MENU_ITEM_LABEL_RENEW_WITH_SUBDIR){ |
1331 |
|
1332 |
//��������������������������������������������������������������� |
1333 |
askForDirRenew(file); |
1334 |
|
1335 |
}else if((event.target as ContextMenuItem).label == Message.L_FILE_SYSTEM_TREE_MENU_ITEM_LABEL_RENEW){ |
1336 |
|
1337 |
//������������������������������������������������������������������ |
1338 |
renewAndShowDialog(file, false); |
1339 |
|
1340 |
} |
1341 |
|
1342 |
} |
1343 |
}else if((event.target as ContextMenuItem).label == Message.L_FILE_SYSTEM_TREE_MENU_ITEM_LABEL_PLAYALL){ |
1344 |
var itreeItem:ITreeItem = null; |
1345 |
itreeItem = (tree_library.selectedItem as ITreeItem); |
1346 |
|
1347 |
if (itreeItem != null) |
1348 |
{ |
1349 |
var labelName:String = itreeItem.label; |
1350 |
if(itreeItem.file == null){ |
1351 |
// ��������������������������������������������������������� |
1352 |
playMovieByPlayListIndex(labelName); |
1353 |
|
1354 |
}else{ |
1355 |
if(isEnableLibrary){ |
1356 |
// ��������������������������������������������������� |
1357 |
var videoArray:ArrayCollection = dataGrid_downloaded.dataProvider as ArrayCollection; |
1358 |
playMovieByLibraryDir(itreeItem.file.name, convertDataGridItemToNNDDVideo(videoArray)); |
1359 |
} |
1360 |
} |
1361 |
} |
1362 |
else |
1363 |
{ |
1364 |
// tree��������������������������������������������������������������������������������� |
1365 |
|
1366 |
var obj:Object = dataGrid_downloaded.selectedItem; |
1367 |
if(obj != null){ |
1368 |
var videoArray:ArrayCollection = dataGrid_downloaded.dataProvider as ArrayCollection; |
1369 |
|
1370 |
var file:File = new File(obj.dataGridColumn_videoPath as String); |
1371 |
playMovieByLibraryDir(file.parent.name, convertDataGridItemToNNDDVideo(videoArray)); |
1372 |
} |
1373 |
} |
1374 |
} |
1375 |
|
1376 |
} |
1377 |
|
1378 |
private function convertDataGridItemToNNDDVideo(dataProvider:ArrayCollection):Vector.<NNDDVideo> |
1379 |
{ |
1380 |
var videos:Vector.<NNDDVideo> = new Vector.<NNDDVideo>(); |
1381 |
for each(var elem:Object in dataProvider) |
1382 |
{ |
1383 |
var video:NNDDVideo = new NNDDVideo(elem.dataGridColumn_videoPath, elem.dataGridColumn_videoName); |
1384 |
videos.push(video); |
1385 |
} |
1386 |
return videos; |
1387 |
}; |
1388 |
|
1389 |
/** |
1390 |
* |
1391 |
* @param dir |
1392 |
* |
1393 |
*/ |
1394 |
private function askForDirRenew(dir:File):void{ |
1395 |
|
1396 |
trace(dir.nativePath); |
1397 |
|
1398 |
Alert.show("���������������������������������������������������������������������������������������������������������������\n(���������������������������������������������������������)\n\n" + dir.nativePath, |
1399 |
Message.M_MESSAGE, (Alert.YES | Alert.NO), null, function(event:CloseEvent):void{ |
1400 |
if(event.detail == Alert.YES){ |
1401 |
renewAndShowDialog(dir, true); |
1402 |
} |
1403 |
}); |
1404 |
|
1405 |
} |
1406 |
|
1407 |
private function addMyList(myListId:String, video:NNDDVideo):void{ |
1408 |
|
1409 |
if(this._myListAdder != null){ |
1410 |
this._myListAdder.close(); |
1411 |
this._myListAdder = null; |
1412 |
} |
1413 |
|
1414 |
this._myListAdder = new NNDDMyListAdder(this.logManager); |
1415 |
|
1416 |
this._myListAdder.addEventListener(NNDDMyListAdder.ADD_MYLIST_SUCESS, function(event:Event):void{ |
1417 |
logManager.addLog("���������������������������������������:" + video.getVideoNameWithVideoID()); |
1418 |
logManager.addLog("***���������������������������������***"); |
1419 |
_myListAdder.close(); |
1420 |
_myListAdder = null; |
1421 |
}); |
1422 |
this._myListAdder.addEventListener(NNDDMyListAdder.ADD_MYLIST_DUP, function(event:Event):void{ |
1423 |
logManager.addLog("���������������������������������������������������:" + video.getVideoNameWithVideoID()); |
1424 |
logManager.addLog("***���������������������������������***"); |
1425 |
Alert.show("������������������������������������������������������������������\n" + video.getVideoNameWithVideoID(), Message.M_MESSAGE); |
1426 |
_myListAdder.close(); |
1427 |
_myListAdder = null; |
1428 |
}); |
1429 |
this._myListAdder.addEventListener(NNDDMyListAdder.ADD_MYLIST_NOT_EXIST, function(event:Event):void{ |
1430 |
logManager.addLog("������������������������������:" + video.getVideoNameWithVideoID()); |
1431 |
logManager.addLog("***���������������������������������***"); |
1432 |
Alert.show("������������������������������������������������������������������������������������������������������������\n" + video.getVideoNameWithVideoID(), Message.M_MESSAGE); |
1433 |
_myListAdder.close(); |
1434 |
_myListAdder = null; |
1435 |
}); |
1436 |
this._myListAdder.addEventListener(NNDDMyListAdder.ADD_MYLSIT_FAIL, function(event:ErrorEvent):void{ |
1437 |
logManager.addLog("������������������������������������:" + video.getVideoNameWithVideoID() + ":" + event); |
1438 |
logManager.addLog("***���������������������������������***"); |
1439 |
Alert.show("������������������������������������\n" + event, Message.M_ERROR); |
1440 |
Application.application.activate(); |
1441 |
_myListAdder.close(); |
1442 |
_myListAdder = null; |
1443 |
}); |
1444 |
this._myListAdder.addEventListener(NNDDMyListAdder.LOGIN_FAIL, function(event:Event):void{ |
1445 |
logManager.addLog("������������������������������������:" + video.getVideoNameWithVideoID() + ":" + event); |
1446 |
logManager.addLog("***���������������������������������***"); |
1447 |
Alert.show("������������������������������������\n" + event, Message.M_ERROR); |
1448 |
Application.application.activate(); |
1449 |
_myListAdder.close(); |
1450 |
_myListAdder = null; |
1451 |
}); |
1452 |
this._myListAdder.addEventListener(NNDDMyListAdder.GET_MYLISTGROUP_FAIL, function(event:Event):void{ |
1453 |
logManager.addLog("������������������������������������:" + video.getVideoNameWithVideoID() + ":" + event); |
1454 |
logManager.addLog("***���������������������������������***"); |
1455 |
Alert.show("������������������������������������\n" + event, Message.M_ERROR); |
1456 |
Application.application.activate(); |
1457 |
_myListAdder.close(); |
1458 |
_myListAdder = null; |
1459 |
}); |
1460 |
|
1461 |
this._myListAdder.addMyList("http://www.nicovideo.jp/watch/" + PathMaker.getVideoID(video.getDecodeUrl()), myListId, UserManager.instance.user, UserManager.instance.password); |
1462 |
} |
1463 |
|
1464 |
|
1465 |
/** |
1466 |
* ��������������������������������������������������������������������������������������������������������������� |
1467 |
* @param event |
1468 |
* |
1469 |
*/ |
1470 |
private function tagListItemHandler(event:ContextMenuEvent):void { |
1471 |
if(event.mouseTarget is UITextField){ |
1472 |
|
1473 |
var tags:Array = new Array(); |
1474 |
|
1475 |
var selectedItems:Array = (event.contextMenuOwner as TileList).selectedItems; |
1476 |
|
1477 |
for each(var object:Object in selectedItems){ |
1478 |
if(object.hasOwnProperty("label") && object.label != null){ |
1479 |
tags.push(object.label); |
1480 |
}else if(object is String){ |
1481 |
tags.push(object); |
1482 |
} |
1483 |
} |
1484 |
|
1485 |
var textField:UITextField = (event.mouseTarget as UITextField); |
1486 |
if (textField != null) |
1487 |
{ |
1488 |
var renderer:IListItemRenderer = (textField.automationOwner as IListItemRenderer); |
1489 |
if (renderer != null) |
1490 |
{ |
1491 |
var tag:String = String(renderer.data); |
1492 |
if (tag != null) |
1493 |
{ |
1494 |
tags.push(tag); |
1495 |
} |
1496 |
} |
1497 |
} |
1498 |
|
1499 |
var label:String = (event.target as ContextMenuItem).label; |
1500 |
if(tag != null && tag.length > 0 && label != null){ |
1501 |
if(label == Message.L_TAB_LIST_MENU_ITEM_LABEL_SEARCH){ |
1502 |
search(new SearchItem(tag, SearchSortString.convertSortTypeFromIndex(4), |
1503 |
NNDDSearchType.TAG, tag)); |
1504 |
}else if(label == Message.L_TAB_LIST_MENU_ITEM_LABEL_JUMP_DIC){ |
1505 |
navigateToURL(new URLRequest("http://dic.nicovideo.jp/a/" + encodeURIComponent(tag))); |
1506 |
}else if(label == Message.L_TAB_LIST_MENU_ITEM_LABEL_HIDE_TAG){ |
1507 |
ngTagManager.addTags(tags); |
1508 |
}else if(label == Message.L_TAB_LIST_MENU_ITEM_LABEL_SHOW_TAG){ |
1509 |
ngTagManager.removeTags(tags); |
1510 |
} |
1511 |
|
1512 |
var file:File = (this.tree_library.selectedItem as File); |
1513 |
if(file == null){ |
1514 |
file = libraryManager.libraryDir; |
1515 |
} |
1516 |
tagManager.tagRenew(this.tileList_tag, file); |
1517 |
ngTagManager.tagRenew(this.tileList_filterTag); |
1518 |
|
1519 |
} |
1520 |
} |
1521 |
} |
1522 |
|
1523 |
public function tagShow():void{ |
1524 |
var array:Array = tileList_filterTag.selectedItems; |
1525 |
|
1526 |
if(array != null){ |
1527 |
ngTagManager.removeTags(array); |
1528 |
|
1529 |
var file:File = (this.tree_library.selectedItem as File); |
1530 |
if(file == null){ |
1531 |
file = libraryManager.libraryDir; |
1532 |
} |
1533 |
tagManager.tagRenew(this.tileList_tag, file); |
1534 |
ngTagManager.tagRenew(this.tileList_filterTag); |
1535 |
} |
1536 |
|
1537 |
} |
1538 |
|
1539 |
public function tagHide():void{ |
1540 |
var array:Array = tileList_tag.selectedItems; |
1541 |
|
1542 |
if(array != null){ |
1543 |
ngTagManager.addTags(array); |
1544 |
|
1545 |
var file:File = (this.tree_library.selectedItem as File); |
1546 |
if(file == null){ |
1547 |
file = libraryManager.libraryDir; |
1548 |
} |
1549 |
tagManager.tagRenew(this.tileList_tag, file); |
1550 |
ngTagManager.tagRenew(this.tileList_filterTag); |
1551 |
} |
1552 |
} |
1553 |
|
1554 |
|
1555 |
/** |
1556 |
* ��������������������������������������������������������������������� |
1557 |
* @param event |
1558 |
* |
1559 |
*/ |
1560 |
private function playAllMenuItemHandler(event:ContextMenuEvent):void{ |
1561 |
if((event.contextMenuOwner as DataGrid).dataProvider != null){ |
1562 |
var array:ArrayCollection = ((event.contextMenuOwner as DataGrid).dataProvider as ArrayCollection); |
1563 |
var selectedIndices:Array = (event.contextMenuOwner as DataGrid).selectedIndices; |
1564 |
if(array.length > 0){ |
1565 |
|
1566 |
var playList:PlayList = new PlayList(); |
1567 |
playList.name = "������������������������.m3u"; |
1568 |
var isMyList:Boolean = false; |
1569 |
|
1570 |
if(array[0].hasOwnProperty("dataGridColumn_videoLocalPath")){ |
1571 |
isMyList = true; |
1572 |
} |
1573 |
|
1574 |
for(var i:int = 0; i<array.length; i++){ |
1575 |
|
1576 |
//������������������������ |
1577 |
// dataGridColumn_videoPath: localURL, |
1578 |
// dataGridColumn_nicoVideoUrl: urlList[i][0] |
1579 |
//��������������� |
1580 |
// dataGridColumn_videoUrl:videoUrl, |
1581 |
// dataGridColumn_videoLocalPath:videoLocalPath |
1582 |
|
1583 |
var url:String = ""; |
1584 |
if(isMyList){ |
1585 |
url = array[i].dataGridColumn_videoLocalPath; |
1586 |
if(url == null || url == ""){ |
1587 |
url = array[i].dataGridColumn_videoUrl; |
1588 |
} |
1589 |
}else{ |
1590 |
url = array[i].videoPath; |
1591 |
if(url == null || url == ""){ |
1592 |
url = array[i].dataGridColumn_nicoVideoUrl; |
1593 |
} |
1594 |
} |
1595 |
|
1596 |
var videoName:String = array[i].dataGridColumn_videoName; |
1597 |
var videoId:String = PathMaker.getVideoID(url); |
1598 |
if(videoName.indexOf("\n") != -1){ |
1599 |
videoName = videoName.substring(0, videoName.indexOf("\n")) + " - [" + videoId + "]"; |
1600 |
} |
1601 |
|
1602 |
playList.items.push(new NNDDVideo(url, videoName)); |
1603 |
|
1604 |
} |
1605 |
|
1606 |
var startIndex:int = (event.contextMenuOwner as DataGrid).selectedIndex; |
1607 |
|
1608 |
// ������������������������������������������������������������������������������������������������������������ |
1609 |
var selectedItemPlayList:PlayList = new PlayList(); |
1610 |
selectedItemPlayList.name = "������������������������.m3u"; |
1611 |
if(selectedIndices.length > 1){ |
1612 |
startIndex = 0; |
1613 |
|
1614 |
selectedIndices.reverse(); |
1615 |
for each(var index:int in selectedIndices){ |
1616 |
selectedItemPlayList.items.push(playList.items[index]); |
1617 |
} |
1618 |
|
1619 |
playList = selectedItemPlayList; |
1620 |
} |
1621 |
|
1622 |
if(playList.items.length > 0 && startIndex >= 0 && playList.items.length > startIndex){ |
1623 |
playMovie(playList.items[startIndex].getDecodeUrl(), startIndex, playList); |
1624 |
} |
1625 |
|
1626 |
} |
1627 |
} |
1628 |
} |
1629 |
|
1630 |
/** |
1631 |
* ��������������������������������������������������������������������������������������� |
1632 |
* @param event |
1633 |
* |
1634 |
*/ |
1635 |
private function invokeEventHandler(event:InvokeEvent):void{ |
1636 |
if(event.arguments.length >= 1){ |
1637 |
|
1638 |
var arguments:String = ""; |
1639 |
for each(var arg:String in event.arguments){ |
1640 |
if(arguments.length != 0){ |
1641 |
arguments = arguments + ","; |
1642 |
} |
1643 |
arguments = arguments + arg; |
1644 |
|
1645 |
if (arg == "-showRedrawRegions") |
1646 |
{ |
1647 |
flash.profiler.showRedrawRegions( true, 0x0000FF ); |
1648 |
} |
1649 |
|
1650 |
} |
1651 |
|
1652 |
logManager.addLog(Message.INVOKE_ARGUMENT + ":" + arguments); |
1653 |
|
1654 |
var arg1:String = event.arguments[0]; |
1655 |
|
1656 |
try{ |
1657 |
if(arg1.indexOf("-d") != -1){ |
1658 |
var url:String = event.arguments[1]; |
1659 |
var videoId:String = PathMaker.getVideoID(url); |
1660 |
if(videoId != null){ |
1661 |
url = "http://www.nicovideo.jp/watch/" + videoId; |
1662 |
} |
1663 |
|
1664 |
if(url.indexOf("http://www.nicovideo.jp/watch/") > -1){ |
1665 |
//DL������������������ |
1666 |
|
1667 |
var video:NNDDVideo = new NNDDVideo(url, "-"); |
1668 |
var timer:Timer = new Timer(1000, 1); |
1669 |
timer.addEventListener(TimerEvent.TIMER_COMPLETE, function(event:TimerEvent):void{ |
1670 |
addDownloadList(video, -1); |
1671 |
}, false, 0, true); |
1672 |
timer.start(); |
1673 |
}else if(url.indexOf("http://") > -1){ |
1674 |
var checker:ShortUrlChecker = new ShortUrlChecker(); |
1675 |
if (checker.isShortUrl(url)) |
1676 |
{ |
1677 |
// ������URL������������ |
1678 |
logManager.addLog("������URL������������...:" + url); |
1679 |
checker.addEventListener(Event.COMPLETE, function(event:Event):void{ |
1680 |
if (checker.url != null) |
1681 |
{ |
1682 |
logManager.addLog("������URL���������:" + checker.url); |
1683 |
|
1684 |
if(checker.url.indexOf("http://www.nicovideo.jp/watch/") > -1){ |
1685 |
//DL������������������ |
1686 |
var video:NNDDVideo = new NNDDVideo(checker.url, "-"); |
1687 |
var timer:Timer = new Timer(1000, 1); |
1688 |
timer.addEventListener(TimerEvent.TIMER_COMPLETE, function(event:TimerEvent):void{ |
1689 |
addDownloadList(video, -1); |
1690 |
}, false, 0, true); |
1691 |
timer.start(); |
1692 |
} |
1693 |
else |
1694 |
{ |
1695 |
//���������������������URL or ������ID������������ |
1696 |
logManager.addLog(Message.FAIL_ARGUMENT_BOOT + ":argument=[" + arguments + "]\n" + Message.ARGUMENT_FORMAT); |
1697 |
Alert.show(Message.M_FAIL_ARGUMENT_BOOT + "\n\n" + arguments + "\n" + Message.ARGUMENT_FORMAT, Message.M_ERROR); |
1698 |
} |
1699 |
} |
1700 |
else |
1701 |
{ |
1702 |
logManager.addLog(Message.M_SHORT_URL_EXPANSION_FAIL + ":ShortUrlChecker.url is null."); |
1703 |
Alert.show(Message.M_SHORT_URL_EXPANSION_FAIL, Message.M_ERROR); |
1704 |
} |
1705 |
}); |
1706 |
checker.addEventListener(IOErrorEvent.IO_ERROR, function(event:Event):void{ |
1707 |
logManager.addLog(Message.M_SHORT_URL_EXPANSION_FAIL + ":" + event); |
1708 |
Alert.show(Message.M_SHORT_URL_EXPANSION_FAIL, Message.M_ERROR); |
1709 |
}); |
1710 |
checker.expansion(url); |
1711 |
} |
1712 |
}else{ |
1713 |
//���������������������URL or ������ID������������ |
1714 |
logManager.addLog(Message.FAIL_ARGUMENT_BOOT + ":argument=[" + arguments + "]\n" + Message.ARGUMENT_FORMAT); |
1715 |
Alert.show(Message.M_FAIL_ARGUMENT_BOOT + "\n\n" + arguments + "\n" + Message.ARGUMENT_FORMAT, Message.M_ERROR); |
1716 |
} |
1717 |
}else if(arg1.indexOf("http://") == -1){ |
1718 |
// ��������������������������� |
1719 |
|
1720 |
var file:File = new File(arg1); |
1721 |
if(file.exists){ |
1722 |
// this.isArgumentBoot = true; |
1723 |
this.playingVideoPath = decodeURIComponent(file.nativePath); |
1724 |
playMovie(decodeURIComponent(file.url), -1); |
1725 |
} |
1726 |
}else if(arg1.indexOf("http://www.nicovideo.jp/watch/") > -1){ |
1727 |
// ��������� |
1728 |
|
1729 |
if(UserManager.instance.user == ""){ |
1730 |
this.isArgumentBoot = true; |
1731 |
this.argumentURL = arg1; |
1732 |
}else{ |
1733 |
this.playingVideoPath = arg1; |
1734 |
this.videoStreamingPlayStart(arg1); |
1735 |
} |
1736 |
}else if(arg1.indexOf("http://") > -1){ |
1737 |
var checker:ShortUrlChecker = new ShortUrlChecker(); |
1738 |
if (checker.isShortUrl(arg1)) |
1739 |
{ |
1740 |
// ������URL������������ |
1741 |
logManager.addLog("������URL������������...:" + arg1); |
1742 |
checker.addEventListener(Event.COMPLETE, function(event:Event):void{ |
1743 |
if (checker.url != null) |
1744 |
{ |
1745 |
logManager.addLog("������URL���������...:" + checker.url); |
1746 |
if(UserManager.instance.user == ""){ |
1747 |
isArgumentBoot = true; |
1748 |
argumentURL = checker.url; |
1749 |
}else{ |
1750 |
playingVideoPath = checker.url; |
1751 |
videoStreamingPlayStart(checker.url); |
1752 |
} |
1753 |
} else |
1754 |
{ |
1755 |
logManager.addLog(Message.M_SHORT_URL_EXPANSION_FAIL + ":ShortUrlChecker.url is null."); |
1756 |
Alert.show(Message.M_SHORT_URL_EXPANSION_FAIL, Message.M_ERROR); |
1757 |
} |
1758 |
}); |
1759 |
checker.addEventListener(IOErrorEvent.IO_ERROR, function(event:Event):void{ |
1760 |
logManager.addLog(Message.M_SHORT_URL_EXPANSION_FAIL + ":" + event); |
1761 |
Alert.show(Message.M_SHORT_URL_EXPANSION_FAIL, Message.M_ERROR); |
1762 |
}); |
1763 |
checker.expansion(arg1); |
1764 |
} |
1765 |
}else{ |
1766 |
logManager.addLog(Message.FAIL_ARGUMENT_BOOT + ":argument=[" + arguments + "]\n" + Message.ARGUMENT_FORMAT); |
1767 |
Alert.show(Message.M_FAIL_ARGUMENT_BOOT + "\n\n" + arguments + "\n" + Message.ARGUMENT_FORMAT, Message.M_ERROR); |
1768 |
} |
1769 |
}catch(error:Error){ |
1770 |
logManager.addLog(Message.FAIL_ARGUMENT_BOOT + ":argument=[" + arguments + "]\n" + error.getStackTrace()); |
1771 |
Alert.show(Message.M_FAIL_ARGUMENT_BOOT + "\n\n" + arguments + "\n" + Message.ARGUMENT_FORMAT, Message.M_ERROR); |
1772 |
} |
1773 |
} |
1774 |
} |
1775 |
|
1776 |
/** |
1777 |
* ��������������������������������� |
1778 |
* @param url URI���������������������������������URL��������������������� |
1779 |
* @param index ������������������������������������������������ |
1780 |
* |
1781 |
*/ |
1782 |
private function deleteVideo(urls:Array, indices:Array):void{ |
1783 |
if(!this.playListManager.isSelectedPlayList){ |
1784 |
var fileNames:String = ""; |
1785 |
for(var j:int=0; indices.length > j; j++){ |
1786 |
fileNames += "���"+ urls[j].substring(urls[j].lastIndexOf("/")+1) + "\n"; |
1787 |
} |
1788 |
|
1789 |
if(urls.length > 0){ |
1790 |
Alert.show("���������������������������������������������������������������������������������������������������������������������������������������������������������������\n\n" + fileNames, |
1791 |
Message.M_MESSAGE, (Alert.YES | Alert.NO), null, function(event:CloseEvent):void{ |
1792 |
if(event.detail == Alert.YES){ |
1793 |
try{ |
1794 |
for(var i:int=indices.length-1; -1 < i; i--){ |
1795 |
var url:String = urls[i]; |
1796 |
var index:int = i; |
1797 |
|
1798 |
//��������������� |
1799 |
var movieFile:File = new File(url); |
1800 |
|
1801 |
var nnddVideo:NNDDVideo = libraryManager.remove(LibraryUtil.getVideoKey(decodeURIComponent(movieFile.url)), false); |
1802 |
if(nndd == null){ |
1803 |
logManager.addLog("������������������������NNDD���������������������:" + movieFile.nativePath); |
1804 |
} |
1805 |
|
1806 |
if(!movieFile.exists){ |
1807 |
//��������������������������������������� |
1808 |
continue; |
1809 |
} |
1810 |
movieFile.moveToTrash(); |
1811 |
// downloadedProvider.removeItemAt(index); |
1812 |
logManager.addLog(Message.DELETE_FILE + ":" + movieFile.nativePath); |
1813 |
|
1814 |
try{ |
1815 |
|
1816 |
var failURL:String = ""; |
1817 |
|
1818 |
//��������������������������� |
1819 |
var commentFile:File = new File(PathMaker.createNomalCommentPathByVideoPath(decodeURIComponent(url))); |
1820 |
failURL = decodeURIComponent(commentFile.url); |
1821 |
if(commentFile.exists){ |
1822 |
commentFile.moveToTrash(); |
1823 |
logManager.addLog(Message.DELETE_FILE + ":" + commentFile.nativePath); |
1824 |
} |
1825 |
|
1826 |
//������������������������������ |
1827 |
var ownerCommentFile:File = new File(PathMaker.createOwnerCommentPathByVideoPath(decodeURIComponent(url))); |
1828 |
failURL = decodeURIComponent(ownerCommentFile.url); |
1829 |
if(ownerCommentFile.exists){ |
1830 |
ownerCommentFile.moveToTrash(); |
1831 |
logManager.addLog(Message.DELETE_FILE + ":" + ownerCommentFile.nativePath); |
1832 |
} |
1833 |
|
1834 |
//������������������������������ |
1835 |
var thmbInfoFile:File = new File(PathMaker.createThmbInfoPathByVideoPath(decodeURIComponent(url))); |
1836 |
failURL = decodeURIComponent(thmbInfoFile.url); |
1837 |
if(thmbInfoFile.exists){ |
1838 |
thmbInfoFile.moveToTrash(); |
1839 |
logManager.addLog(Message.DELETE_FILE + ":" + thmbInfoFile.nativePath); |
1840 |
} |
1841 |
|
1842 |
//��������������������� |
1843 |
var iChibaFile:File = new File(PathMaker.createNicoIchibaInfoPathByVideoPath(decodeURIComponent(url))); |
1844 |
failURL = decodeURIComponent(iChibaFile.url); |
1845 |
if(iChibaFile.exists){ |
1846 |
iChibaFile.moveToTrash(); |
1847 |
logManager.addLog(Message.DELETE_FILE + ":" + iChibaFile.nativePath); |
1848 |
} |
1849 |
|
1850 |
//��������������������������������������������� |
1851 |
var thumbImgFile:File = new File(PathMaker.createThumbImgFilePath(decodeURIComponent(url))); |
1852 |
failURL = decodeURIComponent(thumbImgFile.url); |
1853 |
if(thumbImgFile.exists){ |
1854 |
thumbImgFile.moveToTrash(); |
1855 |
logManager.addLog(Message.DELETE_FILE + ":" + thumbImgFile.nativePath); |
1856 |
} |
1857 |
|
1858 |
//������������������ |
1859 |
while(true){ |
1860 |
var file:File = new File(PathMaker.createNicowariPathByVideoPathAndNicowariVideoID(decodeURIComponent(url))); |
1861 |
if(file.exists){ |
1862 |
failURL = decodeURIComponent(file.url); |
1863 |
file.moveToTrash(); |
1864 |
logManager.addLog(Message.DELETE_FILE + ":" + file.nativePath); |
1865 |
}else{ |
1866 |
break; |
1867 |
} |
1868 |
} |
1869 |
|
1870 |
}catch (error:Error){ |
1871 |
Alert.show(Message.M_FAIL_OTHER_DELETE, Message.M_ERROR); |
1872 |
logManager.addLog(Message.M_FAIL_OTHER_DELETE + ":" + failURL + ":" + error + "\n" + error.getStackTrace()); |
1873 |
} |
1874 |
} |
1875 |
|
1876 |
updateLibrary(tree_library.selectedIndex); |
1877 |
|
1878 |
}catch (error:Error){ |
1879 |
// tree_library.refresh(); |
1880 |
updateLibrary(tree_library.selectedIndex); |
1881 |
Alert.show(Message.M_FAIL_VIDEO_DELETE, Message.M_ERROR); |
1882 |
logManager.addLog(Message.M_FAIL_VIDEO_DELETE + ":" + movieFile.nativePath + ":" + error + "\n" + error.getStackTrace()); |
1883 |
} |
1884 |
|
1885 |
libraryManager.saveLibrary(); |
1886 |
|
1887 |
} |
1888 |
}, null, Alert.NO); |
1889 |
} |
1890 |
}else{ |
1891 |
var index:int = playListManager.getPlayListIndexByName(tree_library.selectedItem.label); |
1892 |
playListManager.removePlayListItemByIndex(index, indices); |
1893 |
updatePlayList(index); |
1894 |
} |
1895 |
} |
1896 |
|
1897 |
/** |
1898 |
* ������������������������������������������������������������������������������������������������ |
1899 |
* @param event |
1900 |
* |
1901 |
*/ |
1902 |
private function downloadedKeyUpHandler(event:KeyboardEvent):void{ |
1903 |
if(event.keyCode == Keyboard.DELETE || event.keyCode == Keyboard.BACKSPACE){ |
1904 |
var indices:Array = dataGrid_downloaded.selectedIndices; |
1905 |
if(indices.length > 0 && indices[0] > -1){ |
1906 |
var urls:Array = new Array(indices.length); |
1907 |
for(var i:int=indices.length-1; -1 < i; i--){ |
1908 |
urls[i] = this.downloadedListManager.getVideoPath(indices[i]); |
1909 |
} |
1910 |
deleteVideo(urls,indices); |
1911 |
} |
1912 |
} |
1913 |
} |
1914 |
|
1915 |
/** |
1916 |
* ��������������������������������������������������������������������������������� |
1917 |
* |
1918 |
*/ |
1919 |
private function readStore(isLogout:Boolean = false):void{ |
1920 |
|
1921 |
var errorName:String = "LocalStoreKey"; |
1922 |
|
1923 |
var isLocalStoreErrorOccured:Boolean = false; |
1924 |
|
1925 |
this._libraryDir = libraryManager.defaultLibraryDir; |
1926 |
|
1927 |
logManager.addLog("���������������������������:" + ConfigManager.getInstance().confFileNativePath); |
1928 |
trace("���������������������������:" + ConfigManager.getInstance().confFileNativePath); |
1929 |
|
1930 |
var confValue:String = null; |
1931 |
|
1932 |
try{ |
1933 |
errorName = "windowPosition_x"; |
1934 |
//x,y,w,h |
1935 |
confValue = ConfigManager.getInstance().getItem("windowPosition_x"); |
1936 |
if (confValue == null) { |
1937 |
//��������������� |
1938 |
}else{ |
1939 |
nativeWindow.x = lastRect.x = int(confValue); |
1940 |
} |
1941 |
|
1942 |
errorName = "windowPosition_y"; |
1943 |
confValue = ConfigManager.getInstance().getItem("windowPosition_y"); |
1944 |
if (confValue == null) { |
1945 |
//��������������� |
1946 |
}else{ |
1947 |
nativeWindow.y = lastRect.y = int(confValue); |
1948 |
} |
1949 |
|
1950 |
errorName = "windowPosition_w"; |
1951 |
confValue = ConfigManager.getInstance().getItem("windowPosition_w"); |
1952 |
if (confValue == null) { |
1953 |
//��������������� |
1954 |
}else{ |
1955 |
nativeWindow.width = lastRect.width = int(confValue); |
1956 |
} |
1957 |
|
1958 |
errorName = "windowPosition_h"; |
1959 |
confValue = ConfigManager.getInstance().getItem("windowPosition_h"); |
1960 |
if (confValue == null) { |
1961 |
//��������������� |
1962 |
}else{ |
1963 |
nativeWindow.height = lastRect.height = int(confValue); |
1964 |
} |
1965 |
|
1966 |
errorName = "isVersionCheckEnable"; |
1967 |
confValue = ConfigManager.getInstance().getItem("isVersionCheckEnable"); |
1968 |
if (confValue == null) { |
1969 |
//��������������� |
1970 |
}else{ |
1971 |
this.isVersionCheckEnable = ConfUtil.parseBoolean(confValue); |
1972 |
} |
1973 |
|
1974 |
errorName = "isUseDownloadDir"; |
1975 |
confValue = ConfigManager.getInstance().getItem("isUseDownloadDir"); |
1976 |
if (confValue != null){ |
1977 |
this.isUseDownloadDir = ConfUtil.parseBoolean(confValue); |
1978 |
} |
1979 |
|
1980 |
errorName = "lastCanvasPlaylistHight"; |
1981 |
confValue = ConfigManager.getInstance().getItem("lastCanvasPlaylistHight"); |
1982 |
if (confValue == null) { |
1983 |
//��������������� |
1984 |
}else{ |
1985 |
this.lastCanvasPlaylistHight = int(confValue); |
1986 |
} |
1987 |
|
1988 |
errorName = "thumbImageSize"; |
1989 |
confValue = ConfigManager.getInstance().getItem("thumbImageSize"); |
1990 |
if (confValue == null) { |
1991 |
//��������������� |
1992 |
}else{ |
1993 |
thumbImageSize = Number(confValue); |
1994 |
if(dataGrid_ranking != null && dataGrid_ranking != null && dataGridColumn_thumbImage != null){ |
1995 |
// ������������������������������������������������������������������������������������������������������������������ |
1996 |
slider_thumbImageSize.value = thumbImageSize; |
1997 |
dataGrid_ranking.rowHeight = 55*slider_thumbImageSize.value; |
1998 |
dataGridColumn_thumbImage.width = 70*slider_thumbImageSize.value; |
1999 |
this.validateNow(); |
2000 |
} |
2001 |
} |
2002 |
|
2003 |
errorName = "thumbImgSizeForMyList"; |
2004 |
confValue = ConfigManager.getInstance().getItem("thumbImgSizeForMyList"); |
2005 |
if (confValue == null) { |
2006 |
//��������������� |
2007 |
}else{ |
2008 |
thumbImgSizeForMyList = Number(confValue); |
2009 |
} |
2010 |
|
2011 |
errorName = "thumbImgSizeForDLList"; |
2012 |
confValue = ConfigManager.getInstance().getItem("thumbImgSizeForDLList"); |
2013 |
if (confValue == null){ |
2014 |
//������������������ |
2015 |
}else{ |
2016 |
thumbImgSizeForDLList = Number(confValue); |
2017 |
} |
2018 |
|
2019 |
errorName = "thumbImgSizeForLibrary"; |
2020 |
confValue = ConfigManager.getInstance().getItem("thumbImgSizeForLibrary"); |
2021 |
if (confValue == null) { |
2022 |
//��������������� |
2023 |
}else{ |
2024 |
thumbImgSizeForLibrary = Number(confValue); |
2025 |
} |
2026 |
|
2027 |
errorName = "thumbImgSizeHistory"; |
2028 |
confValue = ConfigManager.getInstance().getItem("thumbImgSizeHistory"); |
2029 |
if (confValue == null){ |
2030 |
// ��������������� |
2031 |
}else{ |
2032 |
thumbImgSizeHistory = Number(confValue); |
2033 |
} |
2034 |
|
2035 |
errorName = "thumbImgSizeForSearch"; |
2036 |
confValue = ConfigManager.getInstance().getItem("thumbImgSizeForSearch"); |
2037 |
if (confValue == null) { |
2038 |
//��������������� |
2039 |
}else{ |
2040 |
thumbImgSizeForSearch = Number(confValue); |
2041 |
} |
2042 |
|
2043 |
errorName = "isAutoLogin"; |
2044 |
confValue = ConfigManager.getInstance().getItem("isAutoLogin"); |
2045 |
if (confValue == null) { |
2046 |
//��������������� |
2047 |
}else{ |
2048 |
this.isAutoLogin = ConfUtil.parseBoolean(confValue); |
2049 |
} |
2050 |
|
2051 |
errorName = "isAutoDownload"; |
2052 |
confValue = ConfigManager.getInstance().getItem("isAutoDownload"); |
2053 |
if (confValue == null) { |
2054 |
//��������������� |
2055 |
}else{ |
2056 |
this.isAutoDownload = ConfUtil.parseBoolean(confValue); |
2057 |
} |
2058 |
|
2059 |
errorName = "isEnableEcoCheck"; |
2060 |
confValue = ConfigManager.getInstance().getItem("isEnableEcoCheck"); |
2061 |
if (confValue == null) { |
2062 |
//��������������� |
2063 |
}else{ |
2064 |
this.isEnableEcoCheck = ConfUtil.parseBoolean(confValue); |
2065 |
} |
2066 |
|
2067 |
|
2068 |
errorName = "rankingTarget"; |
2069 |
confValue = ConfigManager.getInstance().getItem("rankingTarget"); |
2070 |
if (confValue == null) { |
2071 |
//��������������� |
2072 |
}else{ |
2073 |
this.target = int(confValue); |
2074 |
this.addEventListener(AIREvent.WINDOW_COMPLETE, function():void{ |
2075 |
radiogroup_target.selectedValue = target; |
2076 |
}); |
2077 |
} |
2078 |
|
2079 |
errorName = "rankingPeriod"; |
2080 |
confValue = ConfigManager.getInstance().getItem("rankingPeriod"); |
2081 |
if (confValue == null) { |
2082 |
//��������������� |
2083 |
}else{ |
2084 |
this.period = int(confValue); |
2085 |
this.addEventListener(AIREvent.WINDOW_COMPLETE, function():void{ |
2086 |
radiogroup_period.selectedValue = period; |
2087 |
}); |
2088 |
} |
2089 |
|
2090 |
errorName = "libraryURL"; |
2091 |
/*������������������*/ |
2092 |
confValue = ConfigManager.getInstance().getItem("libraryURL"); |
2093 |
if (confValue == null) { |
2094 |
this._libraryDir = File.documentsDirectory; |
2095 |
this._libraryDir.url = this._libraryDir.url + "/NNDD"; |
2096 |
}else{ |
2097 |
this._libraryDir.url = String(confValue); |
2098 |
} |
2099 |
logManager.setLogDir(libraryManager.systemFileDir); |
2100 |
|
2101 |
errorName = "isSayHappyNewYear"; |
2102 |
confValue = ConfigManager.getInstance().getItem("isSayHappyNewYear"); |
2103 |
if (confValue == null) { |
2104 |
//��������������� |
2105 |
}else{ |
2106 |
isSayHappyNewYear = ConfUtil.parseBoolean(confValue); |
2107 |
} |
2108 |
|
2109 |
// errorName = "isShowOnlyNowLibraryTag"; |
2110 |
// storedValue = EncryptedLocalStore.getItem("isShowOnlyNowLibraryTag"); |
2111 |
// if(storedValue != null){ |
2112 |
// this.isShowOnlyNowLibraryTag = storedValue.readBoolean(); |
2113 |
// } |
2114 |
|
2115 |
errorName = "isAlwaysEconomy"; |
2116 |
confValue = ConfigManager.getInstance().getItem("isAlwaysEconomy"); |
2117 |
if (confValue == null) { |
2118 |
//��������������� |
2119 |
}else{ |
2120 |
this.isAlwaysEconomy = ConfUtil.parseBoolean(confValue); |
2121 |
} |
2122 |
|
2123 |
|
2124 |
errorName = "lastCanvasTagTileListHight"; |
2125 |
confValue = ConfigManager.getInstance().getItem("lastCanvasTagTileListHight"); |
2126 |
if (confValue == null) { |
2127 |
//��������������� |
2128 |
}else{ |
2129 |
this.lastCanvasTagTileListHight = int(confValue); |
2130 |
} |
2131 |
|
2132 |
errorName = "lastSearchItemListWidth"; |
2133 |
confValue = ConfigManager.getInstance().getItem("lastSearchItemListWidth"); |
2134 |
if (confValue == null) { |
2135 |
//��������������� |
2136 |
}else{ |
2137 |
this.lastSearchItemListWidth = int(confValue); |
2138 |
} |
2139 |
|
2140 |
errorName = "isRankingRenewAtStart"; |
2141 |
confValue = ConfigManager.getInstance().getItem("isRankingRenewAtStart"); |
2142 |
if (confValue == null) { |
2143 |
//��������������� |
2144 |
}else{ |
2145 |
this.isRankingRenewAtStart = ConfUtil.parseBoolean(confValue); |
2146 |
} |
2147 |
|
2148 |
errorName = "isOutStreamingPlayerUse"; |
2149 |
confValue = ConfigManager.getInstance().getItem("isOutStreamingPlayerUse"); |
2150 |
if (confValue == null) { |
2151 |
//��������������� |
2152 |
}else{ |
2153 |
this.isOutStreamingPlayerUse = ConfUtil.parseBoolean(confValue); |
2154 |
} |
2155 |
|
2156 |
errorName = "isPrecedenceDownloadedVideo"; |
2157 |
confValue = ConfigManager.getInstance().getItem("isPrecedenceDownloadedVideo"); |
2158 |
if (confValue == null) { |
2159 |
//��������������� |
2160 |
}else{ |
2161 |
this.isPrecedenceDownloadedVideo = ConfUtil.parseBoolean(confValue); |
2162 |
} |
2163 |
|
2164 |
errorName = "isDoubleClickOnVideoPlay"; |
2165 |
confValue = ConfigManager.getInstance().getItem("isDoubleClickOnVideoPlay"); |
2166 |
if (confValue == null) { |
2167 |
//��������������� |
2168 |
}else{ |
2169 |
this.isDoubleClickOnVideoPlay = ConfUtil.parseBoolean(confValue); |
2170 |
} |
2171 |
|
2172 |
errorName = "lastCategoryListWidth"; |
2173 |
confValue = ConfigManager.getInstance().getItem("lastCategoryListWidth"); |
2174 |
if (confValue == null) { |
2175 |
//��������������� |
2176 |
}else{ |
2177 |
this.lastCategoryListWidth = int(confValue); |
2178 |
} |
2179 |
|
2180 |
errorName = "lastMyListSummaryWidth"; |
2181 |
confValue = ConfigManager.getInstance().getItem("lastMyListSummaryWidth"); |
2182 |
if (confValue != null) { |
2183 |
this.lastMyListSummaryWidth = int(confValue); |
2184 |
} |
2185 |
|
2186 |
errorName = "lastMyListHeight"; |
2187 |
confValue = ConfigManager.getInstance().getItem("lastMyListHeight"); |
2188 |
if (confValue == null) { |
2189 |
//��������������� |
2190 |
}else{ |
2191 |
this.lastMyListHeight = int(confValue); |
2192 |
} |
2193 |
|
2194 |
errorName = "lastLibraryWidth"; |
2195 |
confValue = ConfigManager.getInstance().getItem("lastLibraryWidth"); |
2196 |
if (confValue == null) { |
2197 |
//��������������� |
2198 |
}else{ |
2199 |
this.lastLibraryWidth = int(confValue); |
2200 |
} |
2201 |
|
2202 |
errorName = "lastCategoryListWidth"; |
2203 |
confValue = ConfigManager.getInstance().getItem("lastCategoryListWidth"); |
2204 |
if (confValue == null) { |
2205 |
//��������������� |
2206 |
}else{ |
2207 |
this.lastCategoryListWidth = int(confValue); |
2208 |
} |
2209 |
|
2210 |
errorName = "libraryDataGridSortFieldName"; |
2211 |
confValue = ConfigManager.getInstance().getItem("libraryDataGridSortFieldName"); |
2212 |
if (confValue == null) { |
2213 |
//��������������� |
2214 |
}else{ |
2215 |
this.libraryDataGridSortFieldName = String(confValue); |
2216 |
} |
2217 |
|
2218 |
errorName = "libraryDataGridSortDescending"; |
2219 |
confValue = ConfigManager.getInstance().getItem("libraryDataGridSortDescending"); |
2220 |
if (confValue == null) { |
2221 |
//��������������� |
2222 |
}else{ |
2223 |
this.libraryDataGridSortDescending = ConfUtil.parseBoolean(confValue); |
2224 |
} |
2225 |
|
2226 |
errorName = "isEnableLibrary"; |
2227 |
confValue = ConfigManager.getInstance().getItem("isEnableLibrary"); |
2228 |
if (confValue == null) { |
2229 |
//��������������� |
2230 |
}else{ |
2231 |
this.isEnableLibrary = ConfUtil.parseBoolean(confValue); |
2232 |
} |
2233 |
|
2234 |
errorName = "isAddedDefSearchItems"; |
2235 |
confValue = ConfigManager.getInstance().getItem("isAddedDefSearchItems"); |
2236 |
if (confValue == null) { |
2237 |
//��������������� |
2238 |
}else{ |
2239 |
this.isAddedDefSearchItems = ConfUtil.parseBoolean(confValue); |
2240 |
} |
2241 |
|
2242 |
errorName = "isDisEnableAutoExit"; |
2243 |
confValue = ConfigManager.getInstance().getItem("isDisEnableAutoExit"); |
2244 |
if (confValue == null) { |
2245 |
//��������������� |
2246 |
}else{ |
2247 |
this.isDisEnableAutoExit = ConfUtil.parseBoolean(confValue); |
2248 |
} |
2249 |
this.autoExit = !this.isDisEnableAutoExit; |
2250 |
|
2251 |
errorName = "isAppendComment"; |
2252 |
confValue = ConfigManager.getInstance().getItem("isAppendComment"); |
2253 |
if (confValue == null) { |
2254 |
//��������������� |
2255 |
}else{ |
2256 |
this.isAppendComment = ConfUtil.parseBoolean(confValue); |
2257 |
} |
2258 |
|
2259 |
errorName = "myListRenewScheduleTime"; |
2260 |
confValue = ConfigManager.getInstance().getItem("myListRenewScheduleTime"); |
2261 |
if(confValue == null){ |
2262 |
// ��������������� |
2263 |
}else{ |
2264 |
this.myListRenewScheduleTime = Number(confValue); |
2265 |
} |
2266 |
|
2267 |
errorName = "myListRenewDelayOfMylist"; |
2268 |
confValue = ConfigManager.getInstance().getItem("myListRenewDelayOfMylist"); |
2269 |
if(confValue == null){ |
2270 |
// ��������������� |
2271 |
}else{ |
2272 |
MyListRenewScheduler.instance.delayOfMylist = Number(confValue); |
2273 |
} |
2274 |
|
2275 |
errorName = "mylistRenewOnScheduleEnable"; |
2276 |
confValue = ConfigManager.getInstance().getItem("mylistRenewOnScheduleEnable"); |
2277 |
if(confValue == null){ |
2278 |
// ��������������� |
2279 |
}else{ |
2280 |
this.mylistRenewOnScheduleEnable = ConfUtil.parseBoolean(confValue); |
2281 |
} |
2282 |
|
2283 |
errorName = "fontFamily"; |
2284 |
confValue = ConfigManager.getInstance().getItem("fontFamily"); |
2285 |
if(confValue == null){ |
2286 |
confValue = "Verdana"; |
2287 |
} |
2288 |
confValue = FontUtil.setFont(confValue); |
2289 |
ConfigManager.getInstance().setItem("fontFamily", confValue); |
2290 |
|
2291 |
errorName = "isSaveSearchHistory"; |
2292 |
confValue = ConfigManager.getInstance().getItem("isSaveSearchHistory"); |
2293 |
if(confValue == null){ |
2294 |
// ��������������� |
2295 |
}else{ |
2296 |
this.isSaveSearchHistory = ConfUtil.parseBoolean(confValue); |
2297 |
} |
2298 |
|
2299 |
errorName = "saveCommentMaxCount"; |
2300 |
confValue = ConfigManager.getInstance().getItem("saveCommentMaxCount"); |
2301 |
if(confValue == null){ |
2302 |
//��������������� |
2303 |
}else{ |
2304 |
this.saveCommentMaxCount = Number(confValue); |
2305 |
} |
2306 |
|
2307 |
errorName = "showAll"; |
2308 |
confValue = ConfigManager.getInstance().getItem("showAll"); |
2309 |
if(confValue == null){ |
2310 |
|
2311 |
}else{ |
2312 |
this.showAll = ConfUtil.parseBoolean(confValue); |
2313 |
} |
2314 |
|
2315 |
errorName = "isEnableNativePlayer"; |
2316 |
confValue = ConfigManager.getInstance().getItem("isEnableNativePlayer"); |
2317 |
if(confValue == null){ |
2318 |
|
2319 |
}else{ |
2320 |
this.isEnableNativePlayer = ConfUtil.parseBoolean(confValue); |
2321 |
} |
2322 |
|
2323 |
errorName = "nativePlayerPath"; |
2324 |
confValue = ConfigManager.getInstance().getItem("nativePlayerPath"); |
2325 |
if(confValue == null){ |
2326 |
|
2327 |
}else{ |
2328 |
try{ |
2329 |
var file:File = new File(); |
2330 |
file.nativePath = String(confValue); |
2331 |
|
2332 |
NativeProcessPlayerManager.instance.executeFile = file; |
2333 |
|
2334 |
}catch(error:Error){ |
2335 |
trace(error.getStackTrace()); |
2336 |
} |
2337 |
} |
2338 |
|
2339 |
errorName = "fontSize"; |
2340 |
confValue = ConfigManager.getInstance().getItem("fontSize"); |
2341 |
if(confValue == null){ |
2342 |
confValue = "11"; |
2343 |
} |
2344 |
confValue = FontUtil.setSize(Number(confValue)); |
2345 |
ConfigManager.getInstance().setItem("fontSize", confValue); |
2346 |
|
2347 |
// ������������������������������(useAppDirSystemFile���������) |
2348 |
// errorName = "useAppDirLibFile"; |
2349 |
// confValue = ConfigManager.getInstance().getItem("useAppDirLibFile"); |
2350 |
// if(confValue != null){ |
2351 |
// useAppDirLibFile = ConfUtil.parseBoolean(confValue); |
2352 |
// }else{ |
2353 |
useAppDirLibFile = false; |
2354 |
// } |
2355 |
|
2356 |
errorName = "isOpenPlayerOnBoot"; |
2357 |
confValue = ConfigManager.getInstance().getItem("isOpenPlayerOnBoot"); |
2358 |
if(confValue != null) |
2359 |
{ |
2360 |
this.isOpenPlayerOnBoot = ConfUtil.parseBoolean(confValue); |
2361 |
} |
2362 |
else |
2363 |
{ |
2364 |
this.isOpenPlayerOnBoot = false; |
2365 |
} |
2366 |
|
2367 |
errorName = "downloadRetryMaxCount"; |
2368 |
confValue = ConfigManager.getInstance().getItem("downloadRetryMaxCount"); |
2369 |
if(confValue != null) |
2370 |
{ |
2371 |
this.downloadRetryMaxCount = int(confValue); |
2372 |
} |
2373 |
else |
2374 |
{ |
2375 |
this.downloadRetryMaxCount = 2; |
2376 |
} |
2377 |
|
2378 |
errorName = "myListRenewOnBootTime"; |
2379 |
confValue = ConfigManager.getInstance().getItem("myListRenewOnBootTime"); |
2380 |
if (confValue != null) |
2381 |
{ |
2382 |
this.myListRenewOnBootTime = ConfUtil.parseBoolean(confValue); |
2383 |
} |
2384 |
else |
2385 |
{ |
2386 |
this.myListRenewOnBootTime = false; |
2387 |
} |
2388 |
|
2389 |
errorName ="useOldTypeCommentGet"; |
2390 |
confValue = ConfigManager.getInstance().getItem("useOldTypeCommentGet"); |
2391 |
if (confValue != null) |
2392 |
{ |
2393 |
this.useOldTypeCommentGet = ConfUtil.parseBoolean(confValue); |
2394 |
} |
2395 |
else |
2396 |
{ |
2397 |
this.useOldTypeCommentGet = true; |
2398 |
} |
2399 |
|
2400 |
errorName = "isCloseNNDDWindowWhenLogin"; |
2401 |
confValue = ConfigManager.getInstance().getItem("isCloseNNDDWindowWhenLogin"); |
2402 |
if (confValue != null) |
2403 |
{ |
2404 |
this.isCloseNNDDWindowWhenLogin = ConfUtil.parseBoolean(confValue); |
2405 |
} |
2406 |
else |
2407 |
{ |
2408 |
this.isCloseNNDDWindowWhenLogin = false; |
2409 |
} |
2410 |
|
2411 |
errorName = "isSkipEconomy"; |
2412 |
confValue = ConfigManager.getInstance().getItem("isSkipEconomy"); |
2413 |
if (confValue != null) |
2414 |
{ |
2415 |
this.isSkipEconomy = ConfUtil.parseBoolean(confValue); |
2416 |
} |
2417 |
else |
2418 |
{ |
2419 |
this.isSkipEconomy = false; |
2420 |
} |
2421 |
|
2422 |
errorName = "isSaveMyListHistory"; |
2423 |
confValue = ConfigManager.getInstance().getItem("isSaveMyListHistory"); |
2424 |
if (confValue != null) |
2425 |
{ |
2426 |
this.isSaveMyListHistory = ConfUtil.parseBoolean(confValue); |
2427 |
} |
2428 |
|
2429 |
errorName = "allowOtherNNDDConnection"; |
2430 |
confValue = ConfigManager.getInstance().getItem("allowOtherNNDDConnection"); |
2431 |
if (confValue != null) |
2432 |
{ |
2433 |
this.allowOtherNNDDConnection = ConfUtil.parseBoolean(confValue); |
2434 |
} |
2435 |
errorName = "enableShareVideoInfo"; |
2436 |
confValue = ConfigManager.getInstance().getItem("enableShareVideoInfo"); |
2437 |
if (confValue != null) |
2438 |
{ |
2439 |
this.enableShareVideoInfo = ConfUtil.parseBoolean(confValue); |
2440 |
} |
2441 |
errorName = "enableShareMyListInfo"; |
2442 |
confValue = ConfigManager.getInstance().getItem("enableShareMyListInfo"); |
2443 |
if (confValue != null) |
2444 |
{ |
2445 |
this.enableShareMyListInfo = ConfUtil.parseBoolean(confValue); |
2446 |
} |
2447 |
errorName = "allowGetOtherNNDDInfo"; |
2448 |
confValue = ConfigManager.getInstance().getItem("allowGetOtherNNDDInfo"); |
2449 |
if (confValue != null) |
2450 |
{ |
2451 |
this.allowGetOtherNNDDInfo = ConfUtil.parseBoolean(confValue); |
2452 |
} |
2453 |
errorName = "enableSyncMyListYetPlay"; |
2454 |
confValue = ConfigManager.getInstance().getItem("enableSyncMyListYetPlay"); |
2455 |
if (confValue != null) |
2456 |
{ |
2457 |
this.enableSyncMyListYetPlay = ConfUtil.parseBoolean(confValue); |
2458 |
} |
2459 |
|
2460 |
errorName = "localPort"; |
2461 |
confValue = ConfigManager.getInstance().getItem("localPort"); |
2462 |
if (confValue != null) |
2463 |
{ |
2464 |
this.string_localPort = String(confValue); |
2465 |
} |
2466 |
errorName = "remoteNNDDPort"; |
2467 |
confValue = ConfigManager.getInstance().getItem("remoteNNDDPort"); |
2468 |
if (confValue != null) |
2469 |
{ |
2470 |
this.string_remoteNNDDPort = String(confValue); |
2471 |
} |
2472 |
errorName = "remoteNNDDAddress"; |
2473 |
confValue = ConfigManager.getInstance().getItem("remoteNNDDAddress"); |
2474 |
if (confValue != null) |
2475 |
{ |
2476 |
this.string_remoteNNDDAddress = String(confValue); |
2477 |
} |
2478 |
|
2479 |
errorName = "isRowHeightSync"; |
2480 |
confValue = ConfigManager.getInstance().getItem("isRowHeightSync"); |
2481 |
if (confValue != null) |
2482 |
{ |
2483 |
this.isRowHeightSync = ConfUtil.parseBoolean(confValue); |
2484 |
} |
2485 |
|
2486 |
}catch(error:Error){ |
2487 |
/* ������������������������ */ |
2488 |
// EncryptedLocalStore.reset(); |
2489 |
|
2490 |
/* ��������������������������������� */ |
2491 |
this._libraryDir = libraryManager.defaultLibraryDir; |
2492 |
logManager.setLogDir(libraryManager.systemFileDir); |
2493 |
|
2494 |
/* ��������������������� */ |
2495 |
Alert.show(Message.M_CONF_FILE_IS_BROKEN, Message.M_ERROR); |
2496 |
logManager.addLog(Message.M_CONF_FILE_IS_BROKEN + ":" + Message.FAIL_LOAD_CONF_FILE_FOR_NNDD_MAIN_WINDOW + "[" + errorName + "]:" + error + ":" + error.getStackTrace()); |
2497 |
trace(error.getStackTrace()); |
2498 |
} |
2499 |
|
2500 |
/* ������������������ */ |
2501 |
createLoginDialog(isLogout, isLocalStoreErrorOccured); |
2502 |
|
2503 |
} |
2504 |
|
2505 |
private function createLoginDialog(isLogout:Boolean, isLocalStoreError:Boolean):void{ |
2506 |
// ������������������������������������ |
2507 |
loginDialog = PopUpManager.createPopUp(this, LoginDialog, true) as LoginDialog; |
2508 |
loginDialog.initLoginDialog(Access2Nico.TOP_PAGE_URL, Access2Nico.LOGIN_URL, LogManager.instance, isLogout); |
2509 |
// ������������������������������������������������ |
2510 |
loginDialog.addEventListener(LoginDialog.ON_LOGIN_SUCCESS, onFirstTimeLoginSuccess); |
2511 |
loginDialog.addEventListener(LoginDialog.LOGIN_FAIL, loginFailEventHandler); |
2512 |
loginDialog.addEventListener(LoginDialog.NO_LOGIN, noLogin); |
2513 |
loginDialog.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:Event):void{ |
2514 |
if (isLocalStoreError) |
2515 |
{ |
2516 |
EncryptedLocalStore.reset(); |
2517 |
Alert.show(Message.M_LOCAL_STORE_IS_BROKEN, Message.M_ERROR); |
2518 |
} |
2519 |
}); |
2520 |
|
2521 |
// ��������������������������������� |
2522 |
PopUpManager.centerPopUp(loginDialog); |
2523 |
} |
2524 |
|
2525 |
/** |
2526 |
* |
2527 |
* @param event |
2528 |
* |
2529 |
*/ |
2530 |
private function loginFailEventHandler(event:Event):void{ |
2531 |
logManager.addLog("���������������������:" + event); |
2532 |
} |
2533 |
|
2534 |
/** |
2535 |
* ������������������������������������������������������������������������ |
2536 |
* @param event |
2537 |
* |
2538 |
*/ |
2539 |
private function onFirstTimeLoginSuccess(event:HTTPStatusEvent):void |
2540 |
{ |
2541 |
if (!rankingDataGridComplete) |
2542 |
{ |
2543 |
DataGridColumnWidthUtil.loadAndSet(dataGrid_ranking, new Vector.<String>("dataGridColumn_ranking", "dataGridColumn_condition")); |
2544 |
rankingDataGridComplete = true; |
2545 |
} |
2546 |
|
2547 |
logoutButton.label = "���������������"; |
2548 |
logoutButton.enabled = true; |
2549 |
|
2550 |
PopUpManager.removePopUp(loginDialog); |
2551 |
|
2552 |
UserManager.instance.user = loginDialog.textInput_userName.text; |
2553 |
UserManager.instance.password = loginDialog.textInput_password.text; |
2554 |
|
2555 |
MyListRenewScheduler.instance.mailAddress = UserManager.instance.user; |
2556 |
MyListRenewScheduler.instance.password = UserManager.instance.password; |
2557 |
|
2558 |
if ( this.myListRenewOnBootTime ) |
2559 |
{ |
2560 |
MyListRenewScheduler.instance.startNow(); |
2561 |
} |
2562 |
else |
2563 |
{ |
2564 |
if(this.mylistRenewOnScheduleEnable){ |
2565 |
MyListRenewScheduler.instance.startNow(); |
2566 |
MyListRenewScheduler.instance.start((this.myListRenewScheduleTime*60)*1000); |
2567 |
} |
2568 |
} |
2569 |
|
2570 |
downloadManager.setMailAndPass(UserManager.instance.user, UserManager.instance.password); |
2571 |
downloadManager.isContactTheUser = isEnableEcoCheck; |
2572 |
downloadManager.isSkipEconomy = isSkipEconomy; |
2573 |
downloadManager.retryMaxCount = this.downloadRetryMaxCount; |
2574 |
scheduleManager = new ScheduleManager(logManager, downloadManager); |
2575 |
if (scheduleManager.isScheduleEnable) |
2576 |
{ |
2577 |
scheduleManager.timerStart(); |
2578 |
} |
2579 |
|
2580 |
trace("���������������������"+event); |
2581 |
logManager.addLog("������������:" + event); |
2582 |
|
2583 |
|
2584 |
//���������������������������������URL��������������������������������������������������������������� |
2585 |
if(isArgumentBoot){ |
2586 |
isArgumentBoot = false; |
2587 |
try{ |
2588 |
this.playingVideoPath = this.argumentURL; |
2589 |
this.videoStreamingPlayStart(this.playingVideoPath); |
2590 |
this.isArgumentBoot = false; |
2591 |
this.argumentURL = ""; |
2592 |
}catch(error:Error){ |
2593 |
Alert.show("������������������������������������������������������\n" + this.argumentURL, Message.M_ERROR); |
2594 |
logManager.addLog("������������������������������������������������������:url" + this.argumentURL + "\n" + error.getStackTrace()); |
2595 |
} |
2596 |
} |
2597 |
|
2598 |
// ������������������Window��������������������������������������� |
2599 |
if (isCloseNNDDWindowWhenLogin) |
2600 |
{ |
2601 |
if (isDisEnableAutoExit && ( NativeApplication.supportsSystemTrayIcon || NativeApplication.supportsDockIcon)) |
2602 |
{ |
2603 |
if (this.nativeWindow != null && !this.nativeWindow.closed ) |
2604 |
{ |
2605 |
var timer:Timer = new Timer(1000, 1); |
2606 |
timer.addEventListener(TimerEvent.TIMER_COMPLETE, function(event:Event):void |
2607 |
{ |
2608 |
close(); |
2609 |
logManager.addLog("���������������������������������������������������������������"); |
2610 |
}); |
2611 |
timer.start(); |
2612 |
} |
2613 |
} |
2614 |
else |
2615 |
{ |
2616 |
if (this.nativeWindow != null && !this.nativeWindow.closed |
2617 |
&& this.nativeWindow.displayState != NativeWindowDisplayState.MINIMIZED) |
2618 |
{ |
2619 |
var timer:Timer = new Timer(1000, 1); |
2620 |
timer.addEventListener(TimerEvent.TIMER_COMPLETE, function(event:Event):void |
2621 |
{ |
2622 |
nativeWindow.minimize(); |
2623 |
logManager.addLog("���������������������������������������������������������������������"); |
2624 |
}); |
2625 |
timer.start(); |
2626 |
} |
2627 |
} |
2628 |
} |
2629 |
|
2630 |
|
2631 |
} |
2632 |
|
2633 |
/** |
2634 |
* ������������������������������"���������������������������"������������������������������������������������ |
2635 |
* |
2636 |
*/ |
2637 |
private function noLogin(event:HTTPStatusEvent):void |
2638 |
{ |
2639 |
if (!rankingDataGridComplete) |
2640 |
{ |
2641 |
DataGridColumnWidthUtil.loadAndSet(dataGrid_ranking, new Vector.<String>("dataGridColumn_ranking", "dataGridColumn_condition")); |
2642 |
rankingDataGridComplete = true; |
2643 |
} |
2644 |
|
2645 |
logoutButton.label = "������������"; |
2646 |
logoutButton.enabled = true; |
2647 |
|
2648 |
PopUpManager.removePopUp(loginDialog); |
2649 |
|
2650 |
UserManager.instance.user = ""; |
2651 |
UserManager.instance.password = ""; |
2652 |
|
2653 |
MyListRenewScheduler.instance.mailAddress = UserManager.instance.user; |
2654 |
MyListRenewScheduler.instance.password = UserManager.instance.password; |
2655 |
|
2656 |
MyListRenewScheduler.instance.stop(); |
2657 |
|
2658 |
logManager.addLog("������������������:" + event); |
2659 |
|
2660 |
downloadManager.setMailAndPass(UserManager.instance.user, UserManager.instance.password); |
2661 |
scheduleManager = new ScheduleManager(logManager, downloadManager); |
2662 |
|
2663 |
this.isArgumentBoot = false; |
2664 |
this.argumentURL = ""; |
2665 |
|
2666 |
} |
2667 |
|
2668 |
private function setEnableTargetRadioButtons(enable:Boolean):void{ |
2669 |
|
2670 |
nndd.radio_target_mylist.enabled = enable; |
2671 |
nndd.radio_target_res.enabled = enable; |
2672 |
nndd.radio_target_view.enabled = enable; |
2673 |
|
2674 |
} |
2675 |
|
2676 |
/** |
2677 |
* ��������������������������������������������������������������������� |
2678 |
* @param enable |
2679 |
* |
2680 |
*/ |
2681 |
private function setEnableRadioButtons(enable:Boolean):void{ |
2682 |
nndd.radiogroup_period.enabled = enable; |
2683 |
nndd.radiogroup_target.enabled = enable; |
2684 |
|
2685 |
nndd.radio_period_new.enabled = enable; |
2686 |
nndd.radio_period_daily.enabled = enable; |
2687 |
nndd.radio_period_hourly.enabled = enable; |
2688 |
nndd.radio_period_monthly.enabled = enable; |
2689 |
nndd.radio_period_weekly.enabled = enable; |
2690 |
nndd.radio_period_all.enabled = enable; |
2691 |
nndd.radio_target_mylist.enabled = enable; |
2692 |
nndd.radio_target_res.enabled = enable; |
2693 |
nndd.radio_target_view.enabled = enable; |
2694 |
} |
2695 |
|
2696 |
/** |
2697 |
* ��������������������������������������������������������������������� <br> |
2698 |
* |
2699 |
*/ |
2700 |
private function folderSelectButtonClicked(event:MouseEvent):void |
2701 |
{ |
2702 |
var directory:File = new File(libraryManager.libraryDir.url); |
2703 |
|
2704 |
directory.browseForDirectory("���������������������������������"); |
2705 |
|
2706 |
// ��������������������������������������������������� |
2707 |
directory.addEventListener(Event.SELECT, function(event:Event):void |
2708 |
{ |
2709 |
// ������������������������������������������������������������������������������������ |
2710 |
if (libraryManager.libraryDir != null && libraryManager.libraryDir.exists) |
2711 |
{ |
2712 |
|
2713 |
// ������������ |
2714 |
_searchItemManager.saveSearchItems(libraryManager.systemFileDir); |
2715 |
|
2716 |
// ��������������� |
2717 |
MyListManager.instance.saveMyListSummary(libraryManager.systemFileDir); |
2718 |
|
2719 |
// DL��������� |
2720 |
// DownloadedListManager.instance. |
2721 |
|
2722 |
// ��������������� |
2723 |
libraryManager.saveLibrary(libraryManager.systemFileDir); |
2724 |
|
2725 |
// ������ |
2726 |
HistoryManager.instance.saveHistory(); |
2727 |
|
2728 |
// NG������ |
2729 |
ngTagManager.saveNgTags(); |
2730 |
|
2731 |
} |
2732 |
|
2733 |
|
2734 |
// ������������������������������������������������������������������������`File`������������ |
2735 |
libraryManager.changeLibraryDir(File(event.target)); |
2736 |
|
2737 |
nndd.textInput_saveAdress.text = libraryManager.libraryDir.nativePath; |
2738 |
|
2739 |
if(tree_library != null){ |
2740 |
|
2741 |
var libraryTreeBuilder:LibraryTreeBuilder = new LibraryTreeBuilder(); |
2742 |
tree_library.dataProvider = libraryTreeBuilder.build(true); |
2743 |
|
2744 |
} |
2745 |
|
2746 |
var vector:Vector.<PlayList> = playListManager.readPlayListSummary(libraryManager.playListDir); |
2747 |
|
2748 |
var treeDataBuilder:TreeDataBuilder = new TreeDataBuilder(); |
2749 |
var object:Object = treeDataBuilder.getFolderObject("PlayList"); |
2750 |
for each(var playList:PlayList in vector){ |
2751 |
var file:Object = treeDataBuilder.getFileObject(playList.name); |
2752 |
(object.children as Array).push(file); |
2753 |
} |
2754 |
|
2755 |
// libraryProvider.addItem(object); |
2756 |
|
2757 |
if(tree_library != null){ |
2758 |
tree_library.invalidateList(); |
2759 |
tree_library.validateNow(); |
2760 |
} |
2761 |
|
2762 |
// ������������ |
2763 |
searchProvider.removeAll(); |
2764 |
searchListProvider.splice(0, searchListProvider.length); |
2765 |
_searchItemManager.readSearchItems(libraryManager.systemFileDir); |
2766 |
|
2767 |
// ��������������� |
2768 |
myListItemProvider.removeAll(); |
2769 |
myListProvider.splice(0, myListProvider.length); |
2770 |
MyListManager.instance.readMyListSummary(libraryManager.systemFileDir); |
2771 |
|
2772 |
// DL��������� |
2773 |
downloadedListManager.updateDownLoadedItems(libraryManager.systemFileDir.url, showAll); |
2774 |
|
2775 |
// ������ |
2776 |
HistoryManager.instance.loadHistory(); |
2777 |
|
2778 |
// Ng������ |
2779 |
ngTagManager.loadNgTags(); |
2780 |
|
2781 |
logManager.addLog("������������������:"+libraryManager.libraryDir.nativePath); |
2782 |
}); |
2783 |
} |
2784 |
|
2785 |
|
2786 |
/** |
2787 |
* ��������������������������������������������������� |
2788 |
* |
2789 |
*/ |
2790 |
private function tabChanged():void{ |
2791 |
|
2792 |
this.status = ""; |
2793 |
|
2794 |
switch(viewStack.selectedIndex){ |
2795 |
case RANKING_AND_SERACH_TAB_NUM: |
2796 |
|
2797 |
break; |
2798 |
case SEARCH_TAB_NUM: |
2799 |
(tree_SearchItem.dataProvider as ArrayCollection).refresh(); |
2800 |
tree_SearchItem.dataProvider = tree_SearchItem.dataProvider; |
2801 |
tree_SearchItem.invalidateList(); |
2802 |
tree_SearchItem.validateNow(); |
2803 |
|
2804 |
break; |
2805 |
case MYLIST_TAB_NUM: |
2806 |
|
2807 |
var confValue:String = ConfigManager.getInstance().getItem("firstTimeMyListShow"); |
2808 |
if(confValue == null){ |
2809 |
if(UserManager.instance.user.length > 0 && UserManager.instance.password.length > 0){ |
2810 |
Alert.show(Message.M_RENEW_MYLIST_GROUP, Message.M_MESSAGE, (Alert.YES | Alert.NO), null, function(event:CloseEvent):void{ |
2811 |
if(event.detail == Alert.YES){ |
2812 |
MyListManager.instance.addEventListener(MyListManager.MYLIST_RENEW_COMPLETE, myListRenewCompleteHandler); |
2813 |
MyListManager.instance.renewMyListIds(UserManager.instance.user, UserManager.instance.password); |
2814 |
} |
2815 |
ConfigManager.getInstance().setItem("firstTimeMyListShow", false); |
2816 |
ConfigManager.getInstance().save(); |
2817 |
}); |
2818 |
} |
2819 |
} |
2820 |
|
2821 |
refreshMyListHistoryComboBox(); |
2822 |
|
2823 |
(tree_myList.dataProvider as ArrayCollection).refresh(); |
2824 |
tree_myList.invalidateList(); |
2825 |
tree_myList.validateNow(); |
2826 |
|
2827 |
break; |
2828 |
case DOWNLOAD_LIST_TAB_NUM: |
2829 |
|
2830 |
if (scheduleManager != null) |
2831 |
{ |
2832 |
label_nextDownloadTime.text = scheduleManager.scheduleString; |
2833 |
} |
2834 |
dataGrid_downloadList.setFocus(); |
2835 |
|
2836 |
(dataGrid_downloadList.dataProvider as ArrayCollection).refresh(); |
2837 |
dataGrid_downloadList.invalidateList(); |
2838 |
// dataGrid_downloadList.validateNow(); |
2839 |
|
2840 |
if(downloadManager.listLength > downloadManager.maxDlListCount){ |
2841 |
Alert.show(Message.M_DOWNLOAD_LIST_COUNT_OVER_DELETE_PRE + |
2842 |
|