// GET: Admin/FileManager public ActionResult Index() { var dirs = Directory.GetFiles(Server.MapPath("~/WebFiles/")); var model = dirs.Select(item => FileListModel.Import(Path.GetFileName(item), Path.GetExtension(item))).ToList(); return(View(model)); }
//for windows.... private string GetPreviewTextureFullpathOfVideo(string videoFullpath) { //int filesuffixPos = videoFullpath.IndexOf ("."); //int filenamePos = videoFullpath.LastIndexOf ("/"); return(FileListModel.GetDataPath() + "/" + FileListModel.GetFileShortName(videoFullpath) + ".png"); }
//filter字段: Video: mov, .mpg, .mpeg, .mp4,.avi, .asf, wmv, webm格式... //https://baike.baidu.com/item/OPENFILENAME/1166193?fr=aladdin... public void WebUrlConfirm() { // StartCoroutine(WaitLoad(ofn.file));//加载图片到panle .. string strurl = url.text; string strtitle = title.text; //string filename = "file:///" + Utility.StrictLinuxStyle(ofn.file); Debug.Log("Selected file with full path: " + strurl); //ofn.file = filename; //must not duplicate... string shortUrl = FileListModel.GetUrlShortName(strurl); if (FileListControl.Instance().GetFileListView(shortUrl) != null) { return; } FileItem item = new FileItem(); item._fileInfo = null; item._title = strtitle; item._webUrl = strurl; item._fileType = FileItem.FileType.FileType_Web; FileListControl.Instance().AddFile(item); //file path must convert for url path... //VideoPreviewer.Instance().StartPreview ("file:///C:/Unity3d/dangmu/dangmu/Assets/Dangmu/Textures/WeChat_20180305193437.mp4", PreViewDone); WebPreviewer.Instance().StartPreview(strurl, PreViewDone); //StartCoroutine ( WaitLoadTexture(ofn.file) ); merialDlg.Hide(); }
public void PutTest() { ICrud <FileListModel> fileListService = null; // TODO: Initialize to an appropriate value FileListController target = new FileListController(fileListService); // TODO: Initialize to an appropriate value int id = 0; // TODO: Initialize to an appropriate value FileListModel user = new FileListModel { UserName = "******", ActivationDate = null, Admin = false, CanexportList = false, CompanyName = "Risk Metrics", ExpirationDate = null, FilePath = @"db\SC-JordanMcCallum.mdb", LastLoginDate = null, MaxReportViewsPerMonth = 0, Name = null, Password = "******", RenewalDate = null, States = "SC" }; HttpResponseMessage expected = null; // TODO: Initialize to an appropriate value HttpResponseMessage actual; //actual = target.Put(id, model); //Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
//filter字段: Video: mov, .mpg, .mpeg, .mp4,.avi, .asf, wmv, webm格式... //https://baike.baidu.com/item/OPENFILENAME/1166193?fr=aladdin... public void VideoFileSelect() { OpenFileName ofn = new OpenFileName(); ofn.structSize = Marshal.SizeOf(ofn); //三菱(*.gxw)\0*.gxw\0西门子(*.mwp)\0*.mwp\0All Files\0*.*\0\0 ofn.filter = "All Files\0*.mp4;*.mpg\0\0"; ofn.file = new string(new char[256]); ofn.maxFile = ofn.file.Length; ofn.fileTitle = new string(new char[64]); ofn.maxFileTitle = ofn.fileTitle.Length; ofn.initialDir = objectThread.UnityFullpath; //默认路径 ofn.title = "Open Video"; ofn.defExt = "mp4"; //显示文件的类型 //注意 一下项目不一定要全选 但是0x00000008项不要缺少 ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008; //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR if (DllComdlg.GetOpenFileName(ofn)) { // StartCoroutine(WaitLoad(ofn.file));//加载图片到panle //string filename = "file:///" + Utility.StrictLinuxStyle(ofn.file); string filename = Utility.StrictLinuxStyle(ofn.file); ofn.file = filename; //must not duplicate... string shortName = FileListModel.GetFileShortName(filename); //Debug.Log( "Selected file with full path: " + filename + " : shortName:" + shortName); if (FileListControl.Instance().GetFileListView(shortName) != null) { return; } FileItem item = new FileItem(); item._fileInfo = new OpenFileNameEx(ofn); item._fileType = FileItem.FileType.FileType_Video; lock ( objectThread ) { FileListControl.Instance().AddFile(item); objectThread.BUnityWorkMutex = true; objectThread.UnityFullpath = filename; } //file path must convert for url path... //VideoPreviewer.Instance().StartPreview ("file:///C:/Unity3d/dangmu/dangmu/Assets/Dangmu/Textures/WeChat_20180305193437.mp4", PreViewDone); //StartCoroutine ( WaitLoadTexture(ofn.file) ); /*VideoPreviewer.Instance().StartPreview (filename, PreViewDone); * merialDlg.Hide ();*/ } Thread.CurrentThread.Abort(); }
// POST api/filelist public FileListModel Post(FileListModel model) { if (ModelState.IsValid) { return(_fileListService.Create(model)); } return(null); }
public ActionResult loadfiles(int?doc_code) { FileListModel objfilelistmodel = new FileListModel(); objfilelistmodel.FileListCollction = new List <FileList>(); objfilelistmodel.FileListCollction = GetUploadedFileList(doc_code); //return View(objfilelistmodel); return(Json(objfilelistmodel, JsonRequestBehavior.AllowGet)); }
// PUT api/filelist/5 public HttpResponseMessage Put(int id, FileListModel model) { if (ModelState.IsValid) { _fileListService.Update(model); } return(new HttpResponseMessage(HttpStatusCode.OK)); }
public ActionResult FileList() { CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting("StorageConnectionString")); var storageClient = storageAccount.CreateCloudBlobClient(); var storageContainer = storageClient.GetContainerReference( ConfigurationManager.AppSettings.Get("CloudStorageContainerReference")); var blobsList = new FileListModel(storageContainer.ListBlobs(useFlatBlobListing: true)); return(View("FileList", blobsList)); }
void Start() { if (null == instance) { instance = this; } // fileModel = new FileListModel(); fileModel.InitFileList(); // StartCoroutine("InitDisPlayedSprite"); }
/// <summary> /// Inits the dis played sprite. /// To display sprite list in the dicVideoSpriteList.. /// </summary> public void FreshPreViewByType(List <FileItem> itemList) { //init video sprite first.. foreach (var item in itemList) { //string name = System.Convert.ToString(item.Key); string shortname = FileListModel.GetShortName(item); FileListView instance = FileListView.Create(name, item._title, dicVideoSpriteList[shortname]); instance.fileListModel = item; AddFileListView(shortname, instance); //viewDic.Add (shortname, instance); } //init web sprite preview... }
public async Task Load() { FolderPicker fp = new FolderPicker(); fp.FileTypeFilter.Add("*"); var outputFolder = await fp.PickSingleFolderAsync(); var profile = new StorageItemProfile(); var parentModel = profile.GetModelFor(outputFolder); await FileListModel.LoadAsync(profile, parentModel, null); //ActionExecutionContext context = new ActionExecutionContext(); //foreach (var r in FileListModel.Load(profile, parentModel, null)) // await r.ExecuteAsync(context); }
/// <summary> /// Creates the preview sprite for video. /// </summary> /// <param name="filePath">File path.</param> /// <param name="sprite">Sprite.</param> public void CreatePreviewSprite(string filePath, Sprite sprite) { string filename = FileListModel.GetFileShortName(filePath); FileItem file = fileModel.GetFileInfo(filename); Debug.Log("CreatePreviewSprite: name:" + filename + "###file:" + file + "###fileinfo.file:" + file._fileInfo.file); //dicVideoSpriteList.Add (filename, sprite); AddPreViewSprite(filename, sprite); FileListView instance = FileListView.Create(filename, file._title, sprite); instance.fileListModel = file; AddFileListView(filename, instance); //viewDic.Add (filename, instance); fileModel.Save(); RefreshFileList(); }
public static List <FileItemModel> Get115SearchFileResult(CookieContainer cc, string content, string folder = "1834397846621504875", string host = "115.com", string reffer = "https://115.com/?cid=0&offset=0&mode=wangpan", string ua = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 115Browser/12.0.0") { FileListModel temp = new FileListModel(); var url = string.Format(string.Format("https://webapi.115.com/files/search?search_value={0}&format=json&cid={1}", content, folder)); var htmlRet = HtmlManager.GetHtmlWebClient("https://webapi.115.com", url, cc); if (htmlRet.Success) { if (!string.IsNullOrEmpty(htmlRet.Content)) { temp = JsonConvert.DeserializeObject <FileListModel>(htmlRet.Content); } } return((temp == null || temp.data == null) ? null : temp.data); }
public Task <Result <FileListModel> > Handle(GetPagedFileListQueryMock request, CancellationToken cancellationToken) { var pager = new Pager(request.Page, request.ItemsPerPage); var files = new List <FileModel>(); files.Add(new FileModel { FileName = "image.jpg", MimeType = "image/jpeg", Url = "https://www.example.com/image.jpg" }); var model = new FileListModel { Files = files, Pager = pager }; return(Task.FromResult(Result <FileListModel> .Success(model))); }
/// <summary> /// Creates the preview web for web. /// </summary> /// <param name="strUrl">String URL.</param> /// <param name="sprite">Sprite.</param> public void CreatePreviewWeb(string strUrl, Sprite sprite) { string key = FileListModel.GetUrlShortName(strUrl); FileItem file = fileModel.GetFileInfo(key); Debug.Log("CreatePreviewWeb: name:" + strUrl + "###file:" + file + "###weburl:" + file._webUrl); //dicWebSpriteList.Add (); AddPreViewWeb(key, sprite); FileListView instance = FileListView.Create(key, file._title, sprite); instance.fileListModel = file; Debug.Log("CreatePreviewWeb:GameObjectName: " + instance.gameObject.name + "_model._webUrl:" + instance.fileListModel._webUrl + ":_model._filetype:" + instance.fileListModel._fileType); AddFileListView(key, instance); //viewDic.Add (key, instance); fileModel.Save(); RefreshFileList(); }
public static FileListModel GetMixedOneOneFileInFolder(string folder, int page = 0, int pageSize = 1150) { FileListModel ret = new FileListModel(); var cc = Get115Cookie(); var url = $"https://aps.115.com/natsort/files.php?aid=1&cid={folder}&o=file_name&asc=1&offset={page}&show_dir=1&limit={pageSize}&code=&scid=&snap=0&natsort=1&record_open_time=1&source=&format=json&fc_mix=0"; var htmlRet = HtmlManager.GetHtmlWebClient("https://115.com", url, cc); if (htmlRet.Success) { if (!string.IsNullOrEmpty(htmlRet.Content)) { ret = JsonConvert.DeserializeObject <FileListModel>(htmlRet.Content); } } return(ret); }
//init to set .. /* * public void SetSprite(int index, Sprite previewSprite) * { * this.index = index; * previewImage.sprite = previewSprite; * }*/ public void OnClick(GameObject objSender) { switch (objSender.name) { case "PreviewBtn": //Open Material Window.. if (fileListModel._fileType == FileItem.FileType.FileType_Video) { SCMainWinController.Instance().TopLeftVw.DisplayVideo(fileListModel._fileInfo.file, title); } else if (fileListModel._fileType == FileItem.FileType.FileType_Web) { SCMainWinController.Instance().TopLeftVw.DisplayWeb(fileListModel._webUrl, title); } break; case "ProjectBtn": //.. if (fileListModel._fileType == FileItem.FileType.FileType_Video) { SCMainWinController.Instance().TopRhtVw.DisplayVideo(fileListModel._fileInfo.file, title, SCMainWinController.Instance().TopLeftVw.GetVideoFrameCount()); } else if (fileListModel._fileType == FileItem.FileType.FileType_Web) { SCMainWinController.Instance().TopRhtVw.DisplayWeb(fileListModel._webUrl, title); } break; case "RemoveBtn": //移除... string key = ""; if (fileListModel._fileType == FileItem.FileType.FileType_Video) { key = FileListModel.GetFileShortName(fileListModel._fileInfo.file); } else if (fileListModel._fileType == FileItem.FileType.FileType_Web) { key = FileListModel.GetUrlShortName(fileListModel._webUrl); } FileListControl.Instance().ClickRemovePreview(key); break; default: break; } }
/// <summary> /// Handle the GetPagedAzureBlobListQuery request. /// </summary> /// <param name="request">The GetPagedAzureBlobListQuery request.</param> /// <param name="cancellationToken">A cancellation token.</param> public async Task <Result <FileListModel> > Handle(GetPagedAzureBlobListQuery request, CancellationToken cancellationToken) { var cloudBlobContainer = await _azureBlobHelper.GetCloudBlobContainerAsync(cancellationToken); if (!cloudBlobContainer.IsSuccess) { return(Result <FileListModel> .Fail(cloudBlobContainer.Exception)); } var pager = new Pager(request.Page, request.ItemsPerPage); var files = await GetPagedListAsync(pager, cloudBlobContainer.Value, request.DirectoryPath, request.FileType, cancellationToken); var model = new FileListModel { Files = files, Pager = pager }; return(Result <FileListModel> .Success(model)); }
public static FileListModel GetOneOneFileInFolder(string folder, OneOneFiveSearchType type, int page = 0, int pageSize = 1150) { FileListModel ret = new FileListModel(); var cc = Get115Cookie(); var url = $"https://webapi.115.com/files?aid=1&cid={folder}&o=user_ptime&asc=0&offset={page}&show_dir=1&limit={pageSize}&code=&scid=&snap=0&natsort=1&record_open_time=1&source=&format=json&type={((int)type).ToString()}&star=&is_q=&is_share="; var htmlRet = HtmlManager.GetHtmlWebClient("https://115.com", url, cc); if (htmlRet.Success) { if (!string.IsNullOrEmpty(htmlRet.Content)) { ret = JsonConvert.DeserializeObject <FileListModel>(htmlRet.Content); if (ret.data == null) { ret = GetMixedOneOneFileInFolder(folder, page, pageSize); } } } return(ret); }
//for windows.... private string GetPreviewTextureFullpathOfWeb(string webUrl) { return(FileListModel.GetDataPath() + "/" + FileListModel.GetUrlShortName(webUrl) + ".png");; }
public static void FileListModelClassInitialize(TestContext testContext) { fmodel = new FileListModel(); }