review3 renames

This commit is contained in:
N
2022-09-06 17:07:35 +02:00
parent 37fadc5bb3
commit 8778ae0aef
10 changed files with 586 additions and 553 deletions

View File

@ -20,14 +20,14 @@ func ServerFromUrl(url string) *Server {
return &s
}
func (contact *ContactCard) AddUrls(urls []string) {
func (Contact *ContactCard) AddUrls(urls []string) {
for _, url := range urls {
contact.PullServers = append(contact.PullServers, ServerFromUrl(url))
Contact.PullServers = append(Contact.PullServers, ServerFromUrl(url))
}
}
func (contact *ContactCard) WritePng(filename string) {
jsonContact, _ := json.Marshal(contact)
func (Contact *ContactCard) WritePng(filename string) {
jsonContact, _ := json.Marshal(Contact)
//imgdata := base64.StdEncoding.EncodeToString(jsonContact)
size := int(math.Sqrt(float64(len(jsonContact))/3)) + 1
println(size)
@ -65,8 +65,8 @@ func (contact *ContactCard) WritePng(filename string) {
}
func (contact *ContactCard) WriteQr(filename string) {
jsonContact, _ := json.Marshal(contact)
func (Contact *ContactCard) WriteQr(FileName string) {
jsonContact, _ := json.Marshal(Contact)
qwriter := qrcode.NewQRCodeWriter()
code, err := qwriter.Encode(string(jsonContact), gozxing.BarcodeFormat_QR_CODE, 512, 512, nil)
if err != nil {
@ -81,8 +81,8 @@ func (contact *ContactCard) WriteQr(filename string) {
}
func ReadQr(fielname string) ContactCard {
var contact ContactCard
func ReadQr(FileName string) ContactCard {
var Contact ContactCard
// open and decode image file
file, _ := os.Open("qrcode.jpg")
img, _, _ := image.Decode(file)
@ -95,5 +95,5 @@ func ReadQr(fielname string) ContactCard {
result, _ := qrReader.Decode(bmp, nil)
fmt.Println(result)
return contact
return Contact
}