public void SelectProjectFile(ProjectFileData new_data) { // close error panel if open errorPanel.SetActive(false); // retrieve the file extension string name = new_data.attributes.displayName; string[] extension = name.Split('.'); string ext = extension[extension.Length - 1].ToLower(); // check if file is an image if (ext.Equals("jpg") || ext.Equals("jpeg") || ext.Equals("png")) { selfPanel.SetActive(false); picPanel.SetActive(true); DownloadImageWWW tex = picPanel.GetComponent <DownloadImageWWW>(); tex.setImage(); } // check if file is a pdf else if (ext.Equals("pdf")) { selfPanel.SetActive(false); picPanel.SetActive(true); DownloadImageWWW tex = picPanel.GetComponent <DownloadImageWWW>(); tex.setImage(); } // otherwise the format is unsupported give error else { errorPanel.SetActive(true); } }
public void Setup(ProjectFileData current_file, ProjectFileScrollList current_list) { file = current_file; if (FileNameText != null) { FileNameText.text = file.attributes.displayName; } else { Debug.LogWarning("NameText is null"); } file_list = current_list; }
private void AddButtons() { for (int i = 0; i < projectFiles.data.Length; i++) { ProjectFileData file = projectFiles.data[i]; GameObject newButton = fileDirectory.Get_Object(); newButton.transform.SetParent(contentPanel); ProjectFileButton fileButton = newButton.GetComponent <ProjectFileButton>(); //if (fileButton.FileText == null){ // fileButton.FileText = fileButton.GetComponent<Text>(); // fileButton.FileImage = fileButton.GetComponent<Image>(); //} fileButton.Setup(file, this); } }
private FileContents LoadSingleFileContents( FileSystemEntities entities, FileContentsLoadingContext loadingContext, ProjectFileData projectFileData) { var fileName = projectFileData.FileName; var oldFileData = loadingContext.OldFileDatabaseSnapshot.Files.GetValue(fileName); // If the file was never loaded before, just load it if (oldFileData == null || oldFileData.Contents == null) { return(LoadSingleFileContentsWorker(loadingContext, projectFileData)); } bool isSearchable; // If the project configuration is unchanged from the previous file // database (and the file was present in it), then it is certainly // searchable, so no need to make an expensive call to "IsSearchable" // again. if (loadingContext.UnchangedProjects.Contains(projectFileData.Project)) { isSearchable = true; } else { // If the file is not searchable in the current project, it should be // ignored too. Note that "IsSearachable" is a somewhat expensive // operation, as the filename is checked against potentially many glob // patterns. isSearchable = projectFileData.IsSearchable; } if (!isSearchable) { return(null); } // If the file has not changed since the previous snapshot, we can re-use // the former file contents snapshot. if (IsFileContentsUpToDate(entities, loadingContext.FullPathChanges, oldFileData)) { return(oldFileData.Contents); } return(LoadSingleFileContentsWorker(loadingContext, projectFileData)); }
public void CommandViewModelTo(LoadProjectFile cmd) { ProjectFileReader Reader = new ProjectFileReader(cmd.LoadedProjectFileAbsolutePath); ProjectFileData Data = new ProjectFileData(); Data = Reader.LoadProjectFilePathData(); //フルパス名からディレクトリ名を取得 System.IO.FileInfo fi = new System.IO.FileInfo(cmd.LoadedProjectFileAbsolutePath); string ProjectFileDirectoryAbsolutePath = fi.Directory.FullName; StoringDataFilePath.GetInstance().StoreFilePath(Data, ProjectFileDirectoryAbsolutePath); //FIXME:将来的には、ActiveProjectDataか、直接生成するほうか、どちらかに統一しなければならない。 ActiveProjectData.GetInstance().MaterialSiteListData = new MaterialSiteListData(); ActiveProjectData.GetInstance().MateiralListLogicalData = new MaterialListLogicalData(); }
private FileContents LoadSingleFileContentsWorker( FileContentsLoadingContext loadingContext, ProjectFileData projectFileData) { // If project configuration has not changed, the file is still not // searchable, irrelevant to calling "IsSearchable". if (loadingContext.FullPathChanges != null) { if (loadingContext.FullPathChanges.ShouldSkipLoadFileContents(projectFileData.FileName.FullPath)) { if (loadingContext.UnchangedProjects.Contains(projectFileData.Project)) { return(null); } } } // This is an expensive call, hopefully avoided by the code above. if (!projectFileData.IsSearchable) { return(null); } loadingContext.PartialProgressReporter.ReportProgress(); var fileContents = _fileContentsFactory.ReadFileContents(projectFileData.FileName.FullPath); if (fileContents is BinaryFileContents) { Interlocked.Increment(ref loadingContext.LoadedBinaryFileCount); } else { Interlocked.Increment(ref loadingContext.LoadedTextFileCount); } return(loadingContext.FileContentsMemoization.Get(projectFileData.FileName, fileContents)); }
private FileContents LoadSingleFileContentsWorker( FileContentsLoadingInfo loadingInfo, ProjectFileData projectFileData) { // If project configuration has not changed, the file is still not // searchable, irrelevant to calling "IsSearchable". if (loadingInfo.FullPathChanges != null) { if (loadingInfo.FullPathChanges.GetPathChangeKind(projectFileData.FileName.FullPath) == PathChangeKind.None) { if (loadingInfo.UnchangedProjects.Contains(projectFileData.Project)) return null; } } // This is an expensive call, hopefully avoided by the code above. if (!projectFileData.IsSearchable) return null; loadingInfo.PartialProgressReporter.ReportProgress(); var fileContents = _fileContentsFactory.GetFileContents(projectFileData.FileName.FullPath); if (fileContents is BinaryFileContents) { Interlocked.Increment(ref loadingInfo.LoadedBinaryFileCount); } else { Interlocked.Increment(ref loadingInfo.LoadedTextFileCount); } return loadingInfo.FileContentsMemoization.Get(projectFileData.FileName, fileContents); }
private FileContents LoadSingleFileContents( FileContentsLoadingInfo loadingInfo, ProjectFileData projectFileData) { var fileName = projectFileData.FileName; var oldFileData = loadingInfo.OldFileDatabase.Files.GetValue(fileName); // If the file was never loaded before, just load it if (oldFileData == null || oldFileData.Contents == null) { return LoadSingleFileContentsWorker(loadingInfo, projectFileData); } bool isSearchable; // If the project configuration is unchanged from the previous file // database (and the file was present in it), then it is certainly // searchable, so no need to make an expensive call to "IsSearchable" // again. if (loadingInfo.UnchangedProjects.Contains(projectFileData.Project)) { isSearchable = true; } else { // If the file is not searchable in the current project, it should be // ignored too. Note that "IsSearachable" is a somewhat expensive // operation, as the filename is checked against potentially many glob // patterns. isSearchable = projectFileData.IsSearchable; } if (!isSearchable) return null; // If the file has not changed since the previous snapshot, we can re-use // the former file contents snapshot. if (IsFileContentsUpToDate(loadingInfo.FullPathChanges, oldFileData)) { return oldFileData.Contents; } return LoadSingleFileContentsWorker(loadingInfo, projectFileData); }
private void EnumProjectItems(EnvDTE.ProjectItem item) { try { if (item == null) { return; } if (item.SubProject != null) { foreach (EnvDTE.ProjectItem subitem in item.SubProject.ProjectItems) { EnumProjectItems(subitem); if (needReCollect) { break; } } } if (item.Properties == null || item.ProjectItems == null) { return; } if (item.ProjectItems.Count <= 0) { ProjectFileData data = new ProjectFileData(); data.m_strFileName = item.Name; try { data.m_strFullPath = item.Properties.Item("FullPath").Value.ToString(); bool bFound = false; for (int i = 0; i < m_files.Count; ++i) { if (needReCollect) { break; } if (m_files[i].m_strFullPath == data.m_strFullPath) { bFound = true; break; } } /// 같은 파일은 다시 넣지 않는다. if (bFound == false) { m_files.Add(data); } } catch (ArgumentException ex)///< 이 exception 에 걸리는건 item.Name 이 파일이 없는 "리소스 파일" 같은 폴더(혹은 필터)들이다. { System.Diagnostics.Debug.Print("ZAssist : " + ex.Message); } } else { foreach (EnvDTE.ProjectItem subItem in item.ProjectItems) { if (needReCollect) { break; } EnumProjectItems(subItem); } } } catch (Exception e) { System.Diagnostics.Debug.Print("ZAssist : " + e.Message); } }