Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
Backend_Storage.c
Go to the documentation of this file.
1
2
3// events here!
4class BackendCallback_Storage extends BackendCallback
5{
6
7};
8
9
10class Backend_Test_Storage
11{
12 ref BackendCallback_Storage m_cbx1;
13
14 void Backend_Test_Storage()
15 {
16 }
17
18 void ~Backend_Test_Storage()
19 {
20 m_cbx1 = null;
21 }
22
23 void Init()
24 {
25 // callback + structure
26 m_cbx1 = new BackendCallback_Storage;
27 }
28
29 void Read()
30 {
31 Print("BackendTest() -> Read Archive from StorageApi");
32 WorkshopApi wa = GetGame().GetBackendApi().GetWorkshop();
33
34 WorkshopItem s1 = wa.GetByName("Mod Prototype");
35 if( s1 )
36 {
37 s1.Download(m_cbx1, null);
38
39 Print(s1.GetStateFlags());
40 }
41
42 Print( "Page: " + wa.GetPage() ) ;
43 Print( "Page Count: " + wa.GetPageCount() ) ;
44 Print( "Page Items: " + wa.GetPageItemCount() ) ;
45 Print( "Total Items: " + wa.GetTotalItemCount() ) ;
46
47 ref array<WorkshopItem> aItems = new array<WorkshopItem>;
48 /*int itemCount = */wa.GetPageItems(aItems);
49
50 // iterate items
51 Print( "--- Listing page items ---" ) ;
52 for( int i = 0; i < aItems.Count(); i++ )
53 {
54 // name
55 Print( "aItems[" + i + "]" );
56 Print( aItems[i].Name() );
57
58 // print results
59 if (aItems[i].Author())
60 Print( " AuthorName:" + aItems[i].Author().Name() );
61 else
62 Print( " AuthorName: none (unpublished mod)" );
63 }
64
65
66 }
67
68 void Update()
69 {
70 Print("BackendTest() -> Write Archive to StorageApi");
71 WorkshopItem s1 = GetGame().GetBackendApi().GetWorkshop().GetByName("Mod Prototype");
72 if( s1 )
73 {
74// s1.Upload();
75 s1.Download(m_cbx1, null);
76
77 Print(s1.GetStateFlags());
78 }
79 }
80
81};
82
override void Init()
ArmaReforgerScripted GetGame()
Definition game.c:1398
proto bool Read(void value_in)
Workshop Api instance.
Definition WorkshopApi.c:14
Workshop Item instance.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.