-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from berkekbgz/context-menu
Feat: Context menu extension
- Loading branch information
Showing
16 changed files
with
837 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import 'package:msix/src/method_extensions.dart'; | ||
import 'package:yaml/yaml.dart'; | ||
|
||
class ContextMenuConfiguration { | ||
final String dllPath; | ||
List<ContextMenuItem> items; | ||
|
||
ContextMenuConfiguration({required this.dllPath, required this.items}); | ||
|
||
List<ContextMenuComSurrogateServer> get comSurrogateServers { | ||
return items | ||
.map((e) => e.commands) | ||
.expand((e) => e) | ||
.map((e) { | ||
return ContextMenuComSurrogateServer( | ||
clsid: e.clsid, dllPath: e.customDllPath ?? dllPath); | ||
}) | ||
.toList() | ||
.unique((element) => element.clsid); | ||
} | ||
|
||
factory ContextMenuConfiguration.fromYaml(YamlMap json) { | ||
return ContextMenuConfiguration( | ||
dllPath: json['dll_path'], | ||
items: (json['items'] as YamlList) | ||
.map((e) => ContextMenuItem.fromYaml(e)) | ||
.toList()); | ||
} | ||
|
||
@override | ||
String toString() { | ||
return 'ContextMenuConfiguration{dllPath: $dllPath, items: $items}'; | ||
} | ||
} | ||
|
||
class ContextMenuItem { | ||
String type; | ||
List<ContextMenuItemCommand> commands; | ||
|
||
ContextMenuItem({required this.type, required this.commands}); | ||
|
||
factory ContextMenuItem.fromYaml(YamlMap json) { | ||
return ContextMenuItem( | ||
type: json['type'], | ||
commands: (json['commands'] as YamlList) | ||
.map((e) => ContextMenuItemCommand.fromYaml(e)) | ||
.toList()); | ||
} | ||
|
||
@override | ||
String toString() { | ||
return 'ContextMenuItem{type: $type, commands: $commands}'; | ||
} | ||
} | ||
|
||
class ContextMenuItemCommand { | ||
final String id; | ||
final String clsid; | ||
final String? customDllPath; | ||
|
||
ContextMenuItemCommand( | ||
{required this.id, required this.clsid, this.customDllPath}); | ||
|
||
factory ContextMenuItemCommand.fromYaml(YamlMap json) { | ||
return ContextMenuItemCommand( | ||
id: json['id'], | ||
clsid: json['clsid'], | ||
customDllPath: json['custom_dll']); | ||
} | ||
|
||
@override | ||
String toString() { | ||
return 'ContextMenuItemCommand{id: $id, clsid: $clsid, customDllPath: $customDllPath}'; | ||
} | ||
} | ||
|
||
class ContextMenuComSurrogateServer { | ||
final String clsid; | ||
final String dllPath; | ||
|
||
ContextMenuComSurrogateServer({required this.clsid, required this.dllPath}); | ||
|
||
@override | ||
String toString() { | ||
return 'ContextMenuComSurrogateServer{clsid: $clsid, dllPath: $dllPath}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.