Ejemplo n.º 1
0
 protected override bool DecodePacket(MessageStructure reader, MessageHead head)
 {
     responsePack = ProtoBufUtils.Deserialize<Response1010Pack>(netReader.Buffer);
     string responseDataInfo = "";
     responseDataInfo = "request :" + Game.Utils.JsonHelper.prettyJson<Request1010Pack>(req) + "\n";
     responseDataInfo += "response:" + Game.Utils.JsonHelper.prettyJson<Response1010Pack>(responsePack) + "\n";
     DecodePacketInfo = responseDataInfo;
     int childStepId = getChild(1010);
     System.Console.WriteLine("childStepID:" + childStepId);
     if (childStepId > 0)
     {
         System.Collections.Generic.Dictionary<string, string> dic = new System.Collections.Generic.Dictionary<string, string>();
         /*
           req.UserID = GetParamsData("UserID", req.UserID);
         req.identify = GetParamsData("identify", req.identify);
         req.version = GetParamsData("version", req.version);
         req.the3rdUserID = GetParamsData("the3rdUserID", req.the3rdUserID);
         req.happyPoint = GetParamsData("happyPoint", req.happyPoint);
         req.Rate = GetParamsData("Rate", req.Rate);
         req.index = GetParamsData("index", req.index);
         req.strThe3rdUserID = GetParamsData("strThe3rdUserID", req.strThe3rdUserID);
         req.typeUser = GetParamsData("typeUser", req.typeUser);
          */
         dic.Add("UserID", req.UserID.ToString());
         dic.Add("index", responsePack.index.ToString());
         dic.Add("the3rdUserID", req.the3rdUserID.ToString());
         dic.Add("strThe3rdUserID", req.strThe3rdUserID);
        SetChildStep(childStepId.ToString(), _setting,dic);
     }
     return true;
 }
Ejemplo n.º 2
0
		void LogParameterEvent ()
		{
			var analiticsParam = new System.Collections.Generic.Dictionary<string, string> {
				{ "parameter", "test" }
			};
			Flurry.Analytics.Portable.AnalyticsApi.LogEvent ("EventWithParameters", analiticsParam);
		}
Ejemplo n.º 3
0
		public static void InitDataDefinitions() {
			if (!initCache) {
                imageDictionary = new System.Collections.Generic.Dictionary<string, DefImage>();
                animationDictionary = new System.Collections.Generic.Dictionary<string, DefAnimation>();
				initCache = true;
			}
		}
 internal static System.Collections.Generic.Dictionary<string, string> ToDictionary(GeometryThiessenAnalystParameters geometryThiessenParams)
 {
     System.Collections.Generic.Dictionary<string, string> dict = new System.Collections.Generic.Dictionary<string, string>();
     if (geometryThiessenParams.ClipRegion != null)
     {
         dict.Add("clipRegion", ServerGeometry.ToJson(geometryThiessenParams.ClipRegion));
     }
     dict.Add("createResultDataset", geometryThiessenParams.CreateResultDataset.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());
     dict.Add("resultDatasetName", geometryThiessenParams.ResultDatasetName.ToString(System.Globalization.CultureInfo.InvariantCulture));
     dict.Add("resultDatasourceName", geometryThiessenParams.ResultDatasourceName.ToString(System.Globalization.CultureInfo.InvariantCulture));
     dict.Add("returnResultRegion", geometryThiessenParams.ReturnResultRegion.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());
     if (geometryThiessenParams.Points.Count > 0)
     {
         string points_str = "[";
         int count = geometryThiessenParams.Points.Count;
         for (int i = 0; i < count; i++)
         {
             Point2D point = geometryThiessenParams.Points[i];
             var point_str = "{";
             point_str+=String.Format("\"y\":{0},\"x\":{1}", point.Y, point.X);
             point_str += "}";
             points_str += point_str;
             if (i == count - 1)
             {
                 points_str += "]";                    }
             else
             {
                 points_str+=",";
             }
         }
         dict.Add("points", points_str);
     }
     return dict;
 }
Ejemplo n.º 5
0
 public void List()
 {
     System.Collections.Generic.IDictionary<string, object> uriArguments = new System.Collections.Generic.Dictionary<string, object>();
     var accept = new string[0];
     var contentType = new string[0];
     Call(Verb.GET, "/type/#GET", accept, contentType, uriArguments);
 }
Ejemplo n.º 6
0
        //also reference to Algorithm.TreeAndGraph.Floyd and Algorithm.TreeAndGraph.Dijkstra
        public static int getShortestDistance(TreeAndGraph.GraphNode start, TreeAndGraph.GraphNode end)
        {
            System.Collections.Generic.Dictionary<int, System.Collections.Generic.List<TreeAndGraph.GraphNode>> tab
                = new System.Collections.Generic.Dictionary<int, System.Collections.Generic.List<TreeAndGraph.GraphNode>>();
            System.Collections.Generic.List<TreeAndGraph.GraphNode> list = new System.Collections.Generic.List<TreeAndGraph.GraphNode>();
            int count = 1;
            list.Add(start);
            tab.Add(count, list);
            while (true)
            {
                System.Collections.Generic.List<TreeAndGraph.GraphNode> gn_list = tab[count];
                ++count;
                if (!tab.ContainsKey(count))
                {
                    list = new System.Collections.Generic.List<TreeAndGraph.GraphNode>();
                    tab.Add(count, list);
                }
                foreach (TreeAndGraph.GraphNode gn in gn_list)
                {

                    foreach (TreeAndGraph.GraphNode node in gn.Nodes)
                    {
                        if (node == end)
                        {
                            return count;
                        }

                        tab[count].Add(node);
                    }
                }
            }
        }
 public override System.Collections.Generic.IDictionary<string, object> AsDictionary()
 {
     System.Collections.Generic.Dictionary<string, object> result = new System.Collections.Generic.Dictionary<string, object>();
     result["LastAppliedEventId"] = this.LastAppliedEventId;
     result["Value"] = this.Value;
     return result;
 }
 private void InitializeObjects()
 {
     this._updateDataTimer = new Timer();
     this._updateDataTimer.Interval = this._updateDataInterval;
     this._updateDataTimer.Tick += new System.EventHandler(this._updateDataTimer_Tick);
     this._OldBetListHistory = new Dictionary<string, DateTime>();
 }
Ejemplo n.º 9
0
        public string ToRelative(string DateString)
        {
            DateTime theDate = Convert.ToDateTime(DateString);
            System.Collections.Generic.Dictionary<long, string> thresholds = new System.Collections.Generic.Dictionary<long, string>();
            int minute = 60;
            int hour = 60 * minute;
            int day = 24 * hour;
            thresholds.Add(60, "{0} seconds ago");
            thresholds.Add(minute * 2, "a minute ago");
            thresholds.Add(45 * minute, "{0} minutes ago");
            thresholds.Add(120 * minute, "an hour ago");
            thresholds.Add(day, "{0} hours ago");
            thresholds.Add(day * 2, "yesterday");
            // thresholds.Add(day * 30, "{0} days ago");
            thresholds.Add(day * 365, "{0} days ago");
            thresholds.Add(long.MaxValue, "{0} years ago");

            long since = (DateTime.Now.Ticks - theDate.Ticks) / 10000000;
            foreach (long threshold in thresholds.Keys)
            {
                if (since < threshold)
                {
                    TimeSpan t = new TimeSpan((DateTime.Now.Ticks - theDate.Ticks));
                    return string.Format(thresholds[threshold], (t.Days > 365 ? t.Days / 365 : (t.Days > 0 ? t.Days : (t.Hours > 0 ? t.Hours : (t.Minutes > 0 ? t.Minutes : (t.Seconds > 0 ? t.Seconds : 0))))).ToString());
                }
            }
            return "";
        }
Ejemplo n.º 10
0
 public LSTRFont(LFont font, bool anti, char[] additionalChars)
 {
     if (displays == null)
     {
         displays = new System.Collections.Generic.Dictionary<string, Loon.Core.Graphics.Opengl.LTextureBatch.GLCache>(totalCharSet);
     }
     else
     {
         displays.Clear();
     }
     this.useCache = true;
     this.font = font;
     this.fontSize = font.GetSize();
     this.ascent = font.GetAscent();
     this.antiAlias = anti;
     if (antiAlias)
     {
         if (trueFont == null)
         {
             trueFont = LFont.GetTrueFont();
         }
         if (additionalChars != null && additionalChars.Length > (textureWidth / trueFont.GetSize()))
         {
             this.textureWidth *= 2;
             this.textureHeight *= 2;
         }
         this.fontScale = (float)fontSize / (float)trueFont.GetSize();
         this.Make(trueFont, additionalChars);
     }
     else
     {
         this.Make(this.font, additionalChars);
     }
 }
	static public int constructor(IntPtr l) {
		try {
			int argc = LuaDLL.lua_gettop(l);
			System.Collections.Generic.Dictionary<System.Int32,System.String> o;
			if(argc==1){
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>();
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(IEqualityComparer<System.Int32>))){
				System.Collections.Generic.IEqualityComparer<System.Int32> a1;
				checkType(l,2,out a1);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(IDictionary<System.Int32,System.String>))){
				System.Collections.Generic.IDictionary<System.Int32,System.String> a1;
				checkType(l,2,out a1);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(int))){
				System.Int32 a1;
				checkType(l,2,out a1);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(IDictionary<System.Int32,System.String>),typeof(IEqualityComparer<System.Int32>))){
				System.Collections.Generic.IDictionary<System.Int32,System.String> a1;
				checkType(l,2,out a1);
				System.Collections.Generic.IEqualityComparer<System.Int32> a2;
				checkType(l,3,out a2);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1,a2);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(int),typeof(IEqualityComparer<System.Int32>))){
				System.Int32 a1;
				checkType(l,2,out a1);
				System.Collections.Generic.IEqualityComparer<System.Int32> a2;
				checkType(l,3,out a2);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1,a2);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			return error(l,"New object failed.");
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
        public static LinkedList<int> RemoveDuplicateFromUnsortedList(LinkedList<int> linkedList)
        {
            if (linkedList == null)
                throw new ArgumentNullException("linkedList");

            var hash = new System.Collections.Generic.Dictionary<int, bool>();
            LinkedListNode<int> currentNode = linkedList.Root;
            LinkedListNode<int> previous = null;

            while (currentNode != null)
            {
                int data = currentNode.Data;
                if (hash.ContainsKey(data))
                {
                    previous.Next = currentNode.Next;
                }
                else
                {
                    hash.Add(data, true);
                    previous = currentNode;
                }
                currentNode = currentNode.Next;
            }
            return linkedList;
        }
		static XMLTokener()
		{
			/*
			Copyright (c) 2002 JSON.org
			
			Permission is hereby granted, free of charge, to any person obtaining a copy
			of this software and associated documentation files (the "Software"), to deal
			in the Software without restriction, including without limitation the rights
			to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
			copies of the Software, and to permit persons to whom the Software is
			furnished to do so, subject to the following conditions:
			
			The above copyright notice and this permission notice shall be included in all
			copies or substantial portions of the Software.
			
			The Software shall be used for Good, not Evil.
			
			THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
			IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
			FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
			AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
			LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
			OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
			SOFTWARE.
			*/
			entity = new System.Collections.Generic.Dictionary<string, char>(8);
			entity["amp"] = org.json.XML.AMP;
			entity["apos"] = org.json.XML.APOS;
			entity["gt"] = org.json.XML.GT;
			entity["lt"] = org.json.XML.LT;
			entity["quot"] = org.json.XML.QUOT;
		}
Ejemplo n.º 14
0
 private void saveInitialPositions()
 {
     initialPositions = new System.Collections.Generic.Dictionary<int, Vector3>();
     foreach(GameObject obj in GameObject.FindGameObjectsWithTag("respawn")) {
         initialPositions.Add(obj.GetInstanceID(), obj.rigidbody.position);
     }
 }
Ejemplo n.º 15
0
 protected void ShowPage()
 {
     UsersData users = new UsersData(MapPath("."));
     ImagesData images = new ImagesData(MapPath("."));
     var image = new System.Collections.Generic.Dictionary<string, string>();
     if ((string)Request.QueryString["new"] == "true")
     {
         MultiView_Char.SetActiveView(View_NewChar);
         image["imageName"] = "新しい文字";
     }
     else if (Request.QueryString["id"] != null)
     {
         MultiView_Char.SetActiveView(View_ShowChar);
         image = images.FindImageId((string)Request.QueryString["id"]);
         Label_UserName.Text = users.FindUserID(image["userID"])["userName"];
         Image_Char.ImageUrl = string.Format("images/{0}.{1}", image["imageID"], image["imageType"]);
         TextBox_CharName.Text = image["imageName"];
     }
     else
     {
         Response.Redirect("index.aspx");
     }
     if (TextBox_NewCharName.Text == "")
     {
         TextBox_NewCharName.Text = image["imageName"];
     }
     Literal_Title.Text = image["imageName"];
     Literal_HeaderTitle.Text = image["imageName"];
     string userID = (string)Session["userID"];
     Literal_NavTop.Text = PageKits.generateNavTopContent(userID, users.FindUserID(userID)["userName"]);
 }
        private void SetHourData(Models.Student student, ExcelWorksheet worksheet)
        {
            var collector = new System.Collections.Generic.Dictionary<SpreadsheetExport.Key, int>();
            foreach (var b in student.Behaviors) {
                var key = new SpreadsheetExport.Key { DayOfWeek = b.TimeRecorded.DayOfWeek.ToString(), Hour = b.TimeRecorded.Hour };
                if (collector.ContainsKey(key))
                    collector[key] += 1;
                else
                    collector.Add(key, 1);

            }
            foreach (var key in collector.Keys) {
                var value = key.Hour - 2;
                switch (key.DayOfWeek.ToString()) {
                    case "Monday": worksheet.Cells[5, value].Value = collector[key];
                        break;
                    case "Tuesday": worksheet.Cells[6, value].Value = collector[key];
                        break;
                    case "Wednesday": worksheet.Cells[7, value].Value = collector[key];
                        break;
                    case "Thursday": worksheet.Cells[8, value].Value = collector[key];
                        break;
                    case "Friday": worksheet.Cells[9, value].Value = collector[key];
                        break;
                    default:
                        break;
                }
            }
        }
        internal static System.Collections.Generic.Dictionary<string, string> ToDictionary(DatasetBufferAnalystParameters datasetBufferParams)
        {
            System.Collections.Generic.Dictionary<string, string> dict = new System.Collections.Generic.Dictionary<string, string>();
            dict.Add("isAttributeRetained", datasetBufferParams.IsAttributeRetained.ToString().ToLower());
            dict.Add("isUnion", datasetBufferParams.IsUnion.ToString().ToLower());

            string dataReturnOption = "{\"dataReturnMode\": \"RECORDSET_ONLY\",\"deleteExistResultDataset\": true,";
            dataReturnOption += string.Format("\"expectCount\":{0}", datasetBufferParams.MaxReturnRecordCount);
            dataReturnOption += "}";
            dict.Add("dataReturnOption", dataReturnOption);

            if (datasetBufferParams.FilterQueryParameter != null)
            {
                dict.Add("filterQueryParameter", FilterParameter.ToJson(datasetBufferParams.FilterQueryParameter));
            }
            else
            {
                dict.Add("filterQueryParameter", FilterParameter.ToJson(new FilterParameter()));
            }

            if (datasetBufferParams.BufferSetting != null)
            {
                dict.Add("bufferAnalystParameter", BufferSetting.ToJson(datasetBufferParams.BufferSetting));
            }
            else
            {
                dict.Add("bufferAnalystParameter", BufferSetting.ToJson(new BufferSetting()));
            }

            return dict;
        }
Ejemplo n.º 18
0
        public static System.Collections.Generic.Dictionary<System.Int16, System.Collections.Generic.List<BinaryTreeNode>> getLevelLinkedList(BinaryTreeNode head)
        {
            System.Collections.Generic.Dictionary<System.Int16, System.Collections.Generic.List<BinaryTreeNode>> result
                = new System.Collections.Generic.Dictionary<System.Int16, System.Collections.Generic.List<BinaryTreeNode>>();
            short level = 0;
            System.Collections.Generic.List<BinaryTreeNode> list = new System.Collections.Generic.List<BinaryTreeNode>();
            list.Add(head);
            result.Add(level, list);

            while (true)
            {
                System.Collections.Generic.List<BinaryTreeNode> list_loop = result[level];
                list = new System.Collections.Generic.List<BinaryTreeNode>();
                result.Add(++level, list);
                foreach (BinaryTreeNode btn in list_loop)
                {
                    if (btn.LeftNode != null)
                    {
                        list.Add(btn.LeftNode);
                    }
                    if (btn.RightNode != null)
                    {
                        list.Add(btn.RightNode);
                    }
                }
                if (list.Count == 0)
                {
                    break;
                }
            }
            return result;
        }
Ejemplo n.º 19
0
 public override Task Invoke(IOwinContext ctx)
 {
     var requestMethod = ctx.Request.Method;
     var routeParams = new System.Collections.Generic.Dictionary<string, object>();
     string remainder;
     var path = ctx.Request.Path.Value;
     var match = MatchMethodAndTemplate(ctx, path);
     if (match == null)
     {
         return Next.Invoke(ctx);
     }
     var env = ctx.Environment;
     RouteParams.Merge(env, match.extracted);
     var oldBase = ctx.Request.PathBase;
     var oldPath = ctx.Request.Path;
     ctx.Request.PathBase = new PathString(oldBase + match.pathMatched);
     ctx.Request.Path = new PathString(match.pathRemaining);
     var restore = new Action<Task>(task => restorePaths(ctx, oldBase, oldPath));
     if (options.app != null)
     {
         return options.app.Invoke(env).ContinueWith(restore, TaskContinuationOptions.ExecuteSynchronously);
     }
     else
     {
         return options.branch.Invoke(ctx).ContinueWith(restore, TaskContinuationOptions.ExecuteSynchronously);
     }
 }
 public string Build()
 {
     _queryWeights = ExtensionPointsRepository.Instance.GetQueryWeightsSupplierImplementation().GetQueryWeightsValues();
     var stringBuilder = new StringBuilder();
     if (_criteria.SearchByAccessLevel && (!_criteria.SearchByProgramElementType || !_criteria.ProgramElementTypes.Contains(ProgramElementType.Comment)))
     {
         AccessLevelCriteriaToString(stringBuilder);
     }
     if (_criteria.SearchByProgramElementType)
     {
         if(_criteria.ProgramElementTypes.Count != sizeof(ProgramElementType)){
             if (stringBuilder.Length > 0)
                 stringBuilder.Append(" AND ");
             ProgramElementTypeCriteriaToString(stringBuilder);
         }
     }
     if (_criteria.SearchByFileExtension)
     {
         if (stringBuilder.Length > 0)
             stringBuilder.Append(" AND ");
         FileExtensionsCriteriaToString(stringBuilder);
     }
     if (_criteria.SearchByLocation)
     {
         if (stringBuilder.Length > 0)
             stringBuilder.Append(" AND ");
         LocationCriteriaToString(stringBuilder);
     }
     UsageTypeCriteriaToString(stringBuilder);
     return stringBuilder.ToString();
 }
        internal static System.Collections.Generic.Dictionary<string, string> ToDictionary(DatasetSurfaceAnalystParameters datasetSurfaceAnalystParams)
        {
            var dict = new System.Collections.Generic.Dictionary<string, string>();

            if (datasetSurfaceAnalystParams.ParametersSetting != null)
            {
                dict.Add("extractParameter", SurfaceAnalystParametersSetting.ToJson(datasetSurfaceAnalystParams.ParametersSetting));
            }
            else
            {
                dict.Add("extractParameter", SurfaceAnalystParametersSetting.ToJson(new SurfaceAnalystParametersSetting()));
            }

            string resultSetting = string.Format(System.Globalization.CultureInfo.InvariantCulture, "\"dataReturnMode\":\"RECORDSET_ONLY\",\"expectCount\":{0}", datasetSurfaceAnalystParams.MaxReturnRecordCount);
            resultSetting = "{" + resultSetting + "}";
            dict.Add("resultSetting", resultSetting);

            if (datasetSurfaceAnalystParams.FilterQueryParam != null)
            {
                dict.Add("filterQueryParameter", FilterParameter.ToJson(datasetSurfaceAnalystParams.FilterQueryParam));
            }

            if (!string.IsNullOrEmpty(datasetSurfaceAnalystParams.ZValueFieldName) && !string.IsNullOrWhiteSpace(datasetSurfaceAnalystParams.ZValueFieldName))
            {
                dict.Add("zValueFieldName", "\"" + datasetSurfaceAnalystParams.ZValueFieldName + "\"");
            }
            else
            {
                dict.Add("zValueFieldName","\"\"");
            }

            dict.Add("resolution", datasetSurfaceAnalystParams.Resolution.ToString(System.Globalization.CultureInfo.InvariantCulture));
            return dict;
        }
Ejemplo n.º 22
0
 private static SQLCEVersion DetermineVersion(string filename)
 {
     var versionDictionary = new System.Collections.Generic.Dictionary<int, SQLCEVersion> 
 { 
     { 0x73616261, SQLCEVersion.SQLCE20 }, 
     { 0x002dd714, SQLCEVersion.SQLCE30},
     { 0x00357b9d, SQLCEVersion.SQLCE35},
     { 0x003d0900, SQLCEVersion.SQLCE40}
 };
     int versionLONGWORD = 0;
     try
     {
         using (var fs = new System.IO.FileStream(filename, System.IO.FileMode.Open))
         {
             fs.Seek(16, System.IO.SeekOrigin.Begin);
             using (System.IO.BinaryReader reader = new System.IO.BinaryReader(fs))
             {
                 versionLONGWORD = reader.ReadInt32();
             }
         }
     }
     catch
     {
         throw;
     }
     if (versionDictionary.ContainsKey(versionLONGWORD))
     {
         return versionDictionary[versionLONGWORD];
     }
     else
     {
         throw new ApplicationException("Unable to determine database file version");
     }
 }
        // CONSTRUCTOR ---------------------------------------------------------------------------------------
        public AnimationGlitchSpriteSingleton()
        {
            if(!isOkToCreate) Console.WriteLine (this + "is a singleton. Use get instance");
            if(isOkToCreate){
                FileStream fileStream = File.OpenRead("/Application/assets/animation/leftGlitch/leftOneLine.xml");
                StreamReader fileStreamReader = new StreamReader(fileStream);
                string xml = fileStreamReader.ReadToEnd();
                fileStreamReader.Close();
                fileStream.Close();
                XDocument doc = XDocument.Parse(xml);

                var lines = from sprite in doc.Root.Elements("sprite")
                    select new {
                        Name = sprite.Attribute("n").Value,
                        X1 = (int)sprite.Attribute ("x"),
                        Y1 = (int)sprite.Attribute ("y"),
              			Height = (int)sprite.Attribute ("h"),
              			Width = (int)sprite.Attribute("w"),
            };

               				_sprites = new Dictionary<string,Sce.PlayStation.HighLevel.GameEngine2D.Base.Vector2i>();
                foreach(var curLine in lines)
                {
                    _sprites.Add(curLine.Name,new Vector2i((curLine.X1/curLine.Width),(curLine.Y1/curLine.Height)));
                //note if you add more than one line of sprites you must do this
                // _sprites.Add(curLine.Name,new Vector2i((curLine.X1/curLine.Width),1-(curLine.Y1/curLine.Height)));
                //where 9 is the num of rows minus 1 to reverse the order :/
               			}
               				_texture = new Texture2D("/Application/assets/animation/leftGlitch/leftOneLine.png", false);
               				_textureInfo = new TextureInfo(_texture,new Vector2i(5,1));
            }
              		if(!isOkToCreate) {
                Console.WriteLine("this is a singleton. access via get Instance");
            }
        }
Ejemplo n.º 24
0
		//Rolls back index to a chosen ID
		private void  RollBackLast(int id)
		{
			
			// System.out.println("Attempting to rollback to "+id);
			System.String ids = "-" + id;
			IndexCommit last = null;
			System.Collections.ICollection commits = IndexReader.ListCommits(dir);
			for (System.Collections.IEnumerator iterator = commits.GetEnumerator(); iterator.MoveNext(); )
			{
				IndexCommit commit = (IndexCommit) iterator.Current;
                System.Collections.Generic.IDictionary<string, string> ud = commit.GetUserData();
				if (ud.Count > 0)
					if (((System.String) ud["index"]).EndsWith(ids))
						last = commit;
			}
			
			if (last == null)
				throw new System.SystemException("Couldn't find commit point " + id);
			
			IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(), new RollbackDeletionPolicy(this, id), MaxFieldLength.UNLIMITED, last);
            System.Collections.Generic.IDictionary<string, string> data = new System.Collections.Generic.Dictionary<string, string>();
			data["index"] = "Rolled back to 1-" + id;
			w.Commit(data);
			w.Close();
		}
Ejemplo n.º 25
0
 /// <summary>
 /// Serialises the keys object as a media-storage-query-compatible, JSON-friendly data-structure.
 /// </summary>
 /// <returns>
 /// A JSON-friendly dictionary representation of the keys object in its current state.
 /// </returns>
 internal virtual System.Collections.Generic.IDictionary<string, object> ToDictionary()
 {
     System.Collections.Generic.IDictionary<string, object> dictionary = new System.Collections.Generic.Dictionary<string, object>();
     dictionary.Add("read", this.Read);
     dictionary.Add("write", this.Write);
     return dictionary;
 }
Ejemplo n.º 26
0
 public DataBoundCalendarHeader(DateTime VisibleDate)
 {
     _dataItem = new System.Collections.Generic.Dictionary<string, DateTime>();
     _prevMonth = VisibleDate.AddMonths(-1);
     _currMonth = VisibleDate;
     _nextMonth = VisibleDate.AddMonths(1);
 }
Ejemplo n.º 27
0
 public Regex(string pattern, RegexOptions options)
 {
     this.refsInitialized = false;
     if (pattern == null)
     {
         throw new ArgumentNullException();
     }
     if ((options < RegexOptions.None) || ((((int) options) >> 9) != 0))
     {
         throw new ArgumentOutOfRangeException();
     }
     if (((options & RegexOptions.ECMAScript) != RegexOptions.None) && ((options & ~(RegexOptions.CultureInvariant | RegexOptions.ECMAScript | RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase)) != RegexOptions.None))
     {
         throw new ArgumentOutOfRangeException();
     }
     string text1 = options + ":" + pattern;
     this.pattern = pattern;
     this.roptions = options;
     RegexTree t = RegexParser.Parse(pattern, this.roptions);
     this.capnames = t._capnames;
     this.capslist = t._capslist;
     this.code = RegexWriter.Write(t);
     this.caps = this.code._caps;
     this.capsize = this.code._capsize;
 }
Ejemplo n.º 28
0
        public void TestCompression()
        {
            System.Collections.Generic.Dictionary<string, string> dic = new System.Collections.Generic.Dictionary<string, string>();

            for (int i = 0; i < 10001; i++)
            {
                dic.Add(Guid.NewGuid().ToString(), Guid.NewGuid().ToString() + "::" + Properties.Settings.Default.Value_Text + "::" + Guid.NewGuid().ToString());
            }

            byte[] source_byte = Utility.Serialize(dic);
            byte[] dest_byte = Utility.Deflate(source_byte, System.IO.Compression.CompressionMode.Compress);


            byte[] dest_byte_2 = Utility.Deflate(dest_byte, System.IO.Compression.CompressionMode.Decompress);

            for (int i = 0; i < source_byte.Length; i++)
            {
                if (source_byte[i] != dest_byte_2[i])
                {
                    Microsoft.VisualStudio.TestTools.UnitTesting.Assert.Fail("Byte Array Error...");
                    break;
                }
            }

        }
Ejemplo n.º 29
0
 public void RefreshConfiguration()
 {
     System.Configuration.ConfigurationManager.RefreshSection("appSettings");
     System.Configuration.ConfigurationManager.RefreshSection("CTS");
     lock (lockObject)
         configurationSubSections = null;
 }
Ejemplo n.º 30
0
		public virtual void  Set(System.Object object_Renamed)
		{
			if (slots == null)
				slots = new System.Collections.Generic.Dictionary<object, object>();

			slots[this] = object_Renamed;	
		}
Ejemplo n.º 31
0
        public void parse(string astr, bool doNormalizePath)
        {
            setOriginal(astr);
            if (!(astr != null))
            {
                return;
            }
            var fsp = cape.String.split(astr, '#', 2);
            var str = cape.Vector.get(fsp, 0);

            fragment = cape.Vector.get(fsp, 1);
            var qsplit = cape.String.split(str, '?', 2);

            str = cape.Vector.get(qsplit, 0);
            var queryString = cape.Vector.get(qsplit, 1);

            if (cape.String.isEmpty(queryString) == false)
            {
                var qss = cape.String.split(queryString, '&');
                if (qss != null)
                {
                    var n = 0;
                    var m = qss.Count;
                    for (n = 0; n < m; n++)
                    {
                        var qs = qss[n];
                        if (qs != null)
                        {
                            if (!(rawQueryParameters != null))
                            {
                                rawQueryParameters = new cape.KeyValueList <string, string>();
                            }
                            if (!(queryParameters != null))
                            {
                                queryParameters = new System.Collections.Generic.Dictionary <string, string>();
                            }
                            if (cape.String.indexOf(qs, '=') < 0)
                            {
                                cape.Map.set(queryParameters, qs, null);
                                rawQueryParameters.add((string)qs, null);
                                continue;
                            }
                            var qsps = cape.String.split(qs, '=', 2);
                            var key  = cape.Vector.get(qsps, 0);
                            var val  = cape.Vector.get(qsps, 1);
                            if (cape.String.isEmpty(key) == false)
                            {
                                if (!(val != null))
                                {
                                    val = "";
                                }
                                var udv = cape.URLDecoder.decode(val);
                                cape.Map.set(queryParameters, key, udv);
                                rawQueryParameters.add((string)key, (string)udv);
                            }
                        }
                    }
                }
            }
            var css = cape.String.indexOf(str, "://");

            if (css >= 0)
            {
                scheme = cape.String.subString(str, 0, css);
                if (cape.String.indexOf(scheme, ':') >= 0 || cape.String.indexOf(scheme, '/') >= 0)
                {
                    scheme = null;
                }
                else
                {
                    str = cape.String.subString(str, css + 3);
                }
            }
            string pp = null;

            if (cape.String.charAt(str, 0) == '/')
            {
                pp = cape.URLDecoder.decode(str);
            }
            else
            {
                if (cape.String.indexOf(str, '/') >= 0)
                {
                    var sssplit = cape.String.split(str, '/', 2);
                    str = cape.Vector.get(sssplit, 0);
                    pp  = cape.Vector.get(sssplit, 1);
                    if (!(pp != null))
                    {
                        pp = "";
                    }
                    if (cape.String.charAt(pp, 0) != '/')
                    {
                        pp = cape.String.append("/", pp);
                    }
                    pp = cape.URLDecoder.decode(pp);
                }
                if (cape.String.indexOf(str, '@') >= 0)
                {
                    var asplit = cape.String.split(str, '@', 2);
                    var auth   = cape.Vector.get(asplit, 0);
                    str = cape.Vector.get(asplit, 1);
                    if (cape.String.indexOf(auth, ':') >= 0)
                    {
                        var acsplit = cape.String.split(auth, ':', 2);
                        username = cape.URLDecoder.decode(cape.Vector.get(acsplit, 0));
                        password = cape.URLDecoder.decode(cape.Vector.get(acsplit, 1));
                    }
                    else
                    {
                        username = auth;
                    }
                }
                if (cape.String.indexOf(str, ':') >= 0)
                {
                    var hcsplit = cape.String.split(str, ':', 2);
                    str  = cape.Vector.get(hcsplit, 0);
                    port = cape.Vector.get(hcsplit, 1);
                }
                host = str;
            }
            if (doNormalizePath)
            {
                path = normalizePath(pp);
            }
            else
            {
                path = pp;
            }
        }
Ejemplo n.º 32
0
 public MsgPack_Serialization_PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWritePropertySerializer(MsgPack.Serialization.SerializationContext context) :
     base(context, (MsgPack.Serialization.SerializerCapabilities.PackTo | MsgPack.Serialization.SerializerCapabilities.UnpackFrom))
 {
     MsgPack.Serialization.PolymorphismSchema   schema0           = default(MsgPack.Serialization.PolymorphismSchema);
     MsgPack.Serialization.PolymorphismSchema[] tupleItemsSchema0 = default(MsgPack.Serialization.PolymorphismSchema[]);
     tupleItemsSchema0 = new MsgPack.Serialization.PolymorphismSchema[1];
     MsgPack.Serialization.PolymorphismSchema tupleItemSchema0 = default(MsgPack.Serialization.PolymorphismSchema);
     System.Collections.Generic.Dictionary <string, System.Type> tupleItemSchemaTypeMap0 = default(System.Collections.Generic.Dictionary <string, System.Type>);
     tupleItemSchemaTypeMap0 = new System.Collections.Generic.Dictionary <string, System.Type>(2);
     tupleItemSchemaTypeMap0.Add("0", typeof(MsgPack.Serialization.FileEntry));
     tupleItemSchemaTypeMap0.Add("1", typeof(MsgPack.Serialization.DirectoryEntry));
     tupleItemSchema0     = MsgPack.Serialization.PolymorphismSchema.ForPolymorphicObject(typeof(object), tupleItemSchemaTypeMap0);
     tupleItemsSchema0[0] = tupleItemSchema0;
     schema0           = MsgPack.Serialization.PolymorphismSchema.ForPolymorphicTuple(typeof(System.Tuple <object>), tupleItemsSchema0);
     this._serializer0 = context.GetSerializer <System.Tuple <object> >(schema0);
     System.Action <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty>[] packOperationList = default(System.Action <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty>[]);
     packOperationList       = new System.Action <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty> [1];
     packOperationList[0]    = new System.Action <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty>(this.PackValueOfTuple1ObjectItem);
     this._packOperationList = packOperationList;
     System.Func <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, System.Threading.CancellationToken, System.Threading.Tasks.Task>[] packOperationListAsync = default(System.Func <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, System.Threading.CancellationToken, System.Threading.Tasks.Task>[]);
     packOperationListAsync       = new System.Func <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, System.Threading.CancellationToken, System.Threading.Tasks.Task> [1];
     packOperationListAsync[0]    = new System.Func <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, System.Threading.CancellationToken, System.Threading.Tasks.Task>(this.PackValueOfTuple1ObjectItemAsync);
     this._packOperationListAsync = packOperationListAsync;
     System.Collections.Generic.Dictionary <string, System.Action <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty> > packOperationTable = default(System.Collections.Generic.Dictionary <string, System.Action <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty> >);
     packOperationTable = new System.Collections.Generic.Dictionary <string, System.Action <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty> >(1);
     packOperationTable["Tuple1ObjectItem"] = new System.Action <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty>(this.PackValueOfTuple1ObjectItem);
     this._packOperationTable = packOperationTable;
     System.Collections.Generic.Dictionary <string, System.Func <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, System.Threading.CancellationToken, System.Threading.Tasks.Task> > packOperationTableAsync = default(System.Collections.Generic.Dictionary <string, System.Func <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, System.Threading.CancellationToken, System.Threading.Tasks.Task> >);
     packOperationTableAsync = new System.Collections.Generic.Dictionary <string, System.Func <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, System.Threading.CancellationToken, System.Threading.Tasks.Task> >(1);
     packOperationTableAsync["Tuple1ObjectItem"] = new System.Func <MsgPack.Packer, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, System.Threading.CancellationToken, System.Threading.Tasks.Task>(this.PackValueOfTuple1ObjectItemAsync);
     this._packOperationTableAsync = packOperationTableAsync;
     System.Collections.Generic.Dictionary <string, System.Func <MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, bool> > nullCheckerTable = default(System.Collections.Generic.Dictionary <string, System.Func <MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, bool> >);
     nullCheckerTable = new System.Collections.Generic.Dictionary <string, System.Func <MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, bool> >(1);
     nullCheckerTable["Tuple1ObjectItem"] = new System.Func <MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, bool>(this.IsTuple1ObjectItemNull);
     this._nullCheckersTable = nullCheckerTable;
     System.Action <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int>[] unpackOperationList = default(System.Action <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int>[]);
     unpackOperationList       = new System.Action <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int> [1];
     unpackOperationList[0]    = new System.Action <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int>(this.UnpackValueOfTuple1ObjectItem);
     this._unpackOperationList = unpackOperationList;
     System.Func <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int, System.Threading.CancellationToken, System.Threading.Tasks.Task>[] unpackOperationListAsync = default(System.Func <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int, System.Threading.CancellationToken, System.Threading.Tasks.Task>[]);
     unpackOperationListAsync       = new System.Func <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int, System.Threading.CancellationToken, System.Threading.Tasks.Task> [1];
     unpackOperationListAsync[0]    = new System.Func <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int, System.Threading.CancellationToken, System.Threading.Tasks.Task>(this.UnpackValueOfTuple1ObjectItemAsync);
     this._unpackOperationListAsync = unpackOperationListAsync;
     System.Collections.Generic.Dictionary <string, System.Action <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int> > unpackOperationTable = default(System.Collections.Generic.Dictionary <string, System.Action <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int> >);
     unpackOperationTable = new System.Collections.Generic.Dictionary <string, System.Action <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int> >(1);
     unpackOperationTable["Tuple1ObjectItem"] = new System.Action <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int>(this.UnpackValueOfTuple1ObjectItem);
     this._unpackOperationTable = unpackOperationTable;
     System.Collections.Generic.Dictionary <string, System.Func <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int, System.Threading.CancellationToken, System.Threading.Tasks.Task> > unpackOperationTableAsync = default(System.Collections.Generic.Dictionary <string, System.Func <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int, System.Threading.CancellationToken, System.Threading.Tasks.Task> >);
     unpackOperationTableAsync = new System.Collections.Generic.Dictionary <string, System.Func <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int, System.Threading.CancellationToken, System.Threading.Tasks.Task> >(1);
     unpackOperationTableAsync["Tuple1ObjectItem"] = new System.Func <MsgPack.Unpacker, MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, int, int, System.Threading.CancellationToken, System.Threading.Tasks.Task>(this.UnpackValueOfTuple1ObjectItemAsync);
     this._unpackOperationTableAsync = unpackOperationTableAsync;
     this._memberNames = new string[] {
         "Tuple1ObjectItem"
     };
     this.this_SetUnpackedValueOfTuple1ObjectItemDelegate = new System.Action <MsgPack.Serialization.PolymorphicMemberTypeKnownType_Tuple_Tuple1ObjectItemReadWriteProperty, System.Tuple <object> >(this.SetUnpackedValueOfTuple1ObjectItem);
 }
Ejemplo n.º 33
0
 public cape.URL setQueryParameters(System.Collections.Generic.Dictionary <string, string> v)
 {
     queryParameters = v;
     return(this);
 }