Пример #1
0
 private void Get(string filename, Action <int> callback)
 {
     UVFile.Open(filename, UVFileAccess.Read, (e, file) => {
         byte[] r = new byte[512];
         file.Read(r, r.Length, 0, (e2, size) => {
             if (callback != null)
             {
                 callback(int.Parse(Encoding.ASCII.GetString(r, 0, size)));
             }
         });
     });
 }
Пример #2
0
        public void CreateNotexistingFile()
        {
            if (File.Exists(Default.File))
            {
                File.Delete(Default.File);
            }

            UVFile.Open(Default.File, UVFileAccess.Write, (e, file) => {
                Assert.IsNull(e);
                Assert.IsNotNull(file);
            });

            Loop.Default.Run();
        }
Пример #3
0
        private void Set(int value, Action <bool> callback)
        {
            UVFile.Open(PWM, UVFileAccess.Write, (e, file) => {
                if (e != null)
                {
                    callback(false);
                    return;
                }

                file.Write(Encoding.ASCII, value.ToString(), (e2, length) => {
                    if (e2 != null)
                    {
                        callback(false);
                        return;
                    }
                    if (callback != null)
                    {
                        callback(true);
                    }
                });
            });
        }