Skip to content

Commit

Permalink
went off on a tangent
Browse files Browse the repository at this point in the history
  • Loading branch information
chinonso098 committed Sep 22, 2024
1 parent fcd8463 commit 8286ccf
Show file tree
Hide file tree
Showing 43 changed files with 88 additions and 34 deletions.
89 changes: 71 additions & 18 deletions src/app/shared/system-service/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,12 @@ export class FileService{
}

private changeFolderIcon(fileName:string, iconPath:string, path:string):string{


console.log('iconPath:',iconPath);

const baseUrl = '/osdrive';
const iconMaybe = `/Cheetah/System/Imageres/${fileName.toLocaleLowerCase()}_folder.png`;

if(path !== `/Users/${fileName}`)
return iconPath;

return this._fileSystem.existsSync(iconMaybe) ? `${baseUrl}${iconMaybe}` : iconPath;
return this._fileSystem.existsSync(iconMaybe) ? `${this._consts.IMAGE_BASE_PATH}${fileName.toLocaleLowerCase()}_folder.png` : iconPath;
}

public async checkIfDirectory(path: string):Promise<boolean> {
Expand Down Expand Up @@ -341,6 +336,64 @@ export class FileService{
return `${basename(path, extname(path))}${ extname(path)}`;
}


public async getFileInfoAsync1(path:string):Promise<FileInfo>{
const extension = extname(path);
this._fileInfo = new FileInfo();
const fileMetaData = await this.getExtraFileMetaDataAsync(path) as FileMetaData;
if(!extension){
const sc = await this.setFolderValuesAsync(path) as ShortCut;


// this._fileInfo.setIconPath = this.changeFolderIcon(sc.geFileName,sc.getIconPath, path);
// this._fileInfo.setCurrentPath = path;
// this._fileInfo.setFileType = sc.getFileType;
// this._fileInfo.setFileName = sc.geFileName;
// this._fileInfo.setOpensWith = sc.getOpensWith;
// this._fileInfo.setIsFile = false;
// this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
// this._fileInfo.setSize = fileMetaData.getSize;
// this._fileInfo.setMode = fileMetaData.getMode;

this._fileInfo = this.populateFileInfo(path,fileMetaData,false, this._consts.EMPTY_STRING,sc);
this._fileInfo.setIconPath = this.changeFolderIcon(sc.geFileName,sc.getIconPath, path);
}
else if(extension == this._consts.URL){
const sc = await this.getShortCutFromURLAsync(path) as ShortCut;
this._fileInfo = this.populateFileInfo(path,fileMetaData,false, this._consts.EMPTY_STRING,sc);
}
else if(this._consts.IMAGE_FILE_EXTENSIONS.includes(extension)){
const sc = await this.getShortCutFromURLAsync(path) as ShortCut;
this._fileInfo = this.populateFileInfo(path,fileMetaData,true,'photoviewer',sc);
}
else if(this._consts.VIDEO_FILE_EXTENSIONS.includes(extension)){
const sc = await this.getShortCutFromURLAsync(path) as ShortCut;
this._fileInfo = this.populateFileInfo(path,fileMetaData,true, this._consts.EMPTY_STRING,sc);
}
else if(this._consts.AUDIO_FILE_EXTENSIONS.includes(extension)){
const sc = await this.getShortCutFromURLAsync(path) as ShortCut;
this._fileInfo = this.populateFileInfo(path,fileMetaData,true, this._consts.EMPTY_STRING,sc);
}

return this._fileInfo;
}

populateFileInfo(path:string, fileMetaData:FileMetaData, isFile =true, opensWith:string, shortCut?:ShortCut, imageName?:string):FileInfo{
const fileInfo = new FileInfo();

this._fileInfo.setIconPath = shortCut?.getIconPath || `${this._consts.IMAGE_BASE_PATH}${imageName}.png`;
fileInfo.setCurrentPath = path;
fileInfo.setFileType = shortCut?.getFileType || extname(path);
fileInfo.setFileName = shortCut?.geFileName || basename(path, extname(path));
fileInfo.setOpensWith = shortCut?.getOpensWith || opensWith;
fileInfo.setIsFile = isFile;
fileInfo.setDateModified = fileMetaData.getModifiedDate;
fileInfo.setSize = fileMetaData.getSize;
fileInfo.setMode = fileMetaData.getMode;

return fileInfo;
}

public async getFileInfoAsync(path:string):Promise<FileInfo>{
const extension = extname(path);
this._fileInfo = new FileInfo();
Expand Down Expand Up @@ -377,7 +430,7 @@ export class FileService{
}
else if(this._consts.IMAGE_FILE_EXTENSIONS.includes(extension)){
const sc = await this.getShortCutFromB64DataUrlAsync(path,'image');
this._fileInfo.setIconPath = sc.getIconPath;
this._fileInfo.setIconPath = `${this._consts.IMAGE_BASE_PATH}image_file.png`;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setContentPath = sc.getContentPath;
this._fileInfo.setFileType = extension;
Expand All @@ -389,7 +442,7 @@ export class FileService{
}
else if(this._consts.VIDEO_FILE_EXTENSIONS.includes(extension)){
const sc = await this.getShortCutFromB64DataUrlAsync(path, 'video');
this._fileInfo.setIconPath = '/osdrive/Cheetah/System/Imageres/video_file.png';
this._fileInfo.setIconPath = `${this._consts.IMAGE_BASE_PATH}video_file.png`;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setContentPath = sc.getContentPath;
this._fileInfo.setFileType = extension;
Expand All @@ -400,7 +453,7 @@ export class FileService{
this._fileInfo.setMode = fileMetaData.getMode;
}else if(this._consts.AUDIO_FILE_EXTENSIONS.includes(extension)){
const sc = await this.getShortCutFromB64DataUrlAsync(path, 'audio');
this._fileInfo.setIconPath = '/osdrive/Cheetah/System/Imageres/music_file.png';
this._fileInfo.setIconPath = `${this._consts.IMAGE_BASE_PATH}music_file.png`;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setContentPath = sc.getContentPath;
this._fileInfo.setFileType = extension;
Expand All @@ -410,45 +463,45 @@ export class FileService{
this._fileInfo.setSize = fileMetaData.getSize;
this._fileInfo.setMode = fileMetaData.getMode;
}else if(extension == '.txt' || extension == '.properties'){
this._fileInfo.setIconPath = '/osdrive/Cheetah/System/Imageres/file.png';
this._fileInfo.setIconPath = `${this._consts.IMAGE_BASE_PATH}file.png`;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileType = extname(path);
this._fileInfo.setFileType = extension
this._fileInfo.setFileName = basename(path, extname(path));
this._fileInfo.setOpensWith = 'texteditor';
this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
this._fileInfo.setSize = fileMetaData.getSize;
this._fileInfo.setMode = fileMetaData.getMode;
}else if(extension == '.md'){
this._fileInfo.setIconPath = '/osdrive/Cheetah/System/Imageres/markdown-file_50.png';
this._fileInfo.setIconPath = `${this._consts.IMAGE_BASE_PATH}markdown_file.png`;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileType = extname(path);
this._fileInfo.setFileType = extension
this._fileInfo.setFileName = basename(path, extname(path));
this._fileInfo.setOpensWith = 'markdownviewer';
this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
this._fileInfo.setSize = fileMetaData.getSize;
this._fileInfo.setMode = fileMetaData.getMode;
}else if(extension == '.jsdos'){
this._fileInfo.setIconPath = '/osdrive/Cheetah/System/Imageres/emulator_2.png';
this._fileInfo.setIconPath = `${this._consts.IMAGE_BASE_PATH}js-dos.png`;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileType = extname(path);
this._fileInfo.setFileType = extension
this._fileInfo.setFileName = basename(path, extname(path));
this._fileInfo.setOpensWith = 'jsdos';
this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
this._fileInfo.setSize = fileMetaData.getSize;
this._fileInfo.setMode = fileMetaData.getMode;
}
else if(extension == '.swf'){
this._fileInfo.setIconPath = '/osdrive/Cheetah/System/Imageres/lightning_flash.png';
this._fileInfo.setIconPath = `${this._consts.IMAGE_BASE_PATH}swf_file.png`;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileType = extname(path);
this._fileInfo.setFileType = extension
this._fileInfo.setFileName = basename(path, extname(path));
this._fileInfo.setOpensWith = 'ruffle';
this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
this._fileInfo.setSize = fileMetaData.getSize;
this._fileInfo.setMode = fileMetaData.getMode;
}
else{
this._fileInfo.setIconPath='/osdrive/Cheetah/System/Imageres/unknown.png';
this._fileInfo.setIconPath=`${this._consts.IMAGE_BASE_PATH}/unknown.png`;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileName = basename(path, extname(path));
this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
Expand Down
6 changes: 3 additions & 3 deletions src/app/system-apps/desktop/desktop.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ export class DesktopComponent implements OnInit, OnDestroy, AfterViewInit{
const textEditor:NestedMenuItem={ icon:`${this._consts.IMAGE_BASE_PATH}text-editor_48.png`, label:'Rich Text', action: this.openTextEditor.bind(this), variables:true ,
emptyline:false, styleOption:'C' }

const codeEditor:NestedMenuItem={ icon:`${this._consts.IMAGE_BASE_PATH}vs-code_48.png`, label:'Code Editor', action: this.openCodeEditor.bind(this), variables:true ,
const codeEditor:NestedMenuItem={ icon:`${this._consts.IMAGE_BASE_PATH}vs-code.png`, label:'Code Editor', action: this.openCodeEditor.bind(this), variables:true ,
emptyline:false, styleOption:'C' }

const sortByMenu = [newFolder, textEditor, codeEditor ]
Expand All @@ -607,8 +607,8 @@ export class DesktopComponent implements OnInit, OnDestroy, AfterViewInit{
{icon1:'', icon2:`${this._consts.IMAGE_BASE_PATH}arrow_next_1.png`, label:'Sort by', nest:this.buildSortByMenu(), action: ()=>'', action1: this.shiftSortBySubMenu.bind(this), emptyline:false},
{icon1:'', icon2:'', label: 'Refresh', nest:[], action:this.refresh.bind(this), action1: ()=> '', emptyline:true},
{icon1:'', icon2:'', label: 'Paste', nest:[], action:this.onPaste.bind(this), action1: ()=> '', emptyline:false},
{icon1:`${this._consts.IMAGE_BASE_PATH}terminal_48.png`, icon2:'', label:'Open in Terminal', nest:[], action: this.openTerminal.bind(this), action1: ()=> '', emptyline:false},
{icon1:`${this._consts.IMAGE_BASE_PATH}camera_48.png`, icon2:'', label:'Screen Shot', nest:[], action: this.captureComponentImg.bind(this), action1: ()=> '', emptyline:false},
{icon1:`${this._consts.IMAGE_BASE_PATH}terminal.png`, icon2:'', label:'Open in Terminal', nest:[], action: this.openTerminal.bind(this), action1: ()=> '', emptyline:false},
{icon1:`${this._consts.IMAGE_BASE_PATH}camera.png`, icon2:'', label:'Screen Shot', nest:[], action: this.captureComponentImg.bind(this), action1: ()=> '', emptyline:false},
{icon1:'', icon2:'', label:'Next Background', nest:[], action: this.nextBackground.bind(this), action1: ()=> '', emptyline:false},
{icon1:'', icon2:'', label:'Previous Background', nest:[], action: this.previousBackground.bind(this), action1: ()=> '', emptyline:true},
{icon1:'', icon2:`${this._consts.IMAGE_BASE_PATH}arrow_next_1.png`, label:'New', nest:this.buildNewMenu(), action: ()=> '', action1: this.shiftNewSubMenu.bind(this), emptyline:true},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/* Styles for the tabbed window container */
.fileexp-header-tab-container {
width: 100%;
min-width: 610px;
min-width: 700px;
/* border:0.5px solid #9d9d9d; */
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/system-apps/fileexplorer/fileexplorer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2032,8 +2032,8 @@ export class FileExplorerComponent implements BaseComponent, OnInit, AfterViewIn
{icon1:this._consts.EMPTY_STRING, icon2:`${this._consts.IMAGE_BASE_PATH}arrow_next_1.png`, label:'Sort by', nest:this.buildSortByMenu(), action: ()=> this._consts.EMPTY_STRING, action1: this.shiftSortBySubMenu.bind(this), emptyline:false},
{icon1:this._consts.EMPTY_STRING, icon2:this._consts.EMPTY_STRING, label: 'Refresh', nest:[], action:() => console.log('Refresh'), action1: ()=> this._consts.EMPTY_STRING, emptyline:true},
{icon1:this._consts.EMPTY_STRING, icon2:this._consts.EMPTY_STRING, label: 'Paste', nest:[], action: () => console.log('Paste!! Paste!!'), action1: ()=> this._consts.EMPTY_STRING, emptyline:false},
{icon1:`${this._consts.IMAGE_BASE_PATH}terminal_48.png`, icon2:this._consts.EMPTY_STRING, label:'Open in Terminal', nest:[], action: () => console.log('Open Terminal'), action1: ()=> this._consts.EMPTY_STRING, emptyline:false},
{icon1:`${this._consts.IMAGE_BASE_PATH}vs-code_48.png`, icon2:this._consts.EMPTY_STRING, label:'Open with Code', nest:[], action: () => console.log('Open CodeEditor'), action1: ()=> this._consts.EMPTY_STRING, emptyline:true},
{icon1:`${this._consts.IMAGE_BASE_PATH}terminal.png`, icon2:this._consts.EMPTY_STRING, label:'Open in Terminal', nest:[], action: () => console.log('Open Terminal'), action1: ()=> this._consts.EMPTY_STRING, emptyline:false},
{icon1:`${this._consts.IMAGE_BASE_PATH}vs-code.png`, icon2:this._consts.EMPTY_STRING, label:'Open with Code', nest:[], action: () => console.log('Open CodeEditor'), action1: ()=> this._consts.EMPTY_STRING, emptyline:true},
{icon1:this._consts.EMPTY_STRING, icon2:`${this._consts.IMAGE_BASE_PATH}arrow_next_1.png`, label:'New', nest:this.buildNewMenu(), action: ()=> this._consts.EMPTY_STRING, action1: this.shiftNewSubMenu.bind(this), emptyline:true},
{icon1:this._consts.EMPTY_STRING, icon2:this._consts.EMPTY_STRING, label:'Properties', nest:[], action: () => console.log('Properties'), action1: ()=> this._consts.EMPTY_STRING, emptyline:false}
]
Expand Down
2 changes: 1 addition & 1 deletion src/app/system-apps/photoviewer/photoviewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class PhotoViewerComponent implements BaseComponent, OnInit, OnDestroy, A
SECONDS_DELAY = 250;
name= 'photoviewer';
hasWindow = true;
icon = '/osdrive/Cheetah/System/Imageres/photos_48.png';
icon = '/osdrive/Cheetah/System/Imageres/photoviewer.png';
isMaximizable = false;
processId = 0;
type = ComponentType.System;
Expand Down
7 changes: 4 additions & 3 deletions src/app/system-files/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class Constants{
readonly OSDISK = 'OSDisk (C:)';
readonly THISPC = 'This PC';
readonly URL = '.url';
readonly BASE = 'osdrive';
readonly IMAGE_BASE_PATH = 'osdrive/Cheetah/System/Imageres/';

readonly DEFAULT_MENU_ORDER = 'DefaultMenuOrder';
Expand All @@ -15,9 +16,9 @@ export class Constants{
readonly FILE_EXPLORER_FOLDER_MENU_ORDER = 'FileExplorerfolderMenuOrder';
readonly FILE_EXPLORER_UNIQUE_MENU_ORDER = 'FileExploreruniqueMenuOrder';

readonly TASK_BAR_MENU_OPTION = "taskbar-menu";
readonly NESTED_MENU_OPTION = "nested-menu";
readonly FILE_EXPLORER_FILE_MANAGER_MENU_OPTION = "file-explorer-file-manager-menu";
readonly TASK_BAR_MENU_OPTION = 'taskbar-menu';
readonly NESTED_MENU_OPTION = 'nested-menu';
readonly FILE_EXPLORER_FILE_MANAGER_MENU_OPTION = 'file-explorer-file-manager-menu';

readonly IMAGE_FILE_EXTENSIONS = [
'.jpg',
Expand Down
2 changes: 1 addition & 1 deletion src/app/user-apps/jsdos/jsdos.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class JSdosComponent implements BaseComponent, OnInit, OnDestroy, AfterVi

name= 'jsdos';
hasWindow = true;
icon = '/osdrive/Cheetah/System/Imageres/js-dos-logo.png';
icon = '/osdrive/Cheetah/System/Imageres/js-dos.png';
isMaximizable = false;
processId = 0;
type = ComponentType.User;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class MarkDownViewerComponent implements BaseComponent, OnDestroy, After
SECONDS_DELAY = 250;

hasWindow = true;
icon = 'osdrive/Cheetah/System/Imageres/markdown-2_50.png';
icon = 'osdrive/Cheetah/System/Imageres/markdown.png';
name = 'markdownviewer';
processId = 0;
type = ComponentType.System;
Expand Down
4 changes: 2 additions & 2 deletions src/app/user-apps/ruffle/ruffle.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class RuffleComponent implements BaseComponent, OnInit, AfterViewInit {

name= 'ruffle';
hasWindow = true;
icon = '/osdrive/Cheetah/System/Imageres/emulator_1.png';
icon = '/osdrive/Cheetah/System/Imageres/ruffle.png';
isMaximizable = false;
processId = 0;
type = ComponentType.User;
Expand Down Expand Up @@ -118,7 +118,7 @@ export class RuffleComponent implements BaseComponent, OnInit, AfterViewInit {
if(this.checkForExt(pathOne,pathTwo)){
gameSrc = '/' + this._fileInfo.getContentPath;
}else{
gameSrc = this._fileInfo.getCurrentPath;
gameSrc = 'osdrive' +this._fileInfo.getCurrentPath;
}

return gameSrc;
Expand Down
Loading

0 comments on commit 8286ccf

Please sign in to comment.