Exemplo n.º 1
0
        public static void Init(string applicationId)
        {
            if (!_Initilized)
            {
                Assembly assem = Assembly.GetExecutingAssembly();
                log4net.Config.XmlConfigurator.Configure(assem.GetManifestResourceStream("SmartLife.Share.Behaviors.log4net.config"));

                if (applicationId == SmartLife_CertManage_CertServices || applicationId == SmartLife_Auth_Mobile_Services ||
                    applicationId == SmartLife_CertManage_MobileServices || applicationId == SmartLife_DataExchange_Services ||
                    applicationId == SmartLife_WeiXin || applicationId == SmartLife_Officer_CertServices || applicationId == SmartLife_Auth_CertServices ||
                    applicationId == SmartLife_CertManage_MerchantServices
                    )
                {
                    _Initilized = true;
                }
                CurrentApplicationId = applicationId;

                StreamReader srForErrorMessage = new StreamReader(assem.GetManifestResourceStream("SmartLife.Share.Behaviors.ErrorCodeMessage.txt"));
                string[]     lines             = srForErrorMessage.ReadToEnd().Split('\n');
                srForErrorMessage.Close();
                foreach (var line in lines)
                {
                    if (line.Trim() != "")
                    {
                        var keyValues = line.Split("=".ToCharArray());
                        if (!errorCodeMessages.ContainsKey(keyValues[0]))
                        {
                            errorCodeMessages.Add(keyValues[0], keyValues[1].Replace("\r", ""));
                        }
                    }
                }
            }
        }
        public void SetUp()
        {
            _dictionary = new StringStringDictionary();
            _readOnly   = _dictionary.AsReadOnly();
            Assert.AreEqual(0, _dictionary.Count);

            _dictionary.Add("one", "first value");
            _dictionary.Add("two", "second value");
            _dictionary.Add("three", "third value");
            Assert.AreEqual(3, _dictionary.Count);
        }
        public void Constructor()
        {
            StringStringDictionary dictionary = new StringStringDictionary();

            dictionary.Add("foo", "foo value");
            dictionary.Add("bar", "bar value");
            Assert.AreEqual(2, dictionary.Count);

            StringStringDictionary clone = new StringStringDictionary(dictionary);

            Assert.AreEqual(2, clone.Count);
        }
        public void Count()
        {
            _dictionary.Add("foo", "foo value");
            _dictionary.Add("bar", "bar value");
            Assert.AreEqual(5, _dictionary.Count);

            _dictionary.Remove("bar");
            Assert.AreEqual(4, _dictionary.Count);
        }
    void Reset()
    {
        // access by property
        StringStringDictionary = new Dictionary <string, string>();

        m_stringStringDictionary.Add("first key", "value A");
        m_stringStringDictionary.Add("second key", "value B");
        m_stringStringDictionary.Add("third key", "value C");
        m_objectColorDictionary = new ObjectColorDictionary()
        {
            { gameObject, Color.blue }, { this, Color.red }
        };
    }
Exemplo n.º 6
0
        public override void OnImportAsset(AssetImportContext ctx)
        {
            byte[] data = Tools.Load(ctx.assetPath);
            string json = System.Text.UTF8Encoding.UTF8.GetString(data);

            LitJson.JsonData jsonData = Tools.DeserializeObject(json);
            mJsonList = new List <StringStringDictionary>();
            for (int i = 0; i < jsonData.Count; i++)
            {
                LitJson.JsonData       tmp  = jsonData[i];
                StringStringDictionary dict = new StringStringDictionary();
                IEnumerator            ite  = jsonData[i].Keys.GetEnumerator();
                while (ite.MoveNext())
                {
                    string key   = ite.Current.ToString();
                    string value = tmp[key].ToString();
                    dict.Add(key, value);
                }
                mJsonList.Add(dict);
            }

            string fileName = Path.GetFileNameWithoutExtension(ctx.assetPath);
            Object asset    = AssetDatabase.LoadAssetAtPath(ctx.assetPath, typeof(Object));

            ctx.AddObjectToAsset(fileName, asset);
            ctx.SetMainObject(asset);
        }
Exemplo n.º 7
0
        public static void InitWeiXin(string serviceAccountCode, IWeiXinDebugger debugger, IWeiXinResponseMessage responser, IWeiXinRequestMessage requester, IWeiXinDispatchMessage dispatcher)
        {
            TheServiceAccount = BuilderFactory.DefaultBulder(GlobalManager.getConnectString()).Load <ServiceAccount, ServiceAccountPK>(new ServiceAccountPK {
                AccountCode = serviceAccountCode
            });
            var items = BuilderFactory.DefaultBulder(GlobalManager.getConnectString()).ListStringObjectDictionary("GetMapAPIOfInverseAdressParse");

            if (items.Count > 0)
            {
                foreach (var item in items)
                {
                    TheMapAPIOfInverseAdressParse.Add(TypeConverter.ChangeString(item["ItemId"]), TypeConverter.ChangeString(item["ItemValue"]));
                }
            }
            TheWeiXinAPIOfV1.Add(APIGETKey_Bas_GetAccessToken, "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}");
            TheWeiXinAPIOfV1.Add(APIPOSTKey_Cmu_CreateCustomMenu, "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={0}");
            TheWeiXinAPIOfV1.Add(APIGETKey_Cmu_DeleteCustomMenu, "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token={0}");
            TheWeiXinAPIOfV1.Add(APIGETKey_Meb_GetInfoOfNormalAccount, "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN");
            TheWeiXinAPIOfV1.Add(APIPOSTKey_Msg_SendCustomMessage, "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}");
            TheWeiXinAPIOfV1.Add(APIGETKey_OAuth2_GetAccessToken, "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code");
            TheWeiXinDebugger   = debugger;
            TheWeiXinResponser  = responser;
            TheWeiXinRequester  = requester;
            TheWeiXinDispatcher = dispatcher;
        }
        public void Equals()
        {
            StringStringDictionary dictionary = new StringStringDictionary();

            dictionary.Add("one", "first value");
            dictionary.Add("two", "second value");
            dictionary.Add("three", "third value");
            Assert.IsTrue(_dictionary.Equals(dictionary));

            dictionary["two"] = "foo value";
            Assert.IsFalse(_dictionary.Equals(dictionary));

            dictionary["two"] = "second value";
            Assert.IsTrue(_dictionary.Equals(dictionary));

            dictionary["foo"] = "second value";
            Assert.IsFalse(_dictionary.Equals(dictionary));
        }
        public void AddRange()
        {
            StringStringDictionary dictionary = new StringStringDictionary();

            dictionary.Add(new StringStringPair("four", "fourth value"));
            dictionary.Add(new StringStringPair("five", "fifth value"));

            Assert.Throws <NotSupportedException>(() => _readOnly.AddRange(dictionary));
            _dictionary.AddRange(dictionary);

            Assert.AreEqual(5, _dictionary.Count);
            Assert.IsTrue(_dictionary.ContainsKey("four"));
            Assert.IsTrue(_dictionary.ContainsValue("fourth value"));
            Assert.IsTrue(_dictionary.ContainsKey("five"));
            Assert.IsTrue(_dictionary.ContainsValue("fifth value"));

            Assert.Throws <ArgumentException>(() => _dictionary.AddRange(dictionary));
        }
Exemplo n.º 10
0
 public void SetUserLoginData(string value, string key)
 {
     if (temp.ContainsKey(key))
     {
         temp[key] = value;
     }
     else
     {
         temp.Add(key, value);
     }
 }
Exemplo n.º 11
0
    public void Update(Vector2Int mapsize, Texture2D beforeTexture)
    {
        properties         = new StringNoiseValueTypeDictionary();
        this.beforeTexture = beforeTexture;
        this.mapsize       = mapsize;
        switch (type)
        {
        case NoiseType.Perlin:
            Shader = Shader.Find("Noise/Perlin");
            Properties.Add("X", NoiseValueType.Float);
            Properties.Add("Y", NoiseValueType.Float);
            Properties.Add("Scale", NoiseValueType.Float);
            Properties.Add("Fractal", NoiseValueType.Int);
            Properties.Add("Mode", NoiseValueType.Mode);
            break;

        case NoiseType.Simplex:
            Shader = Shader.Find("Noise/Simplex");
            Properties.Add("X", NoiseValueType.Float);
            Properties.Add("Y", NoiseValueType.Float);
            Properties.Add("Scale", NoiseValueType.Float);
            Properties.Add("Fractal", NoiseValueType.Int);
            Properties.Add("Mode", NoiseValueType.Mode);
            break;

        case NoiseType.Circle:
            Shader = Shader.Find("Noise/Circle");
            Properties.Add("X", NoiseValueType.Float);
            Properties.Add("Y", NoiseValueType.Float);
            Properties.Add("Scale", NoiseValueType.Float);
            Properties.Add("Mode", NoiseValueType.Mode);
            break;

        case NoiseType.Box:
            Shader = Shader.Find("Noise/Box");
            Properties.Add("X", NoiseValueType.Float);
            Properties.Add("Y", NoiseValueType.Float);
            Properties.Add("BLX", NoiseValueType.Float);
            Properties.Add("BLY", NoiseValueType.Float);
            Properties.Add("TRX", NoiseValueType.Float);
            Properties.Add("TRY", NoiseValueType.Float);
            Properties.Add("Mode", NoiseValueType.Mode);
            break;

        case NoiseType.BasicTerrain:
            Shader = Shader.Find("Noise/BasicTerrain");
            Properties.Add("Height", NoiseValueType.Float);
            Properties.Add("Scale", NoiseValueType.Float);
            Properties.Add("Fractal", NoiseValueType.Int);
            Properties.Add("Mode", NoiseValueType.Mode);
            break;

        case NoiseType.Ridge:
            Shader = Shader.Find("Noise/Ridge");
            Properties.Add("Scale", NoiseValueType.Float);
            Properties.Add("Grain", NoiseValueType.Float);
            Properties.Add("Lacunarity", NoiseValueType.Float);
            Properties.Add("Fractal", NoiseValueType.Int);
            Properties.Add("Mode", NoiseValueType.Mode);
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(type), type, null);
        }

        foreach (var pair in Properties)
        {
            if (values.ContainsKey(pair.Key))
            {
                continue;
            }

            switch (pair.Value)
            {
            case NoiseValueType.Int:
                values.Add(pair.Key, "0");
                break;

            case NoiseValueType.Float:
                values.Add(pair.Key, "0");
                break;

            case NoiseValueType.String:
                values.Add(pair.Key, "");
                break;

            case NoiseValueType.Mode:
                values.Add(pair.Key, "0");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
    }