mirror of
https://github.com/Polaris-Entertainment/bytefy.git
synced 2026-07-08 00:25:09 +00:00
Added oracle guid converter
This commit is contained in:
@@ -9,6 +9,7 @@ import { ImageConverterComponent } from '../tools/server-side/image-converter/im
|
|||||||
import { WordCounterComponent } from '../tools/client-side/word-counter/word-counter.component';
|
import { WordCounterComponent } from '../tools/client-side/word-counter/word-counter.component';
|
||||||
import { ColorPickerComponent } from '../tools/client-side/color-picker/color-picker.component';
|
import { ColorPickerComponent } from '../tools/client-side/color-picker/color-picker.component';
|
||||||
import { QrCodeGeneratorComponent } from '../tools/client-side/qr-code-generator/qr-code-generator.component';
|
import { QrCodeGeneratorComponent } from '../tools/client-side/qr-code-generator/qr-code-generator.component';
|
||||||
|
import { OracleGuidConverterComponent } from '../tools/client-side/oracle-guid-converter/oracle-guid-converter.component';
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{
|
{
|
||||||
@@ -60,6 +61,11 @@ export const routes: Routes = [
|
|||||||
path: 'color-picker',
|
path: 'color-picker',
|
||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
component: ColorPickerComponent
|
component: ColorPickerComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'oracle-guid-converter',
|
||||||
|
pathMatch: 'full',
|
||||||
|
component: OracleGuidConverterComponent
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,11 @@ export class HeaderComponent implements OnInit {
|
|||||||
label: 'Ascii to text',
|
label: 'Ascii to text',
|
||||||
routerLink: 'ascii-to-text',
|
routerLink: 'ascii-to-text',
|
||||||
routerLinkActiveOptions: { exact: true }
|
routerLinkActiveOptions: { exact: true }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Oracle GUID Converter',
|
||||||
|
routerLink: 'oracle-guid-converter',
|
||||||
|
routerLinkActiveOptions: { exact: true }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<div class="container">
|
||||||
|
<h2>GUID to Oracle RAW(16) Converter</h2>
|
||||||
|
|
||||||
|
<div class="conversion-section">
|
||||||
|
<h3>Convert GUID to RAW(16)</h3>
|
||||||
|
<label for="guidInput">Enter GUID:</label>
|
||||||
|
<input id="guidInput" [(ngModel)]="guidInput" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" />
|
||||||
|
<button (click)="onConvertToRaw()">Convert to RAW(16)</button>
|
||||||
|
|
||||||
|
<ng-container *ngIf="rawOutput as output">
|
||||||
|
<p><strong>RAW(16) Output:</strong></p>
|
||||||
|
<p>{{ output }}</p>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="conversion-section">
|
||||||
|
<h3>Convert RAW(16) to GUID</h3>
|
||||||
|
<label for="rawOutput">Enter RAW(16):</label>
|
||||||
|
<input id="rawOutput" [(ngModel)]="rawOutput" placeholder="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
|
||||||
|
<button (click)="onConvertToGuid()">Convert to GUID</button>
|
||||||
|
|
||||||
|
<ng-container *ngIf="convertedGuid as converted">
|
||||||
|
<p><strong>GUID Output:</strong></p>
|
||||||
|
<p>{{ converted }}</p>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
h2, h3, label {
|
||||||
|
color: #a5a5a5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.conversion-section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:host ::ng-deep p { // Idk about this -.-
|
||||||
|
color: #a5a5a5;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding: 10px 20px;
|
||||||
|
font-size: 16px;
|
||||||
|
background-color: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-oracle-guid-converter',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
FormsModule,
|
||||||
|
CommonModule
|
||||||
|
],
|
||||||
|
templateUrl: './oracle-guid-converter.component.html',
|
||||||
|
styleUrl: './oracle-guid-converter.component.scss'
|
||||||
|
})
|
||||||
|
export class OracleGuidConverterComponent {
|
||||||
|
guidInput: string = '';
|
||||||
|
rawOutput: string = '';
|
||||||
|
convertedGuid: string = '';
|
||||||
|
|
||||||
|
private isValidGuid(guid: string): boolean {
|
||||||
|
const guidPattern = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
||||||
|
return guidPattern.test(guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
private isValidRaw(raw: string): boolean {
|
||||||
|
const rawPattern = /^[0-9a-fA-F]{32}$/;
|
||||||
|
return rawPattern.test(raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private guidToRaw(guid: string): string {
|
||||||
|
const hexParts = guid.replace(/-/g, '');
|
||||||
|
const guidBytes = Array.from({ length: 16 }, (_, i) =>
|
||||||
|
parseInt(hexParts.substr(i * 2, 2), 16)
|
||||||
|
);
|
||||||
|
|
||||||
|
const reorderedBytes = [
|
||||||
|
guidBytes[3], guidBytes[2], guidBytes[1], guidBytes[0],
|
||||||
|
guidBytes[5], guidBytes[4],
|
||||||
|
guidBytes[7], guidBytes[6],
|
||||||
|
...guidBytes.slice(8, 16)
|
||||||
|
];
|
||||||
|
|
||||||
|
return reorderedBytes.map(b => b.toString(16).padStart(2, '0')).join('').toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
private rawToGuid(raw: string): string {
|
||||||
|
const rawBytes = Array.from({ length: 16 }, (_, i) =>
|
||||||
|
parseInt(raw.substring(i * 2, i * 2 + 2), 16)
|
||||||
|
);
|
||||||
|
|
||||||
|
const reorderedBytes = [
|
||||||
|
rawBytes[3], rawBytes[2], rawBytes[1], rawBytes[0],
|
||||||
|
rawBytes[5], rawBytes[4],
|
||||||
|
rawBytes[7], rawBytes[6],
|
||||||
|
...rawBytes.slice(8, 16)
|
||||||
|
];
|
||||||
|
|
||||||
|
const hexArray = reorderedBytes.map(b => b.toString(16).padStart(2, '0'));
|
||||||
|
|
||||||
|
return [
|
||||||
|
hexArray.slice(0, 4).join(''),
|
||||||
|
hexArray.slice(4, 6).join(''),
|
||||||
|
hexArray.slice(6, 8).join(''),
|
||||||
|
hexArray.slice(8, 10).join(''),
|
||||||
|
hexArray.slice(10, 16).join('')
|
||||||
|
].join('-');
|
||||||
|
}
|
||||||
|
|
||||||
|
onConvertToRaw(): void {
|
||||||
|
if (this.isValidGuid(this.guidInput)) {
|
||||||
|
this.rawOutput = this.guidToRaw(this.guidInput);
|
||||||
|
} else {
|
||||||
|
this.rawOutput = 'Invalid GUID format';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onConvertToGuid(): void {
|
||||||
|
if (this.isValidRaw(this.rawOutput)) {
|
||||||
|
this.convertedGuid = this.rawToGuid(this.rawOutput);
|
||||||
|
} else {
|
||||||
|
this.convertedGuid = 'Invalid RAW(16) format';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user