예제 #1
0
        internal void SetRootID(string Email, CloudType cloudname, string RootID)
        {
            if (string.IsNullOrEmpty(RootID))
            {
                return;
            }
            XmlNode node = GetCloud(Email, cloudname);

            if (node == null)
            {
                throw new Exception("Cloud not found");
            }
            try
            {
                node.Attributes["RootID"].Value = RootID;
            }
            catch
            {
                CreateNewAttribute(node, "RootID", RootID);
            }
#if DEBUG
            Console.WriteLine("{Settings} Save RootID [" + cloudname.ToString() + ":" + Email + "] : " + RootID);
#endif
            SaveSettings();
        }
예제 #2
0
        public bool AddCloud(string Email, CloudType cloudname, string token, bool AreEncrypt, bool IsDefault = false, string root_id = null)
        {
            if (string.IsNullOrEmpty(AppSetting.Pass))
            {
                throw new Exception("Pass is null.");
            }
            if (GetToken(Email, cloudname) == null)
            {
                XmlNode NewSetting = xmlSettings.CreateElement("Cloud");

                CreateNewAttribute(NewSetting, "Email", Email);
                CreateNewAttribute(NewSetting, "CloudName", cloudname.ToString());
                if (!AreEncrypt)
                {
                    token = Crypto.EncryptStringAES(token, AppSetting.Pass);
                }
                CreateNewAttribute(NewSetting, "Token", token);
                CreateNewAttribute(NewSetting, "Default", "0");
                CreateNewAttribute(NewSetting, "RootID", root_id == null ? "" : root_id);
                xmlSettings.DocumentElement.SelectSingleNode("UserAccount").AppendChild(NewSetting);
                if (IsDefault)
                {
                    SetDefaultCloud(Email, cloudname);
                }
                SaveSettings();
                return(true);
            }
            return(false);
        }
예제 #3
0
 public string GetDefaultCloud(CloudType cloudname)
 {
     foreach (XmlNode node in GetCloudDataList())
     {
         if (node.Attributes["CloudName"].Value == cloudname.ToString() && node.Attributes["Default"].Value == "1")
         {
             return(node.Attributes["Email"].Value);
         }
     }
     foreach (XmlNode node in GetCloudDataList())
     {
         if (node.Attributes["CloudName"].Value == cloudname.ToString() && node.Attributes["Default"].Value == "0")
         {
             node.Attributes["Default"].Value = "1";
             SaveSettings();
             return(node.Attributes["Email"].Value);
         }
     }
     return(null);
 }
예제 #4
0
 void Start()
 {
     cloudParent = new GameObject($"{type.ToString()} Cloud").transform;
     if (canSpawn)
     {
         StartCoroutine(SpawnCloud());
     }
     if (Random.value > .5)
     {
         left = false;
         transform.position = Vector3.Scale(transform.position, new Vector3(-1, 1, 1));
     }
 }
예제 #5
0
        public bool SetDefaultCloud(string Email, CloudType cloudname)
        {
            XmlNode n = GetCloud(Email, cloudname);

            if (n != null)
            {
                foreach (XmlNode node in GetCloudDataList())
                {
                    if (node.Attributes["CloudName"].Value == cloudname.ToString() && node.Attributes["Default"].Value == "1")
                    {
                        node.Attributes["Default"].Value = "0";
                    }
                }
                n.Attributes["Default"].Value = "1";
                return(true);
            }
            return(false);
        }
예제 #6
0
        internal string GetToken(string Email, CloudType cloudname)//SyncPass
        {
            XmlNode node = GetCloud(Email, cloudname);

            if (node == null)
            {
                return(null);
            }
            string token;

            try
            {
                Monitor.Enter(SyncPass);
                token = Crypto.DecryptStringAES(node.Attributes["Token"].Value, AppSetting.Pass);
            }
            finally { Monitor.Exit(SyncPass); }
#if DEBUG
            Console.WriteLine("Token: " + Email + ":" + cloudname.ToString() + " : " + token);
#endif
            return(token);
        }
예제 #7
0
 internal XmlNode GetCloud(string Email, CloudType cloudname)
 {
     foreach (XmlNode node in GetCloudDataList())
     {
         if (node.Attributes["Email"].Value == Email & node.Attributes["CloudName"].Value == cloudname.ToString())
         {
             return(node);
         }
     }
     return(null);
 }
 public ContextMenuDataModel(CloudType Name_n_Img_type)
 {
     this.Text = Name_n_Img_type.ToString();
     this.Img  = Setting_UI.GetImage(ListBitmapImageResource.list_bm_cloud[(int)Name_n_Img_type]);
     this.Type = Name_n_Img_type;
 }