Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cemheren committed Nov 21, 2022
0 parents commit 5491ac6
Show file tree
Hide file tree
Showing 77 changed files with 13,874 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
obj/wanshitong.csproj.nuget.cache
obj/wanshitong.csproj.nuget.g.props
obj/wanshitong.csproj.nuget.g.targets
obj/Debug/netcoreapp2.2/wanshitong.AssemblyInfoInputs.cache
obj/Debug/netcoreapp2.2/wanshitong.assets.cache
obj/Debug/netcoreapp2.2/wanshitong.csproj.CoreCompileInputs.cache
obj/Debug/netcoreapp2.2/wanshitong.csprojAssemblyReference.cache
keylogger
obj
bin
Index
Electron/librarian UI-darwin-x64
out
librarian-win32-x64.zip
Indexer/Screenshots
Electron/server/
37 changes: 37 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": ".NET Core Launch (Indexer)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Indexer/bin/Debug/netcoreapp2.2/Indexer.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Launch (Querier)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Querier/bin/Debug/netcoreapp2.2/Querier.dll",
"args": ["list" , "clipboard"],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
42 changes: 42 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/wanshitong.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/wanshitong.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/wanshitong.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
3 changes: 3 additions & 0 deletions Electron/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
server/*.*
36 changes: 36 additions & 0 deletions Electron/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron: Main",
"protocol": "inspector",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"runtimeArgs": [
"--remote-debugging-port=9223",
"."
],
"windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
}
},
{
"name": "Electron: Renderer",
"type": "chrome",
"request": "attach",
"port": 9223,
"webRoot": "${workspaceFolder}",
"timeout": 30000
}
],
"compounds": [
{
"name": "Electron: All",
"configurations": [
"Electron: Main",
"Electron: Renderer"
]
}
]
}
45 changes: 45 additions & 0 deletions Electron/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# electron-quick-start

**Clone and run for a quick way to see Electron in action.**

This is a minimal Electron application based on the [Quick Start Guide](https://electronjs.org/docs/tutorial/quick-start) within the Electron documentation.

**Use this app along with the [Electron API Demos](https://electronjs.org/#get-started) app for API code examples to help you get started.**

A basic Electron application needs just these files:

- `package.json` - Points to the app's main file and lists its details and dependencies.
- `main.js` - Starts the app and creates a browser window to render HTML. This is the app's **main process**.
- `index.html` - A web page to render. This is the app's **renderer process**.

You can learn more about each of these components within the [Quick Start Guide](https://electronjs.org/docs/tutorial/quick-start).

## To Use

To clone and run this repository you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line:

```bash
# Clone this repository
git clone https://github.com/electron/electron-quick-start
# Go into the repository
cd electron-quick-start
# Install dependencies
npm install
# Run the app
npm start
```

Note: If you're using Linux Bash for Windows, [see this guide](https://www.howtogeek.com/261575/how-to-run-graphical-linux-desktop-applications-from-windows-10s-bash-shell/) or use `node` from the command prompt.

## Resources for Learning Electron

- [electronjs.org/docs](https://electronjs.org/docs) - all of Electron's documentation
- [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - sample starter apps created by the community
- [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - a very basic starter Electron app
- [electron/simple-samples](https://github.com/electron/simple-samples) - small applications with ideas for taking them further
- [electron/electron-api-demos](https://github.com/electron/electron-api-demos) - an Electron app that teaches you how to use Electron
- [hokein/electron-sample-apps](https://github.com/hokein/electron-sample-apps) - small demo apps for the various Electron APIs

## License

[CC0 1.0 (Public Domain)](LICENSE.md)
8 changes: 8 additions & 0 deletions Electron/build/entitlements.mac.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
</dict>
</plist>
21 changes: 21 additions & 0 deletions Electron/build/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { notarize } = require('electron-notarize');

exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin') {
return;
}

const appName = context.packager.appInfo.productFilename;
console.log("appName: " + appName);

console.log("appleid:", process.env.APPLEID);
console.log("pass:", process.env.ITUNES_PASS);

return await notarize({
appBundleId: 'com.heren.librarian',
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLEID,
appleIdPassword: process.env.ITUNES_PASS
});
};
129 changes: 129 additions & 0 deletions Electron/contextmenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
const Pickr = require("@simonwep/pickr");
const randomWords = require("random-words");

// Show open button is a hack to handle opening the document on single click case
function CreateContextMenu(elementArray, showOpenButton) {

RemoveContextMenu();

var rect = elementArray[elementArray.length-1].getBoundingClientRect();

if (window.event.ctrlKey) {
showOpenButton = true;
}

const div = document.createElement('div');
div.className = 'context_menu';
div.id = 'contextMenu';
div.style['left'] = rect.right + "px";
div.style['top'] = rect.top + "px";

// div.innerHTML += `
// <i class="material-icons context_menu_close" onClick="RemoveContextMenu(this)">close</i>
// `;

var nodes = ds.getSelection();
if (nodes.length == 1) {

if(!showOpenButton){
openDocumentFromContextMenu();
return;
}

div.innerHTML += `
<button class="row_button context_menu_open" onClick="openDocumentFromContextMenu(this)">Open Document</button>
<div class="divider"></div>
`;
}

var sampletag = randomWords({ exactly: 2, join: '_' })

div.innerHTML += `
<div class="context_menu_label">Add a tag:</div>
<input id="context_menu_input" type="text" placeholder="${sampletag}" class="context_menu_input"/>
<button id="context_menu_submit" class="row_button context_menu_submit" onClick="SubmitContextMenu(this)">Add tag</button>
`;

document.body.appendChild(div);

//enablePickr();

return div;
}

function openDocumentFromContextMenu() {
var nodes = ds.getSelection();
var current = nodes[0];

onRowTextClick({
currentTarget: current,
})
}

function SubmitContextMenu(element) {

var nodes = ds.getSelection();
var indexAndDocId = new Object();

var i = 0;
nodes.forEach(node => {
indexAndDocId[i] = node.querySelector('#result_row_my_id').textContent
i++;
});

var tagDocModel = {
IndexAndDocId: indexAndDocId,
Tag: element.parentElement.querySelector("#context_menu_input").value
}

var response = http("POST", "http://localhost:4153/tag", JSON.stringify(tagDocModel));

var submitButton = document.getElementById("context_menu_submit");
submitButton.innerHTML = "Done";
submitButton.disabled = true;

refreshList();
}

function RemoveContextMenu(params) {
var oldMenu = document.getElementById("contextMenu");
if (oldMenu && oldMenu.parentNode) {
oldMenu.parentNode.removeChild(oldMenu);
}
}

function enablePickr() {
const pickr = Pickr.create({
el: '.color-picker',
theme: 'nano', // or 'monolith', or 'nano'
container: '.context_menu',
default: 'aliceblue',
swatches: [
'rgba(244, 67, 54, 1)',
'rgba(233, 30, 99, 1)',
'rgba(156, 39, 176, 1)',
'rgba(103, 58, 183, 1)',
'rgba(63, 81, 181, 1)',
'rgba(33, 150, 243, 1)',
'rgba(3, 169, 244, 1)',
'rgba(0, 188, 212, 1)',
'rgba(0, 150, 136, 1)',
'rgba(76, 175, 80, 1)',
'rgba(139, 195, 74, 1)',
'rgba(205, 220, 57, 1)',
'rgba(255, 235, 59, 1)',
'rgba(255, 193, 7, 1)'
],

});

pickr.on('change', (color, instance) => {
var menu = document.getElementById('contextMenu');
menu.style['backgroundColor'] = color.toHEXA();

var nodes = ds.getSelection();
nodes.forEach(node => {
node.style['backgroundColor'] = color.toHEXA();
});
});
}
Loading

0 comments on commit 5491ac6

Please sign in to comment.