0
Отвечен
Force save project token value
Wouter van der Post 6 лет назад
в Приложения / i3 Pro
•
обновлен Vladimir Ovchinnikov (expert) 5 лет назад •
6
Hello,
I need to be able to forcefully store the value of a project token in a panel project. In case of power loss the token values are lost. I write the value to the token from JS, so a function like "IR.PersistTokens()" would be more than welcome.
Сервис поддержки клиентов работает на платформе UserEcho
Hello.
Project Tokens store values immediately after IR.SetVariable is run. It is recommended to create the necessary Project Tokens in the panel project in advance. The values are stored locally on the device in an xml file. If emergency shutdown of the power supply, the xml file was not corrupted, the client i3 pro when the new start will read it. Project Tokens will be obtained from this file.
I have checked this by opening the irconfig.xml file in the Client folder, but after the IR.SetVariable the file still contains the old value. Only when you close the emulator, the file is updated and the new value is written....
The token is already created in the project.
I've attached the test project so you can see, the "add 1" button adds 1 to the current token value and uses IR.SetVariable.
StoreToken.irpz
Hello.
If a Project Token is declared but not assigned a value, no entry is made to the xml file. If you make IR.SetVariable, the value of the Project Token changes, but only in memory, writing to xml does not occur. Only when the correct end of the panel project is the last value of the Project Tokens are stored in an xml file.
This makes sense, because writing to the Project Tokens can be performed every second, there can be a lot of Project Tokens and frequent access to the medium will lead to a decrease in its resource. However, most PCs have HDDs (they have a much larger resource) and are often not connected to the UPS. In that case, your question is worthy of discussion. We will consider options for recording Project Tokens, but we will need time to make a decision and implement (if the decision is made). In any case, we will inform you about the result.
If I assign a value to the token, then close the application the entry is written. If I then open the application again (so an entry is already there) it's not being updated on IR.SetVariable. So I don't understand why, in the first post, you said:
Second, you don't need to write the token value to XML directly after the IR.SetVariable. You're right the HDD's will be stressed by this if you write every second. That is why I was suggesting a function (IR.PersistTokens()) to manually store the token values. That way the programmer can decide for himself when to persist the token value to disk.
Thanks for taking this under consideration.
The token is written after IR.SetVariable, but to memory, not to the file system. Write to the file only after I3 pro is closed. . If you open i3 pro again, the value of the token will be read. However, this only works if i3 pro has been properly closed. We will think about how best to implement the preservation of the token before the process of application.
Hello.
In version 1.3.12, Project Tokens are written immediately after SetVariable is executed. The I3 pro crash now does not affect the reading of recorded tokens. Do not write tokens too often to conserve the media resource on mobile devices.