public static void Write(TextWriter writer, IEnumerable<Dictionary<string, string>> records)
		{
			if (records == null) return; //AOT

		    var allKeys = new System.Collections.Generic.HashSet<string>();
		    var cachedRecords = new List<IDictionary<string, string>>();

			foreach (var record in records) {
                foreach (var key in record.Keys) {
                    if (!allKeys.Contains(key)) {
                        allKeys.Add(key);
                    }
                }
                cachedRecords.Add(record);
			}

		    var headers = allKeys.OrderBy(key => key).ToList();
            if (!CsvConfig<Dictionary<string, string>>.OmitHeaders) {
                WriteRow(writer, headers);
            }
		    foreach (var cachedRecord in cachedRecords) {
                var fullRecord = new List<string>();
                foreach (var header in headers) {
                    fullRecord.Add(cachedRecord.ContainsKey(header)
                                        ? cachedRecord[header]
                                        : null);
                }
                WriteRow(writer, fullRecord);
		    }
		}
 public FormProgressWindows()
 {
     _setErrorList = new HashSet<int>();
     _bIgnoreError = false;
     _semaPause = new System.Threading.Semaphore(0, 1);
     InitializeComponent();
 }
 public static void CollectMapping(Activity rootActivity1, Activity rootActivity2, Dictionary<object, SourceLocation> mapping, string path)
 {
     Activity activity = (rootActivity1.RootActivity != null) ? rootActivity1.RootActivity : rootActivity1;
     if (!activity.IsRuntimeReady)
     {
         IList<ValidationError> validationErrors = null;
         ActivityUtilities.CacheRootMetadata(activity, new ActivityLocationReferenceEnvironment(), ProcessActivityTreeOptions.ValidationOptions, null, ref validationErrors);
     }
     Activity activity2 = (rootActivity2.RootActivity != null) ? rootActivity2.RootActivity : rootActivity2;
     if (!activity2.IsRuntimeReady)
     {
         IList<ValidationError> list2 = null;
         ActivityUtilities.CacheRootMetadata(activity2, new ActivityLocationReferenceEnvironment(), ProcessActivityTreeOptions.ValidationOptions, null, ref list2);
     }
     Queue<KeyValuePair<Activity, Activity>> queue = new Queue<KeyValuePair<Activity, Activity>>();
     queue.Enqueue(new KeyValuePair<Activity, Activity>(rootActivity1, rootActivity2));
     System.Collections.Generic.HashSet<Activity> set = new System.Collections.Generic.HashSet<Activity>();
     while (queue.Count > 0)
     {
         SourceLocation location;
         KeyValuePair<Activity, Activity> pair = queue.Dequeue();
         Activity key = pair.Key;
         Activity activity4 = pair.Value;
         set.Add(key);
         if (TryGetSourceLocation(activity4, path, out location))
         {
             mapping.Add(key, location);
         }
         else if (!(activity4 is IExpressionContainer) && !(activity4 is IValueSerializableExpression))
         {
             Debugger.Log(2, "Workflow", "WorkflowDebugger: Does not have corresponding Xaml node for: " + activity4.DisplayName + "\n");
         }
         if ((!(key is IExpressionContainer) && !(activity4 is IExpressionContainer)) && (!(key is IValueSerializableExpression) && !(activity4 is IValueSerializableExpression)))
         {
             IEnumerator<Activity> enumerator = WorkflowInspectionServices.GetActivities(key).GetEnumerator();
             IEnumerator<Activity> enumerator2 = WorkflowInspectionServices.GetActivities(activity4).GetEnumerator();
             bool flag = enumerator.MoveNext();
             bool flag2 = enumerator2.MoveNext();
             while (flag && flag2)
             {
                 if (!set.Contains(enumerator.Current))
                 {
                     if (enumerator.Current.GetType() != enumerator2.Current.GetType())
                     {
                         Debugger.Log(2, "Workflow", "Unmatched type: " + enumerator.Current.GetType().FullName + " vs " + enumerator2.Current.GetType().FullName + "\n");
                     }
                     queue.Enqueue(new KeyValuePair<Activity, Activity>(enumerator.Current, enumerator2.Current));
                 }
                 flag = enumerator.MoveNext();
                 flag2 = enumerator2.MoveNext();
             }
             if (flag || flag2)
             {
                 Debugger.Log(2, "Workflow", "Unmatched number of children\n");
             }
         }
     }
 }
Exemple #4
0
 public HashSet<string> HashSet()
 {
     HashSet<string> set = new System.Collections.Generic.HashSet<string>();
     set.Add("wenbin1");
     set.Add("wenbin2");
     set.Add("wenbin3");
     set.Add("wenbin4");
     return set;
 }
 private void Cleaning(SplitTree ST, SplitTree tPrime)
 {
     //different from original algorithm 7, since the structure of T' is marked with visited flags, here we don't reset the flags
     //scan T' twice
     System.Collections.Generic.HashSet<MarkerVertex> A = new System.Collections.Generic.HashSet<MarkerVertex>();
     System.Collections.Generic.HashSet<MarkerVertex> B = new System.Collections.Generic.HashSet<MarkerVertex>();
     for (int i = 0, n = tPrime.vertices.Count; i < n; ++i)
     {
         if (tPrime.vertices[i] is DegenerateNode)
         {
             var deg = tPrime.vertices[i] as DegenerateNode;
             A.Clear();//Here A is P* and B is V \ P*
             B.Clear();
             deg.ForEachMarkerVertex((v) =>
                 {
                     if (v.perfect && v != deg.center)
                         A.Add(v);
                     else
                         B.Add(v);
                     return IterationFlag.Continue;
                 });
             if (A.Count > 1 && B.Count > 1)
             {
                 var newNode = SplitNode(deg, B, A);
                 if (newNode.parent == deg)
                     newNode.rootMarkerVertex.opposite.MarkAsPerfect();
                 else
                     deg.rootMarkerVertex.MarkAsPerfect();
                 ST.vertices.Add(newNode);//In this way, the structure of T' is unchanged as the newly forked node contains P*(u)
             }
         }
     }
     //again we don't need to reset flags
     for (int i = 0, n = tPrime.vertices.Count; i < n; ++i)
     {
         if (tPrime.vertices[i] is DegenerateNode)
         {
             var deg = tPrime.vertices[i] as DegenerateNode;
             A.Clear();//Here A is V \ E* and B is E
             B.Clear();
             deg.ForEachMarkerVertex((v) =>
                 {
                     if ((v.perfect && v == deg.center) || (!v.perfect && !deg.GetOppositeGLTVertex(v).visited))//if v is not P and is not incident to a tree edge in T', it is E*
                         B.Add(v);
                     else
                         A.Add(v);
                     return IterationFlag.Continue;
                 });
             if (A.Count > 1 & B.Count > 1)
             {
                 ST.vertices.Add(SplitNode(deg, A, B));//let V \ E* be preserved in T'
             }
         }
     }
     //and we're done with cl(ST(G)) and T_c.
 }
Exemple #6
0
 private LinqHashSet(System.Collections.Generic.HashSet <T> h)
 {
     Inner = h;
 }
Exemple #7
0
 public PersonDto()
 {
     this.Cars = new System.Collections.Generic.HashSet <CarDto>();
 }
 public GraphVertex(T value)
 {
     Value = value;
     Edges = new System.Collections.Generic.HashSet <GraphVertex <T> >();
 }
Exemple #9
0
        public DashletGenerator(string companyName)
        {
            List <Unit>    items    = new List <Unit>();
            HttpWebRequest request  = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://54.173.140.216:8080"));
            var            postData = "query=SELECT `capacity.total.freeTiB`, systemName, serialNumber, `location.region`, `capacity.total.sizeTiB` FROM msa.data WHERE companyName = '" + companyName + "'";
            var            data     = Encoding.ASCII.GetBytes(postData);

            request.Method        = "POST";
            request.ContentType   = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;
            using (var stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }
            var           response       = (HttpWebResponse)request.GetResponse();
            var           responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            List <String> raw_data       = new List <String>();
            Regex         rgx            = new Regex(@"\[.*?\]");
            Regex         rgx2           = new Regex("[^a-zA-Z0-9\\.\\(\\)\\-\\:\\, -]");
            string        temp           = "";

            foreach (Match match in rgx.Matches(responseString))
            {
                temp = rgx2.Replace(match.Value, "");
                raw_data.Add(temp);
            }

            var mach_to_region  = new System.Collections.Generic.Dictionary <string, string>();
            var region_to_count = new System.Collections.Generic.Dictionary <string, int>();
            var region_set      = new System.Collections.Generic.HashSet <string>();
            var region_list     = new List <string>();

            for (int i = 0; i < raw_data.Count; i++)
            {
                string[] unitInfo = raw_data[i].Split(',');
                items.Add(new Unit()
                {
                    capacity     = unitInfo[0],
                    systemName   = unitInfo[1],
                    serialNumber = unitInfo[2],
                    region       = unitInfo[3],
                    total_cap    = unitInfo[4]
                });
                region_list.Add((unitInfo[3]));
                region_set.Add(unitInfo[3]);
                mach_to_region[unitInfo[1]] = unitInfo[3];
            }

            displayCapacity = new PlotModel {
                Title = "Total Capacity"
            };



            float avg_allocated = 0;
            float avg_free      = 0;

            for (int i = 0; i < items.Count; i++)
            {
                avg_allocated += (float.Parse(items[i].total_cap) - float.Parse(items[i].capacity));
                avg_free      += float.Parse(items[i].capacity);
            }
            avg_allocated /= items.Count();
            avg_free      /= items.Count();

            PieSeries ps = new PieSeries {
                StrokeThickness = 2.0, InsideLabelPosition = .5, AngleSpan = 360, StartAngle = 0
            };

            ps.Slices.Add(new PieSlice("Allocated", avg_allocated));
            ps.Slices.Add(new PieSlice("Free", avg_free));

            displayCapacity.Series.Add(ps);

            displaySystemsByRegion = new PlotModel {
                Title = "Systems By Region"
            };

            //postData = "query=SELECT `location.region`, systemName, serialNumber FROM msa.data WHERE companyName = '" + companyName + "'";
            //data = Encoding.ASCII.GetBytes(postData);
            //request.Method = "POST";
            //request.ContentType = "application/x-www-form-urlencoded";
            //request.ContentLength = data.Length;
            //using (var stream = request.GetRequestStream())
            //{
            //    stream.Write(data, 0, data.Length);
            //}

            //response = (HttpWebResponse)request.GetResponse();
            //responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            //raw_data = new List<String>();
            //rgx = new Regex(@"\[.*?\]");
            //rgx2 = new Regex("[^a-zA-Z0-9\\.\\(\\)\\-\\:\\, -]");
            //temp = "";
            //foreach (Match match in rgx.Matches(responseString))
            //{
            //    temp = rgx2.Replace(match.Value, "");
            //    raw_data.Add(temp);
            //}



            //for (int i = 0; i < raw_data.Count; i++)
            //{
            //    string[] unitInfo = raw_data[i].Split(',');
            //    items.Add(new Unit()
            //    {
            //        region = unitInfo[0],
            //        systemName = unitInfo[1],
            //        serialNumber = unitInfo[2]
            //    });

            //}

            BarSeries bs = new BarSeries {
                StrokeColor = OxyColors.Black, StrokeThickness = 1
            };
            CategoryAxis ca = new CategoryAxis {
                Position = AxisPosition.Left
            };

            if (region_set.Count() > 1)
            {
                foreach (string region in region_list)
                {
                    region_to_count[region] += 1;
                }

                foreach (string reg in region_to_count.Keys)
                {
                    bs.Items.Add(new BarItem {
                        Value = region_to_count[reg]
                    });
                    ca.Labels.Add(reg);
                }
            }


            else
            {
                bs.Items.Add(new BarItem {
                    Value = 16
                });
                bs.Items.Add(new BarItem {
                    Value = 11
                });
                bs.Items.Add(new BarItem {
                    Value = 8
                });
                bs.Items.Add(new BarItem {
                    Value = 2
                });

                ca.Labels.Add("Americas");
                ca.Labels.Add("EMEA");
                ca.Labels.Add("AMS");
                ca.Labels.Add("APJ");
            }


            LinearAxis va = new LinearAxis {
                Position = AxisPosition.Bottom, AbsoluteMinimum = 0
            };

            displaySystemsByRegion.Series.Add(bs);
            displaySystemsByRegion.Axes.Add(ca);
            displaySystemsByRegion.Axes.Add(va);

            controllerSystemsByRegion = new PlotController();
            controllerSystemsByRegion.UnbindAll();

            displaySystemsByFeature = new PlotModel {
                Title = "Systems By Feature"
            };

            PieSeries ps2 = new PieSeries {
                StrokeThickness = 2.0, InsideLabelPosition = .5, AngleSpan = 360, StartAngle = 0
            };

            ps2.Slices.Add(new PieSlice("CAT", 29));
            ps2.Slices.Add(new PieSlice("NAS", 28));
            ps2.Slices.Add(new PieSlice("VTL", 29));

            displaySystemsByFeature.Series.Add(ps2);
        }
        public void TestMemberFn_GetHashCode ()
        {
            var hs1 = new System.Collections.Generic.HashSet<Matrix44>();
            var hs2 = new System.Collections.Generic.HashSet<Int32>();

            for(Int32 i = 0; i < 10000; ++i)
            {
                var a = GetNextRandomMatrix44 ();

                hs1.Add(a);
                hs2.Add(a.GetHashCode ());
            }

            Assert.That(hs1.Count, Is.EqualTo(hs2.Count).Within(10));
        }
 public override void EnsureCanDelete(System.Collections.Generic.HashSet <IDelRecord> deletionList)
 {
 }
        public void greedySolve()
        {
            timer = new Stopwatch();
            timer.Start();
            Route = new ArrayList(Cities.Length);
            System.Collections.Generic.HashSet<int> unvisitedIndexes = new System.Collections.Generic.HashSet<int>(); // using a city's index in Cities, we can interate through indexes that have yet to be added
            for (int index = 0; index < Cities.Length; index++)
            {
                unvisitedIndexes.Add(index);
            }

            print("\n\nTESTING\n");

            City city;
            for (int i = 0; i < Cities.Length; i++) // keep trying start nodes until a solution is found
            {
                if (Route.Count == Cities.Length)
                {
                    break; // DONE!
                }
                else
                {
                    Route.Clear();
                    for (int index = 0; index < Cities.Length; index++)
                    {
                        unvisitedIndexes.Add(index);
                    }
                    city = Cities[i];
                }

                for (int n = 0; n < Cities.Length; n++) // add nodes n times
                {

                    double shortestDistance = Double.PositiveInfinity;
                    int closestIndex = -1;
                    foreach (int check in unvisitedIndexes) //find the closest city to add to route
                    {
                        double distance = city.costToGetTo(Cities[check]);
                        if (distance < shortestDistance)
                        {
                            shortestDistance = distance;
                            closestIndex = check;
                        }
                    }

                    if (closestIndex != -1)
                    {
                        city = Cities[closestIndex];
                        Route.Add(city);
                        unvisitedIndexes.Remove(closestIndex);
                    }
                    else
                    {
                        break; // try again
                    }
                }
            }

            // call this the best solution so far.  bssf is the route that will be drawn by the Draw method.
            bssf = new TSPSolution(Route);
            // update the cost of the tour.
            Program.MainForm.tbCostOfTour.Text = " " + bssf.costOfRoute();
            TimeSpan ts = timer.Elapsed;
            Program.MainForm.tbElapsedTime.Text = ts.TotalSeconds.ToString();
            // do a refresh.
            Program.MainForm.Invalidate();
        }
 public void DeleteEmployee(IEmployee record) {
     if (record == null) return;
     Employee _record_;
     var deletionList = new System.Collections.Generic.HashSet<IDelRecord>();
     if ( !_employee_pk.TryGetValue(record.Id, out _record_)) {
         throw new ArgumentException(String.Format(
             "'Employee' with id '{0}' does not exist.",
             record.Id));
     }
     _record_.PreDeleteOuter(deletionList, false);
     foreach (IDelRecord item in deletionList) {
         item.EnsureCanDelete(deletionList);
     }
     foreach (IDelRecord item in deletionList) {
         item.DoDelete(this, deletionList);
     }
 }
Exemple #15
0
 internal override void GetResAsset(System.Collections.Generic.HashSet <string> setRes)
 {
 }
        private static void setupAsterismGrabbers()
        {
            GameObject starRoot = new GameObject("StarRoot");

              for(int i=0; i < AsterismData.Length; i++) {
            Asterism asterism = AsterismData[i];
            Vector3 centroid = averageStarLocations(asterism.HD_ids);

            GameObject newRoot = new GameObject();
            GameObject rest = new GameObject();
            GameObject jewelcase = new GameObject();

            newRoot.name = asterism.name + "_root";
            newRoot.transform.position = centroid;
            newRoot.transform.rotation = Quaternion.identity;

            rest.name = "rest";
            rest.transform.parent = newRoot.transform;
            rest.transform.localPosition = Vector3.zero;
            rest.transform.localRotation = Quaternion.identity;
            rest.transform.localScale = new Vector3(1.0f,1.0f,1.0f);

            jewelcase.name = "jewelcase";
            jewelcase.transform.parent = newRoot.transform;
            jewelcase.transform.localPosition = Vector3.zero;
            jewelcase.transform.localRotation = Quaternion.identity;
            jewelcase.transform.localScale = new Vector3(1.0f,1.0f,1.0f);
            PullToHold pullscript = jewelcase.AddComponent<PullToHold>();
            pullscript.asterismKey = i;
            pullscript.rest = rest.transform;
            pullscript.maxSpeed = 20.0f;

            newRoot.transform.parent = starRoot.transform;
            asterism.root = newRoot;
            asterism.rest = rest;
            asterism.mover = jewelcase;

            System.Collections.Generic.HashSet<uint> used = new System.Collections.Generic.HashSet<uint>();

            GameObject constellationLabel = GameObject.Instantiate(Stars.StarUpdater.Instance.ConstellationLabelPrototype) as GameObject;
            constellationLabel.SetActive(true);
            ConstellationLabel labelBehavior = constellationLabel.GetComponent<ConstellationLabel>();

            if ( asterism.root != null ) {
              labelBehavior.transform.parent = asterism.root.transform;
            }

            labelBehavior.Label = asterism.name;
            labelBehavior.transform.localPosition = (asterism.root.transform.position.normalized * 500.0f);
            asterism.label = labelBehavior;
            labelBehavior.LabelComp.color = new Color(1.0f, 1.0f, 1.0f, Stars.StarUpdater.Instance.LabelOpacity * 0.8f);

            Stars.StarUpdater.Instance.m_constellationLabels.Add(labelBehavior);

            foreach(uint hdId in asterism.HD_ids) {
              if ( !Stars.StarParser.HD_idToIndex.ContainsKey(hdId) ) {
            continue;
              }

              int index = Stars.StarParser.HD_idToIndex[hdId];
              Stars.StarData star = Stars.StarParser.Instance.Stars[index];

              star.AsterismIndex = i;
              Stars.StarParser.Instance.Stars[index] = star;
              if ( star.GameObjectRepresentation != null ) {
            star.GameObjectRepresentation.name = hdId.ToString();
            star.GameObjectRepresentation.transform.parent = jewelcase.transform;
            if (star.Label != ""){

              if(used.Contains(star.HD_id)) {
                continue;
              }

              Stars.StarUpdater.Instance.GenerateStarLabel(star, star.GameObjectRepresentation.transform);
              used.Add(star.HD_id);
            }
              }
            }

            AsterismData[i] = asterism;
              }
        }
 protected internal override void WriteNamespace(NamespaceDeclaration namespaceDeclaration)
 {
     if ((base.Writer.currentDepth == 0) && !this.wroteXamlNamespace)
     {
         if (namespaceDeclaration.Namespace == "http://schemas.microsoft.com/winfx/2006/xaml")
         {
             this.wroteXamlNamespace = true;
         }
         else
         {
             if (this.rootLevelPrefixes == null)
             {
                 this.rootLevelPrefixes = new System.Collections.Generic.HashSet<string>();
             }
             this.rootLevelPrefixes.Add(namespaceDeclaration.Prefix);
         }
     }
     base.WriteNamespace(namespaceDeclaration);
 }
 public void FlushPendingNodes(string classNamespace)
 {
     base.CurrentWriter = base.Writer.innerWriter;
     if (!base.Writer.notRewriting)
     {
         if (!this.wroteXamlNamespace)
         {
             string prefix = this.GenerateNamespacePrefix("x");
             this.WriteNamespace(new NamespaceDeclaration("http://schemas.microsoft.com/winfx/2006/xaml", prefix));
         }
         if (classNamespace != null)
         {
             bool flag = false;
             XamlReader reader = this.pendingNodes.Reader;
             XamlWriter innerWriter = base.Writer.innerWriter;
             while (reader.Read() && (reader.NodeType == XamlNodeType.NamespaceDeclaration))
             {
                 if (classNamespace.Equals(reader.Namespace.Namespace))
                 {
                     flag = true;
                 }
                 innerWriter.WriteNode(reader);
             }
             if (!flag)
             {
                 string str2 = this.GenerateNamespacePrefix("this");
                 innerWriter.WriteNamespace(new NamespaceDeclaration(classNamespace, str2));
             }
             if (!reader.IsEof)
             {
                 innerWriter.WriteNode(reader);
             }
         }
         this.rootLevelPrefixes = null;
     }
     XamlServices.Transform(this.pendingNodes.Reader, base.Writer.innerWriter, false);
     this.pendingNodes = null;
 }
Exemple #19
0
    public static void Update(bool forceUpdate = false)
    {
        //Gather all GeneratedSoundBanks folder from the project
        var allPaths          = AkUtilities.GetAllBankPaths();
        var bNeedRefresh      = false;
        var projectDir        = AkBasePathGetter.GetWwiseProjectDirectory();
        var baseSoundBankPath = AkBasePathGetter.GetFullSoundBankPathEditor();

        AkWwiseInitializationSettings.UpdatePlatforms();

        //make a copy of the platform map and handle "special" custom platforms
        var platformMap = new Dictionary <string, List <string> >();

        foreach (var key in AkUtilities.PlatformMapping.Keys)
        {
            platformMap.Add(key, new List <string>(AkUtilities.PlatformMapping[key]));
            foreach (var customPF in AkUtilities.PlatformMapping[key])
            {
                if (customPF != key && AkWwiseInitializationSettings.PlatformSettings.IsDistinctPlatform(customPF))
                {
                    platformMap.Add(customPF, new List <string> {
                        customPF
                    });
                    platformMap[key].Remove(customPF);
                }
            }
            if (platformMap[key].Count == 0)
            {
                platformMap.Remove(key);
            }
        }


        //Go through all BasePlatforms
        foreach (var pairPF in platformMap)
        {
            //Go through all custom platforms related to that base platform and check if any of the bank files were updated.
            var bParse    = forceUpdate;
            var fullPaths = new System.Collections.Generic.List <string>();
            foreach (var customPF in pairPF.Value)
            {
                string bankPath;
                if (!allPaths.TryGetValue(customPF, out bankPath))
                {
                    continue;
                }

                var pluginFile = "";
                try
                {
                    pluginFile = System.IO.Path.Combine(projectDir, System.IO.Path.Combine(bankPath, "PluginInfo.xml"));
                    pluginFile = pluginFile.Replace('/', System.IO.Path.DirectorySeparatorChar);
                    if (!System.IO.File.Exists(pluginFile))
                    {
                        //Try in StreamingAssets too.
                        pluginFile = System.IO.Path.Combine(System.IO.Path.Combine(baseSoundBankPath, customPF), "PluginInfo.xml");
                        if (!System.IO.File.Exists(pluginFile))
                        {
                            continue;
                        }
                    }

                    fullPaths.Add(pluginFile);

                    var t        = System.IO.File.GetLastWriteTime(pluginFile);
                    var lastTime = System.DateTime.MinValue;
                    s_LastParsed.TryGetValue(customPF, out lastTime);
                    if (lastTime < t)
                    {
                        bParse = true;
                        s_LastParsed[customPF] = t;
                    }
                }
                catch (System.Exception ex)
                {
                    UnityEngine.Debug.LogError("WwiseUnity: " + pluginFile + " could not be parsed. " + ex.Message);
                }
            }

            if (bParse)
            {
                var platform = pairPF.Key;

                var newDlls = ParsePluginsXML(platform, fullPaths);
                System.Collections.Generic.HashSet <AkPluginInfo> oldDlls = null;

                //Remap base Wwise platforms to Unity platform folders names
#if !UNITY_2018_3_OR_NEWER
                if (platform.Contains("Vita"))
                {
                    platform = "Vita";
                }
#endif
                //else other platforms already have the right name

                s_PerPlatformPlugins.TryGetValue(platform, out oldDlls);
                s_PerPlatformPlugins[platform] = newDlls;

                //Check if there was any change.
                if (!bNeedRefresh && oldDlls != null)
                {
                    if (oldDlls.Count == newDlls.Count)
                    {
                        oldDlls.IntersectWith(newDlls);
                    }

                    bNeedRefresh |= oldDlls.Count != newDlls.Count;
                }
                else
                {
                    bNeedRefresh |= newDlls.Count > 0;
                }
            }
        }

        if (bNeedRefresh)
        {
            ActivatePluginsForEditor();
        }

        var currentConfig = GetCurrentConfig();
        CheckMenuItems(currentConfig);
    }
Exemple #20
0
 public PINHash()
 {
     hash = new HashSet <int>();
 }
Exemple #21
0
        public void GetRoutes(ICollection <RouteDescriptor> routes)
        {
            var displayPathsPerArea = _blueprint.Controllers.GroupBy(
                x => x.AreaName,
                x => x.Feature.Descriptor.Extension);

            foreach (var item in displayPathsPerArea)
            {
                var areaName             = item.Key;
                var extensionDescriptors = item.Distinct();

                var displayPaths = new System.Collections.Generic.HashSet <string>();

                foreach (var extensionDescriptor in extensionDescriptors)
                {
                    var displayPath = extensionDescriptor.Path;

                    if (!displayPaths.Contains(displayPath))
                    {
                        displayPaths.Add(displayPath);

                        SessionStateBehavior defaultSessionState;
                        Enum.TryParse(extensionDescriptor.SessionState, true /*ignoreCase*/, out defaultSessionState);


                        routes.Add(new RouteDescriptor {
                            Priority     = -10,
                            SessionState = defaultSessionState,
                            Route        = new Route(
                                "Admin/" + displayPath + "/{action}/{id}",
                                new RouteValueDictionary {
                                { "area", areaName },
                                { "controller", "admin" },
                                { "action", "index" },
                                { "id", "" }
                            },
                                new RouteValueDictionary(),
                                new RouteValueDictionary {
                                { "area", areaName }
                            },
                                new MvcRouteHandler())
                        });

                        routes.Add(new RouteDescriptor {
                            Priority     = -10,
                            SessionState = defaultSessionState,
                            Route        = new Route(
                                displayPath + "/{controller}/{action}/{id}",
                                new RouteValueDictionary {
                                { "area", areaName },
                                { "controller", "home" },
                                { "action", "index" },
                                { "id", "" }
                            },
                                new RouteValueDictionary(),
                                new RouteValueDictionary {
                                { "area", areaName }
                            },
                                new MvcRouteHandler())
                        });
                    }
                }
            }
        }
Exemple #22
0
        public List <FullAddressFields> getBestAddresses(string user_county, string[] user_search_normalized)
        {
            TextFieldParser parser = new TextFieldParser(addrPath);

            parser.TextFieldType = FieldType.Delimited;
            parser.SetDelimiters(",");

            //Dictionary<int, string> header = new Dictionary<int, string>();
            string[] fields     = parser.ReadFields();
            int      fields_len = fields.Length;

            int county_index              = -1;
            int locality_index            = -1;
            int secLocality_index         = -1;
            int thorofare_index           = -1;
            int address_index             = -1;
            int building_id_index         = -1;
            int address_reference_index   = -1;
            int building_number_index     = -1;
            int building_group_name_index = -1;
            int building_name_index       = -1;
            int sub_building_name_index   = -1;
            int department_index          = -1;
            int organisation_name_index   = -1;

            for (int col_index = 0; col_index < fields_len; col_index++)
            {
                string value = fields.GetValueAt <string>(col_index);
                if (string.Equals(county, value, StringComparison.OrdinalIgnoreCase))
                {
                    county_index = col_index;
                }

                else if (string.Equals(locality, value, StringComparison.OrdinalIgnoreCase))
                {
                    locality_index = col_index;
                }

                else if (string.Equals(secLocality, value, StringComparison.OrdinalIgnoreCase))
                {
                    secLocality_index = col_index;
                }

                else if (string.Equals(thorofare, value, StringComparison.OrdinalIgnoreCase))
                {
                    thorofare_index = col_index;
                }

                else if (string.Equals(address, value, StringComparison.OrdinalIgnoreCase))
                {
                    address_index = col_index;
                }

                else if (string.Equals(building, value, StringComparison.OrdinalIgnoreCase))
                {
                    building_id_index = col_index;
                }

                else if (string.Equals(address_reference, value, StringComparison.OrdinalIgnoreCase))
                {
                    address_reference_index = col_index;
                }

                else if (string.Equals(building_number, value, StringComparison.OrdinalIgnoreCase))
                {
                    building_number_index = col_index;
                }

                else if (string.Equals(building_group_name, value, StringComparison.OrdinalIgnoreCase))
                {
                    building_group_name_index = col_index;
                }

                else if (string.Equals(building_name, value, StringComparison.OrdinalIgnoreCase))
                {
                    building_name_index = col_index;
                }

                else if (string.Equals(sub_building_name, value, StringComparison.OrdinalIgnoreCase))
                {
                    sub_building_name_index = col_index;
                }

                else if (string.Equals(department, value, StringComparison.OrdinalIgnoreCase))
                {
                    department_index = col_index;
                }

                else if (string.Equals(organisation_name, value, StringComparison.OrdinalIgnoreCase))
                {
                    organisation_name_index = col_index;
                }

                //header.Add(col_id, fields.GetValueAt<string>(col_id));
            }

            System.Collections.Generic.HashSet <FullAddressFields> top_addresses = new System.Collections.Generic.HashSet <FullAddressFields>();
            List <int> address_scores = new List <int>();

            while (!parser.EndOfData)
            {
                fields = parser.ReadFields();

                // build json using full address fields
                FullAddressFields fulladdr = new FullAddressFields();
                fulladdr.locality           = fields.GetValueAt <string>(locality_index);
                fulladdr.secondary_locality = fields.GetValueAt <string>(secLocality_index);
                fulladdr.thorofare          = fields.GetValueAt <string>(thorofare_index);
                fulladdr.building_number    = fields.GetValueAt <string>(building_number_index);
                fulladdr.county             = fields.GetValueAt <string>(county_index);
                fulladdr.address            = fields.GetValueAt <string>(address_index);
                fulladdr.building           = fields.GetValueAt <int>(building_id_index);
                fulladdr.address_reference  = fields.GetValueAt <long>(address_reference_index);

                fulladdr.building_group_name = fields.GetValueAt <string>(building_group_name_index);
                fulladdr.building_name       = fields.GetValueAt <string>(building_name_index);
                fulladdr.sub_building_name   = fields.GetValueAt <string>(sub_building_name_index);
                fulladdr.department          = fields.GetValueAt <string>(department_index);
                fulladdr.organisation_name   = fields.GetValueAt <string>(organisation_name_index);

                if (string.Equals(user_county, fulladdr.county, StringComparison.OrdinalIgnoreCase))
                {
                    string   address_split            = fulladdr.address.Replace(fulladdr.address.Split(",").Last(), "");
                    string[] address_split_normalized = ner.normalize(address_split);

                    if (!fulladdr.building_number.IsEmpty())
                    {
                        if (!ner.numbers.Contains <string>(fulladdr.building_number.ToLower().Trim()))
                        {
                            continue;
                        }
                    }
                    if (!fulladdr.sub_building_name.IsEmpty())
                    {
                        string sub_building_number = Regex.Replace(fulladdr.sub_building_name, @"(apartment)|(unit)|(flat)", "", RegexOptions.IgnoreCase).ToLower().Trim();
                        if (!ner.numbers.Contains <string>(sub_building_number))
                        {
                            continue;
                        }
                    }


                    int tokens_match = 0;
                    var sim          = new F23.StringSimilarity.JaroWinkler();
                    var dist         = new F23.StringSimilarity.Damerau();
                    foreach (string user_search_token in user_search_normalized)
                    {
                        foreach (string address_token in address_split_normalized)
                        {
                            //double score = sim.Similarity(user_search_token, address_token);
                            double score  = Fuzz.WeightedRatio(user_search_token, address_token, PreprocessMode.Full);
                            double score2 = dist.Distance(user_search_token, address_token);
                            if (score >= MIN_SCORE * 100 || score2 <= MAX_DIST)
                            //if (score >= MIN_SCORE && score2 <= MAX_DIST)
                            {
                                tokens_match += 1;
                                break;
                            }
                        }
                    }

                    if (user_search_normalized.Length == tokens_match)
                    {
                        top_addresses.Add(fulladdr);
                    }

                    //break;
                }
            }

            List <FullAddressFields> best_addresses = new List <FullAddressFields>();

            foreach (FullAddressFields addr in top_addresses)
            {
                if (!addr.building_number.IsEmpty() || !addr.sub_building_name.IsEmpty())
                {
                    best_addresses.Add(addr);
                }
            }

            if (best_addresses.Count == 0)
            {
                return(top_addresses.ToList <FullAddressFields>());
            }

            return(best_addresses);
        }
 public override void PopulateRemoveItemSkills(System.Collections.Generic.HashSet <string> removeItemSkills)
 {
     removeItemSkills.Add("GuildLibrary");
 }
Exemple #24
0
        /// <summary>
        /// Basic A* implementation that searches through the navmesh.
        /// </summary>
        public SearchItem FindCorridor(Vector3 start, Vector3 destination,
                                       out System.Collections.Generic.HashSet <int> visited)
        {
            var mesh = NavMesh;

            visited = null;
            if (mesh == null)
            {
                return(SearchItem.Null);
            }

            var triStart = mesh.FindFirstTriangleUnderneath(start);
            var triEnd   = mesh.FindFirstTriangleUnderneath(destination);

            if (triStart == -1 || triEnd == -1)
            {
                visited = null;
                return(SearchItem.Null);
            }

            visited = new System.Collections.Generic.HashSet <int> {
                triStart
            };

            // the start location is the first node
            var current = new SearchItem(triStart, -1, Vector3.Distance(start, destination), ref start);

            if (triStart == triEnd)
            {
                return(current);
            }

            // create fringe
            var fringe = new IntervalHeap <SearchItem>(comparer)
            {
                current
            };

            // start search
            var corridor = SearchItem.Null;

            do
            {
                // next round
                current = fringe.DeleteMin();

                // get the vertices and neighbors of the current triangle
                //var triangle = mesh.GetTriangle(current.Triangle);
                var neighbors = mesh.GetNeighborsOf(current.Triangle);

                //var poly = ((NavMesh)Mesh).Polygons[current.Triangle / 3];

                // iterate over all neighbors
                for (var edge = 0; edge < TerrainUtil.NeighborsPerTriangle; edge++)
                {
                    var neighbor = neighbors[edge] * 3;

                    if (neighbor < 0 || visited.Contains(neighbor))
                    {
                        continue;
                    }

                    //var npoly = ((NavMesh)Mesh).Polygons[neighbor / 3];
                    //var ntri = Mesh.GetTriangle(neighbor);

                    visited.Add(neighbor);


                    // determine the edge that we want to traverse

                    Vector3 left, right;
                    mesh.GetInsideOrderedEdgePoints(current.Triangle, edge, out right, out left);
                    //switch (edge)
                    //{
                    //    case TerrainUtil.ABEdgeIndex:
                    //        left = triangle.Point1;
                    //        right = triangle.Point2;
                    //        break;
                    //    case TerrainUtil.CAEdgeIndex:
                    //        left = triangle.Point3;
                    //        right = triangle.Point1;
                    //        break;
                    //    case TerrainUtil.BCEdgeIndex:
                    //        left = triangle.Point2;
                    //        right = triangle.Point3;
                    //        break;
                    //    default:
                    //        throw new Exception("Impossible");
                    //}

                    var refPoint = (left + right) / 2.0f;                               // the middle of the edge to be traversed
                    var dist     = Vector3.Distance(refPoint, destination);
                    var newItem  = new SearchItem(neighbor, edge, dist, ref refPoint, current);

                    if (triEnd == neighbor)
                    {
                        // we are done
                        corridor = newItem;
                        goto Done;
                    }

                    fringe.Add(newItem);
                }
            } while (!fringe.IsEmpty);

Done:
            return(corridor);
        }
        public CaseIdentification_ResultType SplitTree_CaseIdentification(SplitTree ST, List<int> sigma, int idx, out TreeEdge e, out Vertex u, out SplitTree tree)
        {
            //nodeOrder is the inverse permutation of sigma
            //Here idx is the index of x.
            e = new TreeEdge();
            u = null;
            #region Line 1
            MarkerVertex.ResetPerfectFlags();//new N(x) will be generated. All old perfect flags outdated.
            tree = SmallestSpanningTree(ST, sigma[idx]);//N(x) is implied in neighbor flag of each vertex
            #endregion
            //remember tree is rooted in tree.root,and it perhaps has a valid parent!
            //Also, check visited flag when traversing, as only those with visited flag true are included in subtree.
            #region Line 2
            int nodeCount = 0;
            Queue<Node> processingQueue = new Queue<Node>();
            Action<Node> testAllLeave = (n) =>
                {
                    bool? allLeave = null;
                    (n as Node).ForEachChild((v) =>
                        {
                            if (!(v is Leaf))
                            {
                                allLeave = false;
                                return IterationFlag.Break;
                            }
                            allLeave = true;
                            return IterationFlag.Continue;
                        }, subtree: false);//TODO XXX here subtree should be true, according to Algorithm 5
                    if (!(allLeave == null || !allLeave.Value))//has all leave
                        processingQueue.Enqueue(n);
                };
            foreach (var n in tree.vertices)
                if (n is Node)
                {
                    ++nodeCount;
                    testAllLeave(n as Node);
                }

            if (nodeCount > 1)//since there're not only 1 node, a node with all leaf children will certainly not be root
            {
                while (processingQueue.Count != 0)
                {
                    var node = processingQueue.Dequeue();
                    //cast the spell of Remark 5.5
                    List<MarkerVertex> P, M, E;
                    node.ComputeStates(out P, out M, out E, exclude: node.rootMarkerVertex);
                    //since node has all leaf children, when we exclude the rootMarkerVertex, the time complexity is bound to |Children|
                    //also, M should be empty. Thus case 2 automatically satisfied. <- XXX not really, cannot assert here
                    //Debug.Assert(M.Count == 0, "A node with all leaf children has a mixed marker vertex!!");
                    var Pset = new System.Collections.Generic.HashSet<MarkerVertex>(P);
                    var inCount = 0;
                    var neighborCount = 0;
                    node.ForEachNeighbor(node.rootMarkerVertex, (q) =>
                        {
                            ++neighborCount;
                            if (Pset.Contains(q))
                                ++inCount;
                            return IterationFlag.Continue;
                        });
                    //P == N_Gu(q) iff P.Count == inCount == neighborCount
                    if (P.Count == inCount && inCount == neighborCount && M.Count == 0)//now we say that rootMarkerVertex'es opposite vertex is perfect
                    {
                        //(node.rootMarkerVertex.opposite as GLTVertex).
                        node.rootMarkerVertex.opposite.MarkAsPerfect();
                        tree.RemoveSubTree(node);
                        if (node.parent is Node)
                            testAllLeave(node.parent as Node);
                    }
                }
            }
            #endregion
            #region Line 3
            u = tree.root;
            bool unique = true;
            Debug.Assert(u != null, "the root of subtree is null, after removing pendant perfect subtrees");
            while (true)
            {
                Node child = null;
                if (u is Leaf)
                {
                    child = (u as Leaf).opposite.node;
                    if (child == null || !child.visited)//now the leaf root u is the unique vertex in T'
                    {
                        //this case is not discussed in paper... Thanks Emeric, problem solved.
                        return CaseIdentification_ResultType.SingleLeaf;
                    }
                }
                else
                {
                    (u as Node).ForEachChild((v) =>
                        {
                            if (v is Node)
                            {
                                if (child == null)
                                {
                                    unique = true;
                                    child = v as Node;
                                }
                                else
                                {
                                    unique = false;
                                    return IterationFlag.Break;
                                }
                            }
                            return IterationFlag.Continue;
                        }, subtree: true);
                }
                //here unique indicates whether u has a unique node child
                if (unique == false)
                    break;//there are at least two non-leaf children of the current root; break out and return the subtree, now.
                else
                    if (child == null)//u contains no non-leaf child
                    {
                        //now we can say u is the unique node in T'
                        break;
                    }
                    else// the unique child node is located
                    {
                        if (u is Leaf)
                        {
                            //the root is a leaf, which indicates that root \in N(x), thus perfect.
                            (u as Leaf).visited = false;
                            tree.vertices.Remove(u as Leaf);
                            u = child;//prune it directly.
                        }
                        else
                        {
                            List<MarkerVertex> P, M, E;
                            (u as Node).ComputeStates(out P, out M, out E, exclude: child.rootMarkerVertex.opposite as MarkerVertex, excludeRootMarkerVertex: false);
                            bool perfect = false;
                            if (M.Count == 0)//condition 2 is satisfied
                            {
                                var Pset = new System.Collections.Generic.HashSet<MarkerVertex>(P);
                                var inCount = 0;
                                var neighborCount = 0;
                                (u as Node).ForEachNeighbor(child.rootMarkerVertex.opposite as MarkerVertex, (q) =>
                                    {
                                        ++neighborCount;
                                        if (Pset.Contains(q))
                                            ++inCount;
                                        return IterationFlag.Continue;
                                    });
                                //P == N_Gu(q) iff P.Count == inCount == neighborCount
                                if (P.Count == inCount && inCount == neighborCount)//now we say that child's rootMarkerVertex is perfect
                                {
                                    child.rootMarkerVertex.MarkAsPerfect();
                                    perfect = true;
                                }
                            }
                            if (perfect)
                            {
                                tree.RemoveSubTree(u as Node, exclude: child);
                                u = child;
                            }
                            else
                            {
                                //the tree edge uv is fully mixed. thus the subtree T' is fully mixed.
                                unique = false;
                                break;
                            }
                        }
                    }
                tree.root = u as GLTVertex;//let the tree root follow u after each iteration of the processing loop
            }
            #endregion
            #region Line 4
            if (!unique)
                return CaseIdentification_ResultType.FullyMixedSubTree;
            else
            {

                #region if (u is DegenerateNode)
                if (u is DegenerateNode)
                {
                    #region Lemma 5.6
                    var uDeg = u as DegenerateNode;
                    MarkerVertex q = null;
                    List<MarkerVertex> P, M, E;
                    //Note, we computed P(u), thus if q exists, its perfect flag is available
                    (uDeg).ComputeStates(out P, out M, out E);
                    //Debug.Assert(M.Count == 0, "Algorithm 5 Line 4, lemma 5.6 requires P(u) == NE(u)!");
                    if (M.Count == 0)
                    {
                        if (P.Count == 1 && uDeg.isStar && uDeg.center == P[0])//case 3
                        {
                            uDeg.ForEachMarkerVertex((v) =>
                                {
                                    if (v != uDeg.center)
                                    {
                                        q = v;
                                        return IterationFlag.Break;
                                    }
                                    return IterationFlag.Continue;
                                });
                        }
                        else if (P.Count == 2 && uDeg.isStar && P.Contains(uDeg.center))//case 4
                        {
                            if (uDeg.center == P[0])
                                q = P[1];
                            else q = P[0];
                        }
                        else
                        {
                            int count = P.Count + E.Count;//faster than the commented line below
                            //uDeg.ForEachMarkerVertex((v) => { ++count; return IterationFlag.Continue; });
                            if (count == P.Count)//case 1
                            {
                                if (uDeg.isClique)
                                    q = P[0];
                                else q = uDeg.center;
                            }
                            else if (P.Count == count - 1 && (uDeg.isClique || E[0] == uDeg.center))//case 2
                            {
                                //E[0]: V(u) \ P(u)
                                q = E[0];
                            }
                        }
                    }
                    #endregion
                    if (q != null)
                    {
                        e.u = q;
                        e.v = q.opposite;
                        q.opposite.MarkAsPerfect();
                        return CaseIdentification_ResultType.TreeEdge;
                    }
                    else
                    {
                        return CaseIdentification_ResultType.HybridNode;
                    }
                }
                #endregion
                #region else: prime node
                else//prime node
                {
                    var uPrime = u as PrimeNode;
                    MarkerVertex q = uPrime.lastMarkerVertex;//last leaf vertex in \sigma[G(u)]
                    MarkerVertex qPrime = (u as PrimeNode).universalMarkerVetex;//the universal marker (if any)

                    //Again cast the spell of Remark 5.5
                    List<MarkerVertex> P, M, E;
                    //Note, here we didn't exclude anything. Which means that, if a PP/PE edge is returned, perfect flags will be available.
                    uPrime.ComputeStates(out P, out M, out E);
                    //first, for q
                    if (M.Count == 0 || (M.Count == 1 && M[0] == q))//condition 2
                    {
                        var Pset = new System.Collections.Generic.HashSet<MarkerVertex>(P);
                        var inCount = 0;
                        var neighborCount = 0;
                        uPrime.ForEachNeighbor(q, (r) =>
                            {
                                ++neighborCount;
                                if (Pset.Contains(r))
                                    ++inCount;
                                return IterationFlag.Continue;
                            });
                        //P == N_Gu(q) iff P.Count == inCount == neighborCount, or P.Count == inCount+1 == neighborCount+1 and q in P
                        if ((P.Count == inCount && inCount == neighborCount)
                            ||
                            (P.Count == inCount + 1 && P.Count == neighborCount + 1 && Pset.Contains(q)))
                        {
                            e.u = q;
                            e.v = q.opposite;
                            q.opposite.MarkAsPerfect();
                            return CaseIdentification_ResultType.TreeEdge;
                        }
                    }
                    //then for q'
                    if (qPrime != null)
                    {
                        if (M.Count == 0 || (M.Count == 1 && M[0] == qPrime))//condition 2
                        {
                            var Pset = new System.Collections.Generic.HashSet<MarkerVertex>(P);
                            var inCount = 0;
                            var neighborCount = 0;
                            uPrime.ForEachNeighbor(qPrime, (r) =>
                                {
                                    ++neighborCount;
                                    if (Pset.Contains(r))
                                        ++inCount;
                                    return IterationFlag.Continue;
                                });
                            //P == N_Gu(q) iff P.Count == inCount == neighborCount, or P.Count == inCount+1 == neighborCount+1 and q in P
                            if ((P.Count == inCount && inCount == neighborCount)
                                ||
                                (P.Count == inCount + 1 && P.Count == neighborCount + 1 && Pset.Contains(qPrime)))
                            {
                                e.u = qPrime;
                                e.v = qPrime.opposite;
                                qPrime.opposite.MarkAsPerfect();
                                return CaseIdentification_ResultType.TreeEdge;
                            }
                        }
                    }
                    //else, just return u
                    return CaseIdentification_ResultType.HybridNode;
                }
                #endregion
            }
            #endregion
        }
 public virtual void DoDelete(Bar db, System.Collections.Generic.HashSet <IDelRecord> deletionList)
 {
     db._employee_Name.Remove(this);
     db._employee_pk.Remove(_id);
 }
 public override void PreDeleteInner(System.Collections.Generic.HashSet <IDelRecord> deletionList)
 {
     base.PreDeleteInner(deletionList);
 }
 // TODO (ZEPHYR) : Replace the HashSet with purpose built VariableList (Selfbalancing Binary Tree with Variable Name Hashvalue acting as key?)
 ZS_Engine()
 {
     m_vars = new System.Collections.Generic.HashSet<ZS_Var>();
 }
Exemple #29
0
        static void Main(string[] args)
        {
            string[] argumenty = new string[3];


            if (args.Length >= 1)
            {
                argumenty[0] = args[0];
            }
            else
            {
                argumenty[0] = @"data.csv";
            }

            if (args.Length >= 2)
            {
                argumenty[1] = args[1];
            }
            else
            {
                argumenty[1] = @"żesult.xml";
            }


            if (args.Length >= 3)
            {
                argumenty[2] = args[2];
            }
            else
            {
                argumenty[2] = @"xml";
            }

            for (int i = 0; i < argumenty.Length; i++)
            {
                Console.WriteLine(argumenty[i]);
            }



            var log = File.Create("łog.txt");

            using (StreamWriter writer = new StreamWriter(log))
            {
                try
                {
                    var setStudentow = new System.Collections.Generic.HashSet <Student>(new OwnComparator());


                    using (var stream = new StreamReader(File.OpenRead(Path.GetFullPath(argumenty[0]))))
                    {
                        string line  = null;
                        var    regex = new Regex("$\\s+");

                        while ((line = stream.ReadLine()) != null)
                        {
                            bool wpisywac = true;

                            string[] student = line.Split(',');


                            for (int i = 0; i < student.Length; i++)
                            {
                                var matches = regex.Matches(student[i]);
                                if (matches.Count >= 1)
                                {
                                    writer.WriteLine(line);
                                    wpisywac = false;
                                    break;
                                }
                            }

                            if (student.Length == 9 && wpisywac == true)
                            {
                                var st = new Student
                                {
                                    index       = student[4],
                                    fName       = student[0],
                                    lName       = student[1],
                                    birthdate   = student[5],
                                    email       = student[6],
                                    mothersName = student[7],
                                    fathersName = student[8],
                                    studiesName = student[2],
                                    studiesMode = student[3]
                                };


                                if (!setStudentow.Add(st))
                                {
                                    writer.WriteLine(line);
                                }
                            }

                            FileStream Typewriter = new FileStream(argumenty[1], FileMode.Create);


                            if (argumenty[2] == "xml")
                            {
                                StreamWriter  Bwriter    = new StreamWriter(Typewriter);
                                XmlSerializer serializer = new XmlSerializer(typeof(HashSet <Student>), new XmlRootAttribute("uczelnia"));
                                serializer.Serialize(Typewriter, setStudentow);
                                Bwriter.Dispose();
                            }
                            else if (argumenty[2] == "json")
                            {
                                using (StreamWriter Jsonwriter = new StreamWriter(Typewriter))
                                {
                                    foreach (var stud in setStudentow)
                                    {
                                        Jsonwriter.WriteLine(JsonConvert.SerializeObject(stud));
                                    }
                                }
                            }

                            Typewriter.Close();
                            Typewriter.Dispose();
                        }
                    }
                }
                catch (ArgumentException e)
                {
                    Console.WriteLine("Podana ścieżka jest niepoprawna");
                    writer.WriteLine("Podana ścieżka jest niepoprawna");
                }
                catch (FileNotFoundException e)
                {
                    Console.WriteLine("Plik nazwa nie istnieje");
                    writer.WriteLine("Plik nazwa nie istnieje");
                }
            }
        }
        //uPrime is the child of u
        //the result of the join is returned.
        private PrimeNode NodeJoin(SplitTree ST, Node u, Node uPrime)
        {
            MarkerVertex qPrime = uPrime.rootMarkerVertex;
            MarkerVertex q = qPrime.opposite as MarkerVertex;
            PrimeNode ret = null;
            List<GLTVertex> uPrimeChildren = new List<GLTVertex>();

            if (u is DegenerateNode)
            {
                ret = (u as DegenerateNode).ConvertToPrime();
                //u.parentLink = ret;
                //u.unionFind_parent = null;
                u.active = true;
            }
            else
                ret = u as PrimeNode;
            var representative = ret.childSetRepresentative;
            if (uPrime is DegenerateNode && (uPrime as DegenerateNode).isStar && qPrime != (uPrime as DegenerateNode).center)//qPrime has degree 1, not center.
            {
                var center = (uPrime as DegenerateNode).center;
                var centerOpposite = center.GetOppositeGLTVertex();
                //Algorithm 8 says q now represents the center of u', so we have to update the center's opposite..
                if (centerOpposite is Node)
                {
                    (centerOpposite as Node).rootMarkerVertex.opposite = q;
                }
                else
                    (centerOpposite as Leaf).opposite = q;
                uPrimeChildren.Add(centerOpposite);
                //And also copy the center's perfect state, and opposite.
                q.perfect = center.perfect;
                q.opposite = center.opposite;
                (uPrime as DegenerateNode).ForEachMarkerVertex((v) =>
                    {
                        if (v != center && v != qPrime)
                        {
                            ret.AddMarkerVertex(v, new HashSet<MarkerVertex> { q });
                            uPrimeChildren.Add(v.GetOppositeGLTVertex());
                        }
                        return IterationFlag.Continue;
                    });
            }
            else
            {
                List<MarkerVertex> qNeighbor = new List<MarkerVertex>();
                ret.ForEachNeighbor(q, (v) =>
                    {
                        qNeighbor.Add(v);
                        return IterationFlag.Continue;
                    });
                ret.RemoveMarkerVertex(q);
                var qPrimeNeighbor = new System.Collections.Generic.HashSet<MarkerVertex>();
                uPrime.ForEachNeighbor(qPrime, (v) =>
                    {
                        qPrimeNeighbor.Add(v);
                        return IterationFlag.Continue;
                    });
                uPrime.ForEachMarkerVertex((v) =>
                    {
                        if (v != qPrime)
                        {
                            if (qPrimeNeighbor.Contains(v))
                            {
                                HashSet<MarkerVertex> nSet = new HashSet<MarkerVertex>(qNeighbor);
                                uPrime.ForEachNeighbor(v, (w) =>
                                    {
                                        if (w != qPrime)
                                            nSet.Add(w);
                                        return IterationFlag.Continue;
                                    });
                                ret.AddMarkerVertex(v, nSet);
                            }
                            else
                            {
                                HashSet<MarkerVertex> nSet = new HashSet<MarkerVertex>();
                                uPrime.ForEachNeighbor(v, (w) =>
                                    {
                                        if (w != qPrime)
                                            nSet.Add(w);
                                        return IterationFlag.Continue;
                                    });
                                ret.AddMarkerVertex(v, nSet);
                            }
                        }
                        return IterationFlag.Continue;
                    });
                if (uPrime is PrimeNode)
                {
                    uPrimeChildren.Add((uPrime as PrimeNode).childSetRepresentative);
                }
                else
                {
                    uPrime.ForEachChild(v =>
                        {
                            uPrimeChildren.Add(v);
                            return IterationFlag.Continue;
                        }, false);
                }
            }

            //union the children of uPrime

            for (int i = 0, n = uPrimeChildren.Count; i < n; ++i)
            {
                uPrimeChildren[i].parentLink = null;
                uPrimeChildren[i].unionFind_parent = representative;
            }

            //set deletion flag for uPrime, or if it's the child representative, make it a fake node
            uPrime.active = true;
            if (uPrime == representative)
            {
                uPrime.parentLink = ret;//update the parentLink to the new prime node
                //don't touch the unoinFind_parent field. leave it pointing to uPrime itself.
            }
            else//uPrime is not a fake node.
            {
                uPrime.parentLink = ret;
                //uPrime.unionFind_parent = null;
            }
            return ret;
        }
        /// <summary>
        /// Default constructor
        /// </summary>
        public Master()
        {
            Children = new System.Collections.Generic.HashSet <Child>();

            Init();
        }
Exemple #32
0
        static void Main(string[] args)
        {
            Console.WriteLine("Count vowels in string::");
            Console.WriteLine("Enter your string");
            string str    = Console.ReadLine().ToLower();
            var    vowels = new System.Collections.Generic.HashSet <char> {
                'a', 'e', 'i', 'o', 'u'
            };

            int total_vowels = str.Count(c => vowels.Contains(c));

            Console.WriteLine("Total number of vowels:{0} ", total_vowels);
            Console.WriteLine("\n");

            Console.WriteLine("Contains ee in names::");
            string[] names = { "mandeep", "rupali", "sandeep", "deep", "anju" };
            //var ch = new System.Collections.Generic.HashSet<char> {'ee' };
            var query = from name in names
                        where name.Contains("ee")
                        select name;

            foreach (string name in query)
            {
                Console.WriteLine(name);
            }

            Console.WriteLine("\n");

            Console.WriteLine("Join two list and return common values::");
            List <list1> list1 = new List <list1>()
            {
                new list1 {
                    name = "mandeep", id = 1
                },
                new list1 {
                    name = "mandy", id = 2
                },
                new list1 {
                    name = "akash", id = 3
                }
            };
            List <list2> list2 = new List <list2>()
            {
                new list2 {
                    name = "chris", id = 5
                },
                new list2 {
                    name = "mandeep", id = 1
                },
                new list2 {
                    name = "mandy", id = 2
                }
            };

            var res = from l1 in list1
                      join l2 in list2
                      on l1.id equals l2.id
                      select new
            {
                name = l1.name,
                id   = l1.id
            };

            foreach (var name in res)
            {
                Console.WriteLine("name: {0}, Id: {1}", name.name, name.id);
            }
        }
Exemple #33
0
 private LinqHashSet(System.Collections.Hashtable h)
 {
     Inner = h;
 }
        public void GetRoutes(ICollection <RouteDescriptor> routes, string areaName)
        {
            var displayPathsPerArea = new List <string>()
            {
                areaName
            };

            //foreach (var item in displayPathsPerArea)
            //{
            // var areaNameTmp = item;
            var extensionDescriptors = displayPathsPerArea.Distinct();

            var displayPaths = new System.Collections.Generic.HashSet <string>();

            foreach (var extensionDescriptor in extensionDescriptors)
            {
                var displayPath = extensionDescriptor;

                if (!displayPaths.Contains(displayPath))
                {
                    displayPaths.Add(displayPath);

                    SessionStateBehavior defaultSessionState = SessionStateBehavior.Default;
                    // Enum.TryParse(extensionDescriptor.SessionState, true /*ignoreCase*/, out defaultSessionState);


                    //routes.Add(new RouteDescriptor
                    //{
                    //    Priority = -10,
                    //    SessionState = defaultSessionState,
                    //    Route = new System.Web.Routing.Route(
                    //        "Admin/" + displayPath + "/{action}/{id}",
                    //        new RouteValueDictionary {
                    //            {"area", areaName},
                    //            {"controller", "admin"},
                    //            {"action", "index"},
                    //            {"id", ""}
                    //        },
                    //        new RouteValueDictionary(),
                    //        new RouteValueDictionary {
                    //            {"area", areaName}
                    //        },
                    //        new MvcRouteHandler())
                    //});

                    routes.Add(new RouteDescriptor
                    {
                        Name         = areaName + "Route",
                        Priority     = -10,
                        SessionState = defaultSessionState,
                        Route        = new System.Web.Routing.Route(
                            displayPath + "/{controller}/{action}/{id}",
                            new RouteValueDictionary {
                            { "area", areaName },
                            { "controller", "home" },
                            { "action", "index" },
                            { "id", "" }
                        },
                            new RouteValueDictionary(),
                            new RouteValueDictionary {
                            { "area", areaName }
                        },
                            new MvcRouteHandler())
                    });
                }
            }
            //}
        }
Exemple #35
0
    public void Populate()
    {
        #region Types of Keywords

        FieldPublicDynamic = new { PropPublic1 = "A", PropPublic2 = 1, PropPublic3 = "B", PropPublic4 = "B", PropPublic5 = "B", PropPublic6 = "B", PropPublic7 = "B", PropPublic8 = "B", PropPublic9 = "B", PropPublic10 = "B", PropPublic11 = "B", PropPublic12 = new { PropSubPublic1 = 0, PropSubPublic2 = 1, PropSubPublic3 = 2 } };
        FieldPublicObject  = new StringBuilder("Object - StringBuilder");
        FieldPublicInt32   = int.MaxValue;
        FieldPublicInt64   = long.MaxValue;
        FieldPublicULong   = ulong.MaxValue;
        FieldPublicUInt    = uint.MaxValue;
        FieldPublicDecimal = 100000.999999m;
        FieldPublicDouble  = 100000.999999d;
        FieldPublicChar    = 'A';
        FieldPublicByte    = byte.MaxValue;
        FieldPublicBoolean = true;
        FieldPublicSByte   = sbyte.MaxValue;
        FieldPublicShort   = short.MaxValue;
        FieldPublicUShort  = ushort.MaxValue;
        FieldPublicFloat   = 100000.675555f;

        FieldPublicInt32Nullable   = int.MaxValue;
        FieldPublicInt64Nullable   = 2;
        FieldPublicULongNullable   = ulong.MaxValue;
        FieldPublicUIntNullable    = uint.MaxValue;
        FieldPublicDecimalNullable = 100000.999999m;
        FieldPublicDoubleNullable  = 100000.999999d;
        FieldPublicCharNullable    = 'A';
        FieldPublicByteNullable    = byte.MaxValue;
        FieldPublicBooleanNullable = true;
        FieldPublicSByteNullable   = sbyte.MaxValue;
        FieldPublicShortNullable   = short.MaxValue;
        FieldPublicUShortNullable  = ushort.MaxValue;
        FieldPublicFloatNullable   = 100000.675555f;

        #endregion

        #region System

        FieldPublicDateTime         = new DateTime(2000, 1, 1, 1, 1, 1);
        FieldPublicTimeSpan         = new TimeSpan(1, 10, 40);
        FieldPublicEnumDateTimeKind = DateTimeKind.Local;

        // Instantiate date and time using Persian calendar with years,
        // months, days, hours, minutes, seconds, and milliseconds
        FieldPublicDateTimeOffset = new DateTimeOffset(1387, 2, 12, 8, 6, 32, 545,
                                                       new System.Globalization.PersianCalendar(),
                                                       new TimeSpan(1, 0, 0));

        FieldPublicIntPtr         = new IntPtr(100);
        FieldPublicTimeZone       = TimeZone.CurrentTimeZone;
        FieldPublicTimeZoneInfo   = TimeZoneInfo.Utc;
        FieldPublicTuple          = Tuple.Create <string, int, decimal>("T-string\"", 1, 1.1m);
        FieldPublicType           = typeof(object);
        FieldPublicUIntPtr        = new UIntPtr(100);
        FieldPublicUri            = new Uri("http://www.site.com");
        FieldPublicVersion        = new Version(1, 0, 100, 1);
        FieldPublicGuid           = new Guid("d5010f5b-0cd1-44ca-aacb-5678b9947e6c");
        FieldPublicSingle         = Single.MaxValue;
        FieldPublicException      = new Exception("Test error", new Exception("inner exception"));
        FieldPublicEnumNonGeneric = EnumTest.ValueA;
        FieldPublicAction         = () => true.Equals(true);
        FieldPublicAction2        = (a, b) => true.Equals(true);
        FieldPublicFunc           = () => true;
        FieldPublicFunc2          = (a, b) => true;

        #endregion

        #region Arrays and Collections

        FieldPublicArrayUni    = new string[2];
        FieldPublicArrayUni[0] = "[0]";
        FieldPublicArrayUni[1] = "[1]";

        FieldPublicArrayTwo       = new string[2, 2];
        FieldPublicArrayTwo[0, 0] = "[0, 0]";
        FieldPublicArrayTwo[0, 1] = "[0, 1]";
        FieldPublicArrayTwo[1, 0] = "[1, 0]";
        FieldPublicArrayTwo[1, 1] = "[1, 1]";

        FieldPublicArrayThree          = new string[1, 1, 2];
        FieldPublicArrayThree[0, 0, 0] = "[0, 0, 0]";
        FieldPublicArrayThree[0, 0, 1] = "[0, 0, 1]";

        FieldPublicJaggedArrayTwo    = new string[2][];
        FieldPublicJaggedArrayTwo[0] = new string[5] {
            "a", "b", "c", "d", "e"
        };
        FieldPublicJaggedArrayTwo[1] = new string[4] {
            "a1", "b1", "c1", "d1"
        };

        FieldPublicJaggedArrayThree          = new string[1][][];
        FieldPublicJaggedArrayThree[0]       = new string[1][];
        FieldPublicJaggedArrayThree[0][0]    = new string[2];
        FieldPublicJaggedArrayThree[0][0][0] = "[0][0][0]";
        FieldPublicJaggedArrayThree[0][0][1] = "[0][0][1]";

        FieldPublicMixedArrayAndJagged = new int[3][, ]
        {
            new int[, ] {
                { 1, 3 }, { 5, 7 }
            },
            new int[, ] {
                { 0, 2 }, { 4, 6 }, { 8, 10 }
            },
            new int[, ] {
                { 11, 22 }, { 99, 88 }, { 0, 9 }
            }
        };

        FieldPublicDictionary = new System.Collections.Generic.Dictionary <string, string>();
        FieldPublicDictionary.Add("Key1", "Value1");
        FieldPublicDictionary.Add("Key2", "Value2");
        FieldPublicDictionary.Add("Key3", "Value3");
        FieldPublicDictionary.Add("Key4", "Value4");

        FieldPublicList = new System.Collections.Generic.List <int>();
        FieldPublicList.Add(0);
        FieldPublicList.Add(1);
        FieldPublicList.Add(2);

        FieldPublicQueue = new System.Collections.Generic.Queue <int>();
        FieldPublicQueue.Enqueue(10);
        FieldPublicQueue.Enqueue(11);
        FieldPublicQueue.Enqueue(12);

        FieldPublicHashSet = new System.Collections.Generic.HashSet <string>();
        FieldPublicHashSet.Add("HashSet1");
        FieldPublicHashSet.Add("HashSet2");

        FieldPublicSortedSet = new System.Collections.Generic.SortedSet <string>();
        FieldPublicSortedSet.Add("SortedSet1");
        FieldPublicSortedSet.Add("SortedSet2");
        FieldPublicSortedSet.Add("SortedSet3");

        FieldPublicStack = new System.Collections.Generic.Stack <string>();
        FieldPublicStack.Push("Stack1");
        FieldPublicStack.Push("Stack2");
        FieldPublicStack.Push("Stack3");

        FieldPublicLinkedList = new System.Collections.Generic.LinkedList <string>();
        FieldPublicLinkedList.AddFirst("LinkedList1");
        FieldPublicLinkedList.AddLast("LinkedList2");
        FieldPublicLinkedList.AddAfter(FieldPublicLinkedList.Find("LinkedList1"), "LinkedList1.1");

        FieldPublicObservableCollection = new System.Collections.ObjectModel.ObservableCollection <string>();
        FieldPublicObservableCollection.Add("ObservableCollection1");
        FieldPublicObservableCollection.Add("ObservableCollection2");

        FieldPublicKeyedCollection = new MyDataKeyedCollection();
        FieldPublicKeyedCollection.Add(new MyData()
        {
            Data = "data1", Id = 0
        });
        FieldPublicKeyedCollection.Add(new MyData()
        {
            Data = "data2", Id = 1
        });

        var list = new List <string>();
        list.Add("list1");
        list.Add("list2");
        list.Add("list3");

        FieldPublicReadOnlyCollection = new ReadOnlyCollection <string>(list);

        FieldPublicReadOnlyDictionary           = new ReadOnlyDictionary <string, string>(FieldPublicDictionary);
        FieldPublicReadOnlyObservableCollection = new ReadOnlyObservableCollection <string>(FieldPublicObservableCollection);
        FieldPublicCollection = new Collection <string>();
        FieldPublicCollection.Add("collection1");
        FieldPublicCollection.Add("collection2");
        FieldPublicCollection.Add("collection3");

        FieldPublicArrayListNonGeneric = new System.Collections.ArrayList();
        FieldPublicArrayListNonGeneric.Add(1);
        FieldPublicArrayListNonGeneric.Add("a");
        FieldPublicArrayListNonGeneric.Add(10.0m);
        FieldPublicArrayListNonGeneric.Add(new DateTime(2000, 01, 01));

        FieldPublicBitArray    = new System.Collections.BitArray(3);
        FieldPublicBitArray[2] = true;

        FieldPublicSortedList = new System.Collections.SortedList();
        FieldPublicSortedList.Add("key1", 1);
        FieldPublicSortedList.Add("key2", 2);
        FieldPublicSortedList.Add("key3", 3);
        FieldPublicSortedList.Add("key4", 4);

        FieldPublicHashtableNonGeneric = new System.Collections.Hashtable();
        FieldPublicHashtableNonGeneric.Add("key1", 1);
        FieldPublicHashtableNonGeneric.Add("key2", 2);
        FieldPublicHashtableNonGeneric.Add("key3", 3);
        FieldPublicHashtableNonGeneric.Add("key4", 4);

        FieldPublicQueueNonGeneric = new System.Collections.Queue();
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric1");
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric2");
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric3");

        FieldPublicStackNonGeneric = new System.Collections.Stack();
        FieldPublicStackNonGeneric.Push("StackNonGeneric1");
        FieldPublicStackNonGeneric.Push("StackNonGeneric2");

        FieldPublicIEnumerable = FieldPublicSortedList;

        FieldPublicBlockingCollection = new System.Collections.Concurrent.BlockingCollection <string>();
        FieldPublicBlockingCollection.Add("BlockingCollection1");
        FieldPublicBlockingCollection.Add("BlockingCollection2");

        FieldPublicConcurrentBag = new System.Collections.Concurrent.ConcurrentBag <string>();
        FieldPublicConcurrentBag.Add("ConcurrentBag1");
        FieldPublicConcurrentBag.Add("ConcurrentBag2");
        FieldPublicConcurrentBag.Add("ConcurrentBag3");

        FieldPublicConcurrentDictionary = new System.Collections.Concurrent.ConcurrentDictionary <string, int>();
        FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary1", 0);
        FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary2", 0);

        FieldPublicConcurrentQueue = new System.Collections.Concurrent.ConcurrentQueue <string>();
        FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue1");
        FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue2");

        FieldPublicConcurrentStack = new System.Collections.Concurrent.ConcurrentStack <string>();
        FieldPublicConcurrentStack.Push("ConcurrentStack1");
        FieldPublicConcurrentStack.Push("ConcurrentStack2");

        // FieldPublicOrderablePartitioner = new OrderablePartitioner();
        // FieldPublicPartitioner;
        // FieldPublicPartitionerNonGeneric;

        FieldPublicHybridDictionary = new System.Collections.Specialized.HybridDictionary();
        FieldPublicHybridDictionary.Add("HybridDictionaryKey1", "HybridDictionary1");
        FieldPublicHybridDictionary.Add("HybridDictionaryKey2", "HybridDictionary2");

        FieldPublicListDictionary = new System.Collections.Specialized.ListDictionary();
        FieldPublicListDictionary.Add("ListDictionaryKey1", "ListDictionary1");
        FieldPublicListDictionary.Add("ListDictionaryKey2", "ListDictionary2");
        FieldPublicNameValueCollection = new System.Collections.Specialized.NameValueCollection();
        FieldPublicNameValueCollection.Add("Key1", "Value1");
        FieldPublicNameValueCollection.Add("Key2", "Value2");

        FieldPublicOrderedDictionary = new System.Collections.Specialized.OrderedDictionary();
        FieldPublicOrderedDictionary.Add(1, "OrderedDictionary1");
        FieldPublicOrderedDictionary.Add(2, "OrderedDictionary1");
        FieldPublicOrderedDictionary.Add("OrderedDictionaryKey2", "OrderedDictionary2");

        FieldPublicStringCollection = new System.Collections.Specialized.StringCollection();
        FieldPublicStringCollection.Add("StringCollection1");
        FieldPublicStringCollection.Add("StringCollection2");

        #endregion

        #region Several

        PropXmlDocument = new XmlDocument();
        PropXmlDocument.LoadXml("<xml>something</xml>");

        var tr = new StringReader("<Root>Content</Root>");
        PropXDocument         = XDocument.Load(tr);
        PropStream            = GenerateStreamFromString("Stream");
        PropBigInteger        = new System.Numerics.BigInteger(100);
        PropStringBuilder     = new StringBuilder("StringBuilder");
        FieldPublicIQueryable = new List <string>()
        {
            "IQueryable"
        }.AsQueryable();

        #endregion

        #region Custom

        FieldPublicMyCollectionPublicGetEnumerator           = new MyCollectionPublicGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsPublicGetEnumerator   = new MyCollectionInheritsPublicGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionExplicitGetEnumerator         = new MyCollectionExplicitGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsExplicitGetEnumerator = new MyCollectionInheritsExplicitGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsTooIEnumerable        = new MyCollectionInheritsTooIEnumerable("a b c", new char[] { ' ' });

        FieldPublicEnumSpecific = EnumTest.ValueB;
        MyDelegate            = MethodDelegate;
        EmptyClass            = new EmptyClass();
        StructGeneric         = new ThreeTuple <int>(0, 1, 2);
        StructGenericNullable = new ThreeTuple <int>(0, 1, 2);
        FieldPublicNullable   = new Nullable <ThreeTuple <int> >(StructGeneric);

        #endregion
    }
        /// <summary>
        /// Default constructor. Protected due to required properties, but present because EF needs it.
        /// </summary>
        protected BParentOptional()
        {
            BChildCollection = new System.Collections.Generic.HashSet <BChild>();

            Init();
        }
Exemple #37
0
    private static System.Collections.Generic.HashSet <AkPluginInfo> ParsePluginsXML(string platform,
                                                                                     System.Collections.Generic.List <string> in_pluginFiles)
    {
        var newPlugins = new System.Collections.Generic.HashSet <AkPluginInfo>();

        foreach (var pluginFile in in_pluginFiles)
        {
            if (!System.IO.File.Exists(pluginFile))
            {
                continue;
            }

            try
            {
                var doc = new System.Xml.XmlDocument();
                doc.Load(pluginFile);
                var Navigator      = doc.CreateNavigator();
                var pluginInfoNode = Navigator.SelectSingleNode("//PluginInfo");
                var boolMotion     = pluginInfoNode.GetAttribute("Motion", "");

                var it = Navigator.Select("//Plugin");

                if (boolMotion == "true")
                {
                    AkPluginInfo motionPluginInfo = new AkPluginInfo();
                    motionPluginInfo.DllName = "AkMotion";
                    newPlugins.Add(motionPluginInfo);
                }

                foreach (System.Xml.XPath.XPathNavigator node in it)
                {
                    var rawPluginID = uint.Parse(node.GetAttribute("ID", ""));
                    if (rawPluginID == 0)
                    {
                        continue;
                    }

                    PluginID pluginID = (PluginID)rawPluginID;

                    if (alwaysSkipPluginsIDs.Contains(pluginID))
                    {
                        continue;
                    }

                    var dll = string.Empty;

                    if (platform == "Switch")
                    {
                        if (pluginID == PluginID.AkMeter)
                        {
                            dll = "AkMeter";
                        }
                    }
                    else if (builtInPluginIDs.Contains(pluginID))
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(dll))
                    {
                        dll = node.GetAttribute("DLL", "");
                    }

                    AkPluginInfo newPluginInfo = new AkPluginInfo();
                    newPluginInfo.PluginID = rawPluginID;
                    newPluginInfo.DllName  = dll;

                    if (!PluginIDToStaticLibName.TryGetValue(pluginID, out newPluginInfo.StaticLibName))
                    {
                        newPluginInfo.StaticLibName = dll;
                    }

                    newPlugins.Add(newPluginInfo);
                }
            }
            catch (System.Exception ex)
            {
                UnityEngine.Debug.LogError("WwiseUnity: " + pluginFile + " could not be parsed. " + ex.Message);
            }
        }

        return(newPlugins);
    }
 public virtual void DoDelete(Bar db, System.Collections.Generic.HashSet <IDelRecord> deletionList)
 {
     db._department_Title.Remove(this);
     db._department_pk.Remove(_id);
 }
Exemple #39
0
        internal static void StartWatch()
        {
            /*
             * try
             * {
             *      if (string.IsNullOrWhiteSpace(sourceFolderUserName) || string.IsNullOrWhiteSpace(sourceFolderPassword))
             *      {
             *              sourceFolderPassword = null;
             *              sourceFolderUserName = null;
             *      }
             *
             *
             *      // *** Connect Networked Folder Connections
             *      if (string.IsNullOrWhiteSpace(targetUserName) || string.IsNullOrWhiteSpace(targetPassword))
             *      {
             *              targetPassword = null;
             *              targetUserName = null;
             *      }
             *
             *      if (sourceFolderIsNetworkedConnection)
             *      {
             *              //DriveSettings.MapNetworkDrive(sourceDrive, sourceFolder, sourceFolderUserName, sourceFolderPassword);
             *
             *      }
             *
             *      if (targetFolderIsNetworkedConnection)
             *      {
             *              //DriveSettings.MapNetworkDrive(targetDrive, targetFolder, targetUserName, targetPassword);
             *      }
             *
             * }
             * catch (Exception ex)
             * {
             *      System.Console.WriteLine("Exception Encountered: {0}", ex);
             *
             * }
             */

            sourceDirectoryInfo = new DirectoryInfo(source_folder);
            cssDirectoryInfo    = new DirectoryInfo(css_folder);



            WatchedFolder   = sourceDirectoryInfo.FullName;          // + "\\InputFileFolder";
            ProcessedFolder = sourceDirectoryInfo.FullName + "\\ProcessedFileFolder\\";
            WatchedFiles    = new System.Collections.Generic.HashSet <string>(System.StringComparer.OrdinalIgnoreCase);
            WatchDictionary = new Dictionary <string, string>(System.StringComparer.OrdinalIgnoreCase);

            Css_Watched_Folder = cssDirectoryInfo.FullName;

            AddWatchFiles(sourceDirectoryInfo);
            AddWatchFiles(cssDirectoryInfo);

            /*
             * WatchedFiles.Add ("editor.js");
             * WatchedFiles.Add ("tree_node.js");
             * WatchedFiles.Add ("app.js");
             * WatchedFiles.Add ("navigation_renderer.js");
             * WatchedFiles.Add ("page_renderer.js");
             */

            HashDirectory(sourceDirectoryInfo);

            fs = new FileSystemWatcher
            {
                Path         = WatchedFolder,
                NotifyFilter = NotifyFilters.LastWrite
                               | NotifyFilters.FileName,
                IncludeSubdirectories = true
            };

            fs.Created            += fs_Changed;
            fs.Changed            += fs_Changed;
            fs.EnableRaisingEvents = true;


            HashDirectory(cssDirectoryInfo);

            css_fs = new FileSystemWatcher
            {
                Path         = Css_Watched_Folder,
                NotifyFilter = NotifyFilters.LastWrite
                               | NotifyFilters.FileName,
                IncludeSubdirectories = true
            };

            css_fs.Created            += fs_Changed;
            css_fs.Changed            += fs_Changed;
            css_fs.EnableRaisingEvents = true;
        }
Exemple #40
0
		public Nb2dJson(bool useHumanReadableFloats)
		{
			if (!useHumanReadableFloats)
			{
				// The floatToHex function is not giving the same results
				// as the original C++ version... not critical so worry about it
				// later.
				Console.WriteLine("Non human readable floats are not implemented yet");
				useHumanReadableFloats = true;
			}
			
			m_useHumanReadableFloats = useHumanReadableFloats;
			m_simulationPositionIterations = 3;
			m_simulationVelocityIterations = 8;
			m_simulationFPS = 60;
			
			m_indexToBodyMap = new Dictionary<int, Body>();
			m_bodyToIndexMap = new Dictionary<Body, int?>();
			m_jointToIndexMap = new Dictionary<Joint, int?>();
			m_bodies = new List<Body>();
			m_joints = new List<Joint>();
			m_images = new List<Nb2dJsonImage>();
			
			m_bodyToNameMap = new Dictionary<Body, string>();
			m_fixtureToNameMap = new Dictionary<Fixture, string>();
			m_jointToNameMap = new Dictionary<Joint, string>();
			m_imageToNameMap = new Dictionary<Nb2dJsonImage, string>();
			
			m_customPropertiesMap = new Dictionary<object, Nb2dJsonCustomProperties>();

            m_bodiesWithCustomProperties = new System.Collections.Generic.HashSet<Body>();
            m_fixturesWithCustomProperties = new System.Collections.Generic.HashSet<Fixture>();
            m_jointsWithCustomProperties = new System.Collections.Generic.HashSet<Joint>();
            m_imagesWithCustomProperties = new System.Collections.Generic.HashSet<Nb2dJsonImage>();
            m_worldsWithCustomProperties = new System.Collections.Generic.HashSet<World>();
		}
Exemple #41
0
        /// <summary>
        /// Default constructor. Protected due to required properties, but present because EF needs it.
        /// </summary>
        protected UParentCollection()
        {
            UChildCollection = new System.Collections.Generic.HashSet <UChild>();

            Init();
        }
        private void DecorateCodeNamespace(CodeNamespace codeNamespace)
        {
            // Generate the schema set code namespace
            CodeNamespace schemaSetCodeNamespace = GenerateSchemaTypes();
            
            // Add the code namespace to a fast search structure
            //      KeyValuePair<type  , namespace> 
            HashSet<KeyValuePair<string, string>> typeSet = new System.Collections.Generic.HashSet<KeyValuePair<string, string>>();
            
            foreach (CodeTypeDeclaration ctd in codeNamespace.Types)
            {
                XmlQualifiedName typeQn = GetCodeTypeXmlQName(ctd);

                typeSet.Add(new KeyValuePair<string, string>(typeQn.Name, typeQn.Namespace));
            }
            
            // add the missing types from the schema code namespace to the main code namespace
            foreach (CodeTypeDeclaration sctd in schemaSetCodeNamespace.Types)
            {
                XmlQualifiedName typeQn = GetCodeTypeXmlQName(sctd);

                if (!typeSet.Contains(new KeyValuePair<string, String>(typeQn.Name, typeQn.Namespace)))
                {
                    codeNamespace.Types.Add(sctd);
                }
            }
        }
Exemple #43
0
        private void DrawTree(System.Collections.Generic.HashSet <string> duplicates)
        {
            bool isRepaint = (Event.current.type == EventType.Repaint);

            for (int row = 0; row < _items.Length; row++)
            {
                var item = _items[row];

                var rect     = GUILayoutUtility.GetRect(24, 24, GUILayout.ExpandWidth(true));
                var position = rect;
                position = new Rect(position.x + 1, position.y, position.width - 2, position.height);

                float indent = item.indent * 15 + 5;
                bool  isEven = ((row % 2) == 0);

                if (isRepaint)
                {
                    var style = isEven ? Utility.GetStyles().ConsoleEntryBackEven : Utility.GetStyles().ConsoleEntryBackOdd;
                    style.Draw(position, false, false, _focusRow == row, false);
                }

                float height      = rect.height * 0.5f - 8;
                float y           = rect.y + height;
                bool  wasSelected = item.selected;

                position = new Rect(position.x + 3, position.y, position.width - 3, position.height);
                bool selected = GUI.Toggle(position, wasSelected, string.Empty, GUIStyle.none);
                position.y       = y;
                position.height -= height;

                GUI.Toggle(position, selected, string.Empty);

                position.y       = rect.y;
                position.height += height;

                GUI.color = selected && item.gameObject != null && duplicates.Contains(item.gameObject.name) ? Utility.ERROR_COLOR : Utility.NORMAL_COLOR;

                if (wasSelected != selected)
                {
                    item.selected = selected;
                    item.UpdateSelection(_target);

                    _focusRow = row;
                    GUIUtility.keyboardControl = LIST_ID;
                }

                if (isRepaint)
                {
                    var position2 = new Rect(position.x + indent, y, 16, 16);
                    GUI.DrawTexture(position2, AssetDatabase.GetCachedIcon(item.path));
                }

                position = new Rect(position.x + 20 + indent, rect.y + 3, position.width - 20 - indent, position.height);
                GUI.Label(position, item.name);

                GUI.color = Utility.NORMAL_COLOR;
            }

            if (_focusRow != -1 && GUIUtility.keyboardControl == LIST_ID && Event.current.type == EventType.KeyDown)
            {
                bool useEvent = true;

                switch (Event.current.keyCode)
                {
                case KeyCode.Space:
                    var item = _items[_focusRow];
                    item.selected = !item.selected;
                    item.UpdateSelection(_target);
                    break;

                case KeyCode.DownArrow:
                    if (_focusRow < _items.Length - 1)
                    {
                        _focusRow++;
                    }
                    break;

                case KeyCode.UpArrow:
                    if (_focusRow > 0)
                    {
                        _focusRow--;
                    }
                    break;

                default:
                    useEvent = false;
                    break;
                }

                if (useEvent)
                {
                    Event.current.Use();
                }
            }
        }
 public virtual void PreDeleteInner(System.Collections.Generic.HashSet <IDelRecord> deletionList)
 {
 }
Exemple #45
0
        private static void setupAsterismGrabbers()
        {
            GameObject starRoot = new GameObject("StarRoot");

            for (int i = 0; i < AsterismData.Length; i++)
            {
                Asterism asterism = AsterismData[i];
                Vector3  centroid = averageStarLocations(asterism.HD_ids);

                GameObject newRoot   = new GameObject();
                GameObject rest      = new GameObject();
                GameObject jewelcase = new GameObject();

                newRoot.name = asterism.name + "_root";
                newRoot.transform.position = centroid;
                newRoot.transform.rotation = Quaternion.identity;

                rest.name                    = "rest";
                rest.transform.parent        = newRoot.transform;
                rest.transform.localPosition = Vector3.zero;
                rest.transform.localRotation = Quaternion.identity;
                rest.transform.localScale    = new Vector3(1.0f, 1.0f, 1.0f);

                jewelcase.name                    = "jewelcase";
                jewelcase.transform.parent        = newRoot.transform;
                jewelcase.transform.localPosition = Vector3.zero;
                jewelcase.transform.localRotation = Quaternion.identity;
                jewelcase.transform.localScale    = new Vector3(1.0f, 1.0f, 1.0f);
                PullToHold pullscript = jewelcase.AddComponent <PullToHold>();
                pullscript.asterismKey = i;
                pullscript.rest        = rest.transform;
                pullscript.maxSpeed    = 20.0f;

                newRoot.transform.parent = starRoot.transform;
                asterism.root            = newRoot;
                asterism.rest            = rest;
                asterism.mover           = jewelcase;

                System.Collections.Generic.HashSet <uint> used = new System.Collections.Generic.HashSet <uint>();

                GameObject constellationLabel = GameObject.Instantiate(Stars.StarUpdater.Instance.ConstellationLabelPrototype) as GameObject;
                constellationLabel.SetActive(true);
                ConstellationLabel labelBehavior = constellationLabel.GetComponent <ConstellationLabel>();

                if (asterism.root != null)
                {
                    labelBehavior.transform.parent = asterism.root.transform;
                }

                labelBehavior.Label = asterism.name;
                labelBehavior.transform.localPosition = (asterism.root.transform.position.normalized * 500.0f);
                asterism.label = labelBehavior;
                labelBehavior.LabelComp.color = new Color(1.0f, 1.0f, 1.0f, Stars.StarUpdater.Instance.LabelOpacity * 0.8f);

                Stars.StarUpdater.Instance.m_constellationLabels.Add(labelBehavior);

                foreach (uint hdId in asterism.HD_ids)
                {
                    if (!Stars.StarParser.HD_idToIndex.ContainsKey(hdId))
                    {
                        continue;
                    }

                    int            index = Stars.StarParser.HD_idToIndex[hdId];
                    Stars.StarData star  = Stars.StarParser.Instance.Stars[index];

                    star.AsterismIndex = i;
                    Stars.StarParser.Instance.Stars[index] = star;
                    if (star.GameObjectRepresentation != null)
                    {
                        star.GameObjectRepresentation.name             = hdId.ToString();
                        star.GameObjectRepresentation.transform.parent = jewelcase.transform;
                        if (star.Label != "")
                        {
                            if (used.Contains(star.HD_id))
                            {
                                continue;
                            }

                            Stars.StarUpdater.Instance.GenerateStarLabel(star, star.GameObjectRepresentation.transform);
                            used.Add(star.HD_id);
                        }
                    }
                }

                AsterismData[i] = asterism;
            }
        }
 public IEnumerable<IDataObject> BindRdfDataObjects(IGraph graph)
 {
     var distinctSubjects = new System.Collections.Generic.HashSet<INode>();
     foreach (var t in graph.Triples)
     {
         distinctSubjects.Add(t.Subject);
     }
     return distinctSubjects.Select(s =>
         MakeDataObject(s.ToString(),
             graph.GetTriplesWithSubject(s).Select(t =>
                 MakeTriple(t.Subject, t.Predicate, t.Object))));
 } 
        private void VertexInsertion(SplitTree ST, List<int> sigma, int idx)
        {
            #region Bootstrapping
            if (ST.vertices.Count == 0)//initialization
            {
                Leaf v = new Leaf
                {
                    id = sigma[idx],
                    parent = null,
                };
                ST.AddLeaf(v);
                ST.root = v;
            }
            else if (ST.vertices.Count == 1)//only the root, thus we cache the second vertex
            {
                Leaf v = new Leaf
                {
                    id = sigma[idx],
                    parent = null,
                };
                ST.AddLeaf(v);
            }
            else if (ST.vertices.Count == 2)//now we're building the first trinity
            {
                Leaf v = new Leaf
                {
                    id = sigma[idx],
                    parent = null
                };
                ST.AddLeaf(v);
                int missingConnection = -1; //test the missing connection between the cached 3 leave
                if (!storage[(ST.vertices[0] as Leaf).id].Contains((ST.vertices[1] as Leaf).id))
                {
                    missingConnection = 0;
                }
                else if (!storage[(ST.vertices[0] as Leaf).id].Contains((ST.vertices[2] as Leaf).id))
                {
                    missingConnection = 1;
                }
                else if (!storage[(ST.vertices[1] as Leaf).id].Contains((ST.vertices[2] as Leaf).id))
                {
                    missingConnection = 2;
                }
                MarkerVertex v1 = new MarkerVertex()
                {
                    opposite = ST.vertices[0]
                };
                MarkerVertex v2 = new MarkerVertex()
                {
                    opposite = ST.vertices[1]
                };
                MarkerVertex v3 = new MarkerVertex()
                {
                    opposite = ST.vertices[2]
                };
                (ST.vertices[0] as Leaf).opposite = v1;
                (ST.vertices[1] as Leaf).opposite = v2;
                (ST.vertices[2] as Leaf).opposite = v3;
                MarkerVertex center = null;
                switch (missingConnection)
                {
                    case 0:
                        center = v3;
                        break;
                    case 1:
                        center = v2;
                        break;
                    case 2:
                        center = v1;
                        break;
                    default: break;
                }
                var deg = new DegenerateNode()
                {
                    parent = ST.vertices[0],
                    Vu = new List<MarkerVertex> { v1, v2, v3 },
                    center = center,
                    rootMarkerVertex = v1
                };
                v1.node = deg;
                ST.vertices[1].parent = ST.vertices[2].parent = deg;
                ST.vertices.Add(deg);
                ST.lastVertex = ST.vertices[2] as Leaf;
            }
            #endregion
            else
            {
                TreeEdge e; Vertex u; SplitTree tPrime;
                var returnType = SplitTree_CaseIdentification(ST, sigma, idx, out e, out u, out tPrime);
                switch (returnType)
                {
                    case CaseIdentification_ResultType.SingleLeaf:
                        //This case is not discussed in paper. However, if there's only a single leaf in neighbor set,
                        //then a unique PE edge can be found.
                        //Applying proposition 4.17, case 6
                        e.u = (u as Leaf).opposite;
                        e.v = u;
                        ST.SplitEdgeToStar(e, sigma[idx]);
                        break;
                    case CaseIdentification_ResultType.TreeEdge://PP or PE
                        {
                            bool unique = true;
                            bool pp;
                            //testing uniqueness, page 24
                            //check whether pp or pe
                            if (!e.u.Perfect())
                            {
                                var tmp = e.u;
                                e.u = e.v;
                                e.v = tmp;
                            }
                            pp = e.v.Perfect();
                            var u_GLT = e.u_GLT;
                            var v_GLT = e.v_GLT;
                            DegenerateNode degNode = null;
                            if (u_GLT is DegenerateNode)
                                degNode = u_GLT as DegenerateNode;
                            if (v_GLT is DegenerateNode)
                                degNode = v_GLT as DegenerateNode;
                            if (degNode != null)//attached to a clique or a star
                            {
                                if ((pp && degNode.isClique) || (!pp/*pe*/ && degNode.isStar && (e.u == degNode.center || degNode.Degree(e.v as MarkerVertex) == 1)))
                                {
                                    unique = false;
                                }
                            }
                            if (unique)
                            {
                                //Proposition 4.17 case 5 or 6

                                if (pp)//PP
                                {
                                    ST.SplitEdgeToClique(e, sigma[idx]);
                                }
                                else//PE
                                {
                                    ST.SplitEdgeToStar(e, sigma[idx]);
                                }
                            }
                            else
                            {
                                //Proposition 4.15, case 1 or 2
                                var deg = u_GLT;
                                if (v_GLT is DegenerateNode)
                                    deg = v_GLT;
                                ST.AttachToDegenerateNode(deg as DegenerateNode, sigma[idx]);
                            }
                        }
                        break;
                    case CaseIdentification_ResultType.HybridNode:
                        if (u is DegenerateNode)
                        {
                            //Proposition 4.16
                            var uDeg = u as DegenerateNode;
                            System.Collections.Generic.HashSet<MarkerVertex> PStar = new System.Collections.Generic.HashSet<MarkerVertex>();
                            System.Collections.Generic.HashSet<MarkerVertex> EStar = new System.Collections.Generic.HashSet<MarkerVertex>();
                            uDeg.ForEachMarkerVertex((v) =>
                                {
                                    if (v.perfect && v != uDeg.center)
                                        PStar.Add(v);
                                    else
                                        EStar.Add(v);
                                    return IterationFlag.Continue;
                                });
                            //before we split, determine the new perfect states for the two new markers to be generated
                            bool pp = false;
                            if (uDeg.isStar && uDeg.center.perfect)
                            {
                                pp = true;//see figure 7. pp==true iff star and center is perfect.
                            }
                            var newNode = SplitNode(uDeg, PStar, EStar);
                            ST.vertices.Add(newNode);
                            //e.u \in PStar ; e.v \in EStar (thus containing the original center, if star)
                            //PStar in uDeg; EStar in newNode
                            if (newNode.parent == uDeg)
                            {
                                e.u = newNode.rootMarkerVertex.opposite;
                                e.v = newNode.rootMarkerVertex;
                            }
                            else
                            {
                                e.u = uDeg.rootMarkerVertex;
                                e.v = uDeg.rootMarkerVertex.opposite;
                            }
                            //assign perfect state values
                            if (pp)
                            {
                                e.u.MarkAsPerfect();
                                e.v.MarkAsPerfect();
                            }
                            else//PE, and PStar part always has an empty state and EStar part has perfect.
                            {
                                e.u.MarkAsEmpty();
                                e.v.MarkAsPerfect();
                            }
                            //check whether pp or pe
                            if (!e.u.Perfect())
                            {
                                var tmp = e.u;
                                e.u = e.v;
                                e.v = tmp;
                            }
                            if (e.v.Perfect())//PP
                            {
                                ST.SplitEdgeToClique(e, sigma[idx]);
                            }
                            else//PE
                            {
                                ST.SplitEdgeToStar(e, sigma[idx]);
                            }
                        }
                        else
                        {
                            //Proposition 4.15, case 3
                            ST.AttachToPrimeNode(u as PrimeNode, sigma[idx]);
                        }
                        break;
                    case CaseIdentification_ResultType.FullyMixedSubTree:
                        //Proposition 4.20
                        Cleaning(ST, tPrime);
                        //ST.Debug(false);
                        var contractionNode = Contraction(ST, tPrime, sigma[idx]);
                        break;
                }
            }
        }
 public virtual void DoDelete(Bar db, System.Collections.Generic.HashSet <IDelRecord> deletionList)
 {
     db._creature_Dna.Remove(this);
     db._creature_pk.Remove(_id);
 }