Skip to content

Commit

Permalink
mostly renames
Browse files Browse the repository at this point in the history
  • Loading branch information
chinonso098 committed Nov 21, 2023
1 parent 8f19881 commit 07c9ba7
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 57 deletions.
35 changes: 19 additions & 16 deletions src/app/shared/system-service/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { Constants } from "src/app/system-files/constants";
import { FSModule } from "browserfs/dist/node/core/FS";
import { FileEntry } from 'src/app/system-files/fileentry';
import { FileMetaData } from "src/app/system-files/file.metadata";

import { Subject } from "rxjs";
import * as BrowserFS from 'browserfs';
import osDriveFileSystemIndex from '../../../osdrive.json';
import ini from 'ini';



@Injectable({
providedIn: 'root'
})
Expand Down Expand Up @@ -81,20 +83,21 @@ export class FileService{

if(!extension){
const sc = await this.getFolderAsync(path) as ShortCut;
this._fileInfo.setIcon = this.changeFolderIcon(sc.geFileName,sc.getIconFile);
this._fileInfo.setIconPath = this.changeFolderIcon(sc.geFileName,sc.getIconPath);
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileType = sc.getFileType;
this._fileInfo.setFileName = sc.geFileName;
this._fileInfo.setOpensWith = sc.getOpensWith;
}
else{

const fileMetaData = await this.getExtraFileMetaDataAsync(path) as FileMetaData;

if(extension == '.url'){
const sc = await this.getShortCutAsync(path) as ShortCut;
this._fileInfo.setIcon = sc.getIconFile;
this._fileInfo.setIconPath = sc.getIconPath;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setContentPath = sc.getContentUrl;
this._fileInfo.setContentPath = sc.getContentPath;
this._fileInfo.setFileType = sc.getFileType;
this._fileInfo.setFileName = sc.geFileName;
this._fileInfo.setOpensWith = sc.getOpensWith;
Expand All @@ -103,9 +106,9 @@ export class FileService{
}
else if(this._consts.IMAGE_FILE_EXTENSIONS.includes(extension)){
const sc = await this.getImageFileB64DataUrlAsync(path) as ShortCut;
this._fileInfo.setIcon = sc.getIconFile;
this._fileInfo.setIconPath = sc.getIconPath;
this._fileInfo.setCurrentPath = path;
this._fileInfo.setContentPath = sc.getContentUrl;
this._fileInfo.setContentPath = sc.getContentPath;
this._fileInfo.setFileType = extension;
this._fileInfo.setFileName = sc.geFileName;
this._fileInfo.setOpensWith = 'imageviewer';
Expand All @@ -114,27 +117,27 @@ export class FileService{
}
else if(this._consts.VIDEO_FILE_EXTENSIONS.includes(extension)){
const sc = await this.getImageFileB64DataUrlAsync(path) as ShortCut;
this._fileInfo.setIcon = '/osdrive/icons/video.ico';
this._fileInfo.setIconPath = '/osdrive/icons/video.ico';
this._fileInfo.setCurrentPath = path;
this._fileInfo.setContentPath = sc.getContentUrl;
this._fileInfo.setContentPath = sc.getContentPath;
this._fileInfo.setFileType = extension;
this._fileInfo.setFileName = sc.geFileName;
this._fileInfo.setOpensWith = 'videoplayer';
this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
this._fileInfo.setSize = fileMetaData.getSize;
}else if(this._consts.AUDIO_FILE_EXTENSIONS.includes(extension)){
const sc = await this.getImageFileB64DataUrlAsync(path) as ShortCut;
this._fileInfo.setIcon = '/osdrive/icons/audio.ico';
this._fileInfo.setIconPath = '/osdrive/icons/audio.ico';
this._fileInfo.setCurrentPath = path;
this._fileInfo.setContentPath = sc.getContentUrl;
this._fileInfo.setContentPath = sc.getContentPath;
this._fileInfo.setFileType = extension;
this._fileInfo.setFileName = sc.geFileName;
this._fileInfo.setOpensWith = 'audioplayer';
this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
this._fileInfo.setSize = fileMetaData.getSize;
}
else if(extension == '.txt' || extension == '.properties'){
this._fileInfo.setIcon = '/osdrive/icons/file.ico';
this._fileInfo.setIconPath = '/osdrive/icons/file.ico';
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileType = extname(path);
this._fileInfo.setFileName = basename(path, extname(path));
Expand All @@ -143,7 +146,7 @@ export class FileService{
this._fileInfo.setSize = fileMetaData.getSize;
}
else if(extension == '.jsdos'){
this._fileInfo.setIcon = '/osdrive/icons/js-dos-logo.png';
this._fileInfo.setIconPath = '/osdrive/icons/js-dos-logo.png';
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileType = extname(path);
this._fileInfo.setFileName = basename(path, extname(path));
Expand All @@ -152,7 +155,7 @@ export class FileService{
this._fileInfo.setSize = fileMetaData.getSize;
}
else{
this._fileInfo.setIcon='/osdrive/icons/unknown.ico';
this._fileInfo.setIconPath='/osdrive/icons/unknown.ico';
this._fileInfo.setCurrentPath = path;
this._fileInfo.setFileName = basename(path, extname(path));
this._fileInfo.setDateModified = fileMetaData.getModifiedDate;
Expand Down Expand Up @@ -205,15 +208,15 @@ export class FileService{
reject(err)
}
const stage = contents? contents.toString(): Buffer.from('').toString();
const shortCut = ini.parse(stage) as unknown || {InternetShortcut:{ FileName:'hi', IconFileUrl:'', FileType:'',ContentUrl:'', OpensWith:''}};
const shortCut = ini.parse(stage) as unknown || {InternetShortcut:{ FileName:'hi', IconPath:'', FileType:'',ContentPath:'', OpensWith:''}};
if (typeof shortCut === 'object') {
const iSCut = (shortCut as {InternetShortcut:unknown})?.['InternetShortcut'];
const fileName= (iSCut as {FileName:unknown})?.['FileName'] as string;
const iconFileUrl = (iSCut as {IconFileUrl:unknown})?.['IconFileUrl'] as string;
const iconPath = (iSCut as {IconPath:unknown})?.['IconPath'] as string;
const fileType = (iSCut as {FileType:unknown})?.['FileType'] as string;
const contentUrl = (iSCut as {ContentUrl:unknown})?.['ContentUrl'] as string;
const contentPath = (iSCut as {ContentPath:unknown})?.['ContentPath'] as string;
const opensWith = (iSCut as {OpensWith:unknown})?.['OpensWith'] as string;
resolve(new ShortCut(iconFileUrl,fileName,fileType,contentUrl,opensWith));
resolve(new ShortCut(iconPath,fileName,fileType,contentPath,opensWith));
}

resolve(new ShortCut('','','','',''));
Expand Down
2 changes: 1 addition & 1 deletion src/app/system-apps/fileexplorer/fileexplorer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class FileexplorerComponent implements BaseComponent {
updateIconAndName(updatedData:FileInfo):void{
this.directory = updatedData.getCurrentPath;
this.name = updatedData.getFileName;
this.icon = updatedData.getIcon;
this.icon = updatedData.getIconPath;
}

private getComponentDetail():Process{
Expand Down
2 changes: 1 addition & 1 deletion src/app/system-apps/filemanager/filemanager.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(contextmenu)="showIconContextMenu($event, file)" (click)="hideIconContextMenu()"
id="iconBtn{{i}}" [style]="btnStyle">
<figure>
<img [src]="file.getIcon | safeResourceUrl" [alt]="file.getFileName" [style]="iconSizeStyle"/>
<img [src]="file.getIconPath | safeResourceUrl" [alt]="file.getFileName" [style]="iconSizeStyle"/>
<figcaption>
{{file.getFileName}}
</figcaption>
Expand Down
2 changes: 1 addition & 1 deletion src/app/system-apps/taskmanager/taskmanager.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ export class TaskmanagerComponent implements BaseComponent,OnInit,OnDestroy,Afte

onFewerDetailsBtnClick():void{
const file:FileInfo = new FileInfo();
file.setIcon = '/osdrive/icons/taskmanger.png';
file.setIconPath = '/osdrive/icons/taskmanger.png';
file.setOpensWith = 'taskmanagermini';
file.setFileType ='.png';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class TaskmanagerMiniComponent implements BaseComponent,OnInit,OnDestroy

onMoreDetailsBtnClick():void{
const file:FileInfo = new FileInfo();
file.setIcon = '/osdrive/icons/taskmanger.png';
file.setIconPath = '/osdrive/icons/taskmanger.png';
file.setOpensWith = 'taskmanager';
file.setFileType ='.png';

Expand Down
12 changes: 6 additions & 6 deletions src/app/system-files/fileinfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export class FileInfo{
private _icon:string;
private _IconPath:string;
private _currentPath:string;
private _contentPath:string;
private _fileType:string;
Expand All @@ -10,7 +10,7 @@ export class FileInfo{


constructor(){
this._icon = '';
this._IconPath = '';
this._currentPath = '';
this._contentPath = '';
this._fileType = '';
Expand All @@ -20,11 +20,11 @@ export class FileInfo{
this._size = 0;
}

get getIcon(){
return this._icon;
get getIconPath(){
return this._IconPath;
}
set setIcon(icon:string){
this._icon = icon;
set setIconPath(iconPath:string){
this._IconPath = iconPath;
}

get getCurrentPath(){
Expand Down
26 changes: 13 additions & 13 deletions src/app/system-files/shortcut.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
export class ShortCut{
private _iconFile:string;
private _iconPath:string;
private _fileName:string;
private _fileType:string;
private _contentUrl:string;
private _contentPath:string;
private _opensWith:string;

constructor(IconFile:string, FileName:string, FileType:string, ContentUrl:string, OpensWith:string){
this._iconFile = IconFile;
constructor(IconPath:string, FileName:string, FileType:string, ContentPath:string, OpensWith:string){
this._iconPath = IconPath;
this._fileName = FileName;
this._fileType = FileType;
this._contentUrl = ContentUrl;
this._contentPath = ContentPath;
this._opensWith = OpensWith;
}

get getIconFile(){
return this._iconFile;
get getIconPath(){
return this._iconPath;
}
set setFileIcon(iconFile:string){
this._iconFile = iconFile;
set setIconPath(iconFile:string){
this._iconPath = iconFile;
}

get geFileName(){
Expand All @@ -27,11 +27,11 @@ export class ShortCut{
this._fileName = fileName
}

get getContentUrl(){
return this._contentUrl;
get getContentPath(){
return this._contentPath;
}
set setContentUrl(contentUrl:string){
this._contentUrl = contentUrl
set setContentPath(contentUrl:string){
this._contentPath = contentUrl
}

get getFileType(){
Expand Down
4 changes: 2 additions & 2 deletions src/osdrive/desktop/audioplayer.url
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[InternetShortcut]
FileName=titanium
IconFileUrl=/osdrive/icons/audio.ico
IconPath=/osdrive/icons/audio.ico
FileType=.mp3
ContentUrl=osdrive/audio/titanium.mp3
ContentPath=osdrive/audio/titanium.mp3
OpensWith=audioplayer
4 changes: 2 additions & 2 deletions src/osdrive/desktop/fileexplorer.url
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[InternetShortcut]
FileName=File Explorer
IconFileUrl=/osdrive/icons/file_explorer.ico
IconPath=/osdrive/icons/file_explorer.ico
FileType=folder
ContentUrl=File Explorer
ContentPath=File Explorer
OpensWith=fileexplorer
4 changes: 2 additions & 2 deletions src/osdrive/desktop/heat.url
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[InternetShortcut]
FileName=heat
IconFileUrl=/osdrive/picture/heat.png
IconPath=/osdrive/picture/heat.png
FileType=.png
ContentUrl=heat
ContentPath=heat
OpensWith=imageviewer
4 changes: 2 additions & 2 deletions src/osdrive/desktop/hello.url
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[InternetShortcut]
FileName=hello
IconFileUrl=/osdrive/picture/favicon_nice.png
IconPath=/osdrive/picture/favicon_nice.png
FileType=.ico
ContentUrl=hello
ContentPath=hello
OpensWith=hello
4 changes: 2 additions & 2 deletions src/osdrive/desktop/taskmanager.url
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[InternetShortcut]
FileName=Task Manager
IconFileUrl=/osdrive/icons/taskmanger.png
IconPath=/osdrive/icons/taskmanger.png
FileType=.png
ContentUrl=Task Manager
ContentPath=Task Manager
OpensWith=taskmanager
4 changes: 2 additions & 2 deletions src/osdrive/desktop/videoplayer.url
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[InternetShortcut]
FileName=surf_video
IconFileUrl=/osdrive/icons/video.ico
IconPath=/osdrive/icons/video.ico
FileType=.mp4
ContentUrl=osdrive/video/surfs.mp4
ContentPath=osdrive/video/surfs.mp4
OpensWith=videoplayer
4 changes: 2 additions & 2 deletions src/osdrive/games/D3D.url
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[InternetShortcut]
FileName=Doom
IconFileUrl=/osdrive/games/icons/doom.png
IconPath=/osdrive/games/icons/doom.png
FileType=.jsdos
ContentUrl=/osdrive/games/data/Doom.jsdos
ContentPath=/osdrive/games/data/Doom.jsdos
OpensWith=jsdos
4 changes: 2 additions & 2 deletions src/osdrive/games/Diggers.url
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[InternetShortcut]
FileName=Diggers
IconFileUrl=/osdrive/games/icons/diggers.png
IconPath=/osdrive/games/icons/diggers.png
FileType=.jsdos
ContentUrl=/osdrive/games/data/Digger.jsdos
ContentPath=/osdrive/games/data/Digger.jsdos
OpensWith=jsdos
4 changes: 2 additions & 2 deletions src/osdrive/games/Doom.url
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[InternetShortcut]
FileName=D3D
IconFileUrl=/osdrive/games/icons/d3d.png
IconPath=/osdrive/games/icons/d3d.png
FileType=.jsdos
ContentUrl=/osdrive/games/data/Doom.jsdos
ContentPath=/osdrive/games/data/Doom.jsdos
OpensWith=jsdos

0 comments on commit 07c9ba7

Please sign in to comment.