Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const electron = require('electron')
  2. const app = electron.app
  3. const BrowserWindow = electron.BrowserWindow
  4.  
  5. class LicenceItem {
  6.     constructor(line) {
  7.         var temp = line.split("|")
  8.         this.companyName = temp[0]
  9.         this.version = temp[1]
  10.         this.beginDate = temp[2]
  11.         this.endDate = temp[3]
  12.         this.adapters = temp[4]
  13.         this.idkWhatThisis = temp[5]
  14.         this.licence = temp[6]
  15.     }
  16. }
  17.  
  18. class Adapter {
  19.     constructor(line) {
  20.         let temp = line.split("|")
  21.         this.adapterName = temp[0],
  22.             this.adapterID = temp[1]
  23.         this.isInLicence = false;
  24.     }
  25.  
  26.     checkLicence(LicenseCode) {
  27.         this.isInLicence = (adapterID & code != 0) ? true : flase
  28.     }
  29. }
  30.  
  31. class LicenceList {
  32.     constructor() {
  33.         this.licences = null
  34.         this.adapters = null
  35.         this.currentLicence = null
  36.         this.loadLicences.bind(this)
  37.         this.loadAdapters.bind(this)
  38.     }
  39.  
  40.     loadLicences(fileName) {
  41.         let data = []
  42.         const fs = require('fs')
  43.         const readline = require('readline');
  44.  
  45.         const rl = readline.createInterface({
  46.             input: fs.createReadStream(fileName),
  47.             crlfDelay: Infinity
  48.         });
  49.  
  50.         rl.on('line', (line) => {
  51.             data.push(new LicenceItem(line))
  52.         })
  53.  
  54.         rl.on('close', () => {
  55.             this.licences = data
  56.             console.log(this.licences)
  57.         })
  58.     }
  59.  
  60.     loadAdapters(fileName) {
  61.         let data = []
  62.         const fs = require('fs')
  63.         const readline = require('readline');
  64.  
  65.         const rl = readline.createInterface({
  66.             input: fs.createReadStream(fileName),
  67.             crlfDelay: Infinity
  68.         });
  69.  
  70.         rl.on('line', (line) => {
  71.             data.push(new Adapter(line))
  72.         })
  73.  
  74.         rl.on('close', _ => {
  75.             this.adapters = data
  76.             console.log(this.adapters)
  77.         })
  78.     }
  79. }
  80.  
  81. async function getLicenses() {
  82.     myLicences = new LicenceList()
  83.     myLicences.loadLicences('./res/licenceKeyLog.txt')
  84.     myLicences.loadAdapters('./res/adapters.txt')
  85.     console.log(myLicences)
  86. }
  87.  
  88. myTests();
  89.  
  90. // let mainWindow
  91.  
  92. // app.on('ready', _ => {
  93. //     mainWindow = new BrowserWindow({
  94. //         height: 400,
  95. //         width: 600
  96. //     })
  97.  
  98. //     mainWindow.on('close', _ => {
  99. //         mainWindow = null
  100. //     })
  101. // })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement