コード例 #1
0
        private static string GetUniqueLocalTraceFileName()
        {
            string         tmp    = Runtime.GetProperty("java.io.tmpdir", "/tmp");
            string         nonce  = null;
            BufferedReader reader = null;

            try
            {
                // On Linux we can get a unique local file name by reading the process id
                // out of /proc/self/stat.  (There isn't any portable way to get the
                // process ID from Java.)
                reader = new BufferedReader(new InputStreamReader(new FileInputStream("/proc/self/stat"
                                                                                      ), Charsets.Utf8));
                string line = reader.ReadLine();
                if (line == null)
                {
                    throw new EOFException();
                }
                nonce = line.Split(" ")[0];
            }
            catch (IOException)
            {
            }
            finally
            {
                IOUtils.Cleanup(Log, reader);
            }
            if (nonce == null)
            {
                // If we can't use the process ID, use a random nonce.
                nonce = UUID.RandomUUID().ToString();
            }
            return(new FilePath(tmp, nonce).GetAbsolutePath());
        }
コード例 #2
0
        /**
         *
         * Método que gera um String randomicamente para ser usada em testes.
         *
         * @return String = Texto gerado randomicamente
         *
         * */
        public string GeraString()
        {
            UUID   uuid     = UUID.RandomUUID();
            string myRandom = uuid.ToString();

            return(myRandom.Substring(0, 30));
        }
コード例 #3
0
        public void RegisterDeviceInBackendless(string token)
        {
            String id = null;

            id = Build.Serial;
            var OS_VERSION = (Build.VERSION.SdkInt).ToString();
            var OS         = "ANDROID";

            try
            {
                id = UUID.RandomUUID().ToString();
            }
            catch (Exception e)
            {
                Console.Write($"Error {e.Message}");
            }

            var DEVICE_ID = id;
            //"174677789761"
            var deviceReg = new DeviceRegistration();

            deviceReg.Os          = OS;
            deviceReg.OsVersion   = OS_VERSION;
            deviceReg.Expiration  = DateTime.Now.AddHours(3);
            deviceReg.DeviceId    = DEVICE_ID;
            deviceReg.DeviceToken = token;
            Backendless.Messaging.DeviceRegistration = deviceReg;

            Backendless.Messaging.RegisterDevice(token, "default", new AsyncCallback <string>(responseHanlder, errorHandler));
        }
コード例 #4
0
        AndroidNetUri GenerateRandomFileUrlInDemoTempStorage(string fileExtension)
        {
            var targetFile = System.IO.Path.Combine(
                MainApplication.TempImageStorage.TempDir, UUID.RandomUUID() + fileExtension);

            return(AndroidNetUri.FromFile(new Java.IO.File(targetFile)));
        }
コード例 #5
0
        public virtual void ShouldRenderASimpleMessageWithTemplates()
        {
            FindCandidatesQueryMessageBean tealBean = new FindCandidatesQueryMessageBean();

            tealBean.ControlActEventBean = new QueryControlActEventBean <FindCandidatesCriteria>();
            tealBean.ControlActEventBean.QueryByParameter.ParameterList = new FindCandidatesCriteria();
            MessageBeanBuilderSupport.PopulateMoreBetterStandardValues(tealBean);
            tealBean.ControlActEventBean.Code = Ca.Infoway.Messagebuilder.Domainvalue.Transport.HL7TriggerEventCode.FIND_CANDIDATES_QUERY;
            this.walker = new TealBeanRenderWalker(tealBean, MockVersionNumber.MOCK_MR2009, null, null, new MockTestCaseMessageDefinitionService
                                                       ());
            AuthorBean author = new AuthorBean();

            author.Time = new PlatformDate();
            author.Id   = new Identifier("1.2.3.4", "authorExtension");
            tealBean.ControlActEventBean.Author  = author;
            tealBean.ControlActEventBean.QueryId = new Identifier(UUID.RandomUUID().ToString());
            tealBean.ControlActEventBean.EventId = new Identifier(UUID.RandomUUID().ToString());
            tealBean.ControlActEventBean.GetCriteria().Gender = Ca.Infoway.Messagebuilder.Domainvalue.Payload.AdministrativeGender.MALE;
            XmlRenderingVisitor visitor = new XmlRenderingVisitor(MockVersionNumber.MOCK_MR2009);

            this.walker.Accept(visitor);
            string xml = visitor.ToXml().GetXmlMessage();

            System.Console.Out.WriteLine(xml);
            AssertValidHl7Message(xml);
        }
コード例 #6
0
        private void MRegButton_Click(object sender, EventArgs e)
        {
            mUsername = mUserNameEdit.Text.Trim();
            mPassword = mPasswordEdit.Text.Trim();
            mEmail    = mEmailEdit.Text.Trim();

            if (mUsername != string.Empty && mPassword != string.Empty && mEmail != string.Empty && EmailChaeck(mEmail))
            {
                mUser.ID       = UUID.RandomUUID().ToString();
                mUser.UserName = mUsername;
                mUser.Email    = mEmail;
                mUser.Password = GetSaltedPass(mPassword);
                mUsers.Add(mUser);

                var dialog = new Android.App.AlertDialog.Builder(this, Resource.Style.AlertDialogCustom)
                             .SetTitle("Успешна Регистрация!")
                             .SetMessage("Поздравленя, Вие, се регистрирахте успешно.")
                             .SetNeutralButton("Напред", (send, args) =>
                {
                    StartActivity(typeof(MainActivity));
                    Finish();
                })
                             .Show();
            }
            else
            {
                var dialog = new Android.App.AlertDialog.Builder(this, Resource.Style.AlertDialogCustom)
                             .SetTitle("Моля попълнете всички полета!")
                             .SetNeutralButton("ОК", (send, args) =>
                {
                })
                             .Show();
            }
        }
コード例 #7
0
ファイル: MainActivity.cs プロジェクト: ibnuda/Lok
        private void TrackLocation()
        {
            var prefs  = this.GetSharedPreferences("lok", 0);
            var editor = prefs.Edit();

            if (!SaveUserSettings())
            {
                return;
            }
            if (!CheckGooglePlayEnable())
            {
                return;
            }

            if (_currentlyTracking)
            {
                CancelAlarmManager();
                _currentlyTracking = false;
                editor.PutBoolean("currentlyTracking", false);
                editor.PutString("sessionId", "");
            }
            else
            {
                StartAlarmManager();
                editor.PutBoolean("currentlyTracking", true);
                editor.PutFloat("totalDistance", 0f);
                editor.PutBoolean("firstTimePosition", false);
                editor.PutString("sessionId", UUID.RandomUUID().ToString());
            }
            editor.Apply();
            SetTrackingButton();
        }
コード例 #8
0
        /// <summary>
        /// Implementación por/plataforma de la solicitud del identificador de la sesión.
        /// </summary>
        /// <param name="merchantId">El identificador del cliente</param>
        /// <param name="apiKey">La llave pública del API del cliente</param>
        /// <param name="baseUrl">El URL al que se debe conectar la plataforma.</param>
        protected override Task <string> CreateDeviceSessionIdInternal(string merchantId, string apiKey, string baseUrl)
        {
            if (null == Activity)
            {
                throw new InvalidOperationException("Activity has not been initialized.");
            }

            var sessionId = UUID.RandomUUID().ToString();

            sessionId = sessionId.Replace("-", string.Empty);

            var identifierForVendor       = Settings.Secure.GetString(Activity.ContentResolver, Settings.Secure.AndroidId);
            var identifierForVendorScript = $"var identifierForVendor = '{identifierForVendor}';";

            using (var webView = new WebView(Activity))
            {
                webView.SetWebViewClient(new WebViewClient());
                webView.Settings.JavaScriptEnabled = true;
                webView.EvaluateJavascript(identifierForVendorScript, null);

                var url = $"{baseUrl}/oa/logo.htm?m={merchantId}&s={sessionId}";
                webView.LoadUrl(url);

                return(Task.FromResult(sessionId));
            }
        }
コード例 #9
0
ファイル: MiniKdc.cs プロジェクト: orf53975/hadoop.net
        /// <summary>Creates  multiple principals in the KDC and adds them to a keytab file.</summary>
        /// <param name="keytabFile">keytab file to add the created principal.s</param>
        /// <param name="principals">principals to add to the KDC, do not include the domain.
        ///     </param>
        /// <exception cref="System.Exception">
        /// thrown if the principals or the keytab file could not be
        /// created.
        /// </exception>
        public virtual void CreatePrincipal(FilePath keytabFile, params string[] principals
                                            )
        {
            string generatedPassword = UUID.RandomUUID().ToString();

            Org.Apache.Directory.Server.Kerberos.Shared.Keytab.Keytab keytab = new Org.Apache.Directory.Server.Kerberos.Shared.Keytab.Keytab
                                                                                   ();
            IList <KeytabEntry> entries = new AList <KeytabEntry>();

            foreach (string principal in principals)
            {
                CreatePrincipal(principal, generatedPassword);
                principal = principal + "@" + GetRealm();
                KerberosTime timestamp = new KerberosTime();
                foreach (KeyValuePair <EncryptionType, EncryptionKey> entry in KerberosKeyFactory.
                         GetKerberosKeys(principal, generatedPassword))
                {
                    EncryptionKey ekey       = entry.Value;
                    byte          keyVersion = unchecked ((byte)ekey.GetKeyVersion());
                    entries.AddItem(new KeytabEntry(principal, 1L, timestamp, keyVersion, ekey));
                }
            }
            keytab.SetEntries(entries);
            keytab.Write(keytabFile);
        }
コード例 #10
0
        /// <summary>
        /// Speak text sentence
        /// </summary>
        /// <param name="text">target text</param>
        public void Speak(string text)
        {
            if (!this.isInitialized)
            {
                // Ignore request
                return;
            }
            this.Stop();
            this.synthesizer.SetSpeechRate(0.8f);
            this.synthesizer.SetLanguage(this.language);

            if (((int)Build.VERSION.SdkInt) >= 21)
            {
                this.synthesizer.Speak(text, QueueMode.Flush, Bundle.Empty, UUID.RandomUUID().ToString());
            }
            else
            {
                #pragma warning disable 618

                // This method was deprecated in API level 21.
                this.synthesizer.Speak(text, QueueMode.Flush, null);

                #pragma warning restore 618
            }
        }
コード例 #11
0
        private static void writeInstallationFile(File installation)
        {
            FileOutputStream outt = new FileOutputStream(installation);
            string           id   = UUID.RandomUUID().ToString();

            System.Text.UTF8Encoding en = new UTF8Encoding();
            outt.Write(en.GetBytes(id));
            outt.Close();
        }
コード例 #12
0
        public virtual void TestParseInvalidIiBusAndVerAsVer()
        {
            UUID    uuid = UUID.RandomUUID();
            XmlNode node = CreateNode("<something root=\"" + uuid.ToString() + "\" use=\"VER\" specializationType=\"II.VER\" />");
            II      ii   = (II) new IiElementParser().Parse(CreateContext("II.BUS_AND_VER"), node, this.result);

            AssertResultAsExpected(ii.Value, uuid.ToString(), null);
            Assert.IsTrue(this.result.IsValid());
        }
コード例 #13
0
        public virtual void TestParseValidIiAsUuid()
        {
            UUID    uuid = UUID.RandomUUID();
            XmlNode node = CreateNode("<something root=\"" + uuid.ToString() + "\" />");
            II      ii   = (II) new IiR2ElementParser().Parse(CreateContext("II"), node, this.result);

            AssertResultAsExpected(ii.Value, uuid.ToString(), null, null, null);
            Assert.IsTrue(this.result.IsValid());
        }
コード例 #14
0
        /// <exception cref="System.Exception"/>
        private void TestCreateHistoryDirs(Configuration conf, Clock clock)
        {
            conf.Set(JHAdminConfig.MrHistoryDoneDir, "/" + UUID.RandomUUID());
            conf.Set(JHAdminConfig.MrHistoryIntermediateDoneDir, "/" + UUID.RandomUUID());
            HistoryFileManager hfm = new HistoryFileManager();

            hfm.conf = conf;
            hfm.CreateHistoryDirs(clock, 500, 2000);
        }
コード例 #15
0
        /// <summary>Return clientId as byte[]</summary>
        public static byte[] GetClientId()
        {
            UUID       uuid = UUID.RandomUUID();
            ByteBuffer buf  = ByteBuffer.Wrap(new byte[ByteLength]);

            buf.PutLong(uuid.GetMostSignificantBits());
            buf.PutLong(uuid.GetLeastSignificantBits());
            return((byte[])buf.Array());
        }
コード例 #16
0
        public IInteraction CreateRequest()
        {
            DocumentDetailQuery interaction = new DocumentDetailQuery();

            interaction.ControlActEvent = new TriggerEvent <QueryDefinition>();

            interaction.AddRealmCode(Realm.ALBERTA);
            interaction.Id = new Identifier(UUID.RandomUUID().ToString());
            return(interaction);
        }
コード例 #17
0
        /// <summary>
        /// If ramDiskStorageLimit is &gt;=0, then RAM_DISK capacity is artificially
        /// capped.
        /// </summary>
        /// <remarks>
        /// If ramDiskStorageLimit is &gt;=0, then RAM_DISK capacity is artificially
        /// capped. If ramDiskStorageLimit &lt; 0 then it is ignored.
        /// </remarks>
        /// <exception cref="System.IO.IOException"/>
        protected internal void StartUpCluster(bool hasTransientStorage, int ramDiskReplicaCapacity
                                               , bool useSCR, bool useLegacyBlockReaderLocal)
        {
            Configuration conf = new Configuration();

            conf.SetLong(DfsBlockSizeKey, BlockSize);
            conf.SetInt(DfsNamenodeLazyPersistFileScrubIntervalSec, LazyWriteFileScrubberIntervalSec
                        );
            conf.SetLong(DfsHeartbeatIntervalKey, HeartbeatIntervalSec);
            conf.SetInt(DfsNamenodeHeartbeatRecheckIntervalKey, HeartbeatRecheckIntervalMsec);
            conf.SetInt(DfsDatanodeLazyWriterIntervalSec, LazyWriterIntervalSec);
            conf.SetInt(DfsDatanodeRamDiskLowWatermarkBytes, EvictionLowWatermark * BlockSize
                        );
            if (useSCR)
            {
                conf.SetBoolean(DfsClientReadShortcircuitKey, true);
                // Do not share a client context across tests.
                conf.Set(DfsClientContext, UUID.RandomUUID().ToString());
                if (useLegacyBlockReaderLocal)
                {
                    conf.SetBoolean(DfsClientUseLegacyBlockreaderlocal, true);
                    conf.Set(DfsBlockLocalPathAccessUserKey, UserGroupInformation.GetCurrentUser().GetShortUserName
                                 ());
                }
                else
                {
                    sockDir = new TemporarySocketDirectory();
                    conf.Set(DfsDomainSocketPathKey, new FilePath(sockDir.GetDir(), this.GetType().Name
                                                                  + "._PORT.sock").GetAbsolutePath());
                }
            }
            long[] capacities = null;
            if (hasTransientStorage && ramDiskReplicaCapacity >= 0)
            {
                // Convert replica count to byte count, add some delta for .meta and
                // VERSION files.
                long ramDiskStorageLimit = ((long)ramDiskReplicaCapacity * BlockSize) + (BlockSize
                                                                                         - 1);
                capacities = new long[] { ramDiskStorageLimit, -1 };
            }
            cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(ReplFactor).StorageCapacities
                          (capacities).StorageTypes(hasTransientStorage ? new StorageType[] { StorageType.
                                                                                              RamDisk, StorageType.Default } : null).Build();
            fs     = cluster.GetFileSystem();
            client = fs.GetClient();
            try
            {
                jmx = InitJMX();
            }
            catch (Exception e)
            {
                NUnit.Framework.Assert.Fail("Failed initialize JMX for testing: " + e);
            }
            Log.Info("Cluster startup complete");
        }
コード例 #18
0
        /// <exception cref="System.Exception"></exception>
        public static SavedRevision CreateRevisionWithRandomProps(SavedRevision createRevFrom
                                                                  , bool allowConflict)
        {
            IDictionary <string, object> properties = new Dictionary <string, object>();

            properties.Put(UUID.RandomUUID().ToString(), "val");
            UnsavedRevision unsavedRevision = createRevFrom.CreateRevision();

            unsavedRevision.SetUserProperties(properties);
            return(unsavedRevision.Save(allowConflict));
        }
コード例 #19
0
        public override void Setup()
        {
            FilePath kmsDir = new FilePath("target/test-classes/" + UUID.RandomUUID().ToString
                                               ());

            NUnit.Framework.Assert.IsTrue(kmsDir.Mkdirs());
            MiniKMS.Builder miniKMSBuilder = new MiniKMS.Builder();
            miniKMS = miniKMSBuilder.SetKmsConfDir(kmsDir).Build();
            miniKMS.Start();
            base.Setup();
        }
コード例 #20
0
        public virtual void TestParseInvalidIiBadUuid()
        {
            UUID    uuid = UUID.RandomUUID();
            XmlNode node = CreateNode("<something root=\"" + uuid.ToString() + "_garbage\" />");
            II      ii   = (II) new IiR2ElementParser().Parse(CreateContext("II"), node, this.result);

            AssertResultAsExpected(ii.Value, uuid.ToString() + "_garbage", null);
            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            Assert.AreEqual(Hl7ErrorCode.DATA_TYPE_ERROR, this.result.GetHl7Errors()[0].GetHl7ErrorCode());
            Assert.IsTrue(this.result.GetHl7Errors()[0].GetMessage().Contains("must conform to be either a UUID, RUID, or OID."));
        }
        private void Add_Person_Group_Click(object sender, EventArgs e)
        {
            String personGroupId = UUID.RandomUUID().ToString();

            Intent intent = new Intent(this, typeof(PersonGroupActivity));

            intent.PutExtra("AddNewPersonGroup", true);
            intent.PutExtra("PersonGroupName", "");
            intent.PutExtra("PersonGroupId", personGroupId);

            StartActivity(intent);
        }
コード例 #22
0
        /// <exception cref="System.Exception"/>
        private void TestKerberosDelegationTokenAuthenticator(bool doAs)
        {
            string doAsUser = doAs ? OkUser : null;
            // setting hadoop security to kerberos
            Configuration conf = new Configuration();

            conf.Set("hadoop.security.authentication", "kerberos");
            UserGroupInformation.SetConfiguration(conf);
            FilePath testDir = new FilePath("target/" + UUID.RandomUUID().ToString());

            Assert.True(testDir.Mkdirs());
            MiniKdc kdc = new MiniKdc(MiniKdc.CreateConf(), testDir);

            Org.Mortbay.Jetty.Server jetty = CreateJettyServer();
            Context context = new Context();

            context.SetContextPath("/foo");
            jetty.SetHandler(context);
            context.AddFilter(new FilterHolder(typeof(TestWebDelegationToken.KDTAFilter)), "/*"
                              , 0);
            context.AddServlet(new ServletHolder(typeof(TestWebDelegationToken.UserServlet)),
                               "/bar");
            try
            {
                kdc.Start();
                FilePath keytabFile = new FilePath(testDir, "test.keytab");
                kdc.CreatePrincipal(keytabFile, "client", "HTTP/localhost");
                TestWebDelegationToken.KDTAFilter.keytabFile = keytabFile.GetAbsolutePath();
                jetty.Start();
                DelegationTokenAuthenticatedURL.Token token = new DelegationTokenAuthenticatedURL.Token
                                                                  ();
                DelegationTokenAuthenticatedURL aUrl = new DelegationTokenAuthenticatedURL();
                Uri url = new Uri(GetJettyURL() + "/foo/bar");
                try
                {
                    aUrl.GetDelegationToken(url, token, FooUser, doAsUser);
                    NUnit.Framework.Assert.Fail();
                }
                catch (AuthenticationException ex)
                {
                    Assert.True(ex.Message.Contains("GSSException"));
                }
                DoAsKerberosUser("client", keytabFile.GetAbsolutePath(), new _Callable_778(aUrl,
                                                                                           url, token, doAs, doAsUser));
            }
            finally
            {
                // Make sure the token belongs to the right owner
                jetty.Stop();
                kdc.Stop();
            }
        }
コード例 #23
0
        public virtual void TestParseInvalidIiBusAndVerDefaultToIiVer()
        {
            UUID    uuid = UUID.RandomUUID();
            XmlNode node = CreateNode("<something root=\"" + uuid.ToString() + "\" use=\"VER\" />");
            II      ii   = (II) new IiElementParser().Parse(CreateContext("II.BUS_AND_VER"), node, this.result);

            AssertResultAsExpected(ii.Value, uuid.ToString(), null);
            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            Assert.AreEqual(Hl7ErrorCode.DATA_TYPE_ERROR, this.result.GetHl7Errors()[0].GetHl7ErrorCode());
            Assert.IsTrue(this.result.GetHl7Errors()[0].GetMessage().Contains("Specialization type must be II.BUS or II.VER; II.VER will be assumed. "
                                                                              ));
        }
コード例 #24
0
        /// <exception cref="System.Exception"/>
        public virtual void TestDatanodeReRegistration()
        {
            // Create a test file
            DistributedFileSystem dfs = cluster.GetFileSystem();
            Path path = new Path("/testRR");

            // Create a file and shutdown the DNs, which populates InvalidateBlocks
            DFSTestUtil.CreateFile(dfs, path, dfs.GetDefaultBlockSize(), (short)NumOfDatanodes
                                   , unchecked ((int)(0xED0ED0)));
            foreach (DataNode dn in cluster.GetDataNodes())
            {
                dn.Shutdown();
            }
            dfs.Delete(path, false);
            namesystem.WriteLock();
            InvalidateBlocks invalidateBlocks;
            int expected = NumOfDatanodes;

            try
            {
                invalidateBlocks = (InvalidateBlocks)Whitebox.GetInternalState(cluster.GetNamesystem
                                                                                   ().GetBlockManager(), "invalidateBlocks");
                NUnit.Framework.Assert.AreEqual("Expected invalidate blocks to be the number of DNs"
                                                , (long)expected, invalidateBlocks.NumBlocks());
            }
            finally
            {
                namesystem.WriteUnlock();
            }
            // Re-register each DN and see that it wipes the invalidation work
            foreach (DataNode dn_1 in cluster.GetDataNodes())
            {
                DatanodeID           did = dn_1.GetDatanodeId();
                DatanodeRegistration reg = new DatanodeRegistration(new DatanodeID(UUID.RandomUUID
                                                                                       ().ToString(), did), new StorageInfo(HdfsServerConstants.NodeType.DataNode), new
                                                                    ExportedBlockKeys(), VersionInfo.GetVersion());
                namesystem.WriteLock();
                try
                {
                    bm.GetDatanodeManager().RegisterDatanode(reg);
                    expected--;
                    NUnit.Framework.Assert.AreEqual("Expected number of invalidate blocks to decrease"
                                                    , (long)expected, invalidateBlocks.NumBlocks());
                }
                finally
                {
                    namesystem.WriteUnlock();
                }
            }
        }
コード例 #25
0
ファイル: UID.cs プロジェクト: mis-mahmud/Mobile-Development
        private static void writeInstallationFile(Java.IO.File installation)
        {
            FileOutputStream outFile = new FileOutputStream(installation);

            Java.Lang.String id = new Java.Lang.String(UUID.RandomUUID().ToString());
            outFile.Write(id.GetBytes());
            outFile.Close();
            //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); //Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
            //string filename = Path.Combine(path, fileName);

            //using (var streamWriter = new StreamWriter(filename, true))
            //{
            //    streamWriter.WriteLine(UUID.RandomUUID().ToString());
            //}
        }
コード例 #26
0
        public UUID GetUniqueueId(Context context)
        {
            var _result = (UUID)null;

            try
            {
                var _android_id = Android.Provider.Settings.Secure.GetString(
                    context.ContentResolver, Android.Provider.Settings.Secure.AndroidId
                    );

                if (_android_id == null)
                {
                    var _telephony_id = "";

                    var _telephony_service = context.GetSystemService(Context.TelephonyService).JavaCast <TelephonyManager>();
                    if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
                    {
                        // TODO: Some phones has more than 1 SIM card or may not have a SIM card inserted at all
                        _telephony_id = _telephony_service.GetMeid(0);
                    }
                    else
#pragma warning disable CS0618 // Type or member is obsolete
                    {
                        _telephony_id = _telephony_service.DeviceId;
                    }
#pragma warning restore CS0618 // Type or member is obsolete

                    if (_telephony_id != null)
                    {
                        _result = UUID.NameUUIDFromBytes(Encoding.UTF8.GetBytes(_telephony_id));
                    }
                    else
                    {
                        _result = UUID.RandomUUID();
                    }
                }
                else
                {
                    _result = UUID.NameUUIDFromBytes(Encoding.UTF8.GetBytes(_android_id));
                }
            }
            catch (Java.Lang.Exception ex)
            {
                Log.Error(this.GetType().Name, ex.Message);
            }

            return(_result);
        }
コード例 #27
0
ファイル: MainActivity.cs プロジェクト: HGldJ1966/dataLogger
        private void TakeAPicture(object sender, EventArgs eventArgs)
        {
            //Pause collect GPS points.
            OnPause();

            Intent intent = new Intent(MediaStore.ActionImageCapture);

            App._file = new File(App._dir, string.Format("myPhoto_{0}.jpg", UUID.RandomUUID()));

            //App._file = new File(App._dir, String.Format("myPhoto_{0}.jpg", guid.NewGuid()));
            intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(App._file));
            StartActivityForResult(intent, 0);

            //Resume collect GPS
            OnResume();
        }
コード例 #28
0
        public virtual void TestGetAttributeNameValuePairsForValidII_TOKEN()
        {
            UUID             randomUUID       = UUID.RandomUUID();
            Identifier       ii               = new Identifier(randomUUID.ToString());
            II               iiHl7            = new IIImpl();
            ModelToXmlResult modelToXmlResult = new ModelToXmlResult();

            Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                                (modelToXmlResult, null, "name", "II.TOKEN", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false);
            IDictionary <string, string> result = new IiPropertyFormatterTest.TestableIiPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (context, ii, iiHl7);

            Assert.AreEqual(1, result.Count, "map size");
            Assert.IsTrue(modelToXmlResult.GetHl7Errors().IsEmpty(), "no errors");
            AssertKeyValuePairInMap(result, "root", randomUUID.ToString());
        }
コード例 #29
0
        public override void OnReceive(Context context,
                                       Intent intent)
        {
            PowerManager pm = (PowerManager)context.GetSystemService(Context.PowerService);

            PowerManager.WakeLock wl = pm.NewWakeLock(WakeLockFlags.Partial, TAG);
            string key = UUID.RandomUUID().ToString();

            dict.Add(key, wl);
            wl.Acquire();
            MainActivity.ScheduleAlarm(context);
            Intent service = new Intent(context,
                                        Class.FromType(typeof(MyIntentService)));

            service.PutExtra(KEY_WL, key);
            context.StartService(service);
        }
コード例 #30
0
        /// <summary>
        /// Test that file data can be read by reading the block file
        /// directly from the local store.
        /// </summary>
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        public virtual void DoTestShortCircuitReadImpl(bool ignoreChecksum, int size, int
                                                       readOffset, string shortCircuitUser, string readingUser, bool legacyShortCircuitFails
                                                       )
        {
            Configuration conf = new Configuration();

            conf.SetBoolean(DFSConfigKeys.DfsClientReadShortcircuitKey, true);
            conf.SetBoolean(DFSConfigKeys.DfsClientReadShortcircuitSkipChecksumKey, ignoreChecksum
                            );
            // Set a random client context name so that we don't share a cache with
            // other invocations of this function.
            conf.Set(DFSConfigKeys.DfsClientContext, UUID.RandomUUID().ToString());
            conf.Set(DFSConfigKeys.DfsDomainSocketPathKey, new FilePath(sockDir.GetDir(), "TestShortCircuitLocalRead._PORT.sock"
                                                                        ).GetAbsolutePath());
            if (shortCircuitUser != null)
            {
                conf.Set(DFSConfigKeys.DfsBlockLocalPathAccessUserKey, shortCircuitUser);
                conf.SetBoolean(DFSConfigKeys.DfsClientUseLegacyBlockreaderlocal, true);
            }
            MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(1).Format(
                true).Build();
            FileSystem fs = cluster.GetFileSystem();

            try
            {
                // check that / exists
                Path path = new Path("/");
                NUnit.Framework.Assert.IsTrue("/ should be a directory", fs.GetFileStatus(path).IsDirectory
                                                  () == true);
                byte[]             fileData = AppendTestUtil.RandomBytes(seed, size);
                Path               file1    = fs.MakeQualified(new Path("filelocal.dat"));
                FSDataOutputStream stm      = CreateFile(fs, file1, 1);
                stm.Write(fileData);
                stm.Close();
                URI uri = cluster.GetURI();
                CheckFileContent(uri, file1, fileData, readOffset, readingUser, conf, legacyShortCircuitFails
                                 );
                CheckFileContentDirect(uri, file1, fileData, readOffset, readingUser, conf, legacyShortCircuitFails
                                       );
            }
            finally
            {
                fs.Close();
                cluster.Shutdown();
            }
        }