main
lensfrex 2 years ago
parent 58ddf2365a
commit d81861467a
Signed by: lensfrex
GPG Key ID: B9127026310852D9
  1. 144
      app/cmd/device
  2. 21
      app/cmd/main.go
  3. 51
      app/encode/encode.go

@ -0,0 +1,144 @@
if (md.mobile())
return {
device: md.os() === 'iOS' ? md.phone() : md.os(),
platform: 'Smartphones/PDAs/Tablets'
};
// Desktop
if (lo.includes('win') && lo.includes('95'))
return {
device: 'Windows 95',
platform: 'Windows'
};
if (lo.includes('win 9x') && lo.includes('4.90'))
return {
device: 'Windows ME',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('98'))
return {
device: 'Windows 98',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('nt 5.0'))
return {
device: 'Windows 2000',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('nt 5.1'))
return {
device: 'Windows XP',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('nt 6.0'))
return {
device: 'Windows Vista',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('nt 6.1'))
return {
device: 'Windows 7',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('nt 6.2'))
return {
device: 'Windows 8',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('nt 6.3'))
return {
device: 'Windows 8',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('nt 10.0'))
return {
device: 'Windows 10',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('32'))
return {
device: 'Windows 32',
platform: 'Windows'
};
if (lo.includes('win') && lo.includes('nt'))
return {
device: 'Windows NT',
platform: 'Windows'
};
if (lo.includes('mac os'))
return {
device: 'Mac OS',
platform: 'Macintosh'
};
if (lo.includes('linux'))
return {
device: 'Linux',
platform: 'Linux'
};
if (lo.includes('unix'))
return {
device: 'Unix',
platform: 'Linux'
};
if (lo.includes('sun') && lo.includes('os'))
return {
device: 'SunOS',
platform: 'Linux'
};
if (lo.includes('ibm') && lo.includes('os'))
return {
device: 'IBM OS/2',
platform: 'Linux'
};
if (lo.includes('mac') && lo.includes('pc'))
return {
device: 'Macintosh',
platform: 'Macintosh'
};
if (lo.includes('powerpc'))
return {
device: 'PowerPC',
platform: 'Linux'
};
if (lo.includes('aix'))
return {
device: 'AIX',
platform: 'Linux'
};
if (lo.includes('hpux'))
return {
device: 'HPUX',
platform: 'Linux'
};
if (lo.includes('netbsd'))
return {
device: 'NetBSD',
platform: 'Linux'
};
if (lo.includes('bsd'))
return {
device: 'BSD',
platform: 'Linux'
};
if (lo.includes('osf1'))
return {
device: 'OSF1',
platform: 'Linux'
};
if (lo.includes('irix'))
return {
device: 'IRIX',
platform: 'Linux'
};
if (lo.includes('freebsd'))
return {
device: 'FreeBSD',
platform: 'Linux'
};
return {
device: 'Windows NT',
platform: 'Windows'
};
}

@ -5,22 +5,23 @@ import (
)
func main() {
a := "123456"
b := true
aa := []int32{1}
aa = append(aa, 12)
aa = append(aa, 23)
fmt.Println(s(a, b))
fmt.Println(aa)
}
func s(origin string, b bool) (result []rune) {
data := []rune(origin)
func s(origin string, b bool) (result []int32) {
data := []int32(origin)
dataLen := len(origin)
resultLen := (dataLen / 4) + 1
if b {
result = make([]rune, resultLen+1)
result[resultLen] = rune(resultLen)
result = make([]int32, resultLen+1)
result[resultLen] = int32(resultLen)
} else {
result = make([]rune, resultLen)
result = make([]int32, resultLen)
}
for i := 0; i < dataLen; i += 4 {
@ -32,10 +33,10 @@ func s(origin string, b bool) (result []rune) {
return result
}
func getCharAt(str []rune, index int, length int) rune {
func getCharAt(data []int32, index int, length int) int32 {
if index >= length {
return 0
} else {
return str[index]
return data[index]
}
}

@ -1,19 +1,19 @@
package encode
func XEncode(str string, key string) string {
//func XEncode(str string, key string) string {
//
//}
}
func s(origin string, b bool) (result []rune) {
data := []rune(origin)
func s(origin string, b bool) (result []int32) {
data := []int32(origin)
dataLen := len(origin)
resultLen := (dataLen / 4) + 1
if b {
result = make([]rune, resultLen+1)
result[resultLen] = rune(resultLen)
result = make([]int32, resultLen+1)
result[resultLen] = int32(resultLen)
} else {
result = make([]rune, resultLen)
result = make([]int32, resultLen)
}
for i := 0; i < dataLen; i += 4 {
@ -23,25 +23,26 @@ func s(origin string, b bool) (result []rune) {
return result
}
func l(a string, b bool) (result []rune) {
d := len(a)
data := []rune(a)
c := d - 1<<2
if b {
m := int(data[d-1])
if m < c-3 || m > c {
return nil
}
c = m
}
}
func get(str []rune, index int, length int) rune {
//
//func l(a string, b bool) (result []int32) {
// d := len(a)
// data := []int32(a)
//
// c := d - 1<<2
//
// if b {
// m := int(data[d-1])
// if m < c-3 || m > c {
// return nil
// }
// c = m
// }
//}
func get(data []int32, index int, length int) int32 {
if index >= length {
return 0
} else {
return str[index]
return data[index]
}
}

Loading…
Cancel
Save