BlipFace.Helpers.IsolatedStorageAccess.WriteStrings C# (CSharp) Method

WriteStrings() public method

public WriteStrings ( string texts ) : void
texts string
return void
        public void WriteStrings(string[] texts)
        {
            using (StreamWriter sw = new StreamWriter(new IsolatedStorageFileStream(isoFileName, FileMode.Create, isoStore)))
            {
                for (int i = 0; i < texts.Length; i++)
                {
                    sw.WriteLine(texts[i]);
                }
                ////zapisujem login
                //sw.Write(usr.Encrypt());

                ////nowa linia
                //sw.Write(Environment.NewLine);

                ////zapisujemy hasło
                //sw.Write(pas.Encrypt());

                sw.Close();
            }
        }

Usage Example

Example #1
0
        private void NotyfiInNewThread()
        {
            try
            {
                Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                Guid blipFaceGuid = Guid.Empty;

                using (IsolatedStorageAccess isoAccess = new IsolatedStorageAccess(FileBlipFaceGuid))
                {
                    string[] credenctial = isoAccess.ReadAll();

                    if (credenctial != null && credenctial.Length > 0)
                    {
                        //odczytujemy Guid danej instancji aplikacji BlipFace
                        var stringGuid = credenctial[0].Decrypt().ToInsecureString();
                        blipFaceGuid = new Guid(stringGuid);
                    }
                }

                //gdy nie ma jeszcze ustawionego Guida aplikacji (np. gdy BlipFace jest uruchamiany poraz pierwszy
                if (blipFaceGuid == Guid.Empty)
                {
                    blipFaceGuid = Guid.NewGuid();

                    SecureString secureGuid = blipFaceGuid.ToString().ToSecureString();

                    using (IsolatedStorageAccess isoAccess = new IsolatedStorageAccess(FileBlipFaceGuid))
                    {
                        string[] credenctial = new[] {secureGuid.Encrypt()};

                        isoAccess.WriteStrings(credenctial);
                    }
                }

                BlipFaceServicesCommunication communication = new BlipFaceServicesCommunication();
                communication.NotifyUseBlipFace(blipFaceGuid, version.ToString());
            }catch(Exception ex)
            {
                string mes = ex.Message;
                if(ex.InnerException!=null)
                {
                    mes += Environment.NewLine + "Inner exp: " + ex.InnerException.Message;
                }
                System.Windows.Forms.MessageBox.Show(mes);
            }
        }
All Usage Examples Of BlipFace.Helpers.IsolatedStorageAccess::WriteStrings