2020-05-29 15:08:55 +02:00
[![Go Report Card ](https://goreportcard.com/badge/github.com/jakoubek/feragstring )](https://goreportcard.com/report/github.com/jakoubek/feragstring)
2020-05-27 21:23:36 +02:00
# feragstring
2020-07-02 18:30:28 +02:00
*feragstring* is a Go package for creating a FERAG string file programmatically. If you don't know what FERAG (the company) or a FERAG string is you probably don't need this package ;-)
2020-05-29 11:02:33 +02:00
## The shortest possible FERAG string
According to FERAG's documentation this is the shortest possible FERAG string:
```
%2440+40DEMO2009!
%2401+11E1_ROUTE_100 !
%2402+11E1_ROUTE_100 +590+91000000+20E1 !
%2403+12R100RE001 +1300123!
%2406+11E1_ROUTE_100 !
%2441+40DEMO2009!
```
The variable values are:
- the title is 'DEMO2009'
- a route named 'E1_ROUTE_100'
- an edition called 'E1'
- a production drop 'R100RE001' with 123 copies
2020-05-28 21:23:15 +02:00
## Usage
```go
2020-07-02 18:30:28 +02:00
// create a FERAG string object
2020-05-30 08:43:10 +02:00
fs := feragstring.NewFeragString()
2020-05-28 21:23:15 +02:00
fs.SetTitleName("EDITION1")
2020-07-02 18:30:28 +02:00
// set title parameters
2020-05-28 21:23:15 +02:00
fs.TitleInfo.SetPrintObjectName("EDITION1A")
fs.TitleInfo.SetPublicationDate("2020-05-31")
fs.TitleInfo.SetCountryCode("13")
fs.TitleInfo.SetPrintObjectColor("00000000")
2020-07-02 18:30:28 +02:00
// add a product
2020-05-30 08:43:10 +02:00
pr1 := feragstring.NewProductReference()
2020-05-28 21:23:15 +02:00
pr1.SetProductName("MAIN")
pr1.SetCopiesAssigned(25000)
pr1.SetSupervision(1)
pr1.SetOverlap(5)
2020-05-30 08:43:10 +02:00
mp := feragstring.NewMissingParameter(1, 1)
2020-05-28 21:23:15 +02:00
pr1.SetMissingParameter(mp)
pr1.SetIssueReference("MAIN01")
fs.AddProductReference(pr1)
2020-05-30 08:43:10 +02:00
2020-07-02 18:30:28 +02:00
// add a route
rt := feragstring.NewRoute()
rt.SetRouteName("ROUTE001")
rt.SetRouteCode(fs.NextRouteCode())
rt.SetRampNumber(0)
rt.SetCopiesInRoute(1500)
rt.SetLimit(1)
rt.SetMaxStack(13)
rt.SetStandard(40)
rt.SetParameterN(4)
rt.SetMaxBundle(40)
rt.SetTopsheetMarker(5)
rt.SetEaMarker(0)
rt.SetTopsheetTemplateDirectory(20)
rt.AddProductReferenceNumber(1)
fs.AddRoute(rt)
// get the FERAG string (the write it to a file...)
feragString := fs.PrintOut()
2020-05-28 21:23:15 +02:00
```
2020-05-27 21:23:36 +02:00
2020-05-27 22:28:17 +02:00
## Supported messages
- Title Info (%2440)
- Title End (%2441)
- Product Reference (%2450)
- Route List Entry (%2401)
- Route Info (%2402)
2020-05-29 11:03:57 +02:00
- Production Drop (%2403)
2020-06-29 10:34:29 +02:00
- Topsheet Data for TSL (%2414)
2020-05-29 11:03:57 +02:00
- Route End (%2406)
2020-05-27 22:28:17 +02:00
2020-05-27 21:23:36 +02:00
## Installation
```bash
go get -u github.com/jakoubek/feragstring
```