├── Documentation
├── Images
│ ├── 1.gif
│ ├── 1.png
│ ├── 2.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ ├── CreatePullReq.png
│ ├── DLandOpen.png
│ ├── EditFile.png
│ ├── ErrorFormat.png
│ ├── Fork.png
│ ├── InstallPackage.gif
│ ├── NewPullReq.png
│ ├── PullReq.png
│ ├── UnityNewProject.png
│ └── fig 1.png
├── Sys Message Library.csv
├── Sys Message Library.xlsx
└── UnityEngine.Sys API Documentation.pdf
├── Downloads
├── Old
│ ├── Sys_API_v1.0.3_Source.zip
│ ├── Sys_API_v1.0.3b.zip
│ ├── Sys_API_v1.0.4.zip
│ ├── UnityEngine.Sys_API_v1.0.3.unitypackage
│ ├── UnityEngine.Sys_API_v1.0.3b.unitypackage
│ ├── UnityEngine.Sys_API_v1.0.4.unitypackage
│ └── UnityEngine.Sys_API_v1.0.4c.unitypackage
├── Standalone
│ └── SystemInformationLogger_v1.0.0_EditorStandalone.unitypackage
└── UnityEngine.Sys_API_v1.0.5.unitypackage
├── LICENSE
├── README.md
├── Source
├── .gitignore
└── Assets
│ ├── Editor
│ ├── SysOptions.cs
│ └── SystemInformationLogger.cs
│ ├── Example.unity
│ ├── Plugins
│ └── SysAPI
│ │ ├── Documentation.txt
│ │ ├── Scripts
│ │ ├── SYS_MASTER.cs
│ │ └── SysUpdateDownloader.cs
│ │ └── vc.dxt
│ └── Sys_API
│ ├── Documentation.txt
│ ├── Examples
│ ├── Sys_API_CSharp_Example.cs
│ └── Sys_API_JS_Example.js
│ └── change.log
└── changelog.md
/Documentation/Images/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/1.gif
--------------------------------------------------------------------------------
/Documentation/Images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/1.png
--------------------------------------------------------------------------------
/Documentation/Images/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/2.png
--------------------------------------------------------------------------------
/Documentation/Images/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/3.png
--------------------------------------------------------------------------------
/Documentation/Images/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/4.png
--------------------------------------------------------------------------------
/Documentation/Images/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/5.png
--------------------------------------------------------------------------------
/Documentation/Images/CreatePullReq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/CreatePullReq.png
--------------------------------------------------------------------------------
/Documentation/Images/DLandOpen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/DLandOpen.png
--------------------------------------------------------------------------------
/Documentation/Images/EditFile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/EditFile.png
--------------------------------------------------------------------------------
/Documentation/Images/ErrorFormat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/ErrorFormat.png
--------------------------------------------------------------------------------
/Documentation/Images/Fork.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/Fork.png
--------------------------------------------------------------------------------
/Documentation/Images/InstallPackage.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/InstallPackage.gif
--------------------------------------------------------------------------------
/Documentation/Images/NewPullReq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/NewPullReq.png
--------------------------------------------------------------------------------
/Documentation/Images/PullReq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/PullReq.png
--------------------------------------------------------------------------------
/Documentation/Images/UnityNewProject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/UnityNewProject.png
--------------------------------------------------------------------------------
/Documentation/Images/fig 1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Images/fig 1.png
--------------------------------------------------------------------------------
/Documentation/Sys Message Library.csv:
--------------------------------------------------------------------------------
1 | ERROR CODE,ERROR MESSAGE,TRIGGER,USEAGE
2 | 000,Unable to establish connection.,Updater cannot connect to download server.,"Debug.LogError(""[Sys API] ERROR000: Unable to establish connection. (EC-XXX-000)""); --or-- Debug.LogError(""[Sys API] ERROR000: Unable to establish connection. (EC-XXX-""+Sys.GetLine()+"")""); "
3 | 001,[Echos WWW method errors],WWW method returned an error.,"Debug.LogError(""[Sys API] ERROR001: ""+WWW.error+"" (EC-XXX-000)""); --or-- Debug.LogError(""[Sys API] ERROR001: ""+WWW.error+"" (EC-XXX-""+Sys.GetLine()+"")""); "
4 | 002,File or path not specified.,The path defined does not exist.,"Debug.LogError(""[Sys API] ERROR002: Path or file not specified. (EC-XXX-000)""); --or-- Debug.LogError(""[Sys API] ERROR002: Path or file not specified. (EC-XXX-""+Sys.GetLine()+"")""); "
5 | 003,"Sys.Log(string, bool) has Invalid Arguments: (string) message cannot be null.",The string attribute of Sys.Log() is null.,"Debug.LogError(""[Sys API] ERROR003: Sys.Log(string, bool) has Invalid Arguments: (string) message cannot be null. (EC-XXX-000)""); --or-- Debug.LogError(""[Sys API] ERROR003: Sys.Log(string, bool) has Invalid Arguments: (string) message cannot be null. (EC-XXX-""+Sys.GetLine()+"")""); "
6 | 004,Path is null or empty.,A path variable is null or string is empty.,"Debug.LogError(""[Sys API] ERROR004: Path is null or empty. (EC-XXX-000)""); --or-- Debug.LogError(""[Sys API] ERROR004: Path is null or empty. (EC-XXX-""+Sys.GetLine()+"")""); "
7 | ,,,
8 | ,,,
9 | ,,,
10 | ,,,
11 | ,,,
12 | ,,,
13 | ,,,
14 | ,,,
15 | ,,,
16 |
--------------------------------------------------------------------------------
/Documentation/Sys Message Library.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/Sys Message Library.xlsx
--------------------------------------------------------------------------------
/Documentation/UnityEngine.Sys API Documentation.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Documentation/UnityEngine.Sys API Documentation.pdf
--------------------------------------------------------------------------------
/Downloads/Old/Sys_API_v1.0.3_Source.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Downloads/Old/Sys_API_v1.0.3_Source.zip
--------------------------------------------------------------------------------
/Downloads/Old/Sys_API_v1.0.3b.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Downloads/Old/Sys_API_v1.0.3b.zip
--------------------------------------------------------------------------------
/Downloads/Old/Sys_API_v1.0.4.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Downloads/Old/Sys_API_v1.0.4.zip
--------------------------------------------------------------------------------
/Downloads/Old/UnityEngine.Sys_API_v1.0.3.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Downloads/Old/UnityEngine.Sys_API_v1.0.3.unitypackage
--------------------------------------------------------------------------------
/Downloads/Old/UnityEngine.Sys_API_v1.0.3b.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Downloads/Old/UnityEngine.Sys_API_v1.0.3b.unitypackage
--------------------------------------------------------------------------------
/Downloads/Old/UnityEngine.Sys_API_v1.0.4.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Downloads/Old/UnityEngine.Sys_API_v1.0.4.unitypackage
--------------------------------------------------------------------------------
/Downloads/Old/UnityEngine.Sys_API_v1.0.4c.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Downloads/Old/UnityEngine.Sys_API_v1.0.4c.unitypackage
--------------------------------------------------------------------------------
/Downloads/Standalone/SystemInformationLogger_v1.0.0_EditorStandalone.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Downloads/Standalone/SystemInformationLogger_v1.0.0_EditorStandalone.unitypackage
--------------------------------------------------------------------------------
/Downloads/UnityEngine.Sys_API_v1.0.5.unitypackage:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Downloads/UnityEngine.Sys_API_v1.0.5.unitypackage
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Sys API for Unity
2 | ##### Version: v1.0.5 | Requirements: Unity5+
3 |
4 | ## About
5 | The **_Sys API_** is essentially an API layer for the _UnityEngine_. The UnitySysAPI provides developers to program common Unity methods quicker and efficently. Also it expands options for some basic operations. For example, saving a screenshot via `Application.CaptureScreenshot(“Screenshot.png”)` works pretty well and is very easy to use. However if you wanna dictate where you save that screenshot, you will have to jump through a few hoops.
6 | But with the Sys API you can simply use:
7 | ```Sys.CaptureScreenshot(this, “Path/To/Screenshot.png”);```
8 | And the Sys API will handle all of the texture encoding and file saving. Continue to _Using the Sys API_ to get started.
9 |
10 | __*If you are looking for information about contributing to the UnitySysAPI, check out [this guide](https://github.com/Alpaca-Studio/UnitySysAPI/wiki/Contributing-to-the-Sys-API).*__
11 |
12 | ## Using the Sys API
13 | The Sys API handles a variety of methods, such as: Logging/Debugging; Data Handling; Screen Capturing/Loading; Arithmetic; and System Information. We will cover a few of these below. If this is your first time using the Sys API, we recommend looking at [Getting Started](https://github.com/Alpaca-Studio/UnitySysAPI/wiki/Getting-Started) in the wiki.
14 | ### Logging and Debugging
15 | The Sys API logging and debugging methods are relatively simple and very similar to using Debug.Log. One way we elaborated upon the basic Debug.Log was to create a “silent log” that captures and timestamps log messages and then allows them to be saved to any desired location. This way developers access their log via txt file for more in depth debugging. But only user declared messages appear in the log. It does not add Engine or System logging.
16 | So to add a message to the silent log:
17 |
18 | ```Sys.Log(“This is a test!”);```
19 |
20 | If you did however want to display the message in the Console you would:
21 |
22 | ```Sys.Log(“This is a test!”, true);```
23 |
24 | This will add the message to the log file and display it in the console window.
25 |
26 | You also have the ability to clear the log at anytime with the `Sys.ClearLog();` function.
27 | To save a log file you would use:
28 |
29 | ```Sys.SaveLog("Path_To_Log_File/SysLog.txt");```
30 |
31 | Calling ‘Sys.SaveLog();’ will save to the default location of ‘[Application.persistentDataPath]/[Application.productName]/Logs/SysLog.txt’
32 |
33 | ### Data Handling
34 |
35 | Saving and Loading data is confined into two methods:
36 |
37 | ```Sys.SaveDataToFile(“Path/To/File.txt”);```
38 |
39 | And ```Sys.LoadDataFromFile(“Path/To/File.txt”);```
40 |
41 | Also with the `SaveDataToFile` method you can open the saved file’s directory in file explorer via:
42 | ```Sys.SaveDataToFile(“Path/To/File.txt”, true);```
43 | It's recommended for use during development, untested in build.
44 |
45 | The `LoadDataFromFile` method makes it simple to cast a text file a string array or list. This can be done by using:
46 |
47 | ```string[] data = Sys.LoadDataFromFile(“Path/To/File.txt”);```
48 | Or
49 | ```List data = new List (Sys.LoadDataFromFile(“Path/To/File.txt”));```
50 |
51 | Now let’s look a bit more into Screen Capturing.
52 |
53 | ### Screen Capturing/ Image Loading
54 | As stated above, capturing screenshots with the Sys API is a little different from using ```Application.CaptureScreenshot();```
55 |
56 | Anytime you use Sys screen capturing you must declare the MonoBehaviour instance as the first parameter of the method.
57 | Using `Sys.CaptureScreenshot(this);` will save a screenshot to the default location: _‘[Application.persistentDataPath]/[Application.productName]/Screenshots/MMddyyyy - hhmmss.png’._
58 |
59 | To define a path and name of a screenshot use: `Sys.CaptureScreenshot(this, “Path/To/Screenshot.png”);` as stated above.
60 |
61 | Much like `SaveDataToFile`, the `CaptureScreenshot` method will open the png directory using:
62 | ```Sys.CaptureScreenshot(this, “Path/To/Screenshot.png”, true);```
63 |
64 | Image loading is much like loading data in the section above. At this time the Sys API only allows png images to be loaded into _Texture2D_ objects. To load a png image into a texture, you would use:
65 | ```Texture2D tex = Sys.LoadImageAtPath("Path_To_Image/SomeImage.png");```
66 |
67 | Lastly we will look at System Information logging methods.
68 |
69 | ### System Information
70 | > As of v1.0.5+ SystemInfomation methods now are within the **Info** class of the [SYS_MASTER.cs](https://github.com/Alpaca-Studio/UnitySysAPI/blob/master/Source/Assets/Plugins/SysAPI/Scripts/SYS_MASTER.cs).
71 | The Sys API’s System Information methods are very useful for logging users system information. This section of the API essentially layers the _UnityEngine.SystemInfo_ variables into the Sys API. For example instead of calling `SystemInfo.batteryLevel`, you could use `Info.batteryLevel` to get the same result.
72 | You can export system info into a neatly formatted text file using:
73 | ```Info.SaveSystemInfo(“Path/To/Save/SystemInfo.txt”);```
74 | And of course open the file directory by using:
75 | ```Info.SaveSystemInfo(“Path/To/Save/SystemInfo.txt”, true);```
76 |
77 | The formatted system info can also be cast into a list by using:
78 | ```List sysInfo = new List (Info.GetSystemInfo());```
79 | [See Example](UnitySysAPI/Documentation/Images/5.png)
80 |
81 | ## Updating the Sys API via Unity Editor
82 | In the _Sys API_ source package is two c# scripts that handle updating the API via the unity editor.
83 | To update the Sys API navigate to _‘Tools/SysAPI/Options’_ or alternatively press __Control+W__ to open the Sys Options editor window.
84 | 
85 |
86 | You will see a new window appear that looks something like this:
87 | 
88 |
89 | The options window contains three buttons: __Check For Updates; Force Update;__ and __Example__. Pressing _‘Check for Updates’_ will check your version versus the latest version of the Sys API. If you have the latest version you will receive this message:
90 | 
91 |
92 | If there is an update available the newest _SYS_MASTER.cs_ will be downloaded and saved to _‘/Assets/Plugins/SysAPI/SYS_MASTER.cs’_. After updating this message will display in the console:
93 | 
94 |
95 | If somehow _SYS_MASTER.cs_ becomes corrupted you can press the _‘Force Update’_ button to grab the latest update from the server.
96 |
97 | Lastly, pressing _‘Example’_ will generate a new game object named **_SYS_** and attach _Sys_API_CSharp_Example.cs_ and _Sys_API_JS_Example.js_ scripts (same as the _'SYS'_ object in the _Example.unity_ scene).
98 |
99 | For more information try checking out the [wiki](https://github.com/Alpaca-Studio/UnitySysAPI/wiki). There’s also a few other functions not covered in this readme. And for a more “hands-on” example, a look at the .cs and .js [examples](UnitySysAPI/Source/Assets/Sys_API/Examples).
100 |
101 | _The Sys API is looking for contributors. If you would like to contribute a useful method or a shortcut, we made [this guide](https://github.com/Alpaca-Studio/UnitySysAPI/wiki/Contributing-to-the-Sys-API) to help you out.__
102 |
--------------------------------------------------------------------------------
/Source/.gitignore:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Source/Assets/Editor/SysOptions.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using UnityEngine;
5 | using UnityEditor;
6 |
7 | #if UNITY_EDITOR
8 | public class SysOptions : EditorWindow {
9 | [MenuItem("Tools/Sys API/Options %_w")]
10 | public static void ShowWindow () {
11 | EditorWindow.GetWindow(typeof(SysOptions));
12 | }
13 | [MenuItem("Tools/Sys API/Examples")]
14 | public static void GenerateExample () {
15 | GameObject newObj = new GameObject("SYS");
16 | newObj.AddComponent();
17 | newObj.AddComponent();
18 | }
19 | [MenuItem("Tools/Sys API/Check For Updates")]
20 | public static void CheckForUpdates () {
21 | EditorApplication.isPlaying = true;
22 | GameObject newObj = new GameObject("SysOptions");
23 | newObj.AddComponent();
24 | }
25 | [MenuItem("Tools/Sys API/Wiki Documentation")]
26 | public static void OpenWebpage () {
27 | Application.OpenURL("https://github.com/Alpaca-Studio/UnitySysAPI/wiki");
28 | }
29 |
30 | string _path;
31 | string _docPath;
32 | //List VC = new List();
33 | string _currentVersion;
34 | string _documentation;
35 |
36 | [SerializeField]
37 | bool _checkForUpdates;
38 | Vector2 _scrollPosition;
39 |
40 | GameObject obj;
41 |
42 | void OnEnable () {
43 | _path = Application.dataPath + "/Plugins/SysAPI/";
44 | _docPath = Application.dataPath + "/Sys_API/";
45 | if(!Directory.Exists(_path)){
46 | Directory.CreateDirectory(_path);
47 | File.Create(_path+"vc.dxt").Dispose();
48 | _currentVersion = "1.0.2";
49 | File.WriteAllText(_path+"vc.dxt", _currentVersion);
50 | //System.Diagnostics.Process.Start(_path);
51 | } else {
52 | if(File.Exists(_path+"vc.dxt")){
53 | _currentVersion = File.ReadAllLines(_path+"vc.dxt")[0];
54 | } else {
55 | File.Create(_path+"vc.dxt").Dispose();
56 | _currentVersion = "1.0.2";
57 | File.WriteAllText(_path+"vc.dxt", _currentVersion);
58 | }
59 | }
60 |
61 | _documentation = "";
62 | List docu = new List(File.ReadAllLines(_docPath+"Documentation.txt"));
63 | for(int i = 0; i < docu.Count; i++){
64 | if(i==0){
65 | _documentation += ""+docu[i]+" \n";
66 | }
67 | if(i!=0){
68 | _documentation += docu[i]+"\n";
69 | }
70 | }
71 | }
72 | void OnFocus () {
73 | if(EditorPrefs.HasKey("VC")){
74 | _currentVersion = EditorPrefs.GetString("VC");
75 | if(EditorApplication.isPlaying == false){
76 | foreach( var gObj in FindObjectsOfType(typeof(GameObject)) as GameObject[]){
77 | if(gObj.name == "SysOptions"){
78 | DestroyImmediate(gObj);
79 | }
80 | }
81 | }
82 | }
83 | }
84 | void OnLostFocus () {
85 | EditorPrefs.SetString("VC",_currentVersion);
86 |
87 | _documentation = "";
88 | List docu = new List(File.ReadAllLines(_docPath+"Documentation.txt"));
89 | for(int i = 0; i < docu.Count; i++){
90 | if(i==0){
91 | _documentation += ""+docu[i]+" \n";
92 | }
93 | if(i!=0){
94 | _documentation += docu[i]+"\n";
95 | }
96 | }
97 |
98 | if(EditorApplication.isPlaying == false){
99 | foreach( var gObj in FindObjectsOfType(typeof(GameObject)) as GameObject[]){
100 | if(gObj.name == "SysOptions"){
101 | DestroyImmediate(gObj);
102 | }
103 | }
104 | }
105 | }
106 | void OnDestroy () {
107 | EditorPrefs.SetString("VC",_currentVersion);
108 | DestroyImmediate(GameObject.Find("SysOptions"));
109 | }
110 | void OnGUI () {
111 | GUIStyle helpBox = GUI.skin.GetStyle("HelpBox");
112 | helpBox.richText = true;
113 |
114 | EditorGUILayout.Space();
115 | GUILayout.Label("Sys API v" + _currentVersion+ " Editor Options", EditorStyles.boldLabel);
116 |
117 | GUILayout.BeginHorizontal();
118 | if(GUILayout.Button("Check For Updates", EditorStyles.miniButton)){
119 | EditorPrefs.SetString("VC",_currentVersion);
120 | EditorApplication.isPlaying = true;
121 | GameObject newObj = new GameObject("SysOptions");
122 | newObj.AddComponent();
123 | }
124 | if(GUILayout.Button("Force Update", EditorStyles.miniButton)){
125 | EditorPrefs.SetString("VC",_currentVersion);
126 | EditorApplication.isPlaying = true;
127 | GameObject newObj = new GameObject("SysOptions");
128 | newObj.AddComponent();
129 | newObj.GetComponent().forceUpdate = true;
130 | }
131 | if(GUILayout.Button("Examples", EditorStyles.miniButton)){
132 | GameObject newObj = new GameObject("SYS");
133 | newObj.AddComponent();
134 | newObj.AddComponent();
135 | }
136 | GUILayout.EndHorizontal();
137 |
138 | EditorGUILayout.Space();
139 | EditorGUILayout.Space();
140 | EditorGUILayout.Space();
141 |
142 | _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition,false,false);
143 | EditorGUILayout.LabelField(_documentation, helpBox);
144 | EditorGUILayout.EndScrollView();
145 | EditorGUILayout.Space();
146 | }
147 |
148 | }
149 | #endif
150 |
--------------------------------------------------------------------------------
/Source/Assets/Editor/SystemInformationLogger.cs:
--------------------------------------------------------------------------------
1 | ///---SystemInformationLogger Editor Standalone v1.0.0---///
2 | ///Created by Alpaca Studio [ http://alpaca.studio ]///
3 | ///Provided as part of the UnitySysAPI. Check out the SysAPI here: https://github.com/Alpaca-Studio/UnitySysAPI ///
4 | using System.IO;
5 | using System.Collections;
6 | using System.Collections.Generic;
7 | using UnityEngine;
8 | using UnityEditor;
9 |
10 | #if UNITY_EDITOR
11 | public class SystemInformationLogger : EditorWindow {
12 | [MenuItem("Tools/System Info Logger")]
13 | public static void ShowWindow () {
14 | EditorWindow.GetWindow(typeof(SystemInformationLogger));
15 | }
16 | Vector2 _scrollPosition;
17 | string _path;
18 | public static List sysInfo = new List();
19 | List richTextSysInfo = new List();
20 | string sysText;
21 | void OnEnable () {
22 | sysInfo.Clear();
23 | richTextSysInfo.Clear();
24 | sysInfo.Add(" --- SystemInfo --- ");
25 | sysInfo.Add("----- " + System.DateTime.Now.ToString()+" -----" );
26 | sysInfo.Add("Battery Level : " + (SystemInfo.batteryLevel *100) + "%");
27 | sysInfo.Add("Battery Status : " + SystemInfo.batteryStatus.ToString());
28 | sysInfo.Add("Copy Texture Support : " + SystemInfo.copyTextureSupport.ToString());
29 | sysInfo.Add("Device Model : " + SystemInfo.deviceModel);
30 | sysInfo.Add("Device Name : " + SystemInfo.deviceName);
31 | sysInfo.Add("Device Type : " + SystemInfo.deviceType.ToString());
32 | sysInfo.Add("Unique Device ID : " + SystemInfo.deviceUniqueIdentifier);
33 | sysInfo.Add("Graphics Device ID : " + SystemInfo.graphicsDeviceID);
34 | sysInfo.Add("Graphics Device Name : " + SystemInfo.graphicsDeviceName);
35 | sysInfo.Add("Graphics Device Type : " + SystemInfo.graphicsDeviceType.ToString());
36 | sysInfo.Add("Graphics Device Vendor : " + SystemInfo.graphicsDeviceVendor);
37 | sysInfo.Add("Graphics Device VendorID : " + SystemInfo.graphicsDeviceVendorID);
38 | sysInfo.Add("Graphics Device Version : " + SystemInfo.graphicsDeviceVersion);
39 | sysInfo.Add("Graphics Memory Size : " + SystemInfo.graphicsMemorySize);//
40 | sysInfo.Add("Graphics Multithreaded : " + SystemInfo.graphicsMultiThreaded);
41 | sysInfo.Add("Graphics Shader Level : " + SystemInfo.graphicsShaderLevel);
42 | sysInfo.Add("Graphics UV Starts at Top? : " + SystemInfo.graphicsUVStartsAtTop);
43 | sysInfo.Add("Max Cubemap Size : " + SystemInfo.maxCubemapSize);
44 | sysInfo.Add("Max Texture Size : " + SystemInfo.maxTextureSize);
45 | sysInfo.Add("NPOT Support : " + SystemInfo.npotSupport.ToString());
46 | sysInfo.Add("OS : " + SystemInfo.operatingSystem);
47 | sysInfo.Add("OS Family : " + SystemInfo.operatingSystemFamily.ToString());
48 | sysInfo.Add("Processor Count : " + SystemInfo.processorCount);
49 | sysInfo.Add("Processor Frequency : " + (SystemInfo.processorFrequency*0.001) + "MHz");
50 | sysInfo.Add("Processor Type : " + SystemInfo.processorType);
51 | sysInfo.Add("Supported Render Targer Count : " + SystemInfo.supportedRenderTargetCount);
52 | if(SystemInfo.supports2DArrayTextures){sysInfo.Add("Supports 2D Array Textures : Yes");} else { sysInfo.Add("Supports 2D Array Textures : No");}
53 | if(SystemInfo.supports3DRenderTextures){sysInfo.Add("Supports 3D Render Textures : Yes");} else { sysInfo.Add("Supports 3D Render Textures : No");}
54 | if(SystemInfo.supports3DTextures){sysInfo.Add("Supports 3D Textures : Yes");} else { sysInfo.Add("Supports 3D Textures : No");}
55 | if(SystemInfo.supportsAccelerometer){sysInfo.Add("Supports Accelerometer : Yes");} else { sysInfo.Add("Supports Accelerometer : No");}
56 | if(SystemInfo.supportsAudio){sysInfo.Add("Supports Audio : Yes");} else { sysInfo.Add("Supports Audio : No");}
57 | if(SystemInfo.supportsComputeShaders){sysInfo.Add("Supports Compute Shaders : Yes");} else { sysInfo.Add("Supports Compute Shaders : No");}
58 | if(SystemInfo.supportsCubemapArrayTextures){sysInfo.Add("Supports Cubemap Array Textures : Yes");} else { sysInfo.Add("Supports Cubemap Array Textures : No");}
59 | if(SystemInfo.supportsGyroscope){sysInfo.Add("Supports Gyroscope : Yes");} else { sysInfo.Add("Supports Gyroscope : No");}
60 | if(SystemInfo.supportsImageEffects){sysInfo.Add("Supports Image Effects : Yes");} else { sysInfo.Add("Supports Image Effects : No");}
61 | if(SystemInfo.supportsInstancing){sysInfo.Add("Supports Instancing : Yes");} else { sysInfo.Add("Supports Instancing : No");}
62 | if(SystemInfo.supportsLocationService){sysInfo.Add("Supports Location Services : Yes");} else { sysInfo.Add("Supports Location Services : No");}
63 | if(SystemInfo.supportsMotionVectors){sysInfo.Add("Supports Motion Vectors : Yes");} else { sysInfo.Add("Supports Motion Vectors : No");}
64 | if(SystemInfo.supportsRawShadowDepthSampling){sysInfo.Add("Supports Raw Shadow Depth Sampling : Yes");} else { sysInfo.Add("Supports Raw Shadow Depth Sampling : No");}
65 | if(SystemInfo.supportsRenderToCubemap){sysInfo.Add("Supports Render To Cubemap : Yes");} else { sysInfo.Add("Supports Render To Cubemap : No");}
66 | if(SystemInfo.supportsShadows){sysInfo.Add("Supports Shadows : Yes");} else { sysInfo.Add("Supports Shadows : No");}
67 | if(SystemInfo.supportsSparseTextures){sysInfo.Add("Supports Sparse Textures : Yes");} else { sysInfo.Add("Supports Sparse Textures : No");}
68 | if(SystemInfo.supportsVibration){sysInfo.Add("Supports Vibration : Yes");} else { sysInfo.Add("Supports Vibration : No");}
69 | sysInfo.Add("System Memory Size : " + SystemInfo.systemMemorySize);
70 | sysInfo.Add("Unsupported Identifier : " + SystemInfo.unsupportedIdentifier);
71 | if(SystemInfo.usesReversedZBuffer){sysInfo.Add("Uses Reversed Z Buffer : Yes");} else { sysInfo.Add("Uses Reversed Z Buffer : No");}
72 | sysInfo.Add(string.Format("{0} {1}", "", System.Environment.NewLine));
73 | sysInfo.Add("'System Information Logger' is part of the Sys API by Alpaca Studio" );
74 | sysInfo.Add(string.Format("{0} {1}", "", System.Environment.NewLine));
75 | GetRichText();
76 | }
77 |
78 | void GetRichText () {
79 | int i = 0;
80 | sysText = string.Empty;
81 | richTextSysInfo.Add(" --- SystemInfo --- ");
82 | richTextSysInfo.Add("----- " + System.DateTime.Now.ToString()+" -----" );
83 | richTextSysInfo.Add("Battery Level : " + ""+(SystemInfo.batteryLevel *100) + "%"+"");
84 | richTextSysInfo.Add("Battery Status : " + ""+SystemInfo.batteryStatus.ToString()+"");
85 | richTextSysInfo.Add("Copy Texture Support : " + ""+SystemInfo.copyTextureSupport.ToString()+"");
86 | richTextSysInfo.Add("Device Model : " + ""+SystemInfo.deviceModel+"");
87 | richTextSysInfo.Add("Device Name : " + ""+SystemInfo.deviceName+"");
88 | richTextSysInfo.Add("Device Type : " + ""+SystemInfo.deviceType.ToString()+"");
89 | richTextSysInfo.Add("Unique Device ID : " + ""+SystemInfo.deviceUniqueIdentifier+"");
90 | richTextSysInfo.Add("Graphics Device ID : " + ""+SystemInfo.graphicsDeviceID+"");
91 | richTextSysInfo.Add("Graphics Device Name : " + ""+SystemInfo.graphicsDeviceName+"");
92 | richTextSysInfo.Add("Graphics Device Type : " + ""+SystemInfo.graphicsDeviceType.ToString()+"");
93 | richTextSysInfo.Add("Graphics Device Vendor : " + ""+SystemInfo.graphicsDeviceVendor+"");
94 | richTextSysInfo.Add("Graphics Device VendorID : " + ""+SystemInfo.graphicsDeviceVendorID+"");
95 | richTextSysInfo.Add("Graphics Device Version : " + ""+SystemInfo.graphicsDeviceVersion+"");
96 | richTextSysInfo.Add("Graphics Memory Size : " + ""+SystemInfo.graphicsMemorySize+"");//
97 | richTextSysInfo.Add("Graphics Multithreaded : " + ""+SystemInfo.graphicsMultiThreaded+"");
98 | richTextSysInfo.Add("Graphics Shader Level : " + ""+SystemInfo.graphicsShaderLevel+"");
99 | richTextSysInfo.Add("Graphics UV Starts at Top? : " + ""+SystemInfo.graphicsUVStartsAtTop+"");
100 | richTextSysInfo.Add("Max Cubemap Size : " + ""+SystemInfo.maxCubemapSize+"");
101 | richTextSysInfo.Add("Max Texture Size : " + ""+SystemInfo.maxTextureSize+"");
102 | richTextSysInfo.Add("NPOT Support : " + ""+SystemInfo.npotSupport.ToString()+"");
103 | richTextSysInfo.Add("OS : " + ""+SystemInfo.operatingSystem+"");
104 | richTextSysInfo.Add("OS Family : " + ""+SystemInfo.operatingSystemFamily.ToString()+"");
105 | richTextSysInfo.Add("Processor Count : " + ""+SystemInfo.processorCount+"");
106 | richTextSysInfo.Add("Processor Frequency : " + ""+(SystemInfo.processorFrequency*0.001) + "MHz"+"");
107 | richTextSysInfo.Add("Processor Type : " + ""+SystemInfo.processorType+"");
108 | richTextSysInfo.Add("Supported Render Targer Count : " + ""+SystemInfo.supportedRenderTargetCount+"");
109 | if(SystemInfo.supports2DArrayTextures){richTextSysInfo.Add("Supports 2D Array Textures : Yes");} else { richTextSysInfo.Add("Supports 2D Array Textures : No");}
110 | if(SystemInfo.supports3DRenderTextures){richTextSysInfo.Add("Supports 3D Render Textures : Yes");} else { richTextSysInfo.Add("Supports 3D Render Textures : No");}
111 | if(SystemInfo.supports3DTextures){richTextSysInfo.Add("Supports 3D Textures : Yes");} else { richTextSysInfo.Add("Supports 3D Textures : No");}
112 | if(SystemInfo.supportsAccelerometer){richTextSysInfo.Add("Supports Accelerometer : Yes");} else { richTextSysInfo.Add("Supports Accelerometer : No");}
113 | if(SystemInfo.supportsAudio){richTextSysInfo.Add("Supports Audio : Yes");} else { richTextSysInfo.Add("Supports Audio : No");}
114 | if(SystemInfo.supportsComputeShaders){richTextSysInfo.Add("Supports Compute Shaders : Yes");} else { richTextSysInfo.Add("Supports Compute Shaders : No");}
115 | if(SystemInfo.supportsCubemapArrayTextures){richTextSysInfo.Add("Supports Cubemap Array Textures : Yes");} else { richTextSysInfo.Add("Supports Cubemap Array Textures : No");}
116 | if(SystemInfo.supportsGyroscope){richTextSysInfo.Add("Supports Gyroscope : Yes");} else { richTextSysInfo.Add("Supports Gyroscope : No");}
117 | if(SystemInfo.supportsImageEffects){richTextSysInfo.Add("Supports Image Effects : Yes");} else { richTextSysInfo.Add("Supports Image Effects : No");}
118 | if(SystemInfo.supportsInstancing){richTextSysInfo.Add("Supports Instancing : Yes");} else { richTextSysInfo.Add("Supports Instancing : No");}
119 | if(SystemInfo.supportsLocationService){richTextSysInfo.Add("Supports Location Services : Yes");} else { richTextSysInfo.Add("Supports Location Services : No");}
120 | if(SystemInfo.supportsMotionVectors){richTextSysInfo.Add("Supports Motion Vectors : Yes");} else { richTextSysInfo.Add("Supports Motion Vectors : No");}
121 | if(SystemInfo.supportsRawShadowDepthSampling){richTextSysInfo.Add("Supports Raw Shadow Depth Sampling : Yes");} else { richTextSysInfo.Add("Supports Raw Shadow Depth Sampling : No");}
122 | if(SystemInfo.supportsRenderToCubemap){richTextSysInfo.Add("Supports Render To Cubemap : Yes");} else { richTextSysInfo.Add("Supports Render To Cubemap : No");}
123 | if(SystemInfo.supportsShadows){richTextSysInfo.Add("Supports Shadows : Yes");} else { richTextSysInfo.Add("Supports Shadows : No");}
124 | if(SystemInfo.supportsSparseTextures){richTextSysInfo.Add("Supports Sparse Textures : Yes");} else { richTextSysInfo.Add("Supports Sparse Textures : No");}
125 | if(SystemInfo.supportsVibration){richTextSysInfo.Add("Supports Vibration : Yes");} else { richTextSysInfo.Add("Supports Vibration : No");}
126 | richTextSysInfo.Add("System Memory Size : " + ""+SystemInfo.systemMemorySize+"");
127 | richTextSysInfo.Add("Unsupported Identifier : " + ""+SystemInfo.unsupportedIdentifier+"");
128 | if(SystemInfo.usesReversedZBuffer){richTextSysInfo.Add("Uses Reversed Z Buffer : Yes");} else { richTextSysInfo.Add("Uses Reversed Z Buffer : No");}
129 | richTextSysInfo.Add(string.Format("{0} {1}", "", System.Environment.NewLine));
130 | richTextSysInfo.Add("**'System Information Logger' is part of the Unity Sys API by Alpaca Studio**" );
131 | richTextSysInfo.Add(string.Format("{0} {1}", "", System.Environment.NewLine));
132 | foreach(string ab in richTextSysInfo){
133 | if(i <=1){
134 | string cd = ""+ab+"";
135 | sysText += string.Format("{0}{1}", cd.ToString(), System.Environment.NewLine);
136 | }else{
137 | sysText += string.Format("{0}{1}", ab.ToString(), System.Environment.NewLine);
138 | }
139 | i++;
140 | }
141 |
142 |
143 | }
144 | void OnGUI () {
145 | GUIStyle helpBox = GUI.skin.GetStyle("HelpBox");
146 | helpBox.richText = true;
147 |
148 | EditorGUILayout.Space();
149 | GUILayout.Label("Sys API System Information Logger", EditorStyles.boldLabel);
150 |
151 | GUILayout.BeginHorizontal();
152 | EditorGUILayout.Space();
153 | if(GUILayout.Button("Export System Information", EditorStyles.miniButton)){
154 | //string fileName = "SystemInformation[" + System.DateTime.Now.ToString("MMddyyyy_hhmmss") +"].txt";
155 | string fileName = "SystemInformation.txt";
156 | if(!File.Exists(fileName))File.Create(fileName).Dispose();
157 | string _path = EditorUtility.SaveFilePanel("Export System Information File",Application.dataPath,fileName,"txt");
158 | //int i = 0;
159 | if(_path != string.Empty){
160 | File.Create(_path).Dispose();
161 | foreach(string ab in sysInfo){
162 | File.AppendAllText(_path, string.Format("{0} {1}", ab, System.Environment.NewLine));
163 | //i++;
164 | }
165 | System.Diagnostics.Process.Start(_path);
166 | } else {
167 | Debug.LogError("[Sys API] ERROR002: Path or file not specified.(EC-SIL-162)");
168 | }
169 | }
170 | EditorGUILayout.Space();
171 | GUILayout.EndHorizontal();
172 |
173 | EditorGUILayout.Space();
174 | EditorGUILayout.Space();
175 | EditorGUILayout.Space();
176 | GUILayout.Label("System Information", EditorStyles.boldLabel);
177 | _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition,false,false);
178 | EditorGUILayout.LabelField(sysText, helpBox);
179 | EditorGUILayout.EndScrollView();
180 | EditorGUILayout.Space();
181 | }
182 | void OnDestroy(){
183 | sysInfo.Clear();
184 | richTextSysInfo.Clear();
185 | sysText = "";
186 | }
187 | }
188 | #endif
189 |
--------------------------------------------------------------------------------
/Source/Assets/Example.unity:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/8f90bc5ac4b6ba627af5662de7a50595723f7564/Source/Assets/Example.unity
--------------------------------------------------------------------------------
/Source/Assets/Plugins/SysAPI/Documentation.txt:
--------------------------------------------------------------------------------
1 | UnityEngine.Sys API Documentation v1.0.4b
2 | Revised: 10/10/2017
3 |
4 |
5 | LOGGING METHODS:
6 | public static void Log(string message)
7 | -Sends a debug message to the Sys.Log that can be exported to a text file when 'SaveLog()' is called.
8 | PARAMETERS:
9 | message - the debug message to be displayed in the exported Sys.Log file.
10 | USEAGE:
11 | Sys.Log("This is a test!");
12 | _________________________________________________________________________________________
13 | public static void Log(string message, bool showInConsole)
14 | -Sends a debug message to the Sys.Log that can be exported to a text file when 'SaveLog()' is called.
15 | -When showInConsole is true the debug message will be appear debug to console (via 'Debug.Log' method).
16 | PARAMETERS:
17 | message - the debug message to be displayed in the exported Sys.Log file.
18 | showInConsole - if true, the Sys.Log message will also be send to the console via Debug.Log method.
19 | USEAGE:
20 | Sys.Log("This is a test!" , true);
21 | __________________________________________________________________________________________
22 | public static void ClearLog()
23 | -Clears the Sys.Log cache.
24 | USEAGE:
25 | Sys.ClearLog();
26 | __________________________________________________________________________________________
27 | public static void SaveLog()
28 | -Saves Sys.Log data to default location: ' Application.persistentDataPath + "/" + Application.productName + "/Logs/SysLog.txt" '.
29 | USEAGE:
30 | Sys.SaveLog();
31 | __________________________________________________________________________________________
32 | public static void SaveLog(string path)
33 | -Saves Sys.Log data to a specified path.
34 | PARAMETERS:
35 | path - desired path to save the Sys.Log as a text file.
36 | USEAGE:
37 | Sys.SaveLog("Path_To_Log_File/SysLog.txt");
38 | __________________________________________________________________________________________
39 | public static void SaveLog(string path, bool openDirectory)
40 | -Saves Sys.Log data to a specified path then opens file directory upon save.
41 | PARAMETERS:
42 | path - desired path to save the Sys.Log as a text file.
43 | openDirectory - if true, File Explorer will open the containing folder of your saved file (Desktop Only).
44 | USEAGE:
45 | Sys.SaveLog("Path_To_Log_File/SysLog.txt", true);
46 | __________________________________________________________________________________________
47 |
48 |
49 |
50 | FILE SAVE/LOAD METHODS:
51 | public static void SaveDataToFile(string path, string[] data)
52 | -Saves string array to a specified path. (Path must include file name and extension.)
53 | -Alternatively, 'Sys.SaveFile(string path, string[] data)' will perfrom the same operation.
54 | PARAMETERS:
55 | path - desired path to save the text file.
56 | data - the string array to be saved to text file.
57 | USEAGE:
58 | public string[] data = new string[]{"a","b","c"};
59 | Sys.SaveDataToFile("Path_To_Text_File/SomeFile.txt", data);
60 | __________________________________________________________________________________________
61 | public static void SaveDataToFile(string path, string[] data, bool openDirectory)
62 | -Saves string array to a specified path then opens file directory upon save. (Path must include file name and extension.)
63 | -Alternatively, 'Sys.SaveFile(string path, string[] data, bool openDirectory)' will perfrom the same operation.
64 | PARAMETERS:
65 | path - desired path to save the text file.
66 | data - the string array to be saved to text file.
67 | openDirectory - if true, File Explorer will open the containing folder of your saved file (Desktop Only).
68 | USEAGE:
69 | public string[] data = new string[]{"a","b","c"};
70 | Sys.SaveDataToFile("Path_To_Text_File/SomeFile.txt", data, true);
71 | __________________________________________________________________________________________
72 | public static string[] LoadDataFromFile (string path)
73 | -Loads data from a specified path and returns it as a string array. (Path must include file name and extension.)
74 | -Alternatively, 'Sys.ReadFile(string path)' will perfrom the same operation.
75 | PARAMETERS:
76 | path - path containing text file to be read and cast to an array of strings.
77 | USEAGE:
78 | public string[] data;
79 | data = Sys.LoadDataFromFile("Path_To_Text_File/SomeFile.txt");
80 | __________________________________________________________________________________________
81 | public static List LoadDataFromFile (string path)
82 | -Loads data from a specified path and returns it as a list of strings. (Path must include file name and extension.)
83 | -Alternatively, 'Sys.ReadFile(string path)' will perfrom the same operation.
84 | PARAMETERS:
85 | path - path containing text file to be read and cast to list of strings.
86 | USEAGE:
87 | public List data;
88 | data = Sys.LoadDataFromFile("Path_To_Text_File/SomeFile.txt");
89 | __________________________________________________________________________________________
90 |
91 |
92 |
93 | SCREEN CAPTURING METHODS:
94 | public static void CaptureScreenshot (MonoBehaviour instance)
95 | -Saves a screenshot to default location: Application.persistentDataPath + "/" + Application.productName+ "/Screenshots/" + System.DateTime.Now.ToString("MMddyyyy - hhmmss") + ".png"
96 | PARAMETERS:
97 | instance - the instance calling the CaptureScreenshot method. Use 'this' by default.
98 | USEAGE:
99 | Sys.CaptureScreenshot(this);
100 | __________________________________________________________________________________________
101 | public static void CaptureScreenshot (MonoBehaviour instance, string path,)
102 | -Saves a screenshot to a specified path. (Path must include file name and '.png' extension.)
103 | PARAMETERS:
104 | instance - the instance calling the CaptureScreenshot method. Use 'this' by default.
105 | path - the path to save screenshot as png file.
106 | USEAGE:
107 | Sys.CaptureScreenshot(this, "Path_To_Screenshots/SomeScreenshot.png");
108 | __________________________________________________________________________________________
109 | public static void CaptureScreenshot (MonoBehaviour instance, string path, bool openDirectory)
110 | -Saves a screenshot to a specified path then opens the png image upon save. (Path must include file name and '.png' extension.)
111 | PARAMETERS:
112 | instance - the instance calling the CaptureScreenshot method. Use 'this' by default.
113 | path - the path to save screenshot as png file.
114 | openDirectory - if true, the saved png will open with the systems default image viewer (Desktop Only).
115 | USEAGE:
116 | Sys.CaptureScreenshot(this, "Path_To_Screenshots/SomeScreenshot.png", true);
117 | __________________________________________________________________________________________
118 | public static Texture2D ScreenToTexture2D ()
119 | -Captures and returns screenshot as Texture2D. (Not Recommended - Bugged)
120 | USEAGE:
121 | public Texture2D tex;
122 | tex = Sys.ScreenToTexture2D();
123 | __________________________________________________________________________________________
124 | public static Texture2D LoadImageAtPath(string path)
125 | -Loads an image from a specified path and returns it as Texture2D.
126 | PARAMETERS:
127 | path - the path containing the desired png image.
128 | USEAGE:
129 | public Texture2D tex;
130 | tex = Sys.LoadImageAtPath("Path_To_Image/SomeImage.png");
131 | __________________________________________________________________________________________
132 |
133 |
134 |
135 | BASIC ARITHMETIC METHODS:
136 | public static int Add(int a, int b, int c, int d)
137 | -Returns sum of any given multiple values.
138 | -Will add anywhere from two to four separate values.
139 | PARAMETERS:
140 | a - value to be added.
141 | b - value to be added.
142 | c - value to be added.
143 | d - value to be added.
144 | USEAGE:
145 | public int sum;
146 | sum = Sys.Add(1,2,3,4);
147 | __________________________________________________________________________________________
148 | public static float Add(float a, float b, float c, float d)
149 | -Returns sum of any given multiple values.
150 | -Will add anywhere from two to four separate values.
151 | PARAMETERS:
152 | a - value to be added.
153 | b - value to be added.
154 | c - value to be added.
155 | d - value to be added.
156 | USEAGE:
157 | public float sum;
158 | sum = Sys.Add(1.2f,2.2f,3.4f,4.5f);
159 | __________________________________________________________________________________________
160 | public static int Subtract(int a, int b, int c, int d)
161 | -Returns sum of any given multiple values.
162 | -Will subtract anywhere from two to four separate values.
163 | PARAMETERS:
164 | a - value to be subtracted.
165 | b - value to be subtracted.
166 | c - value to be subtracted.
167 | d - value to be subtracted.
168 | USEAGE:
169 | public int sum;
170 | sum = Sys.Subtract(1,2,3,4);
171 | __________________________________________________________________________________________
172 | public static float Subtract(float a, float b, float c, float d)
173 | -Returns sum of any given multiple values.
174 | -Will subtract anywhere from two to four separate values.
175 | PARAMETERS:
176 | a - value to be subtracted.
177 | b - value to be subtracted.
178 | c - value to be subtracted.
179 | d - value to be subtracted.
180 | USEAGE:
181 | public float sum;
182 | sum = Sys.Subtract(1.2f,2.2f,3.4f,4.5f);
183 | __________________________________________________________________________________________
184 | public static int Multiply(int a, int b, int c)
185 | -Returns sum of any given multiple values.
186 | -Will multiply anywhere from two to four separate values.
187 | PARAMETERS:
188 | a - value to be multiplied.
189 | b - value to be multiplied.
190 | c - value to be multiplied.
191 | d - value to be multiplied.
192 | USEAGE:
193 | public int sum;
194 | sum = Sys.Multiply(1,2,3,4);
195 | __________________________________________________________________________________________
196 | public static float Multiply(float a, float b, float c)
197 | -Returns sum of any given multiple values.
198 | -Will multiply anywhere from two to four separate values.
199 | PARAMETERS:
200 | a - value to be multiplied.
201 | b - value to be multiplied.
202 | c - value to be multiplied.
203 | d - value to be multiplied.
204 | USEAGE:
205 | public float sum;
206 | sum = Sys.Multiply(1.2f,2.2f,3.4f,4.5f);
207 | __________________________________________________________________________________________
208 | public static float Divide(float a, float b)
209 | -This will return the quotient of the given values.
210 | -Can return only float values.
211 | PARAMETERS:
212 | a - value to be divided.
213 | b - value to be divided.
214 | USEAGE:
215 | public int sum;
216 | sum = Sys.Divide(1.2f,2.2f);
217 | __________________________________________________________________________________________
218 |
219 |
220 |
221 | SYSTEM INFORMATION METHODS:
222 | public static void SaveSystemInfo (string path)
223 | -Saves UnityEngine.SystemInfo data to a neatly formated text file at a specified path. (Path must include file name and extension.)
224 | PARAMETERS:
225 | path - the path to save UnityEngine.SystemInfo as a formatted text file.
226 | USEAGE:
227 | Sys.SaveSystemInfo("Path_To_Save/SystemInfo.txt");
228 | __________________________________________________________________________________________
229 | public static void SaveSystemInfo (string path, bool openDirectory)
230 | -Saves UnityEngine.SystemInfo data to a neatly formated text file at a specified path then opens file directory upon save. (Path must include file name and extension.)
231 | PARAMETERS:
232 | path - the path to save UnityEngine.SystemInfo as a formatted text file.
233 | openDirectory - if true, File Explorer will open the containing folder of your saved file (Desktop Only).
234 | USEAGE:
235 | Sys.SaveSystemInfo("Path_To_Save/SystemInfo.txt", true);
236 | __________________________________________________________________________________________
237 | public static List GetSystemInfo ()
238 | -Returns formatted UnityEngine.SystemInfo to a list of strings.
239 | USEAGE:
240 | public List systemInfo;
241 | systemInfo = Sys.GetSystemInfo();
242 | __________________________________________________________________________________________
243 |
244 |
245 |
246 | UNIQUE IDENTIFIER GENERATION METHODS:
247 | public static string GenerateUniqueID(int length)
248 | -Returns a randomly generated identification code of any given length.
249 | PARAMETERS:
250 | length - desired length of the returned unique identifier.
251 | USEAGE:
252 | public string uniqueID;
253 | unique = Sys.GenerateUniqueID(21);
254 | __________________________________________________________________________________________
255 |
--------------------------------------------------------------------------------
/Source/Assets/Plugins/SysAPI/Scripts/SYS_MASTER.cs:
--------------------------------------------------------------------------------
1 | //---SYS_MASTER.cs v1.0.5--- Created by Alpaca Studio [ http://alpaca.studio ]//
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System;
5 | using System.IO;
6 | using UnityEngine;
7 |
8 | namespace UnityEngine
9 | {
10 | public class Sys : MonoBehaviour
11 | {
12 |
13 | public static string temp;
14 | public static List logRaw = new List();
15 | public static List logData = new List();
16 | public static Dictionary messages = new Dictionary();
17 | public static string lastPath;
18 |
19 | ///LOGGING METHODS///
20 | public static void addMessage(string code, string message)
21 | {
22 | messages.Add(code, message);
23 | }
24 |
25 | public static void Log (string message, bool showInConsole) {
26 | if(message != null){
27 | temp = message;
28 | if(showInConsole){Debug.Log(message);}
29 | Handle(temp);
30 | } else {
31 | LogError("[Sys API] ERROR003: Sys.Log(string, bool) has Invalid Arguments: (string) message cannot be null. "+Sys.GetErrorStackTrace(),true);
32 | }
33 | }
34 |
35 | public static void Log(string message)
36 | {
37 | Log(message, false);
38 | }
39 |
40 | public static void LogCode(string messageCode)
41 | {
42 | Log(messages[messageCode], false);
43 | }
44 |
45 | public static void LogCode(string messageCode, bool showInConsole)
46 | {
47 | Log(messages[messageCode], showInConsole);
48 | }
49 |
50 | public static void LogCode(string messageCode, MonoBehaviour M)
51 | {
52 | LogCode(messageCode, M, false);
53 | }
54 |
55 | public static void LogCode(string messageCode, MonoBehaviour M, bool showInConsole)
56 | {
57 | Log(messages[messageCode].ToString() + " from " + M.ToString() + " ID# " + M.GetInstanceID(), showInConsole);
58 | }
59 |
60 | public static void LogError(string message)
61 | {
62 | LogError(message, false);
63 | }
64 |
65 | public static void LogError (string message, bool showInConsole) {
66 | if(message != null){
67 | temp = message + " - " + GetErrorStackTrace(-1);
68 | if(showInConsole){Debug.LogError(message);}
69 | HandleError(temp);
70 | } else {
71 | LogError("[Sys API] ERROR003: Sys.LogError(string, bool) has Invalid Arguments: (string) message cannot be null. "+Sys.GetErrorStackTrace(),true);
72 | }
73 | }
74 | private static void Handle(string message)
75 | {
76 | string output = "[" + System.DateTime.Now + "]: " + message;
77 | logData.Add(output);
78 | logRaw.Add(message);
79 | }
80 |
81 | private static void HandleError(string message)
82 | {
83 | string output = "[" + System.DateTime.Now + "]: ERROR!!! " + message;
84 | logData.Add(output);
85 | logRaw.Add(message);
86 | }
87 |
88 | // Deletes all entries in the log file
89 | public static void ClearLog()
90 | {
91 | if (lastPath == null) { lastPath = Application.persistentDataPath + "/" + Application.productName + "/Logs/SysLog.txt"; }
92 | if (!Directory.Exists(System.IO.Path.GetDirectoryName(lastPath)))
93 | {
94 | Directory.CreateDirectory(System.IO.Path.GetDirectoryName(lastPath));
95 | File.Create(lastPath).Dispose();
96 | }
97 | else
98 | {
99 | if (!File.Exists(lastPath))
100 | {
101 | File.Create(lastPath).Dispose();
102 | }
103 | else
104 | {
105 | File.WriteAllLines(lastPath, new string[] { "" });
106 | }
107 | }
108 | logData.Clear();
109 | logRaw.Clear();
110 | }
111 |
112 | // Save the log to its location
113 | public static void SaveLog()
114 | {
115 | //logData.Clear();
116 | string path = Application.persistentDataPath + "/" + Application.productName + "/Logs/SysLog.txt";
117 |
118 | foreach (string message in logData)
119 | {
120 | File.AppendAllText(path, string.Format("{0}{1}", message.ToString(), System.Environment.NewLine));
121 | }
122 | lastPath = path;
123 | Debug.Log("[Sys API] SysLog.txt saved to default location: " + (Application.persistentDataPath + "/" + Application.productName + "/Logs/SysLog.txt"));
124 | }
125 |
126 | // Save the log to the given file path
127 | public static void SaveLog(string path)
128 | {
129 | if(path != null){
130 | //logData.Clear();
131 | foreach (string message in logData)
132 | {
133 | File.AppendAllText(path, string.Format("{0}{1}", message.ToString(), System.Environment.NewLine));
134 | }
135 | lastPath = path;
136 | Log("[Sys API] SysLog.txt saved to location: " + path,true);
137 | } else {
138 | LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+GetLine()+")",true);
139 | }
140 | }
141 |
142 | // Save the log to the given file path, specifying whether or not to open the directory
143 | public static void SaveLog(string path, bool openDir)
144 | {
145 | if(path != null){
146 | //logData.Clear();
147 | foreach (string message in logData)
148 | {
149 | File.AppendAllText(path, string.Format("{0}{1}", message.ToString(), System.Environment.NewLine));
150 | }
151 | if (openDir) { System.Diagnostics.Process.Start(path); }
152 | lastPath = path;
153 | Log("[Sys API] SysLog.txt saved to location: " + path, true);
154 | Log("[Sys API] Opening Directory: " + path, true);
155 | } else {
156 | LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+GetLine()+")",true);
157 | }
158 | }
159 |
160 | ///FILE PERSISTANCE///
161 | //Creates a new directory
162 | private static void CreateDirectory(string path){
163 | Directory.CreateDirectory(path);
164 | Log("[Sys API] Directory: "+path+" sucessfully created. "+GetStackTrace());
165 | }
166 | //Checks if a directory exists
167 | public static bool DirectoryCheck (string path){
168 | if(Directory.Exists (path)){return true;}
169 | else { return false;}
170 | }
171 | //Checks if a directory exists, and creates the directory if not.
172 | public static bool DirectoryCheck (string path, bool createDirectory){
173 | if(Directory.Exists (path)){
174 | return true;
175 | } else {
176 | if (createDirectory){
177 | CreateDirectory(path);
178 | if(Directory.Exists(path)){
179 | Log("[Sys API] Directory: "+path+" sucessfully created. "+GetStackTrace(),true);
180 | }
181 | }
182 | return true;
183 | }
184 | }
185 | //Creates an empty file at a given path.
186 | private static void CreateEmptyFile(string path){
187 | File.Create(path).Dispose();
188 | }
189 | private static void CreateEmptyFile(string path, string file){
190 | File.Create(path+file).Dispose();
191 | }
192 | //Checks if a file already exists
193 | public static bool FileCheck (string path){
194 | if(File.Exists (path)){return true;}
195 | else { return false;}
196 | }
197 | public static bool FileCheck (string path, string file){
198 | if(File.Exists (path+file)){return true;}
199 | else { return false;}
200 | }
201 | //Checks if a file already exists, if not an empty file will be created.
202 | public static bool FileCheck (string path, bool createDispose){
203 | if(File.Exists (path)){
204 | return true;
205 | } else {
206 | if (createDispose){
207 | CreateEmptyFile(path);
208 | if(File.Exists(path)){
209 | Log("[Sys API] File: "+Path.GetFileName(path)+" sucessfully created. "+GetStackTrace(),true);
210 | }
211 | return true;
212 | } else {
213 | return false;
214 | }
215 | }
216 | }
217 | public static bool FileCheck (string path, string file, bool createDispose){
218 | string newPath = path+file;
219 | if(File.Exists (newPath)){
220 | return true;
221 | } else {
222 | if (createDispose){
223 | CreateEmptyFile(newPath);
224 | if(File.Exists(newPath)){
225 | Log("[Sys API] File: "+Path.GetFileName(newPath)+" sucessfully created. "+GetStackTrace(),true);
226 | }
227 | return true;
228 | } else {
229 | return false;
230 | }
231 | }
232 | }
233 | //Returns the external storage location per platform.
234 | public static string DeviceExternalStorage(){
235 | string dir = "";
236 | #if UNITY_EDITOR
237 | dir = Application.persistentDataPath;
238 | #endif
239 | #if UNITY_ANDROID && !UNITY_EDITOR
240 | dir = "/storage/emulated/0";
241 | #endif
242 | #if UNITY_IOS && !UNITY_EDITOR
243 | dir = Application.persistentDataPath;
244 | #endif
245 | return dir;
246 | }
247 |
248 | // File Saving Methods//
249 | public static void SaveDataToFile(string path, string[] data)
250 | {
251 | if(path != null){
252 | if (!File.Exists(path))
253 | {
254 | File.Create(path).Dispose();
255 | foreach (string d in data)
256 | {
257 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
258 | }
259 | }
260 | else
261 | {
262 | File.Create(path).Dispose();
263 | foreach (string d in data)
264 | {
265 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
266 | }
267 | }
268 | } else {
269 | LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+GetLine()+")",true);
270 | }
271 | }
272 |
273 | public static void SaveFile(string path, string[] data)
274 | {
275 | if(path != null){
276 | if (!File.Exists(path))
277 | {
278 | File.Create(path).Dispose();
279 | foreach (string d in data)
280 | {
281 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
282 | }
283 | }
284 | else
285 | {
286 | File.Create(path).Dispose();
287 | foreach (string d in data)
288 | {
289 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
290 | }
291 | }
292 | } else {
293 | LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+GetLine()+")",true);
294 | }
295 | }
296 | // Save the given data to the given file, specifying whether to append or overwrite
297 | public static void SaveDataToFile(string path, string[] data, bool clearOldFiles)
298 | {
299 | if(path != null){
300 | if (!File.Exists(path))
301 | {
302 | File.Create(path).Dispose();
303 | foreach (string d in data)
304 | {
305 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
306 | }
307 | }
308 | else
309 | {
310 | if (clearOldFiles)
311 | {
312 | File.Create(path).Dispose();
313 | foreach (string d in data)
314 | {
315 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
316 | }
317 | }
318 | else
319 | {
320 | foreach (string d in data)
321 | {
322 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
323 | }
324 | }
325 | }
326 | } else {
327 | LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+GetLine()+")",true);
328 | }
329 | }
330 |
331 | //'SaveDataToFile' Alternate
332 | public static void SaveFile(string path, string[] data, bool clearOldFiles)
333 | {
334 | if(path != null){
335 | if (!File.Exists(path))
336 | {
337 | File.Create(path).Dispose();
338 | foreach (string d in data)
339 | {
340 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
341 | }
342 | }
343 | else
344 | {
345 | if (clearOldFiles)
346 | {
347 | File.Create(path).Dispose();
348 | foreach (string d in data)
349 | {
350 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
351 | }
352 | }
353 | else
354 | {
355 | foreach (string d in data)
356 | {
357 | File.AppendAllText(path, string.Format("{0}{1}", d.ToString(), System.Environment.NewLine));
358 | }
359 | }
360 | }
361 | } else {
362 | LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+GetLine()+")",true);
363 | }
364 | }
365 |
366 | // Load data from a text file to a string array.
367 | public static string[] LoadDataFromFile(string path)
368 | {
369 | if(path != null){
370 | string[] data = File.ReadAllLines(path);
371 | return data;
372 | } else {
373 | LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+GetLine()+")",true);
374 | return null;
375 | }
376 | }
377 | //'LoadDataFromFile' Alternate
378 | public static string[] ReadFile(string path)
379 | {
380 | if(path != null){
381 | string[] data = File.ReadAllLines(path);
382 | return data;
383 | } else {
384 | LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+GetLine()+")",true);
385 | return null;
386 | }
387 | }
388 | // Load data from a text file to a string list.
389 | public static List LoadDataListFromFile(string path)
390 | {
391 | if(path != null){
392 | List data = new List(File.ReadAllLines(path));
393 | return data;
394 | } else {
395 | LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+GetLine()+")",true);
396 | return null;
397 | }
398 | }
399 |
400 | ///SCREEN CAPTURING METHODS///
401 | public static void CaptureScreenshot(MonoBehaviour instance)
402 | {
403 | string path;
404 | path = (Application.persistentDataPath + "/" + Application.productName + "/Screenshots/" + System.DateTime.Now.ToString("MMddyyyy - hhmmss") + ".png");
405 | instance.StartCoroutine(GetTexture2D(path, false));
406 | }
407 |
408 | public static void CaptureScreenshot(MonoBehaviour instance, string path)
409 | {
410 | instance.StartCoroutine(GetTexture2D(path, false));
411 | }
412 |
413 | public static void CaptureScreenshot(MonoBehaviour instance, string path, bool openDir)
414 | {
415 | instance.StartCoroutine(GetTexture2D(path, openDir));
416 | }
417 |
418 | public static IEnumerator GetTexture2D(string path, bool openDir)
419 | {
420 | yield return new WaitForEndOfFrame();
421 |
422 | Texture2D tex = new Texture2D(Screen.width, Screen.height);
423 | tex.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
424 | tex.Apply();
425 | HandleScreenshot(tex, path, openDir);
426 | }
427 |
428 | private static void HandleScreenshot(Texture2D tex, string path, bool openDir)
429 | {
430 | File.WriteAllBytes(path, tex.EncodeToPNG());
431 | if (openDir) { System.Diagnostics.Process.Start(path); }
432 | }
433 |
434 | public static Texture2D ScreenToTexture2D()
435 | {
436 | Texture2D tex = new Texture2D(Screen.width, Screen.height);
437 | tex.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
438 | tex.Apply();
439 | return tex;
440 | }
441 |
442 | public static Texture2D LoadImageAtPath(string path)
443 | {
444 | Texture2D tex;
445 | byte[] bytes;
446 | bytes = File.ReadAllBytes(path);
447 | tex = new Texture2D(1, 1);
448 | tex.LoadImage(bytes);
449 | return tex;
450 | }
451 |
452 | ///ARITHMETIC METHODS///
453 | public static int Add(params int[] a)
454 | {
455 | int sum = 0;
456 |
457 | for (int k = 0; k < a.Length; k++)
458 | {
459 | sum += a[k];
460 | }
461 | return sum;
462 | }
463 |
464 | public static float Add(params float[] a)
465 | {
466 | float sum = 0;
467 |
468 | for (int k = 0; k < a.Length; k++)
469 | {
470 | sum += a[k];
471 | }
472 | return sum;
473 | }
474 |
475 | public static int Subtract(params int[] a)
476 | {
477 | int sum = a.Length > 0 ? a[0] : 0;
478 |
479 | for (int k = 1; k < a.Length; k++)
480 | {
481 | sum -= a[k];
482 | }
483 | return sum;
484 | }
485 |
486 | public static float Subtract(params float[] a)
487 | {
488 | float sum = a.Length > 0 ? a[0] : 0;
489 |
490 | for (int k = 1; k < a.Length; k++)
491 | {
492 | sum -= a[k];
493 | }
494 | return sum;
495 | }
496 |
497 | public static int Multiply(params int[] a)
498 | {
499 | int product = 1;
500 |
501 | for (int k = 0; k < a.Length; k++)
502 | {
503 | product *= a[k];
504 | }
505 | return product;
506 | }
507 |
508 | public static float Multiply(params float[] a)
509 | {
510 | float product = 1;
511 |
512 | for (int k = 0; k < a.Length; k++)
513 | {
514 | product *= a[k];
515 | }
516 | return product;
517 | }
518 |
519 | public static float Divide(float a, float b)
520 | {
521 | float sum = (a / b);
522 | return sum;
523 | }
524 |
525 | private static int get(int[] d, int index)
526 | {
527 | return index >= 0 && index < d.Length ? d[index] : 0;
528 | }
529 |
530 | public static int[] convolve(int[] a, int[] b)
531 | {
532 | int[] c = new int[] { a.Length > b.Length ? a.Length : b.Length };
533 |
534 | for (int x = 0; x < c.Length; x++)
535 | {
536 | int n = 0;
537 |
538 | for (int k = 0; k <= x; k++)
539 | {
540 | n += get(a, k) * get(b, x - k);
541 | }
542 | c[x] = n;
543 | }
544 | return c;
545 | }
546 |
547 | public static int[] cProduct(int[] a, int[] b)
548 | {
549 | int[] c = new int[] { a.Length > b.Length ? a.Length : b.Length };
550 |
551 | for (int x = 0; x < c.Length; x++)
552 | {
553 | int n = 0;
554 |
555 | for (int k = 0; k <= x; k++)
556 | {
557 | n += get(a, k) * get(b, x - k);
558 | }
559 | c[x] = n;
560 | }
561 | return c;
562 | }
563 |
564 | ///MISC METHODS///
565 | public static string URLAntiCache(){
566 | return "?t="+System.DateTime.Now.ToString("MMddyyyyhhmmss");
567 | }
568 |
569 | public static string GenerateUniqueID(int length)
570 | {
571 | int a = 0;
572 | string hc = "";
573 |
574 | while (a < length)
575 | {
576 | float r = Random.Range(0.0f, 2);
577 | Debug.Log(r);
578 | if (r <= 0.999f)
579 | {
580 | int v = GetValue();
581 | hc += v.ToString();
582 | }
583 | if (r >= 1)
584 | {
585 | string c = GetCharacter();
586 | hc += c;
587 | }
588 | a++;
589 | }
590 |
591 | return hc;
592 | }
593 |
594 | private static int GetValue()
595 | {
596 | int val = Random.Range(0, 9);
597 | return val;
598 | }
599 |
600 | private static string GetCharacter()
601 | {
602 | string[] alp = new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
603 | string returnChar = alp[Random.Range(0, alp.Length)];
604 | return returnChar;
605 | }
606 |
607 | ///STACK TRACE METHODS///
608 | public static int GetLine(){
609 | System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(0,true);
610 | System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount -1);
611 | int line = stackFrame.GetFileLineNumber();
612 | return line;
613 | }
614 |
615 | public static string GetErrorStackTrace(){
616 | System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(0,true);
617 | System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount - 1);
618 | string file = stackFrame.GetFileName();
619 | //string method = stackFrame.GetMethod().ToString();
620 | int line = stackFrame.GetFileLineNumber();
621 | string trace = string.Format("({0}-{1}-{2})","EC",Path.GetFileName(file),line);
622 | return trace;
623 | }
624 | public static string GetErrorStackTrace(int frames){
625 | System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(0,true);
626 | System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount + frames);
627 | string file = stackFrame.GetFileName();
628 | //string method = stackFrame.GetMethod().ToString();
629 | int line = stackFrame.GetFileLineNumber();
630 | string trace = string.Format("({0}-{1}-{2})","EC",Path.GetFileName(file),line);
631 | return trace;
632 | }
633 | public static string GetStackTrace(){
634 | System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(0,true);
635 | System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount -1);
636 | string file = stackFrame.GetFileName();
637 | string method = stackFrame.GetMethod().ToString();
638 | int line = stackFrame.GetFileLineNumber();
639 | string trace = string.Format("{0}({1}:{2})",method,Path.GetFileName(file),line);
640 | return trace;
641 | }
642 | public static string FormatStackTrace(string format){
643 | System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(0,true);
644 | System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount -1);
645 | string file = stackFrame.GetFileName();
646 | string method = stackFrame.GetMethod().ToString();
647 | int line = stackFrame.GetFileLineNumber();
648 | string trace = string.Format(format,method,Path.GetFileName(file),line);
649 | return trace;
650 | }
651 | public static string FormatStackTrace(string format, bool getFileName, bool getMethodName, bool getLineNumber){
652 | System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(0,true);
653 | System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount -1);
654 | string file = stackFrame.GetFileName();
655 | string method = stackFrame.GetMethod().ToString();
656 | int line = stackFrame.GetFileLineNumber();
657 | string trace = null;
658 | //int index = 0; //[0 F,M,L] [1 F,M] [2 F,L] [3 M,L] [4 F] [5 L] [6 M] [7 ---]
659 | if(getFileName){
660 | if(getMethodName && getLineNumber){
661 | //index = 0;
662 | trace = string.Format(format,Path.GetFileName(file),method,line);
663 | }
664 | if(getMethodName && !getLineNumber){
665 | //index = 1;
666 | trace = string.Format(format,Path.GetFileName(file),method);
667 | }
668 | if(!getMethodName && getLineNumber){
669 | //index = 2;
670 | trace = string.Format(format,Path.GetFileName(file),line);
671 | }
672 | if(!getMethodName && !getLineNumber){
673 | //index = 4;
674 | trace = string.Format(format,Path.GetFileName(file));
675 | }
676 | return trace;
677 | } else {
678 | if(getMethodName && getLineNumber){
679 | //index = 3;
680 | trace = string.Format(format,method,line);
681 | }
682 | if(!getMethodName && getLineNumber){
683 | //index = 5;
684 | trace = string.Format(format,line);
685 | }
686 | if(getMethodName && !getLineNumber){
687 | //index = 6;
688 | trace = string.Format(format,method);
689 | }
690 | if(!getMethodName && !getLineNumber){
691 | //index = 7;
692 | LogError("[Sys API] Invalid Arguments. All cannot be false.",true);
693 | trace = "Error!";
694 | }
695 | return trace;
696 | }
697 |
698 |
699 | }
700 |
701 | }
702 |
703 | public class Info : MonoBehaviour {
704 | //System Information Methods//
705 | static string temporaryPath;
706 | static int itemCounter;
707 |
708 | public static float batteryLevel() { return SystemInfo.batteryLevel; }
709 | public static BatteryStatus batteryStatus() { return SystemInfo.batteryStatus; }
710 | public static Rendering.CopyTextureSupport copyTextureSupport() { return SystemInfo.copyTextureSupport; }
711 | public static string deviceModel() { return SystemInfo.deviceModel; }
712 | public static string deviceName() { return SystemInfo.deviceName; }
713 | public static DeviceType deviceType() { return SystemInfo.deviceType; }
714 | public static string deviceUniqueIdentifier() { return SystemInfo.deviceUniqueIdentifier; }
715 | public static int graphicsDeviceID() { return SystemInfo.graphicsDeviceID; }
716 | public static string graphicsDeviceName() { return SystemInfo.graphicsDeviceName; }
717 | public static Rendering.GraphicsDeviceType graphicsDeviceType() { return SystemInfo.graphicsDeviceType; }
718 | public static string graphicsDeviceVendor() { return SystemInfo.graphicsDeviceVendor; }
719 | public static int graphicsDeviceVendorID() { return SystemInfo.graphicsDeviceVendorID; }
720 | public static string graphicsDeviceVersion() { return SystemInfo.graphicsDeviceVersion; }
721 | public static int graphicsMemorySize() { return SystemInfo.graphicsMemorySize; }
722 | public static bool graphicsMultiThreaded() { return SystemInfo.graphicsMultiThreaded; }
723 | public static int graphicsShaderLevel() { return SystemInfo.graphicsShaderLevel; }
724 | public static bool graphicsUVStartsAtTop() { return SystemInfo.graphicsUVStartsAtTop; }
725 | public static int maxCubemapSize() { return SystemInfo.maxCubemapSize; }
726 | public static int maxTextureSize() { return SystemInfo.maxTextureSize; }
727 | public static NPOTSupport npotSupport() { return SystemInfo.npotSupport; }
728 | public static string operatingSystem() { return SystemInfo.operatingSystem; }
729 | public static OperatingSystemFamily operatingSystemFamily() { return SystemInfo.operatingSystemFamily; }
730 | public static int processorCount() { return SystemInfo.processorCount; }
731 | public static int processorFrequency() { return SystemInfo.processorFrequency; }
732 | public static string processorType() { return SystemInfo.processorType; }
733 | public static int supportedRenderTargetCount() { return SystemInfo.supportedRenderTargetCount; }
734 | public static bool supports2DArrayTextures() { return SystemInfo.supports2DArrayTextures; }
735 | public static bool supports3DRenderTextures() { return SystemInfo.supports3DRenderTextures; }
736 | public static bool supports3DTextures() { return SystemInfo.supports3DTextures; }
737 | public static bool supportsAccelerometer() { return SystemInfo.supportsAccelerometer; }
738 | public static bool supportsAudio() { return SystemInfo.supportsAudio; }
739 | public static bool supportsComputeShaders() { return SystemInfo.supportsComputeShaders; }
740 | public static bool supportsCubemapArrayTextures() { return SystemInfo.supportsCubemapArrayTextures; }
741 | public static bool supportsGyroscope() { return SystemInfo.supportsGyroscope; }
742 | public static bool supportsImageEffects() { return SystemInfo.supportsImageEffects; }
743 | public static bool supportsInstancing() { return SystemInfo.supportsInstancing; }
744 | public static bool supportsLocationService() { return SystemInfo.supportsLocationService; }
745 | public static bool supportsMotionVectors() { return SystemInfo.supportsMotionVectors; }
746 | public static bool supportsRawShadowDepthSampling() { return SystemInfo.supportsRawShadowDepthSampling; }
747 | public static bool supportsRenderToCubemap() { return SystemInfo.supportsRenderToCubemap; }
748 | public static bool supportsShadows() { return SystemInfo.supportsShadows; }
749 | public static bool supportsSparseTextures() { return SystemInfo.supportsSparseTextures; }
750 | public static bool supportsVibration() { return SystemInfo.supportsVibration; }
751 | public static int systemMemorySize() { return SystemInfo.systemMemorySize; }
752 | public static string unsupportedIdentifier() { return SystemInfo.unsupportedIdentifier; }
753 | public static bool usesReversedZBuffer() { return SystemInfo.usesReversedZBuffer; }
754 |
755 | public static void SaveSystemInfo(string path)
756 | {
757 | SaveSystemInfo(path, false);
758 | }
759 |
760 | public static void SaveSystemInfo(string path, bool openDir)
761 | {
762 | if(path != null){
763 | if (!File.Exists(path))
764 | {
765 | File.Create(path).Dispose();
766 | temporaryPath = path;
767 | }
768 | else
769 | {
770 | temporaryPath = path;
771 | }
772 | itemCounter = 0;
773 | WriteDataToFile(GetSystemInfo(), openDir);
774 | } else {
775 | Sys.LogError("[Sys API] ERROR004: Path is null or empty. (EC-SYS-"+Sys.GetLine()+")",true);
776 | }
777 | }
778 |
779 | static void WriteDataToFile(List sysInfo, bool openDir)
780 | {
781 | foreach (string ab in sysInfo)
782 | {
783 | File.AppendAllText(temporaryPath, string.Format("{0} {1}", ab, System.Environment.NewLine));
784 | itemCounter++;
785 | }
786 | if (itemCounter >= (sysInfo.ToArray().Length)) { itemCounter = 0; sysInfo.Clear(); }
787 | if (openDir) { System.Diagnostics.Process.Start(temporaryPath); } //Debug.Log("[Sys]: Opening File Location...");}
788 | }
789 |
790 |
791 | public static List GetSystemInfo()
792 | {
793 | List sysInfo = new List();
794 | sysInfo.Add("Battery Level: " + (SystemInfo.batteryLevel * 100) + "%");
795 | sysInfo.Add("Battery Status: " + SystemInfo.batteryStatus.ToString());
796 | sysInfo.Add("Copy Texture Support: " + SystemInfo.copyTextureSupport.ToString());
797 | sysInfo.Add("Device Model: " + SystemInfo.deviceModel);
798 | sysInfo.Add("Device Name: " + SystemInfo.deviceName);
799 | sysInfo.Add("Device Type: " + SystemInfo.deviceType.ToString());
800 | sysInfo.Add("Unique Device ID: " + SystemInfo.deviceUniqueIdentifier);
801 | sysInfo.Add("Graphics Device ID: " + SystemInfo.graphicsDeviceID);
802 | sysInfo.Add("Graphics Device Name: " + SystemInfo.graphicsDeviceName);
803 | sysInfo.Add("Graphics Device Type: " + SystemInfo.graphicsDeviceType.ToString());
804 | sysInfo.Add("Graphics Device Vendor: " + SystemInfo.graphicsDeviceVendor);
805 | sysInfo.Add("Graphics Device VendorID: " + SystemInfo.graphicsDeviceVendorID);
806 | sysInfo.Add("Graphics Device Version: " + SystemInfo.graphicsDeviceVersion);
807 | sysInfo.Add("Graphics Memory Size: " + SystemInfo.graphicsMemorySize);//
808 | sysInfo.Add("Graphics Multithreaded: " + SystemInfo.graphicsMultiThreaded);
809 | sysInfo.Add("Graphics Shader Level: " + SystemInfo.graphicsShaderLevel);
810 | sysInfo.Add("Graphics UV Starts at Top?: " + SystemInfo.graphicsUVStartsAtTop);
811 | sysInfo.Add("Max Cubemap Size: " + SystemInfo.maxCubemapSize);
812 | sysInfo.Add("Max Texture Size: " + SystemInfo.maxTextureSize);
813 | sysInfo.Add("NPOT Support: " + SystemInfo.npotSupport.ToString());
814 | sysInfo.Add("OS: " + SystemInfo.operatingSystem);
815 | sysInfo.Add("OS Family: " + SystemInfo.operatingSystemFamily.ToString());
816 | sysInfo.Add("Processor Count: " + SystemInfo.processorCount);
817 | sysInfo.Add("Processor Frequency: " + (SystemInfo.processorFrequency * 0.001) + "MHz");
818 | sysInfo.Add("Processor Type: " + SystemInfo.processorType);
819 | sysInfo.Add("Supported Render Targer Count: " + SystemInfo.supportedRenderTargetCount);
820 | sysInfo.Add("Supports 2D Array Textures : " + (SystemInfo.supports2DArrayTextures ? "Yes" : "No"));
821 | sysInfo.Add("Supports 3D Render Textures : " + (SystemInfo.supports3DRenderTextures ? "Yes" : "No"));
822 | sysInfo.Add("Supports 3D Textures : " + (SystemInfo.supports3DTextures ? "Yes" : "No"));
823 | sysInfo.Add("Supports Accelerometer : " + (SystemInfo.supportsAccelerometer ? "Yes" : "No"));
824 | sysInfo.Add("Supports Audio : " + (SystemInfo.supportsAudio ? "Yes" : "No"));
825 | sysInfo.Add("Supports Compute Shaders : " + (SystemInfo.supportsComputeShaders ? "Yes" : "No"));
826 | sysInfo.Add("Supports Cubemap Array Textures : " + (SystemInfo.supportsCubemapArrayTextures ? "Yes" : "No"));
827 | sysInfo.Add("Supports Gyroscope : " + (SystemInfo.supportsGyroscope ? "Yes" : "No"));
828 | sysInfo.Add("Supports Image Effects : " + (SystemInfo.supportsImageEffects ? "Yes" : "No"));
829 | sysInfo.Add("Supports Instancing : " + (SystemInfo.supportsInstancing ? "Yes" : "No"));
830 | sysInfo.Add("Supports Location Services : " + (SystemInfo.supportsLocationService ? "Yes" : "No"));
831 | sysInfo.Add("Supports Motion Vectors : " + (SystemInfo.supportsMotionVectors ? "Yes" : "No"));
832 | sysInfo.Add("Supports Raw Shadow Depth Sampling : " + (SystemInfo.supportsRawShadowDepthSampling ? "Yes" : "No"));
833 | sysInfo.Add("Supports Render To Cubemap : " + (SystemInfo.supportsRenderToCubemap ? "Yes" : "No"));
834 | sysInfo.Add("Supports Shadows : " + (SystemInfo.supportsShadows ? "Yes" : "No"));
835 | sysInfo.Add("Supports Sparse Textures : " + (SystemInfo.supportsSparseTextures ? "Yes" : "No"));
836 | sysInfo.Add("Supports Vibration : " + (SystemInfo.supportsVibration ? "Yes" : "No"));
837 | sysInfo.Add("System Memory Size: " + SystemInfo.systemMemorySize);
838 | sysInfo.Add("Unsupported Identifier: " + SystemInfo.unsupportedIdentifier);
839 | sysInfo.Add("Supports Reversed Z Buffer : " + (SystemInfo.usesReversedZBuffer ? "Yes" : "No"));
840 |
841 | return sysInfo;
842 | }
843 |
844 | }
845 | }
846 |
--------------------------------------------------------------------------------
/Source/Assets/Plugins/SysAPI/Scripts/SysUpdateDownloader.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using UnityEngine;
5 |
6 | public class SysUpdateDownloader : MonoBehaviour {
7 | #if UNITY_EDITOR
8 | string _versionURL = "https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/master/Source/Assets/Plugins/SysAPI/vc.dxt"+Sys.URLAntiCache();
9 | string _sourceURL = "https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/master/Source/Assets/Plugins/SysAPI/Scripts/SYS_MASTER.cs"+"?t="+System.DateTime.Now.ToString("MMddyyyyhhmmss");
10 | string _docuURL = "https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/master/Source/Assets/Sys_API/Documentation.txt"+"?t="+System.DateTime.Now.ToString("MMddyyyyhhmmss");
11 | string _sysCSURL = "https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/master/Source/Assets/Sys_API/Examples/Sys_API_CSharp_Example.cs"+"?t="+System.DateTime.Now.ToString("MMddyyyyhhmmss");
12 | string _sysJSURL = "https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/master/Source/Assets/Sys_API/Examples/Sys_API_JS_Example.js";
13 | string _changelogURL = "https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/master/Source/Assets/Sys_API/change.log"+"?t="+System.DateTime.Now.ToString("MMddyyyyhhmmss");
14 | string _silURL = "https://raw.githubusercontent.com/Alpaca-Studio/UnitySysAPI/master/Source/Assets/Editor/SystemInformationLogger.cs"+"?t="+System.DateTime.Now.ToString("MMddyyyyhhmmss");
15 | string _path;
16 | //List VC = new List();
17 | string _currentVersion;
18 | public bool forceUpdate = false;
19 | int dlCount = 0;
20 |
21 | void Start () {
22 | dlCount = 0;
23 | _path = Application.dataPath + "/Plugins/SysAPI/";
24 | _currentVersion = UnityEditor.EditorPrefs.GetString("VC");
25 | if(!forceUpdate){
26 | StartCoroutine(DownloadVC(_versionURL));
27 | } else {
28 | File.Create(Application.dataPath + "/Plugins/SysAPI/Scripts/SYS_MASTER.cs").Dispose();
29 | InitDataFiles();
30 | }
31 | }
32 |
33 | IEnumerator DownloadVC(string url) {
34 | WWW www = new WWW(url);
35 | yield return www;
36 | string file = www.text;
37 | if(www.error != null){Debug.LogError("[Sys API] ERROR001: "+www.error+" (EC-SUD-037)");}
38 | if(file.Length == 0 || file == null){Debug.LogError("[Sys API] ERROR000: Unable to establish connection. (EC-SUD-036)");} else {
39 | File.Create(_path+"vc.dxt").Dispose();
40 | File.WriteAllText(_path+"vc.dxt", file);
41 | InitDataFiles();
42 | }
43 |
44 | }
45 |
46 | void InitDataFiles () {
47 | if(File.ReadAllLines(_path+"vc.dxt")[0] != null){
48 | string newVC = File.ReadAllLines(_path+"vc.dxt")[0];
49 | if(newVC != _currentVersion || forceUpdate){
50 | File.Create(Application.dataPath + "/Plugins/SysAPI/Scripts/SYS_MASTER.cs").Dispose();
51 |
52 | Debug.LogWarning("[Sys API]: Downloading Sys API v" + newVC );
53 | StartCoroutine(DownloadDataFiles(_sourceURL, Application.dataPath + "/Plugins/SysAPI/Scripts/","SYS_MASTER.cs"));
54 | Debug.LogWarning("[Sys API]: Downloading SYS_MASTER.cs");
55 |
56 | File.Create(Application.dataPath + "/Sys_API/Documentation.txt").Dispose();
57 | StartCoroutine(DownloadDataFiles(_docuURL,Application.dataPath + "/Sys_API/","Documentation.txt"));
58 | //File.Create(Application.dataPath + "/Plugins/SysAPI/Documentation.txt").Dispose();
59 | //StartCoroutine(DownloadDataFiles(_docuURL,Application.dataPath + "/Plugins/SysAPI/","Documentation.txt"));
60 | Debug.LogWarning("[Sys API]: Downloading 'Documentation.txt'");
61 |
62 | File.Create(Application.dataPath + "/Sys_API/change.log").Dispose();
63 | StartCoroutine(DownloadDataFiles(_changelogURL,Application.dataPath + "/Sys_API/","change.log"));
64 | Debug.LogWarning("[Sys API]: Downloading 'change.log'");
65 |
66 | File.Create(Application.dataPath + "/Editor/SystemInformationLogger.cs").Dispose();
67 | StartCoroutine(DownloadDataFiles(_silURL,Application.dataPath + "/Editor/","SystemInformationLogger.cs"));
68 | Debug.LogWarning("[Sys API]: Downloading 'SystemInformationLogger.cs'");
69 |
70 | File.Create(Application.dataPath + "/Sys_API/Examples/Sys_API_CSharp_Example.cs").Dispose();
71 | StartCoroutine(DownloadDataFiles(_sysCSURL,Application.dataPath + "/Sys_API/Examples/","Sys_API_CSharp_Example.cs"));
72 | Debug.LogWarning("[Sys API]: Downloading 'Sys_API_CSharp_Example.cs'");
73 |
74 | File.Create(Application.dataPath + "/Sys_API/Examples/Sys_API_JS_Example.js").Dispose();
75 | StartCoroutine(DownloadDataFiles(_sysJSURL,Application.dataPath + "/Sys_API/Examples/","Sys_API_JS_Example.js"));
76 | Debug.LogWarning("[Sys API]: Downloading 'Sys_API_JS_Example.js'");
77 |
78 | _currentVersion = newVC;
79 | UnityEditor.EditorPrefs.SetString("VC",_currentVersion);
80 | } else {
81 | Debug.LogWarning("[Sys API]: You already have the latest version." + " Sys API " + _currentVersion + ".");
82 | UnityEditor.EditorPrefs.SetString("VC",_currentVersion);
83 | Destroy(this.gameObject);
84 | UnityEditor.EditorApplication.isPlaying = false;
85 | Destroy(this.gameObject);
86 | }
87 | }
88 | }
89 |
90 | IEnumerator DownloadDataFiles(string url, string path, string fileName) {
91 | WWW www = new WWW(url);
92 | yield return www;
93 | string file = www.text;
94 | if(www.isDone){
95 | if(file.Length == 0 || file == null){UnityEditor.EditorApplication.isPlaying = false; Debug.LogError("[Sys API] ERROR000: Unable to establish connection. (EC-SUD-119)");} else {
96 | File.Create(path + fileName).Dispose();
97 | File.AppendAllText(path + fileName, file);
98 | Debug.LogWarning("[Sys API]: " + fileName + " successfully updated.");
99 | dlCount++;
100 | //Debug.Log(dlCount);
101 | if(dlCount >= 6){
102 | UnityEditor.EditorPrefs.SetString("VC",_currentVersion);
103 | Destroy(this.gameObject);
104 | UnityEditor.EditorApplication.isPlaying = false;
105 | Debug.LogWarning("[Sys API]: Updated to version " + _currentVersion);
106 | Destroy(this.gameObject);
107 | }
108 | }
109 | }
110 | }
111 |
112 |
113 |
114 |
115 | #endif
116 | }
117 |
--------------------------------------------------------------------------------
/Source/Assets/Plugins/SysAPI/vc.dxt:
--------------------------------------------------------------------------------
1 | 1.0.5
2 |
--------------------------------------------------------------------------------
/Source/Assets/Sys_API/Documentation.txt:
--------------------------------------------------------------------------------
1 | UnityEngine.Sys API Documentation v1.0.5
2 | Revised: 12/02/2017
3 |
4 |
5 | LOGGING METHODS:
6 | public static void Log(string message)
7 | -Sends a debug message to the Sys.Log that can be exported to a text file when 'SaveLog()' is called.
8 | PARAMETERS:
9 | message - the debug message to be displayed in the exported Sys.Log file.
10 | USEAGE:
11 | Sys.Log("This is a test!");
12 | _________________________________________________________________________________________
13 | public static void Log(string message, bool showInConsole)
14 | -Sends a debug message to the Sys.Log that can be exported to a text file when 'SaveLog()' is called.
15 | -When showInConsole is true the debug message will be appear debug to console (via 'Debug.Log' method).
16 | PARAMETERS:
17 | message - the debug message to be displayed in the exported Sys.Log file.
18 | showInConsole - if true, the Sys.Log message will also be send to the console via Debug.Log method.
19 | USEAGE:
20 | Sys.Log("This is a test!" , true);
21 | __________________________________________________________________________________________
22 | public static void ClearLog()
23 | -Clears the Sys.Log cache.
24 | USEAGE:
25 | Sys.ClearLog();
26 | __________________________________________________________________________________________
27 | public static void SaveLog()
28 | -Saves Sys.Log data to default location: ' Application.persistentDataPath + "/" + Application.productName + "/Logs/SysLog.txt" '.
29 | USEAGE:
30 | Sys.SaveLog();
31 | __________________________________________________________________________________________
32 | public static void SaveLog(string path)
33 | -Saves Sys.Log data to a specified path.
34 | PARAMETERS:
35 | path - desired path to save the Sys.Log as a text file.
36 | USEAGE:
37 | Sys.SaveLog("Path_To_Log_File/SysLog.txt");
38 | __________________________________________________________________________________________
39 | public static void SaveLog(string path, bool openDirectory)
40 | -Saves Sys.Log data to a specified path then opens file directory upon save.
41 | PARAMETERS:
42 | path - desired path to save the Sys.Log as a text file.
43 | openDirectory - if true, File Explorer will open the containing folder of your saved file (Desktop Only).
44 | USEAGE:
45 | Sys.SaveLog("Path_To_Log_File/SysLog.txt", true);
46 | __________________________________________________________________________________________
47 |
48 |
49 |
50 | FILE PERSISTANCE METHODS:
51 | public static bool DirectoryCheck (string path)
52 | -The path argument defines the directory to be checked. If the directory exists DirectoryCheck() will return true, else it will return false.
53 | PARAMETERS:
54 | path - the directory to be checked.
55 | USEAGE:
56 | Sys.DirectoryCheck("Path/To/SomeFile");
57 | __________________________________________________________________________________________
58 | public static bool DirectoryCheck (string path, bool createDirectory)
59 | -The path argument defines the directory to be checked. If the directory exists DirectoryCheck() will return true, else it will return false.
60 | -If the createDirectory argument is true, the given directory will be created if the directory has yet to exist.
61 | PARAMETERS:
62 | path - the directory to be checked.
63 | createDirectory - if true, the directory will be created if it doesn't yet exist.
64 | USEAGE:
65 | Sys.DirectoryCheck("Path/To/SomeFile",true);
66 | __________________________________________________________________________________________
67 | public static bool FileCheck (string path)
68 | -Similar to DirectoryCheck(), the path argument defines the file to be checked.
69 | -If the file exists FileCheck() will return true, else it will return false.
70 | PARAMETERS:
71 | path - the path and file name to be checked.
72 | USEAGE:
73 | Sys.FileCheck("Path/To/SomeFile.txt");
74 | __________________________________________________________________________________________
75 | public static bool FileCheck (string path, bool createDispose)
76 | -The path argument defines the file to be checked. If the file exists FileCheck() will return true, else it will return false.
77 | -If the createDispose argument is true and the file doesn't yet exist, an empty will be created at the defined location.
78 | PARAMETERS:
79 | path - the path and file name to be checked.
80 | createDispose - if true, an empty file will be created if the file defined by path doesn't yet exist.
81 | USEAGE:
82 | Sys.FileCheck("Path/To/SomeFile.txt",true);
83 | __________________________________________________________________________________________
84 | public static void SaveDataToFile(string path, string[] data)
85 | -Saves string array to a specified path. (Path must include file name and extension.)
86 | -Alternatively, 'Sys.SaveFile(string path, string[] data)' will perfrom the same operation.
87 | PARAMETERS:
88 | path - desired path to save the text file.
89 | data - the string array to be saved to text file.
90 | USEAGE:
91 | public string[] data = new string[]{"a","b","c"};
92 | Sys.SaveDataToFile("Path_To_Text_File/SomeFile.txt", data);
93 | __________________________________________________________________________________________
94 | public static void SaveDataToFile(string path, string[] data, bool clearOldFiles)
95 | -Saves string array to a specified path then opens file directory upon save. (Path must include file name and extension.)
96 | -Alternatively, 'Sys.SaveFile(string path, string[] data, bool openDirectory)' will perfrom the same operation.
97 | PARAMETERS:
98 | path - desired path to save the text file.
99 | data - the string array to be saved to text file.
100 | clearOldFiles - if true, the existing file data will be deleted before new data is written.
101 | USEAGE:
102 | public string[] data = new string[]{"a","b","c"};
103 | Sys.SaveDataToFile("Path_To_Text_File/SomeFile.txt", data, true);
104 | __________________________________________________________________________________________
105 | public static string[] LoadDataFromFile (string path)
106 | -Loads data from a specified path and returns it as a string array. (Path must include file name and extension.)
107 | -Alternatively, 'Sys.ReadFile(string path)' will perfrom the same operation.
108 | PARAMETERS:
109 | path - path containing text file to be read and cast to an array of strings.
110 | USEAGE:
111 | public string[] data;
112 | data = Sys.LoadDataFromFile("Path_To_Text_File/SomeFile.txt");
113 | __________________________________________________________________________________________
114 | public static List LoadDataFromFile (string path)
115 | -Loads data from a specified path and returns it as a list of strings. (Path must include file name and extension.)
116 | -Alternatively, 'Sys.ReadFile(string path)' will perfrom the same operation.
117 | PARAMETERS:
118 | path - path containing text file to be read and cast to list of strings.
119 | USEAGE:
120 | public List data;
121 | data = Sys.LoadDataFromFile("Path_To_Text_File/SomeFile.txt");
122 | __________________________________________________________________________________________
123 |
124 |
125 |
126 | SCREEN CAPTURING METHODS:
127 | public static void CaptureScreenshot (MonoBehaviour instance)
128 | -Saves a screenshot to default location: Application.persistentDataPath + "/" + Application.productName+ "/Screenshots/" + System.DateTime.Now.ToString("MMddyyyy - hhmmss") + ".png"
129 | PARAMETERS:
130 | instance - the instance calling the CaptureScreenshot method. Use 'this' by default.
131 | USEAGE:
132 | Sys.CaptureScreenshot(this);
133 | __________________________________________________________________________________________
134 | public static void CaptureScreenshot (MonoBehaviour instance, string path,)
135 | -Saves a screenshot to a specified path. (Path must include file name and '.png' extension.)
136 | PARAMETERS:
137 | instance - the instance calling the CaptureScreenshot method. Use 'this' by default.
138 | path - the path to save screenshot as png file.
139 | USEAGE:
140 | Sys.CaptureScreenshot(this, "Path_To_Screenshots/SomeScreenshot.png");
141 | __________________________________________________________________________________________
142 | public static void CaptureScreenshot (MonoBehaviour instance, string path, bool openDirectory)
143 | -Saves a screenshot to a specified path then opens the png image upon save. (Path must include file name and '.png' extension.)
144 | PARAMETERS:
145 | instance - the instance calling the CaptureScreenshot method. Use 'this' by default.
146 | path - the path to save screenshot as png file.
147 | openDirectory - if true, the saved png will open with the systems default image viewer (Desktop Only).
148 | USEAGE:
149 | Sys.CaptureScreenshot(this, "Path_To_Screenshots/SomeScreenshot.png", true);
150 | __________________________________________________________________________________________
151 | public static Texture2D ScreenToTexture2D ()
152 | -Captures and returns screenshot as Texture2D. (Not Recommended - Bugged)
153 | USEAGE:
154 | public Texture2D tex;
155 | tex = Sys.ScreenToTexture2D();
156 | __________________________________________________________________________________________
157 | public static Texture2D LoadImageAtPath(string path)
158 | -Loads an image from a specified path and returns it as Texture2D.
159 | PARAMETERS:
160 | path - the path containing the desired png image.
161 | USEAGE:
162 | public Texture2D tex;
163 | tex = Sys.LoadImageAtPath("Path_To_Image/SomeImage.png");
164 | __________________________________________________________________________________________
165 |
166 |
167 |
168 | BASIC ARITHMETIC METHODS: [DEPRICIATED! v1.0.4 and under only]
169 | public static int Add(int a, int b, int c, int d)
170 | -Returns sum of any given multiple values.
171 | -Will add anywhere from two to four separate values.
172 | PARAMETERS:
173 | a - value to be added.
174 | b - value to be added.
175 | c - value to be added.
176 | d - value to be added.
177 | USEAGE:
178 | public int sum;
179 | sum = Sys.Add(1,2,3,4);
180 | __________________________________________________________________________________________
181 | public static float Add(float a, float b, float c, float d)
182 | -Returns sum of any given multiple values.
183 | -Will add anywhere from two to four separate values.
184 | PARAMETERS:
185 | a - value to be added.
186 | b - value to be added.
187 | c - value to be added.
188 | d - value to be added.
189 | USEAGE:
190 | public float sum;
191 | sum = Sys.Add(1.2f,2.2f,3.4f,4.5f);
192 | __________________________________________________________________________________________
193 | public static int Subtract(int a, int b, int c, int d)
194 | -Returns sum of any given multiple values.
195 | -Will subtract anywhere from two to four separate values.
196 | PARAMETERS:
197 | a - value to be subtracted.
198 | b - value to be subtracted.
199 | c - value to be subtracted.
200 | d - value to be subtracted.
201 | USEAGE:
202 | public int sum;
203 | sum = Sys.Subtract(1,2,3,4);
204 | __________________________________________________________________________________________
205 | public static float Subtract(float a, float b, float c, float d)
206 | -Returns sum of any given multiple values.
207 | -Will subtract anywhere from two to four separate values.
208 | PARAMETERS:
209 | a - value to be subtracted.
210 | b - value to be subtracted.
211 | c - value to be subtracted.
212 | d - value to be subtracted.
213 | USEAGE:
214 | public float sum;
215 | sum = Sys.Subtract(1.2f,2.2f,3.4f,4.5f);
216 | __________________________________________________________________________________________
217 | public static int Multiply(int a, int b, int c)
218 | -Returns sum of any given multiple values.
219 | -Will multiply anywhere from two to four separate values.
220 | PARAMETERS:
221 | a - value to be multiplied.
222 | b - value to be multiplied.
223 | c - value to be multiplied.
224 | d - value to be multiplied.
225 | USEAGE:
226 | public int sum;
227 | sum = Sys.Multiply(1,2,3,4);
228 | __________________________________________________________________________________________
229 | public static float Multiply(float a, float b, float c)
230 | -Returns sum of any given multiple values.
231 | -Will multiply anywhere from two to four separate values.
232 | PARAMETERS:
233 | a - value to be multiplied.
234 | b - value to be multiplied.
235 | c - value to be multiplied.
236 | d - value to be multiplied.
237 | USEAGE:
238 | public float sum;
239 | sum = Sys.Multiply(1.2f,2.2f,3.4f,4.5f);
240 | __________________________________________________________________________________________
241 | public static float Divide(float a, float b)
242 | -This will return the quotient of the given values.
243 | -Can return only float values.
244 | PARAMETERS:
245 | a - value to be divided.
246 | b - value to be divided.
247 | USEAGE:
248 | public int sum;
249 | sum = Sys.Divide(1.2f,2.2f);
250 | __________________________________________________________________________________________
251 |
252 |
253 |
254 | SYSTEM INFORMATION METHODS: [AS OF v1.0.5 SYSTEM INFORMATION METHODS NOW UNDER 'Info' CLASS]
255 | public static void SaveSystemInfo (string path)
256 | -Saves UnityEngine.SystemInfo data to a neatly formated text file at a specified path. (Path must include file name and extension.)
257 | PARAMETERS:
258 | path - the path to save UnityEngine.SystemInfo as a formatted text file.
259 | USEAGE:
260 | Info.SaveSystemInfo("Path_To_Save/SystemInfo.txt");
261 | // Sys.SaveSystemInfo("Path_To_Save/SystemInfo.txt"); //DEPRICIATED
262 | __________________________________________________________________________________________
263 | public static void SaveSystemInfo (string path, bool openDirectory)
264 | -Saves UnityEngine.SystemInfo data to a neatly formated text file at a specified path then opens file directory upon save. (Path must include file name and extension.)
265 | PARAMETERS:
266 | path - the path to save UnityEngine.SystemInfo as a formatted text file.
267 | openDirectory - if true, File Explorer will open the containing folder of your saved file (Desktop Only).
268 | USEAGE:
269 | Info.SaveSystemInfo("Path_To_Save/SystemInfo.txt", true);
270 | // Sys.SaveSystemInfo("Path_To_Save/SystemInfo.txt", true); //DEPRICIATED
271 | __________________________________________________________________________________________
272 | public static List GetSystemInfo ()
273 | -Returns formatted UnityEngine.SystemInfo to a list of strings.
274 | USEAGE:
275 | public List systemInfo;
276 | systemInfo = Info.GetSystemInfo();
277 | // systemInfo = Sys.GetSystemInfo(); //DEPRICIATED
278 | __________________________________________________________________________________________
279 |
280 |
281 |
282 | UNIQUE IDENTIFIER GENERATION METHODS:
283 | public static string GenerateUniqueID(int length)
284 | -Returns a randomly generated identification code of any given length.
285 | PARAMETERS:
286 | length - desired length of the returned unique identifier.
287 | USEAGE:
288 | public string uniqueID;
289 | unique = Sys.GenerateUniqueID(21);
290 | __________________________________________________________________________________________
291 |
--------------------------------------------------------------------------------
/Source/Assets/Sys_API/Examples/Sys_API_CSharp_Example.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using UnityEngine;
5 | using UnityEngine.UI;
6 |
7 | public class Sys_API_CSharp_Example : MonoBehaviour {
8 |
9 | [HeaderAttribute("Directory Info")]
10 | [Tooltip("This is the filename for exported Sys.Log data")]
11 | public string logFileName = "SysLog.txt";
12 | [Tooltip("This is the filename for exported System Information data")]
13 | public string sysFileName = "SystemInformation.txt";
14 | string dir;
15 | [Tooltip("This is the default path to save files. Read Only!")]
16 | public string dataPath;
17 | [Space(15)]
18 | //public Texture2D capture;
19 | [HeaderAttribute("Sys Method Switches")]
20 | [Tooltip("Click this to capture a screenshot!")]
21 | public bool CaptureScreenView;
22 | [Tooltip("Click this to save 'saveArray' to a text file")]
23 | public bool SaveArrayToFile;
24 | [Tooltip("Click this to load 'saveArray' data from a text file")]
25 | public bool GetArrayFromFile;
26 | [Tooltip("Click this save the current system's information to a text file")]
27 | public bool SaveSystemInfo;
28 | [Tooltip("Click this read the current system's information and cast to 'SystemInfo' list variable")]
29 | public bool GetSystemInfo;
30 | [Tooltip("Click this save the Sys.Log to a text file")]
31 | public bool SaveSystemLog;
32 | [Tooltip("Click this to clear the Sys.Log cache")]
33 | public bool ClearSystemLog;
34 | [Space(15)]
35 |
36 | [HeaderAttribute("Sys Logger Imported Data")]
37 | [Tooltip("This is the raw Sys.Log messages without time stamps")]
38 | public List logRaw = new List();
39 | [Tooltip("This is the Sys.Log messages WITH time stamps")]
40 | public List logData = new List();
41 | [Space(12)]
42 |
43 | [HeaderAttribute("File Save/Load Example Arrays")]
44 | [Tooltip("This is the example string array to save to a file using 'Sys.SaveFile()'")]
45 | public string[] saveArray = new string[]{"a","b","c","d","e","f","g","h","i","j"};
46 | [Tooltip("This array reads all the data saved from the 'saveArray' variable when activated by 'GetArrayFromFile' boolean")]
47 | public string[] loadArray;
48 | [Space(12)]
49 |
50 | [HeaderAttribute("Imported System Info")]
51 | [Tooltip("This is current system's information cast to a list of strings. Activated by 'GetSystemInfo' boolean")]
52 | public List SystemInfo = new List();
53 | [Space(12)]
54 |
55 | [HeaderAttribute("Hash Code Generation [Alpha]")]
56 | [Tooltip("Click this generate a random hash code")]
57 | public bool GenerateUniqueID;
58 | [Tooltip("This is current system's information cast to a list of strings. Activated by 'GetSystemInfo' boolean")]
59 | public int uIDLength;
60 | public string uniqueID;
61 |
62 | [Space(12)]
63 |
64 | [HeaderAttribute("Arithmetic Testing [Unstable]")]
65 | [Tooltip("The Cartesian Product of sets 'a' and 'b'.")]
66 | public int[] cProduct;
67 | public int[] a = new int[]{1,2,3,4};
68 | public int[] b = new int[]{1,1,2,3};
69 |
70 | public void Awake () {
71 | /*#if UNITY_EDITOR
72 | dir = Application.persistentDataPath;
73 | #endif
74 | #if UNITY_ANDROID && !UNITY_EDITOR
75 | dir = "/storage/emulated/0";
76 | #endif
77 | #if UNITY_IOS && !UNITY_EDITOR
78 | dir = Application.persistentDataPath;
79 | #endif
80 | dataPath = dir + "/" + Application.productName + "/Logs";
81 | if(!Directory.Exists(dataPath)){
82 | Directory.CreateDirectory(dataPath);
83 | File.Create(dataPath + "/" + logFileName).Dispose();
84 | dataPath = dir + "/"+ Application.productName + "/Logs";
85 | } else {
86 | if(!File.Exists(dataPath + "/" + logFileName)){
87 | File.Create(dataPath + "/" + logFileName).Dispose();
88 | dataPath = dir + "/"+ Application.productName + "/Logs";
89 | } else {
90 | dataPath = dir + "/"+ Application.productName + "/Logs";
91 | }
92 | }*/
93 |
94 | dir = Sys.DeviceExternalStorage();
95 | dataPath = dir + "/" + Application.productName + "/Logs2";
96 | if(Sys.DirectoryCheck(dataPath,true)){
97 | Sys.FileCheck(dataPath+"/", logFileName, true);
98 | }
99 | }
100 | void Start () {
101 | Sys.Log("This is a test..");
102 | Sys.Log("This is a test...",true);
103 | Sys.Log("This is a test....");
104 | Sys.Log("This is a test.....", true);
105 | Sys.Log("This is a test......");
106 | Sys.Log("This is a test.......",true);
107 | Sys.Log("This is a test........");
108 | Sys.Log("This is a test.........", true);
109 | Sys.Log("This is a test..........");
110 | Sys.Log("This is a test...........",true);
111 | Sys.Log("This is a test............");
112 | Sys.Log("This is a test.............", true);
113 | Sys.Log("This is a test..............");
114 | Sys.Log("This is a test...............", true);
115 | Sys.Log("This is a test................", false);
116 | logRaw = Sys.logRaw;
117 | logData = Sys.logData;
118 | //Sys.SaveLog(dataPath + "/" + logFileName, true);
119 | //Sys.SaveSystemInfo(dataPath + "/" + sysFileName);
120 | //uniqueID = Sys.GenerateUniqueID(21);
121 | cProduct = Sys.cProduct(a,b);
122 |
123 | }
124 |
125 | // Update is called once per frame
126 | void Update () {
127 | logRaw = Sys.logRaw;
128 | logData = Sys.logData;
129 |
130 | if(CaptureScreenView){
131 | string getDateTime = System.DateTime.Now.ToString("MMddyyyy_hhmmss");
132 | Sys.CaptureScreenshot(this, (dataPath + "/" + getDateTime + ".png"), true);
133 | //capture = Sys.ScreenToTexture2D();
134 | //capture = Sys.LoadImageAtPath(dataPath + "/" + getDateTime + ".png");
135 | CaptureScreenView = false;
136 | }
137 |
138 | if(SaveArrayToFile){
139 | //Sys.SaveDataToFile(dataPath + "/" + "abc.txt", saveArray);
140 | Sys.SaveFile(dataPath + "/" + "abc.txt", saveArray);
141 | SaveArrayToFile = false;
142 | }
143 | if(GetArrayFromFile){
144 | //loadArray = Sys.LoadDataFromFile(dataPath + "/" + "abc.txt");
145 | loadArray = Sys.ReadFile(dataPath + "/" + "abc.txt");
146 | GetArrayFromFile = false;
147 | }
148 |
149 | if(SaveSystemInfo){
150 | Info.SaveSystemInfo(dataPath + "/" + sysFileName, true);
151 | SaveSystemInfo = false;
152 | }
153 |
154 | if(GetSystemInfo){
155 | SystemInfo = new List(Info.GetSystemInfo());
156 | GetSystemInfo = false;
157 | }
158 |
159 | if(SaveSystemLog){
160 | Sys.SaveLog(dataPath + "/" + logFileName, true);
161 | SaveSystemLog = false;
162 | }
163 |
164 | if(ClearSystemLog){
165 | Sys.ClearLog();
166 | ClearSystemLog = false;
167 | }
168 |
169 | if(GenerateUniqueID){
170 | uniqueID = Sys.GenerateUniqueID(uIDLength);
171 | GenerateUniqueID = false;
172 | }
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/Source/Assets/Sys_API/Examples/Sys_API_JS_Example.js:
--------------------------------------------------------------------------------
1 | import System.Collections.Generic;
2 |
3 | @HeaderAttribute("Directory Info")
4 | @Tooltip("This is the filename for exported Sys.Log data")
5 | var logFileName : String = "SysLog.txt";
6 | @Tooltip("This is the filename for exported System Information data")
7 | var sysFileName : String = "SystemInformation.txt";
8 | var dir : String;
9 | @Tooltip("This is the default path to save files. Read Only!")
10 | var dataPath : String;
11 | @Space(15)
12 | //var Texture2D capture;
13 | @HeaderAttribute("Sys Method Switches")
14 | @Tooltip("Click this to capture a screenshot!")
15 | var CaptureScreenView : boolean;
16 | @Tooltip("Click this to save 'saveArray' to a text file")
17 | var SaveArrayToFile : boolean;
18 | @Tooltip("Click this to load 'saveArray' data from a text file")
19 | var GetArrayFromFile : boolean;
20 | @Tooltip("Click this save the current system's information to a text file")
21 | var SaveSystemInfo : boolean;
22 | @Tooltip("Click this read the current system's information and cast to 'SystemInfo' list variable")
23 | var GetSystemInfo : boolean;
24 | @Tooltip("Click this save the Sys.Log to a text file")
25 | var SaveSystemLog : boolean;
26 | @Tooltip("Click this to clear the Sys.Log cache")
27 | var ClearSystemLog : boolean;
28 | @Space(15)
29 |
30 | @HeaderAttribute("Sys Logger Imported Data")
31 | @Tooltip("This is the raw Sys.Log messages without time stamps")
32 | var logRaw : List. = new List.();
33 | @Tooltip("This is the Sys.Log messages WITH time stamps")
34 | var logData : List. = new List.();
35 | @Space(12)
36 |
37 | @HeaderAttribute("File Save/Load Example Arrays")
38 | @Tooltip("This is the example String array to save to a file using 'Sys.SaveFile()'")
39 | var saveArray : String[] = ["a","b","c","d","e","f","g","h","i","j"];
40 | @Tooltip("This array reads all the data saved from the 'saveArray' variable when activated by 'GetArrayFromFile' boolean")
41 | var loadArray : String[];
42 | @Space(12)
43 |
44 | @HeaderAttribute("Imported System Info")
45 | @Tooltip("This is current system's information cast to a list of strings. Activated by 'GetSystemInfo' boolean")
46 | var SystemInfo : List. = new List.();
47 | @Space(12)
48 |
49 | @HeaderAttribute("Hash Code Generation [Alpha]")
50 | @Tooltip("Click this generate a random hash code")
51 | var GenerateUniqueID : boolean;
52 | @Tooltip("This is current system's information cast to a list of strings. Activated by 'GetSystemInfo' boolean")
53 | var uIDLength : int;
54 | var uniqueID : String;
55 |
56 | public function Awake () {
57 | dir = Sys.DeviceExternalStorage();
58 | dataPath = dir + "/" + Application.productName + "/Logs2";
59 | if(Sys.DirectoryCheck(dataPath,true)){
60 | Sys.FileCheck(dataPath+"/", logFileName, true);
61 | }
62 | }
63 | function Start () {
64 | Sys.Log("This is a test..");
65 | Sys.Log("This is a test...",true);
66 | Sys.Log("This is a test....");
67 | Sys.Log("This is a test.....", true);
68 | Sys.Log("This is a test......");
69 | Sys.Log("This is a test.......",true);
70 | Sys.Log("This is a test........");
71 | Sys.Log("This is a test.........", true);
72 | Sys.Log("This is a test..........");
73 | Sys.Log("This is a test...........",true);
74 | Sys.Log("This is a test............");
75 | Sys.Log("This is a test.............", true);
76 | Sys.Log("This is a test..............");
77 | Sys.Log("This is a test...............", true);
78 | Sys.Log("This is a test................", false);
79 | logRaw = Sys.logRaw;
80 | logData = Sys.logData;
81 | //Sys.SaveLog(dataPath + "/" + logFileName, true);
82 | //Sys.SaveSystemInfo(dataPath + "/" + sysFileName);
83 | }
84 |
85 | // Update is called once per frame
86 | function Update () {
87 | logRaw = Sys.logRaw;
88 | logData = Sys.logData;
89 |
90 | if(CaptureScreenView){
91 | var getDateTime : String = System.DateTime.Now.ToString("MMddyyyy_hhmmss");
92 | Sys.CaptureScreenshot(this, (dataPath + "/" + getDateTime + ".png"), true);
93 | //capture = Sys.ScreenToTexture2D();
94 | //capture = Sys.LoadImageAtPath(dataPath + "/" + getDateTime + ".png");
95 | CaptureScreenView = false;
96 | }
97 |
98 | if(SaveArrayToFile){
99 | //Sys.SaveDataToFile(dataPath + "/" + "abc.txt", saveArray);
100 | Sys.SaveFile(dataPath + "/" + "abc.txt", saveArray);
101 | SaveArrayToFile = false;
102 | }
103 | if(GetArrayFromFile){
104 | //loadArray = Sys.LoadDataFromFile(dataPath + "/" + "abc.txt");
105 | loadArray = Sys.ReadFile(dataPath + "/" + "abc.txt");
106 | GetArrayFromFile = false;
107 | }
108 |
109 | if(SaveSystemInfo){
110 | Info.SaveSystemInfo(dataPath + "/" + sysFileName, true);
111 | SaveSystemInfo = false;
112 | }
113 |
114 | if(GetSystemInfo){
115 | SystemInfo = new List.(Info.GetSystemInfo());
116 | GetSystemInfo = false;
117 | }
118 |
119 | if(SaveSystemLog){
120 | Sys.SaveLog(dataPath + "/" + logFileName, true);
121 | SaveSystemLog = false;
122 | }
123 |
124 | if(ClearSystemLog){
125 | Sys.ClearLog();
126 | ClearSystemLog = false;
127 | }
128 |
129 | if(GenerateUniqueID){
130 | uniqueID = Sys.GenerateUniqueID(uIDLength);
131 | GenerateUniqueID = false;
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/Source/Assets/Sys_API/change.log:
--------------------------------------------------------------------------------
1 | //SYS API v1+ CHANGE LOG//
2 |
3 | [12/02/2017] - v1.0.5:
4 | -Added Stack Trace methods to Sys class.
5 | -Added 'URLAntiCache' method to Sys class.
6 | -Split 'SystemInfo' methods into Info class.
7 | -Purged unneeded comments and operations from package.
8 | -Updated 'SysUpdateDownloader' to ignore /Plugins/SysAPI/Documentation.txt in v1.0.5 and up.
9 | -Added 'Wiki Documentation' toolbar button.
10 | -Removed 'More Information' toolbar button.
11 | -Simplified 'Artithmetic Methods'.
12 | -Added 'LogError' methods into the Sys class.
13 | -Removed unneeded 'import' functions from 'Sys_API_JS_Example.js'.
14 | -Implemented Sys Message Library to github source for detailed debugging and fixes.
15 | -Added 'FileCheck' and 'DirectoryCheck' methods to the Sys class.
16 | -Added 'DeviceDefaultStorage' method to Sys class.
17 | -Updated Documentation.
18 | -Minor bug fixes.
19 | -Updated Sys.Log operations.
20 | -Compiled new Unity Asset Package file'SystemInformationLogger_v1.0.0_EditorStandalone.unitypackage' file.
21 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.5.unitypackage' file.
22 |
23 | [10/13/2017] - v1.0.4b:
24 | -Changed 'Hash Code Generation Methods' to 'Unique Identifier Generation Methods'.
25 | -Updated GitHub repositories to 1.0.4b.
26 | -Swiched update repo host from pastebin to github.
27 |
28 | [10/13/2017] - v1.0.4:
29 | -Added new dependencies to update package. ('SystemInformationLogger.cs', 'Sys_API_CSharp_Example.cs', 'Sys_API_JS_Example.js', 'Documentation.txt', and 'change.log')
30 | -Increased update notifications.
31 | -Added 'primitive' connection checking to update downloader.
32 | -Minor bug fixes.
33 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.4.unitypackage' file.
34 |
35 | [10/13/2017] - v1.0.3c:
36 | -Created 'SystemInformationLogger.cs' standalone editor script.
37 | -Implemented 'Sys API Error Coding System'.
38 | -Minor fixes/updates.
39 |
40 | [10/11/2017] - v1.0.3b:
41 | -Added Force Update method in the event of SYS_MASTER file corruption or compile error.
42 | -Tweaked SYS Editor Window GUI layouts.
43 | -Minor bug fixes.
44 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.3b.unitypackage' file.
45 |
46 |
47 | [10/10/2017] - v1.0.3:
48 | -Created bundle manager script as 'SysOptions.cs'.
49 | -Created 'SysUpdateDownloader.cs' to check for and download future 'SYS_MASTER.cs' updates.
50 | -Revised 'Documentation.txt'.
51 | -Reorganized Assets.
52 | -Added Menu Option'/Tools/Sys Api/Options'.
53 | -Added Menu Option'/Tools/Sys Api/Examples'.
54 | -Added Menu Option'/Tools/Sys Api/Documentation'.
55 | -Added Menu Option'/Tools/Sys Api/More Information'.
56 | -Minor bug fixes.
57 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.3.unitypackage' file.
58 |
59 | [09/21/2017] - v1.0.2:
60 | -Added Basic Arethmetic Methods to 'SYS_MASTER.cs'.
61 | -Added Hash Code Generation to 'SYS_MASTER.cs'.
62 | -Updated 'Sys_API_Example' files with hash code generation examples.
63 | -Updated 'Documentation.txt'.
64 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.2.unitypackage' file.
65 |
66 | [09/20/2017] - v1.0.1:
67 | -Renamed master file from 'AdvSysInfo.cs' to 'SYS_MASTER.cs'.
68 | -Added 'ReadFile()' & 'SaveFile()' methods to 'SYS_MASTER.cs'.
69 | -Added Inspector Attributes to 'Sys_API_Example.cs'.
70 | -Added 'Sys_API_Example.js' from 'Sys_API_Example.cs' conversion.
71 | -Moved 'SYS_MASTER.cs' from '/Assets/Scripts' to 'Assets/Plugins' directory.
72 | -Renamed miscellanous private variables in 'SYS_MASTER.cs'.
73 | -Fixed 'UnauthorizedAccessException' bug in 'Sys.SaveSystemInfo()' methods.
74 | -Fixed Sys Log auto clear cache bug.
75 | -Tweaked directory checking operations.
76 | -Updated 'Documentation.txt'.
77 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.1.unitypackage' file.
78 |
79 | [09/18/2017] - v1.0.0:
80 | -Created and Compiled initial alpha build files.
81 | -Created 'Documentation.txt'.
82 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.0.unitypackage' file.
83 |
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | ## Unity SYS API v1+ CHANGE LOG
2 |
3 | ### [10/13/2017] - v1.0.4b:
4 | -Changed 'Hash Code Generation Methods' to 'Unique Identifier Generation Methods'.
5 | -Updated GitHub repositories to 1.0.4b.
6 | -Swiched update repo host from pastebin to github.
7 |
8 | ### [10/13/2017] - v1.0.4:
9 | -Added new dependencies to update package. ('SystemInformationLogger.cs', 'Sys_API_CSharp_Example.cs', 'Sys_API_JS_Example.js', 'Documentation.txt', and 'change.log')
10 | -Increased update notifications.
11 | -Added 'primitive' connection checking to update downloader.
12 | -Minor bug fixes.
13 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.4.unitypackage' file.
14 |
15 | ### [10/13/2017] - v1.0.3c:
16 | -Created 'SystemInformationLogger.cs' standalone editor script.
17 | -Implemented 'Sys API Error Coding System'.
18 | -Minor fixes/updates.
19 |
20 | ### [10/11/2017] - v1.0.3b:
21 | -Added Force Update method in the event of SYS_MASTER file corruption or compile error.
22 | -Tweaked SYS Editor Window GUI layouts.
23 | -Minor bug fixes.
24 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.3b.unitypackage' file.
25 |
26 |
27 | ### [10/10/2017] - v1.0.3:
28 | -Created bundle manager script as 'SysOptions.cs'.
29 | -Created 'SysUpdateDownloader.cs' to check for and download future 'SYS_MASTER.cs' updates.
30 | -Revised 'Documentation.txt'.
31 | -Reorganized Assets.
32 | -Added Menu Option'/Tools/Sys Api/Options'.
33 | -Added Menu Option'/Tools/Sys Api/Examples'.
34 | -Added Menu Option'/Tools/Sys Api/Documentation'.
35 | -Added Menu Option'/Tools/Sys Api/More Information'.
36 | -Minor bug fixes.
37 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.3.unitypackage' file.
38 |
39 | ### [09/21/2017] - v1.0.2:
40 | -Added Basic Arethmetic Methods to 'SYS_MASTER.cs'.
41 | -Added Hash Code Generation to 'SYS_MASTER.cs'.
42 | -Updated 'Sys_API_Example' files with hash code generation examples.
43 | -Updated 'Documentation.txt'.
44 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.2.unitypackage' file.
45 |
46 | ### [09/20/2017] - v1.0.1:
47 | -Renamed master file from 'AdvSysInfo.cs' to 'SYS_MASTER.cs'.
48 | -Added 'ReadFile()' & 'SaveFile()' methods to 'SYS_MASTER.cs'.
49 | -Added Inspector Attributes to 'Sys_API_Example.cs'.
50 | -Added 'Sys_API_Example.js' from 'Sys_API_Example.cs' conversion.
51 | -Moved 'SYS_MASTER.cs' from '/Assets/Scripts' to 'Assets/Plugins' directory.
52 | -Renamed miscellanous private variables in 'SYS_MASTER.cs'.
53 | -Fixed 'UnauthorizedAccessException' bug in 'Sys.SaveSystemInfo()' methods.
54 | -Fixed Sys Log auto clear cache bug.
55 | -Tweaked directory checking operations.
56 | -Updated 'Documentation.txt'.
57 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.1.unitypackage' file.
58 |
59 | ### [09/18/2017] - v1.0.0:
60 | -Created and Compiled initial alpha build files.
61 | -Created 'Documentation.txt'.
62 | -Compiled updated Unity Asset Package file as 'UnityEngine.Sys_API_v1.0.0.unitypackage' file.
63 |
--------------------------------------------------------------------------------