Example #1
0
 public void OnTownBuild(Town sender)
 {
     _buildedTowns.Add(sender.gameObject);
     sender.OnActivate += new Town.OnActivateContainer(OnTownActivate);
     var cardsTypes = new Dictionary<ResourceType, int>();
     switch (sender.Type) {
         case TownType.Village:
         cardsTypes.Add(ResourceType.Brick,1);
         cardsTypes.Add(ResourceType.Hay,1);
         cardsTypes.Add(ResourceType.Wood,1);
         cardsTypes.Add(ResourceType.Wool,1);
         break;
         case TownType.Town:
         cardsTypes.Add(ResourceType.Hay,2);
         cardsTypes.Add(ResourceType.Stone,3);
         break;
     }
     Debug.Log(cardsTypes.ToString());
     var cards = playerDeck.GetComponent<PlayerDeck>().GetCards(cardsTypes);
     Debug.Log(cards.Count);
     cards.ForEach(delegate(ResourceCard card) {
         var deck = decksController.GetComponent<DecksController>().GetDeck(card.ResourceType);
         card.ReturnCardToDeck(deck);
     });
 }
 public void TestDictionaryToString()
 {
     TestClass testclass = new TestClass() { ID = 5, Decimal = 3.3M, Float = 3.23423F, String = "blah, \"asdff\"" };
     testclass.Class = new TestClass() { ID = 5, Decimal = 3.3M, Float = 3.23423F, String = "blah, \"asdff\"" };
     Dictionary<int, TestClass> lst = new Dictionary<int, TestClass>();
     for (int i = 0; i < 2; i++)
     {
         lst.Add(i, testclass);
     }
     string actual = lst.ToString(',');
     Assert.AreEqual("0,\"5,\"blah, \"\"asdff\"\"\",3.3,3.23423,\"5,\"blah, \"\"asdff\"\"\",3.3,3.23423\"\"\r\n1,\"5,\"blah, \"\"asdff\"\"\",3.3,3.23423,\"5,\"blah, \"\"asdff\"\"\",3.3,3.23423\"\"\r\n", actual);
 }
Example #3
0
        public void GetOrAdd()
        {
            var d = new Dictionary<string, StockStatus>() {
                {"AAPL", new StockStatus { Price = 530.12m, Position = "Sell" }},
                {"GOOG", new StockStatus { Price = 123.5m, Position = "Buy" }}
            };

            d.GetOrAdd("AAPL").Position = "Buy";
            d.GetOrAdd("YHOO").Price = 1.99m;
            Console.Out.WriteLine(d.ToString<string, StockStatus>());

            Assert.That(d["AAPL"].Position, Is.EqualTo("Buy"), "Incorrect position.");
            Assert.That(d.Keys, Has.Count.EqualTo(3), "Incorrect number of keys.");
            Assert.That(d["YHOO"].Price, Is.EqualTo(1.99m), "Incorrect price.");
        }
Example #4
0
 public static string RpcCall(string url, string method, Dictionary<string, string> args)
 {
     string result = string.Empty;
     try
     {
         PHPRPC_Client rpc = new PHPRPC_Client(url);
         IPhprpc p = (IPhprpc)rpc.UseService(typeof(IPhprpc));
         result = p.data(method, args);
     }
     catch(Exception ex)
     {
         string error = string.Format("Exception in RpcCall():{0}, url = {1}, method={2}, args={3}", ex.ToString(), url, method, args.ToString());
     }
     return result;
 }
 public static void UpdateVersionFile(Dictionary<string, string> version, string versionFilePath)
 {
     try
     {
         FileStream versionFile = new FileStream(versionFilePath, FileMode.OpenOrCreate);
         foreach (string fileName in version.Keys)
         {
             string nameHashPair = fileName + "," + version[fileName] + ";";
             versionFile.Write(System.Text.Encoding.ASCII.GetBytes(nameHashPair), 0, System.Text.Encoding.ASCII.GetByteCount(nameHashPair));
         }
         versionFile.Close();
     }
     catch (Exception e)
     {
         Utils.configLog("E", e.Message + ". UpdateVersionFile, version: " + version.ToString());
     }
 }
Example #6
0
        public List<Coordinate> GetShortestPath(Coordinate start, Coordinate goal)
        {
            HashSet<Coordinate> visited = new HashSet<Coordinate>();
            Dictionary<Coordinate, Coordinate> parents = new Dictionary<Coordinate, Coordinate>();
            Dictionary<Coordinate, double> gScore = new Dictionary<Coordinate, double>();
            HeapPriorityQueue<Coordinate> fScoreQueue = new HeapPriorityQueue<Coordinate>(rows * cols);
            parents[start] = start;
            gScore.Add(start, 0);
            fScoreQueue.Enqueue(start, gScore[start] + Heuristic(start, goal));
            while (fScoreQueue.Count() != 0)
            {
                Coordinate current = fScoreQueue.Dequeue();
                Console.Out.WriteLine("");
                Console.Out.WriteLine("Current = " + current.ToString());
                Console.Out.WriteLine("Visited = " + visited.ToString());
                Console.Out.WriteLine("Parents = " + parents.ToString());
                Console.Out.WriteLine("gScore = " + gScore.ToString());
                Console.Out.WriteLine("fScoreQueue = " + fScoreQueue.ToString());
                if (current == goal)
                {
                    return ReconstructPath(parents, goal);
                }

                visited.Add(start);
                foreach (Coordinate neighbor in board[current.row,current.col].GetNeighborCoordinates())
                {
                    if (visited.Contains(neighbor)) continue;
                    double newGScore = gScore[current] + Distance(current, neighbor);
                    if (!fScoreQueue.Contains(neighbor))
                    {
                        parents[neighbor] = current;
                        gScore[neighbor] = newGScore;
                        fScoreQueue.Enqueue(neighbor, newGScore + Heuristic(neighbor, goal));
                    }
                    else if (newGScore < gScore[neighbor])
                    {
                        parents[neighbor] = current;
                        gScore[neighbor] = newGScore;
                        fScoreQueue.UpdatePriority(neighbor, newGScore + Heuristic(neighbor, goal));
                    }

                }
            }

            return null;
        }
        public string PostData(string url, Dictionary<string, string> data, Encoding encoding = null)
        {
            var http = CreateNewRequest(url, "POST");

            http.ContentType = "application/x-www-form-urlencoded";

            if(encoding == null) encoding = new UTF8Encoding();

            var outgoingQueryString = HttpUtility.ParseQueryString(string.Empty);

            foreach (var item in data)
            {
                outgoingQueryString.Add(item.Key, item.Value);
            }

            PostBytes(data.ToString(), encoding, http);

            return ReadResponse(http, encoding);
        }
 public ChampionListStatic(string data,
     string format,
     JObject keys,
     string type,
     string version,
     JObject originalObject)
 {
     this.data = new Dictionary<string, ChampionStatic>();
     this.keys = new Dictionary<string, string>();
     LoadData(data);
     this.format = format;
     if (keys != null)
     {
         this.keys = JsonConvert.DeserializeObject<Dictionary<string, string>>(keys.ToString());
     }
     this.type = type;
     this.version = version;
     this.originalObject = originalObject;
 }
Example #9
0
 public SgmlDtd getDTD(String version, String DTD)
 {
     if (log.IsDebugEnabled) log.Debug("getDTD(version: " + version + ", DTD: " + DTD + ")");
     SgmlReader reader = null;
     Dictionary<String, SgmlDtd> dtd = null;
     if (this.checkAvailableVersion(DTD+version) && !this.version.ContainsKey(version)) {
         reader = new SgmlReader();
         reader.CaseFolding = Sgml.CaseFolding.ToLower;
         String sgmlArticle = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this.availableVersion[DTD+version]);
         if (log.IsDebugEnabled) log.Debug("sgmlArticle: " + sgmlArticle);
         reader.SystemLiteral = sgmlArticle;
         dtd = new Dictionary<String, SgmlDtd>();
         dtd.Add(DTD, reader.Dtd);
         if (log.IsDebugEnabled) log.Debug("dtd.Add(DTD: " + DTD + ", reader.Dtd: " + reader.Dtd.ToString() + ")");
         this.version.Add(version, dtd);
         if (log.IsDebugEnabled) log.Debug("this.version.Add(version: " + version + ", dtd: " + dtd.ToString() + ")");
     }
     if (log.IsDebugEnabled) log.Debug("return this.version[version: " + version + "][DTD: " + DTD + "]");
     return this.version[version][DTD];
 }
        public static void Main(string[] args)
        {
            Console.WriteLine("*****开始发送******");

            JSMSClient client = new JSMSClient(app_key, master_secret);

            // 短信验证码 API
            // API文档地址 http://docs.jiguang.cn/jsms/server/rest_api_jsms/#api_3

            Dictionary<string, string> temp_para= new Dictionary<string, string>(); ;
            temp_para.Add("codes", "1914");
            string para = temp_para.ToString();
            Console.WriteLine(para);

            SMSPayload codes = new SMSPayload("134888888888", 9890, temp_para);
            String codesjson = codes.ToJson(codes);
            Console.WriteLine(codesjson);
            client._SMSClient.sendMessages(codesjson);

            Console.ReadLine();
        }
Example #11
0
		public void ProcessPushNotification(Dictionary <string, string> data)
		{
			System.Diagnostics.Debug.WriteLine ("Received a push notification " + data.ToString());
			MessagingCenter.Send<Xamarin.Forms.Application> (App.Current, "refresh_menu");
		}
Example #12
0
 public BasicDataStatic(string colloq,
     bool? consumeOnFull,
     bool? consumed,
     int? depth,
     string description,
     JArray fromA,
     JObject goldO,
     string group,
     bool? hideFromAll,
     int id,
     JObject imageO,
     bool? inStore,
     JArray intoA,
     JObject maps,
     string name,
     string plainText,
     string requiredChampion,
     JObject runeO,
     string sanitizedDescription,
     int? specialRecipe,
     int? stacks,
     JObject statsO,
     JArray tagsA)
 {
     from = new List<string>();
     into = new List<string>();
     this.maps = new Dictionary<string, bool>();
     tags = new List<string>();
     this.colloq = colloq;
     this.consumeOnFull = consumeOnFull;
     this.consumed = consumed;
     this.depth = depth;
     this.description = description;
     if (fromA != null)
     {
         this.from = HelperMethods.LoadStrings(fromA);
     }
     if (goldO != null)
     {
         LoadGold(goldO);
     }
     this.group = group;
     this.hideFromAll = hideFromAll;
     this.id = id;
     if (imageO != null)
     {
         this.image = HelperMethods.LoadImageStatic(imageO);
     }
     this.inStore = inStore;
     if (intoA != null)
     {
         this.into = HelperMethods.LoadStrings(intoA);
     }
     if (maps != null)
     {
         this.maps = JsonConvert.DeserializeObject<Dictionary<string, bool>>(maps.ToString());
     }
     this.name = name;
     this.plainText = plainText;
     this.requiredChampion = requiredChampion;
     if (runeO != null)
     {
         this.rune = HelperMethods.LoadMetaDataStatic(runeO);
     }
     this.sanitizedDescription = sanitizedDescription;
     this.stacks = stacks;
     if (statsO != null)
     {
         LoadBasicDataStats(statsO);
     }
     if (tagsA != null)
     {
         this.tags = HelperMethods.LoadStrings(tagsA);
     }
 }
 private void UpdateCurrentVersionFile(Dictionary<string, string> version)
 {
     try
     {
         Utils.DeleteFile(logger, Settings.ConfigDir + "\\" + CurrentVersionFileName);
         FileStream versionFile = new FileStream(Settings.ConfigDir + "\\" + CurrentVersionFileName, FileMode.OpenOrCreate);
         foreach (string fileName in version.Keys)
         {
             string nameHashPair = fileName + "," + version[fileName] + ";";
             versionFile.Write(System.Text.Encoding.ASCII.GetBytes(nameHashPair), 0, System.Text.Encoding.ASCII.GetByteCount(nameHashPair));
         }
         versionFile.Close();
     }
     catch (Exception e)
     {
         Utils.structuredLog(logger, "E", e.Message + ". UpdateCurrentVersionFile, version: " + version.ToString());
     }
 }
Example #14
0
        public void var_types(int param)
        {
            WriteXmlAndXslFiles();

            object t = null;
            switch (param)
            {
                case 1: t = Tuple.Create(1, "Melitta", 7.5); break;
                //case 2: t = new TestDynamicObject(); break;
                case 3: t = new Guid(); break;
                case 4: t = new Dictionary<string, object>(); break;
            }
            _output.WriteLine(t.ToString());

#pragma warning disable 0618
            XslTransform xslt = new XslTransform();
#pragma warning restore 0618
            xslt.Load("type.xsl");

            XsltArgumentList xslArg = new XsltArgumentList();
            xslArg.AddParam("param", "", t);
            xslArg.AddExtensionObject("", t);

            XPathDocument xpathDom = new XPathDocument("type.xml");
            using (StringWriter sw = new StringWriter())
            {
                xslt.Transform(xpathDom, xslArg, sw);
                _output.WriteLine(sw.ToString());
            }
            return;
        }
    public override string UpdateRow()
    {
        LogCallMethod(true);
        string returnID = string.Empty;
        using (SqlConnection con = new SqlConnection(DataServices.ConnectString))
        {
            con.Open();
            SqlTransaction sqlTran = con.BeginTransaction();
            try
            {
                Dictionary<string, object> SALE_movingValues = new Dictionary<string, object>
                {
                        {"stockMovingNo", ctrlMa.Text},
                        {"fromStockID",cmbfromStock.Value},
                        {"toStockID",cmbtoStock.Value},
                        {"fromStockStaffID",cmbfromStaff.Value},
                        {"toStockStaffID",cmbtoStaff.Value},
                        {"notes", txtNotes.Text},
                        {"quantity",CU.GetSpinValue(totalQuantity)},
                        {"dateMoved", CU.GetDateEditValue(dtorderdate)}
                };
                //lay invoiceID cua SALE_invoice
                var stockMovingKey = new Dictionary<string, object>
                {
                    {"stockMovingID",globalID}
                };

                EU.updateTblScript(sqlTran, "SM_moving", SALE_movingValues, stockMovingKey);

                var movingWheres = new Dictionary<string, object>
                {
                    {"sessionKey", globalSessionKey},
                };
                var mappingSALE_temptoSM_moving_details = new Dictionary<string, object>
                {       //Details ====== temp
                        {"productID", "productID"},
                        {"currentPrice", "currentPrice"},
                        {"quantity", "quantity"},

                        {"note","notes"},
                        {"orderNum", "oderNumber"},

                        {"boID", "boID"},
                        {"userID", "userID"},
                        {"dateCreated", "dateCreated"},
                        {"sessionKey", "sessionKey"}
                };
                EU.MovingTableTemToDetails(sqlTran, "SM_moving_details", "SALE_temp", stockMovingKey, mappingSALE_temptoSM_moving_details, movingWheres, true);
                sqlTran.Commit();
                returnID = stockMovingKey.ToString();
            }
            catch (Exception ex)
            {
                sqlTran.Rollback();
                LogAction(0, ex.ToString());
                returnID = "error - " + ex.ToString();
            }
        }
        LogCallMethod(false);
        return returnID;
    }
Example #16
0
        public Dictionary<string, string> getFileData(string path)
        {
            Process ffprobe = new Process();
            //Run the thing.
            ffprobe.StartInfo.FileName = "ffprobe.exe";
            ffprobe.StartInfo.UseShellExecute = false;
            ffprobe.StartInfo.RedirectStandardOutput = true;
            ffprobe.StartInfo.RedirectStandardError = true;
            ffprobe.StartInfo.CreateNoWindow = true;
            ffprobe.StartInfo.Arguments = "-v quiet -print_format compact=p=0 -show_format " + "\"" + Path.GetFullPath(path) + "\"";

            Dictionary<string, string> output = new Dictionary<string, string>();

            ffprobe.Start();

            using (StreamReader reader = ffprobe.StandardOutput)
            {
                string result = reader.ReadToEnd();
                //result = result.Substring(result.IndexOf("Duration: "));

                //Split the output.
                string[] splits = result.Split('|');

                foreach(string s in splits)
                {
                    string[] items = s.Split('=');
                    output.Add(items[0], items[1]);
                }

                Console.WriteLine(output.ToString());

                //TODO: Move this to it's own setup method with the rest of them.
                //Put the info in the box. WHY NOT?
                infoList.Text = result.Replace('|', '\n');

                runtime = TimeSpan.FromSeconds((Double.Parse(output["duration"])));
                fileRuntime.Text = runtime.ToString().TrimEnd('0');

                numHour.Maximum = runtime.Hours; //TODO: Sanity check for start time.
            }

            return output;
        }
Example #17
0
 public override String ToString()
 {
     IDictionary<String, Object> values = new Dictionary<String, Object>();
     values["Token"] = _token;
     values["DeltaType"] = _deltaType;
     values["PreviousUid"] = _previousUid;
     values["ObjectClass"] = _objectClass;
     values["Uid"] = _uid;
     values["Object"] = _object;
     return values.ToString();
 }
Example #18
0
 public override string ToString()
 {
     StringBuilder bld = new StringBuilder();
     bld.Append("ScriptContext: ");
     // poor man's to string method.
     IDictionary<string, object> map = new Dictionary<string, object>();
     map["Language"] = ScriptLanguage;
     map["Text"] = ScriptText;
     map["Arguments"] = ScriptArguments;
     bld.Append(map.ToString());
     return bld.ToString();
 }
Example #19
0
        public Boolean dealStopRatioRule(string appDir, string fileName)//讀取逆勢動態停利規則檔
        {
            try
            {

                strategyFileName = fileName;

                strategyFilePath = appDir + "\\" + Config_Dir + "\\" + fileName;

                strategyFile = new TradeFile(strategyFilePath);

                strategyFile.prepareReader();

                stopRatio = new Dictionary<int, int>();

                int checkRange;//最高點與最低點的範圍

                int ratio;//停利或是停損的計算百分比

                String tmpLine = "";

                String[] tmpData = new String[2];

                while (strategyFile.hasNext())
                {

                    tmpLine = strategyFile.getLine();

                    tmpData = tmpLine.Split(',');

                    checkRange = int.Parse(tmpData[0]);

                    ratio = int.Parse(tmpData[1]);

                    stopRatio.Add(checkRange, ratio);


                }

                Console.WriteLine(stopRatio.ToString());

            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Source);
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
                return false;
            }
            return true;
        }
Example #20
0
        private static MyContact ParseProfileRecord(Dictionary<string, object> recordsDict)
        {
            var contact = new MyContact
            {
                Address_ID = recordsDict.ToNullableInt("Address_ID"),
                Address_Line_1 = recordsDict.ToString("Address_Line_1"),
                Address_Line_2 = recordsDict.ToString("Address_Line_2"),
                Congregation_ID = recordsDict.ToNullableInt("Congregation_ID"),
                Household_ID = recordsDict.ToInt("Household_ID"),
                Household_Name = recordsDict.ToString("Household_Name"),
                City = recordsDict.ToString("City"),
                State = recordsDict.ToString("State"),
                County = recordsDict.ToString("County"),
                Postal_Code = recordsDict.ToString("Postal_Code"),                
                Contact_ID = recordsDict.ToInt("Contact_ID"),
                Date_Of_Birth = recordsDict.ToDateAsString("Date_of_Birth"),
                Email_Address = recordsDict.ToString("Email_Address"),
                Employer_Name = recordsDict.ToString("Employer_Name"),
                First_Name = recordsDict.ToString("First_Name"),
                Foreign_Country = recordsDict.ToString("Foreign_Country"),
                Gender_ID = recordsDict.ToNullableInt("Gender_ID"),
                Home_Phone = recordsDict.ToString("Home_Phone"),
                Last_Name = recordsDict.ToString("Last_Name"),
                Maiden_Name = recordsDict.ToString("Maiden_Name"),
                Marital_Status_ID = recordsDict.ToNullableInt("Marital_Status_ID"),
                Middle_Name = recordsDict.ToString("Middle_Name"),
                Mobile_Carrier = recordsDict.ToNullableInt("Mobile_Carrier_ID"),
                Mobile_Phone = recordsDict.ToString("Mobile_Phone"),
                Nickname = recordsDict.ToString("Nickname"),
                Age = recordsDict.ToInt("Age"),
                Passport_Number = recordsDict.ToString("Passport_Number"),
                Passport_Country = recordsDict.ToString("Passport_Country"),
                Passport_Expiration = ParseExpirationDate(recordsDict.ToNullableDate("Passport_Expiration")),
                Passport_Firstname = recordsDict.ToString("Passport_Firstname"),
                Passport_Lastname = recordsDict.ToString("Passport_Lastname"),
                Passport_Middlename = recordsDict.ToString("Passport_Middlename")                
            };
            if (recordsDict.ContainsKey("Participant_Start_Date"))
            {
                contact.Participant_Start_Date = recordsDict.ToDate("Participant_Start_Date");
            }
            if (recordsDict.ContainsKey("Attendance_Start_Date"))
            {
                contact.Attendance_Start_Date = recordsDict.ToNullableDate("Attendance_Start_Date");
            }

            if (recordsDict.ContainsKey("ID_Card"))
            {
                contact.ID_Number = recordsDict.ToString("ID_Card");
            }
            return contact;
        }
Example #21
0
		public void ListToString_EmptyList()
		{
			Dictionary<string, int> list = new Dictionary<string, int>();
			Assert.AreEqual(string.Empty, list.ToString(Environment.NewLine, item => item.Key));
		}
    void Update()
    {
        // Connect the socket to the remote endpoint. Catch any errors.
        try
        {
            /*// Encode the data string into a byte array.
            byte[] msg2 = Encoding.ASCII.GetBytes("Connected.");

            // Send the data through the socket.
            int bytesSent = socket.Send(msg2);*/

            // Receive the response from the remote device.
            int bytesRec;

            string fullMsg = "";
            while ((bytesRec = socket.Receive(bytes)) > 0)
            {
                fullMsg += Encoding.ASCII.GetString(bytes, 0, bytesRec);

                if (fullMsg.EndsWith(";"))
                {
                    //We have a full message
                    MatchCollection matches = Regex.Matches(fullMsg, @"([^\{\w\d\s]?)([\w\d]+)(\s+)?(=>)(\s+)?([\w\d+-]+)");
                    var messageRecieved = new Dictionary<String, String>();

                    foreach (Match match in matches)
                    {
                        String leftSideRegex = @"[\w\d]+(?=(\s+(=>)))";
                        String rightSideRegex = @"(?<=(=>(\s+)))[\+\-\d\w]+";

                        messageRecieved[Regex.Match(match.Value, leftSideRegex).Value.ToLower()] = Regex.Match(match.Value, rightSideRegex).Value.ToLower();
                    }

                    switch (messageRecieved["type"])
                    {
                        case "command":
                            switch (messageRecieved["command"])
                            {
                                case "let_there_be":
                                    Debug.Log(messageRecieved.ToString());
                                    string objectToCreate = messageRecieved["object"];
                                    float radius = float.Parse(messageRecieved["radius"]);
                                    float angleXY = float.Parse(messageRecieved["anglexy"]);
                                    float angleYZ = float.Parse(messageRecieved["angleyz"]);
                                    int orbits = int.Parse(messageRecieved["orbits"]);
                                    int idOfObject = int.Parse(messageRecieved["createdid"]);

                                    GameObject newGameObject = createGameObject(objectToCreate, radius, angleXY, angleYZ);
                                    Orbit orbitComponent = newGameObject.AddComponent<Orbit>();
                                    if (orbits != -1)
                                    {
                                        newGameObject.transform.position += idMap[orbits].transform.position;
                                        orbitComponent.orbitCenter = idMap[orbits];
                                    }
                                    else orbitComponent.orbitCenter = Camera.main.gameObject;

                                    orbitComponent.setupAxis(angleXY, angleYZ);
                                    orbitComponent.orbitPeriod = UnityEngine.Random.Range(30, 60);

                                    idMap[idOfObject] = newGameObject;

                                    break;
                            }

                            break;
                    }

                    //Reset stuff for next msg
                    bytes = new byte[1024];
                    fullMsg = "";
                }
            }
        }
        catch (ArgumentNullException ane)
        {
            Debug.Log("ArgumentNullException : {0}" + ane.ToString());
        }
        catch (SocketException se)
        {
            //Debug.Log("SocketException : {0}" + se.ToString());
        }
        catch (Exception e)
        {
            Debug.Log("Unexpected exception : {0}" + e.ToString());
        }
    }
Example #23
0
        public void GetParam_Tuple(object param)
        {
            WriteXmlAndXslFiles();

            object t = null;
            switch ((int)param)
            {
                case 1: t = Tuple.Create(1, "Melitta", 7.5); break;
                case 2: t = new TestDynamicObject(); break;
                case 3: t = new Guid(); break;
                case 4: t = new Dictionary<string, object>(); break;
            }
            _output.WriteLine(t.ToString());

            XslCompiledTransform xslt = new XslCompiledTransform();
            xslt.Load("type.xsl");

            XsltArgumentList xslArg = new XsltArgumentList();
            xslArg.AddParam("param", "", t);
            xslArg.AddExtensionObject("", t);

            try
            {
                xslt.Transform("type.xml", xslArg, new StringWriter());
            }
            catch (Exception e)
            {
                _output.WriteLine(e.Message);
                return;
            }
            Assert.True(false);
        }
    public void OnIgniteLeaderBoard( Dictionary<string,object> leaderBoardDict )
    {
        Debug.Log( "FuelSDKGrooveIntegration - OnIgniteLeaderBoard called." );
        if( leaderBoardDict.ContainsKey( "id" ) ) {
            string id = Convert.ToString( leaderBoardDict["id"] );
            events[id].LoadActivityData( leaderBoardDict );

            Debug.Log ("FuelSDKGrooveIntegration - LD = " + leaderBoardDict.ToString ());
        }
    }
        public void ReferenceAllTypesInClosedGenericParametersWithReferences(
            Tuple<IInnerInterface, InnerEventArgs, InnerDelegate> arg0,
            List<InnerEnum> innerEnums,
            InnerStruct[] innerStructs,
            Lazy<InnerStruct.InnerStructInnerEnum> innerStructInnerEnum,
            IEnumerable<InnerStruct.IInnerStructInnerInterface> innerStructInnerInterface,
            Dictionary<InnerStruct.InnerStructInnerStruct, InnerStruct.InnerStructInnerClass> innerStructInnerClassByInnerStructInnerStruct,
            Func<InnerAbstractClass, InnerAbstractClass.InnerAbstractClassInnerEnum, InnerAbstractClass.IInnerAbstractClassInnerInterface> getInnerAbstractClass,
            List<Dictionary<InnerAbstractClass.InnerAbstractClassStruct, IEnumerable<InnerImplementingClass[]>>> stuff)
        {
            string toStringHolder;

            toStringHolder = arg0.ToString();
            toStringHolder = arg0.Item1.ToString();
            toStringHolder = arg0.Item2.ToString();
            toStringHolder = arg0.Item3.ToString();
            toStringHolder = innerEnums.ToString();
            toStringHolder = innerEnums.First().ToString();
            toStringHolder = innerStructs.ToString();
            toStringHolder = innerStructs[0].ToString();
            toStringHolder = innerStructInnerEnum.ToString();
            toStringHolder = innerStructInnerEnum.Value.ToString();
            toStringHolder = innerStructInnerInterface.ToString();
            toStringHolder = innerStructInnerInterface.ToString();
            toStringHolder = innerStructInnerClassByInnerStructInnerStruct.ToString();
            toStringHolder = innerStructInnerClassByInnerStructInnerStruct.Keys.First().ToString();
            toStringHolder = innerStructInnerClassByInnerStructInnerStruct.Values.First().ToString();
            toStringHolder = getInnerAbstractClass.ToString();
            toStringHolder = stuff.ToString();
            toStringHolder = stuff[0].ToString();
            toStringHolder = stuff[0].Keys.First().ToString();
            toStringHolder = stuff[0].Values.First().ToString();
            toStringHolder = stuff[0].Values.First().First().ToString();
        }
Example #26
0
        public Dictionary<string, object> Decrypt(Dictionary<string, object> msg)
        {
            if (msg == null)
            {
                throw new ArgumentNullException("msg");
            }

            if (msg["session_id"] == null)
            {
                Logger.Info("Missing session ID in {0}", msg.ToString());
                return null;
            }

            if (msg["encrypted_data"] == null)
            {
                Logger.Info("Missing encrypted data in {0}", msg.ToString());
                return null;
            }

            string messageSessionId = msg["session_id"] as string;
            string replyTo = msg["reply_to"] as string;

            EncryptionHandler encryptionHandler = LookupEncryptionHandler(new Dictionary<string, string>() { { "session_id", messageSessionId } });

            // save message handler for the reply
            this.SessionReplyMap[replyTo] = encryptionHandler;

            // Log exceptions from the EncryptionHandler, but stay quiet on the wire.
            try
            {
                msg = encryptionHandler.Decrypt(msg["encrypted_data"]);
            }
            catch (Exception ex)
            {
                LogEncryptionError(ex);
                return null;
            }

            msg["reply_to"] = replyTo;

            Logger.Info("Decrypted Message: #{msg}");
            return msg;
        }
Example #27
0
 public override String ToString()
 {
     // poor man's toString()
     IDictionary<String, Object> bld = new Dictionary<String, Object>();
     bld["EnableNormalizingResultsHandler"] = EnableNormalizingResultsHandler;
     bld["EnableFilteredResultsHandler"] = EnableFilteredResultsHandler;
     bld["EnableCaseInsensitiveFilter"] = EnableCaseInsensitiveFilter;
     bld["EnableAttributesToGetSearchResultsHandler"] = EnableAttributesToGetSearchResultsHandler;
     return bld.ToString();
 }
        public void ReferenceAllTypesInClosedGenericVariablesWithReferences()
        {
            Tuple<IInnerInterface, InnerEventArgs, InnerDelegate> tuple =
                new Tuple<IInnerInterface, InnerEventArgs, InnerDelegate>(new InnerImplementingClass(), new InnerEventArgs(), Console.WriteLine);
            List<InnerEnum> innerEnums = new List<InnerEnum>();
            InnerStruct[] innerStructs = new InnerStruct[10];
            Lazy<InnerStruct.InnerStructInnerEnum> innerStructInnerEnum = new Lazy<InnerStruct.InnerStructInnerEnum>();
            IEnumerable<InnerStruct.IInnerStructInnerInterface> innerStructInnerInterface = new List<InnerStruct.IInnerStructInnerInterface>();
            Dictionary<InnerStruct.InnerStructInnerStruct, InnerStruct.InnerStructInnerClass> innerStructInnerClassByInnerStructInnerStruct =
                new Dictionary<InnerStruct.InnerStructInnerStruct,InnerStruct.InnerStructInnerClass>();
            Func<InnerAbstractClass, InnerAbstractClass.InnerAbstractClassInnerEnum, InnerAbstractClass.IInnerAbstractClassInnerInterface> getInnerAbstractClass =
                (InnerAbstractClass @class, InnerAbstractClass.InnerAbstractClassInnerEnum @enum) => new InnerImplementingClass();
            List<Dictionary<InnerAbstractClass.InnerAbstractClassStruct, IEnumerable<InnerImplementingClass[]>>> stuff =
                new List<Dictionary<InnerAbstractClass.InnerAbstractClassStruct,IEnumerable<InnerImplementingClass[]>>>();

            string toStringHolder;

            toStringHolder = tuple.ToString();
            toStringHolder = tuple.Item1.ToString();
            toStringHolder = tuple.Item2.ToString();
            toStringHolder = tuple.Item3.ToString();
            toStringHolder = innerEnums.ToString();
            toStringHolder = innerEnums.First().ToString();
            toStringHolder = innerStructs.ToString();
            toStringHolder = innerStructs[0].ToString();
            toStringHolder = innerStructInnerEnum.ToString();
            toStringHolder = innerStructInnerEnum.Value.ToString();
            toStringHolder = innerStructInnerInterface.ToString();
            toStringHolder = innerStructInnerInterface.ToString();
            toStringHolder = innerStructInnerClassByInnerStructInnerStruct.ToString();
            toStringHolder = innerStructInnerClassByInnerStructInnerStruct.Keys.First().ToString();
            toStringHolder = innerStructInnerClassByInnerStructInnerStruct.Values.First().ToString();
            toStringHolder = getInnerAbstractClass.ToString();
            toStringHolder = stuff.ToString();
            toStringHolder = stuff[0].ToString();
            toStringHolder = stuff[0].Keys.First().ToString();
            toStringHolder = stuff[0].Values.First().ToString();
            toStringHolder = stuff[0].Values.First().First().ToString();
        }
Example #29
0
 public override String ToString()
 {
     // poor man's toString()
     IDictionary<String, Object> bld = new Dictionary<String, Object>();
     bld["MaxObjects"] = MaxObjects;
     bld["MaxIdle"] = MaxIdle;
     bld["MaxWait"] = MaxWait;
     bld["MinEvictableIdleTimeMillis"] = MinEvictableIdleTimeMillis;
     bld["MinIdle"] = MinIdle;
     return bld.ToString();
 }
Example #30
0
        public void ParseTemp(String filename)
        {
            LinkedList<string>  current_parent = new LinkedList<string>();
            int level = 0;
            Dictionary<string, List<string>> parents = new Dictionary<string, List<string>>();
            List<Sample> samples = new List<Sample>();
            Sample  s = null;
            bool new_level = false;
            using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read ))
            {
                using (BufferedStream bs = new BufferedStream(fs))
                {
                    using(StreamReader sr = new StreamReader(bs))
                    {
                        String line = sr.ReadLine();
                        while(line != null){
                            if(line.StartsWith("4-"))
                            {
                                if(s != null)
                                {
                                    samples.Add(s);
                                }
                                s = new Sample();
                                //Is Tree Parent

                                line = sr.ReadLine();
                                if(line.StartsWith("3-"))
                                {
                                    line =  line.Replace("3- ", "");
                                    if(String.IsNullOrWhiteSpace(line))
                                    {
                                        //First of tree pivot
                                        line = sr.ReadLine();
                                        line =  line.Replace("3- ", "");
                                        s.Name = line;
                                        s.Text = line;
                                        s.Description = line;
                                        if(current_parent.Count > 0){
                                            //s.Parent = current_parent.First.Value;
                                            s.Parent = Parents( current_parent);
                                        }else{
                                            s.Parent = "";
                                        }
                                        samples.Add(s);
                                        s = null;
                                        current_parent.AddFirst(line);
                                    }else{
                                        current_parent.RemoveFirst();
                                        s.Name = line;
                                        s.Text = line;
                                        s.Description = line;
                                        //s.Parent = Parents( current_parent.First.Value;
                                        s.Parent = Parents( current_parent);
                                        samples.Add(s);
                                        s = null;
                                        current_parent.AddFirst(line);
                                    }
                                }
                            }
                            else if(line.StartsWith("3-") )
                            {
                                if(s != null)
                                {
                                    samples.Add(s);
                                }
                                s = new Sample();
                                line =  line.Replace("3- ", "");
                                if(String.IsNullOrWhiteSpace(line))
                                {
                                    //First of tree pivot
                                    line = sr.ReadLine();
                                    while(!String.IsNullOrWhiteSpace(line))
                                    {
                                        if(line.StartsWith("3-"))
                                        {
                                            line = line.Replace("3-", "");
                                            break;
                                        }
                                        if(line.StartsWith("2-"))
                                        {
                                            line = line.Replace("2-", "");
                                            break;
                                        }
                                        line = sr.ReadLine();
                                    }
                                }
                                line = line.Trim();
                                s.Name = line;
                                s.Description = line;
                                //s.Parent = current_parent.First.Value;
                                s.Parent = Parents( current_parent);
                                sr.ReadLine();
                                sr.ReadLine();
                                sr.ReadLine();
                                sr.ReadLine();
                            }
                            else if(line.StartsWith("2-"))
                            {
                                if(s != null)
                                {
                                    samples.Add(s);
                                }
                                s = new Sample();
                                line =  line.Replace("2- ", "");
                                if(String.IsNullOrWhiteSpace(line))
                                {
                                    //First of tree pivot
                                    line = sr.ReadLine();
                                    while(!String.IsNullOrWhiteSpace(line))
                                    {
                                        if(line.StartsWith("3-"))
                                        {
                                            line = line.Replace("3-", "");
                                            break;
                                        }
                                        if(line.StartsWith("2-"))
                                        {
                                            line = line.Replace("2-", "");
                                            break;
                                        }
                                        line = sr.ReadLine();
                                    }
                                }
                                line = line.Trim();
                                s.Name = line;
                                s.Description = line;
                                //s.Parent = current_parent.First.Value;
                                s.Parent = Parents( current_parent);
                                sr.ReadLine();
                                sr.ReadLine();
                                sr.ReadLine();
                                sr.ReadLine();

                            }else{
                                if(s != null)
                                {
                                    s.Text += line;
                                    s.Text += System.Environment.NewLine;
                                }
                            }
                            line = sr.ReadLine();
                        }
                    }
                }
            }
            if(s != null)
            {
                samples.Add(s);
            }
            foreach(Sample ss in samples)
            {
                ss.Update(true);
            }
            parents.ToString();
        }