public static string GetFileIconSrc(FileMetaInfo file, bool imageResize = false) { string res = ""; switch (file.FileExtension.ToLower()) { case ".jpg": case ".jpeg": case ".png": //preview if (imageResize) res = PhotoManager.GetPreviewSrc2(file.FileUrl, PhotoSize.Small); else res = PhotoManager.GetPreviewSrc(file.FileUrl, PhotoSize.Small, 0); break; default: //icon res = Utility.GetThemedImageSrc( "explorer/file-" + file.FileExtension.ToLower().Replace(".", "") + ".png", "", "explorer/file.png"); break; } return res; }
private void obj2form(FileMetaInfo obj) { TxtFileName.Text = obj.FileName; foreach (KeyValuePair<string, string> item in Config.CultureList) { string sTitleTranslation = ""; TextBox t1 = new TextBox(); t1 = (TextBox)PanelTitle.FindControl("TxtTitle" + item.Value); obj.TitleTranslations.TryGetValue(item.Key, out sTitleTranslation); t1.Text = sTitleTranslation; string sDescriptionTraslation = ""; TextBox t2 = new TextBox(); t2 = (TextBox)PanelDescription.FindControl("TxtDescription" + item.Value); obj.DescriptionTranslations.TryGetValue(item.Key, out sDescriptionTraslation); t2.Text = sDescriptionTraslation; } }
private void form2obj(FileMetaInfo obj) { obj.TitleTranslations.Clear(); obj.DescriptionTranslations.Clear(); foreach (KeyValuePair<string, string> item in Config.CultureList) { TextBox t1 = new TextBox(); t1 = (TextBox)PanelTitle.FindControl("TxtTitle" + item.Value); obj.TitleTranslations.Add(item.Key, t1.Text); TextBox t2 = new TextBox(); t2 = (TextBox)PanelDescription.FindControl("TxtDescription" + item.Value); obj.DescriptionTranslations.Add(item.Key, t2.Text); } }
private void editRow(string fileUrl) { LblOk.Text = ""; LblErr.Text = ""; clearForm(); base.CurrentKey = fileUrl; if (!string.IsNullOrEmpty(fileUrl)) { var obj = new FileMetaInfo(base.CurrentKey); obj2form(obj); } MultiView1.ActiveViewIndex = 1; }
protected void BtnSave_Click(object sender, EventArgs e) { LblErr.Text = ""; LblOk.Text = ""; try { var o1 = new FileMetaInfo(base.CurrentKey); var originalFile = new FileMetaInfo(base.CurrentKey); form2obj(o1); o1.SaveData(); if (originalFile.FileName != TxtFileName.Text) { new FilesGallery(FileUpload1.FilePath, "").RenameFile(originalFile.FileName, TxtFileName.Text); } loadGrid(); LblOk.Text = Utility.GetLabel("RECORD_SAVED_MSG"); MultiView1.ActiveViewIndex = 0; } catch (Exception e1) { LblErr.Text = Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString(); } finally { } }
public static string GetFileIconSrc(FileMetaInfo file) { return GetFileIconSrc(file, false); }
private void fillObject(FileMetaInfo result, string name, long fileLength) { //result.FileFullUrl = this. result.FileUrl = this.AbsolutePath + name; result.FileLength = fileLength; }
private void fillObject(FileMetaInfo result, DirectoryInfo item) { fillObject(result, item.Name, 0); }
private void fillObject(FileMetaInfo result, FileInfo item) { fillObject(result, item.Name, item.Length); }
public FileMetaInfo GetByFileName(string fileName) { var result = new FileMetaInfo(); try { var file = new FileInfo(this.AbsolutePath + fileName); if (file.Exists) fillObject(result, file); } finally { } return result; }
public List<FileMetaInfo> GetAll() { List<FileMetaInfo> result = new List<FileMetaInfo>(); try { DirectoryInfo dir = new DirectoryInfo(this.PhisicalPath); if (dir.Exists) { var folders = dir.GetDirectories(this.SearchPattern); foreach (DirectoryInfo folder in folders) { if (folder.Name.ToLower() != ".svn" && folder.Name.ToLower() != "_vti_cnf") { var item = new FileMetaInfo("", true); fillObject(item, folder); result.Add(item); } } var files = dir.GetFiles(this.SearchPattern); foreach (FileInfo file in files) { if (file.Extension.ToLower() != ".xml") { var item = new FileMetaInfo(); fillObject(item, file); result.Add(item); } } } } finally { } return result; }