public StandardPlayerHelper(IPlayerControl control)
            : base(control)
        {
            int playerCount = Game.Players.Count;
            switch(playerCount)
            {
            case 4:
                unknownRoles = new List<Role> { Role.Outlaw, Role.Outlaw, Role.Renegade };
                break;
            case 5:
                unknownRoles = new List<Role> { Role.Deputy, Role.Outlaw, Role.Outlaw, Role.Renegade };
                break;
            case 6:
                unknownRoles = new List<Role> { Role.Deputy, Role.Outlaw, Role.Outlaw, Role.Outlaw, Role.Renegade };
                break;
            case 7:
                unknownRoles = new List<Role> { Role.Deputy, Role.Deputy, Role.Outlaw, Role.Outlaw, Role.Outlaw, Role.Renegade };
                break;
            case 8:
                unknownRoles = new List<Role> { Role.Deputy, Role.Deputy, Role.Outlaw, Role.Outlaw, Role.Outlaw, Role.Renegade, Role.Renegade };
                break;
            default:
                throw new InvalidOperationException();
            }

            entries = new Dictionary<int, PlayerEntry>(playerCount);
            foreach(IPublicPlayerView p in Game.Players)
            {
                entries.Add(p.ID, new PlayerEntry(this, p));
                unknownRoles.Remove(entries[p.ID].EstimatedRole);
            }
            IPrivatePlayerView thisPlayer = ThisPlayer;
            if(entries[thisPlayer.ID].EstimatedRole == Role.Unknown)
                unknownRoles.Remove(entries[thisPlayer.ID].EstimatedRole = thisPlayer.Role);
        }
Beispiel #2
0
        public async Task SubscribedWebHooksShouldBeCalledPostDeployment()
        {
            string testName = "SubscribedWebHooksShouldBeCalledPostDeployment";
            var expectedHookAddresses = new List<string>();
            string hook1 = "hookCalled/1";
            string hook2 = "hookCalled/2";

            using (new LatencyLogger(testName))
            {
                await ApplicationManager.RunAsync("HookSite" + testName, async hookAppManager =>
                {
                    using (var hookAppRepository = Git.Clone("NodeWebHookTest"))
                    {
                        string hookAddress1 = hookAppManager.SiteUrl + hook1;
                        string hookAddress2 = hookAppManager.SiteUrl + hook2;

                        WebHook webHookAdded1 = await SubscribeWebHook(hookAppManager, hookAddress1, 1);

                        GitDeployApp(hookAppManager, hookAppRepository);

                        expectedHookAddresses.Add(hook1);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Success.ToString(), hookAppRepository.CurrentId);

                        WebHook webHookAdded2 = await SubscribeWebHook(hookAppManager, hookAddress2, 2);

                        TestTracer.Trace("Redeploy to allow web hooks to be called");
                        await hookAppManager.DeploymentManager.DeployAsync(hookAppRepository.CurrentId);

                        expectedHookAddresses.Add(hook2);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Success.ToString(), hookAppRepository.CurrentId);

                        TestTracer.Trace("Make sure web hooks are called for failed deployments");
                        await hookAppManager.SettingsManager.SetValue("COMMAND", "thisIsAnErrorCommand");
                        await hookAppManager.DeploymentManager.DeployAsync(hookAppRepository.CurrentId);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Failed.ToString());

                        await hookAppManager.SettingsManager.Delete("COMMAND");

                        TestTracer.Trace("Unsubscribe first hook");
                        await UnsubscribeWebHook(hookAppManager, webHookAdded1.Id, 1);

                        TestTracer.Trace("Redeploy to allow web hook to be called");
                        await hookAppManager.DeploymentManager.DeployAsync(hookAppRepository.CurrentId);

                        expectedHookAddresses.Remove(hook1);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Success.ToString(), hookAppRepository.CurrentId);

                        TestTracer.Trace("Unsubscribe second hook");
                        await UnsubscribeWebHook(hookAppManager, webHookAdded2.Id, 0);

                        TestTracer.Trace("Redeploy to verify no web hook was called");
                        await hookAppManager.DeploymentManager.DeployAsync(hookAppRepository.CurrentId);

                        TestTracer.Trace("Verify web hook was not called");
                        expectedHookAddresses.Remove(hook2);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Success.ToString(), hookAppRepository.CurrentId);
                    }
                });
            }
        }
Beispiel #3
0
        public bool CanStructureBePlaced(Point location, int size, Unit builder, bool cutCorners)
        {
            List<PathNode> placingStructurePathNodes = new List<PathNode>();
            Circle collisionCircle = new Circle(new Vector2(location.X * Map.TileSize + (size / 2) * Map.TileSize, location.Y * Map.TileSize + (size / 2) * Map.TileSize), size * Map.TileSize);
            //placingStructureCenterPoint = collisionCircle.CenterPoint;

            for (int x = location.X; x < location.X + size; x++)
            {
                for (int y = location.Y; y < location.Y + size; y++)
                {
                    PathNode node = Rts.pathFinder.PathNodes[(int)MathHelper.Clamp(y, 0, Map.Height - 1), (int)MathHelper.Clamp(x, 0, Map.Width - 1)];
                    if (collisionCircle.Intersects(node.Tile))
                    {
                        placingStructurePathNodes.Add(node);
                    }
                }
            }
            // remove corners
            if (cutCorners)
            {
                placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y, location.X]);
                if (location.X + size <= Map.Width - 1)
                    placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y, location.X + size - 1]);
                else
                    return false;
                if (location.Y + size <= Map.Height - 1)
                    placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y + size - 1, location.X]);
                else
                    return false;
                placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y + size - 1, location.X + size - 1]);
            }

            foreach (PathNode node in placingStructurePathNodes)
            {
                if (!node.Tile.Walkable || node.Blocked)
                    return false;
                if (node.UnitsContained.Count > 0)
                {
                    if (node.UnitsContained.Count == 1 && node.UnitsContained.ElementAt<Unit>(0) == builder)
                        continue;
                    else
                    {
                        bool allow = true;

                        foreach (Unit unit in node.UnitsContained)
                        {
                            if (unit.Team != builder.Team)
                            {
                                allow = false;
                                break;
                            }
                        }
                        if (!allow)
                            return false;
                    }
                }
            }

            return true;
        }
Beispiel #4
0
    static void Main()
    {
        int withoutPenCount = 0;

        string lineReader = Console.ReadLine(); // In this implementation of program, the first line of input doesn't matter
        //string[] tokens = lineReader.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

        lineReader = Console.ReadLine(); // Students without pen
        string[] withoutPen = lineReader.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

        lineReader = Console.ReadLine(); // Students with pen
        // Use List<string>, because it is easier to remove directly element by value
        List<string> withPen = new List<string>(lineReader.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));

        for (int i = 0; i < withoutPen.Length; i++)
        {
            string left = (int.Parse(withoutPen[i]) - 1).ToString();
            string right = (int.Parse(withoutPen[i]) + 1).ToString();

            if (withPen.Contains(left))
            {
                withPen.Remove(left);
            }
            else if (withPen.Contains(right))
            {
                withPen.Remove(right);
            }
            else
            {
                withoutPenCount++;
            }
        }

        Console.WriteLine(withoutPenCount);
    }
        public List<List<KingsburgDie>> Find( int targetSum, DiceCollection bag )
        {
            //DiceCollection clone = (DiceCollection)bag.Clone();
            DiceCollection clone = bag;
            List<KingsburgDie> elements = (List<KingsburgDie>)clone;
            mResults = new List<List<KingsburgDie>>();
            RecursiveFind( targetSum, 0, new List<KingsburgDie>(), elements, 0 );

            List<List<KingsburgDie>> copy = new List<List<KingsburgDie>>( mResults );
            foreach( List<KingsburgDie> list in copy )
            {
                if( list.Count == 1 )
                {
                    if( list[0].Type != KingsburgDie.DieTypes.Regular )
                    {
                        mResults.Remove( list );
                    }
                }

                IEnumerable<KingsburgDie> linq = from r in list
                                                 where r.Type == KingsburgDie.DieTypes.MarketNegative || r.Type == KingsburgDie.DieTypes.MarketPositive
                                                 select r;
                List<KingsburgDie> marketDice = new List<KingsburgDie>( linq );
                if( marketDice.Count > 1 )
                {
                    mResults.Remove( list );
                }
            }
            return mResults;
        }
Beispiel #6
0
 public static Zagrada SpojiZagrade(Zagrada a, Zagrada b, int varijabla, Dictionary<int, List<Zagrada>> veze_var_zagrada,List<Zagrada> Formula,List<int> varijable)
 {
     Zagrada nova = new Zagrada();
     for (int i = 0; i < a.varijable.Count; i++)
     {
         if (a.varijable[i] != varijabla && a.varijable[i] != (-varijabla) && (!nova.varijable.Contains(a.varijable[i]))) nova.varijable.Add(a.varijable[i]);
     }
     for (int i = 0; i < b.varijable.Count; i++)
     {
         if (b.varijable[i] != varijabla && b.varijable[i] != (-varijabla) && (!nova.varijable.Contains(b.varijable[i]))) nova.varijable.Add(b.varijable[i]);
     }
     if (!Tautologija(nova))
     {
         for (int i = 0; i < nova.varijable.Count; i++)
         {
             if (!veze_var_zagrada.ContainsKey(nova.varijable[i])) veze_var_zagrada.Add(nova.varijable[i], new List<Zagrada>());
             veze_var_zagrada[nova.varijable[i]].Add(nova);
         }
     }
     nova.tezina = 1;
     popraviVeze(a, b, veze_var_zagrada, varijable);
     Formula.Remove(a);
     Formula.Remove(b);
     return nova;
 }
        public void UpdateImports(SolutionEntityItem item, List<String> imports)
        {
            // Remove imports
            imports.Remove (importCocoaApplication);
            imports.Remove (importConsoleApplication);
            imports.Remove (importCocoaLibrary);

            // Check project nature
            MonobjcProject project = item as MonobjcProject;
            if (project == null) {
                return;
            }

            switch (project.ApplicationType) {
            case MonobjcProjectType.CocoaApplication:
                imports.Add (importCocoaApplication);
                break;
            case MonobjcProjectType.ConsoleApplication:
                imports.Add (importConsoleApplication);
                break;
            case MonobjcProjectType.CocoaLibrary:
                imports.Add (importCocoaLibrary);
                break;
            }
        }
    static List<char> ReverseDecimalNumber(List<char> decimalNumberList)
    {
        int pointPosition = 0;

        for (int i = 0; i < decimalNumberList.Count; i++)
        {
            if (decimalNumberList[i] == '.')
            {
                pointPosition = i;
                decimalNumberList.Remove('.');
                break;
            }
            else if (decimalNumberList[i] == ',')
            {
                pointPosition = i;
                decimalNumberList.Remove(',');
                break;
            }
        }

        decimalNumberList.Reverse();
        if (pointPosition != 0)
        {
            decimalNumberList.Insert(pointPosition, '.');
        }
        return decimalNumberList;
    }
Beispiel #9
0
    /// <summary>
    /// Gets the connected blocks from the children blocks.
    /// </summary>
    /// <returns>List of the connected blocks.</returns>
    /// <param name="children">List of the total blocks.</param>
    /// <param name="root">Root block of the connected blocks.</param>
    List<Transform> getConnectedBlockFrom(List<Transform> children, Transform root = null)
    {
        List<Transform> result = new List<Transform> ();

        if (root == null) {
            root = children[0];
        }
        children.Remove (root);
        result.Add (root);

        List<Transform> neighbors = getNeighbors (root, children);
        foreach (Transform neighbor in neighbors) {
            children.Remove(neighbor);
            result.Add(neighbor);
        }

        List<List<Transform>> recursiveResults = new List<List<Transform>> ();
        foreach (Transform neighbor in neighbors) {
            recursiveResults.Add(getConnectedBlockFrom(children, neighbor));
        }

        foreach (List<Transform> recursiveResult in recursiveResults) {
            result.AddRange(recursiveResult);
        }

        return result;
    }
    public override bool Move(LinkedList<MainTrack> route, List<MainTrack> usedTracks)
    {
        if (route.Find(this) == null)
        {
            return false;
        }

        if(!IsDown){

               Link1.Value.Place(route.Find(this).Previous.Value.Contains);
                route.Find(this).Previous.Value.Contains = null;
                usedTracks.Remove(route.Find(this).Previous.Value);
                usedTracks.Add(Link1.Value);
                return true;

        }
        else if(IsDown){

                Link2.Value.Place(route.Find(this).Previous.Value.Contains);
                route.Find(this).Previous.Value.Contains = null;
                usedTracks.Remove(route.Find(this).Previous.Value);
                usedTracks.Add(Link2.Value);
                return true;

        }
        return false;
    }
        public static List<FortData> Optimize(FortData[] pokeStops, LatLong latlng, GMapOverlay routeOverlay)
        {
            List<FortData> optimizedRoute = new List<FortData>(pokeStops);

            // NN
            FortData NN = FindNN(optimizedRoute, latlng.Latitude, latlng.Longitude);
            optimizedRoute.Remove(NN);
            optimizedRoute.Insert(0, NN);
            for (int i = 1; i < pokeStops.Length; i++)
            {
                NN = FindNN(optimizedRoute.Skip(i), NN.Latitude, NN.Longitude);
                optimizedRoute.Remove(NN);
                optimizedRoute.Insert(i, NN);
                Visualize(optimizedRoute, routeOverlay);
            }

            // 2-Opt
            bool isOptimized;
            do
            {
                optimizedRoute = Optimize2Opt(optimizedRoute, out isOptimized);
                Visualize(optimizedRoute, routeOverlay);
            }
            while (isOptimized);

            return optimizedRoute;
        }
Beispiel #12
0
        /// <summary>
        /// Static ctor. Scan the directory structure for cell groups and types.
        /// Groups are the names of subdirectories inside .\cells
        /// Cell types are the names of subdirectories inside each group folder
        /// Variants are the .x files found there - 0.x, 1.x, etc.
        /// </summary>
        static GroupTypeVariant()
        {
            string folder = Directory.GetCurrentDirectory() + "\\cells";			// assume all cell groups are found in .\cells
            string[] path = Directory.GetDirectories(folder);						// get the list of subdirectories (cell groups)

            // Get the list of group names
            List<string> group = new List<string>();
            for (int p = 0; p < path.Length; p++)	    							// remove everything except the subfolder name
            {
                group.Add(Path.GetFileName(path[p]));
            }

            // Ignore system cell types
            group.Remove("CellTypes");
            group.Remove("Cameras");

            group.Sort();

            // Initialise the library elements (GroupTypeVariants)
            library = new GroupTypeVariant[group.Count];                            // Create the library of groups
            for (int g = 0; g < group.Count; g++)			    					// for each group, create the cell type information
            {
                library[g] = new GroupTypeVariant(folder,group[g]);
            }
        }
        public static void MenuItemGPGSExportUIPackage()
        {
            List<string> exportList = new List<string>();

            Debug.Log("Exporting plugin.");

            AddToList(exportList, "Assets/GooglePlayGames");
            AddToList(exportList, "Assets/Plugins/Android/libs");
            AddToList(exportList, "Assets/Plugins/Android/MainLibProj");
            AddToList(exportList, "Assets/Plugins/iOS");

            exportList.Remove("Assets/GooglePlayGames/Editor/projsettings.txt");
            exportList.Remove("Assets/GooglePlayGames/Editor/GPGSExportPackageUI.cs");
            exportList.Remove("Assets/Plugins/Android/MainLibProj/AndroidManifest.xml");

            string fileList = "Final list of files to export (click for details)\n\n";
            foreach (string s in exportList) {
                fileList += "+ " + s + "\n";
            }
            Debug.Log(fileList);

            string path = EditorUtility.SaveFilePanel("Save plugin to", "",
                              "GooglePlayGamesPlugin-" + GooglePlayGames.PluginVersion.VersionString +
                              ".unitypackage", "unitypackage");

            if (path == null || path.Trim().Length == 0) {
                Debug.LogWarning("Cancelled plugin export.");
                return;
            }

            Debug.Log("Exporting plugin to " + path);
            File.Delete(path);
            AssetDatabase.ExportPackage(exportList.ToArray(), path);
            EditorUtility.DisplayDialog("Export finished", "Plugin exported to " + path, "OK");
        }
        private IList<IMenuModel> SortByAfter(IList<IMenuModel> menuModels)
        {
            var sorted = new List<IMenuModel>(menuModels);

            foreach (IMenuModel model in menuModels)
            {
                int newIndex =
                    sorted.FindIndex(m => m.Name.Equals(model.After, StringComparison.InvariantCultureIgnoreCase));

                if (newIndex < 0) continue;

                int currentIndex = sorted.IndexOf(model);

                if (currentIndex < newIndex)
                {
                    sorted.Remove(model);
                    sorted.Insert(newIndex, model);
                }
                else
                {
                    sorted.Remove(model);
                    sorted.Insert(newIndex + 1, model);
                }
            }

            return sorted;
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://sam2012"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    //Test1(web);
                   // GetAllItemsIncludeFolders(web);
                    Test2(web);
                }

                Console.ReadKey();
            }

            List<string> l = new List<string>(){"1","2","3","4"};
            for (int i = 0; i < 3; i++)
            {
                string s = l.FirstOrDefault(k => k == 1.ToString());
                l.Remove(s);
                string s1 = l.FirstOrDefault(k => k == 2.ToString());
                l.Remove(s1);
            }

            foreach (string v in l)
            {
                Console.WriteLine(v);
            }

            Console.ReadKey();
        }
        public ActionResult GetMenuDetailsForUpdate(string menuID, string FCName, string CName, string DName, string SDate, string NoP)
        {
            FoodCourtAdminDAL agent = new FoodCourtAdminDAL();
            UpdateMenuDetails obj = new UpdateMenuDetails();
            obj.MenuItem = new MenuDetails();

            obj.MenuID = Convert.ToInt32(menuID);
            obj.MenuItem.FoodCourtName = FCName;
            obj.MenuItem.CatererName = CName;
            obj.MenuItem.DishName = DName;
            obj.MenuItem.ServingDate = Convert.ToDateTime(SDate);
            obj.MenuItem.NumberOfPlates =Convert.ToInt32(NoP);

            List<string> tempList = new List<string>();

            tempList = agent.FoodCourts();
            tempList.Remove(FCName);
            ViewBag.list1 = tempList;

            tempList = agent.Caterers();
            tempList.Remove(CName);
            ViewBag.list2 = tempList;

            tempList = agent.Dishes();
            tempList.Remove(CName);
            ViewBag.list3 = tempList;

            return PartialView("_AddMenuPartial", obj);
        }
Beispiel #17
0
        public override IEnumerable<RelationalModelChange> PreFilter(IEnumerable<RelationalModelChange> changes)
        {
            List<RelationalModelChange> filtered = new List<RelationalModelChange>(changes);
            foreach (RelationalModelChange change in changes)
            {
                // if a primary key is being added
                if (change is AddPrimaryKeyChange)
                {
                    // check if the table is being added, in which case
                    // the primary key will be embedded in the CREATE TABLE statement
                    if (IsTableAdded(changes, change.Table))
                        filtered.Remove(change);
                }

                // if a primary key is being dropped
                if (change is DropPrimaryKeyChange)
                {
                    // check if the table is being dropped, in which case
                    // the primary key will be dropped automatically
                    if (IsTableDropped(changes, change.Table))
                        filtered.Remove(change);
                }
            }

			return base.PreFilter(filtered);
        }
        private static List<JointType> SortAndPrepeareToReturn(List<KeyValuePair<JointType, double>> overallResultList)
        {
            overallResultList.Sort(ResultComparer);

            var toReturn = new List<JointType>();
            var array = overallResultList.ToArray();
            for (int i = overallResultList.Count - 1; i >= overallResultList.Count - 7; --i)
            {
                if (array[i].Value != 0)
                {
                    toReturn.Add(array[i].Key);
                }
            }

            try
            {
                toReturn.Remove(JointType.FootLeft);
                toReturn.Remove(JointType.FootRight);
                toReturn.Remove(JointType.WristLeft);
                toReturn.Remove(JointType.WristRight);
            }
            catch { }

            return toReturn;
        }
Beispiel #19
0
        public SimpleExplorer()
        {
            Explore = Explore.FieldsAndProperties | Explore.PublicAndPrivate;
            ShowTypeInProps = true;
            ShowToStringInProps = false;

            ExplorePropsCriterion = AllowExploreProps;
            ExploreElementsCriterion = AllowExploreElements;
            ShowPropsForStandardCollections = false;

            AcceptFieldCriterion = AllowField;
            AcceptPropCriterion = AllowProp;
            AcceptElementCriterion = AllowElement;
            AcceptNodeCriterion = AllowNode;

            LeafTypes = new List<Type>(typeof(IConvertible).GetMethods().Select(m => m.ReturnType));
            LeafTypes.Remove(typeof(Object));
            LeafTypes.Remove(typeof(TypeCode));
            LeafTypes.Add(typeof(Enum));
            LeafTypes.Add(typeof(Delegate));
            LeafTypes.Add(typeof(Type));
            LeafTypes.Add(typeof(Guid));
            LeafCriterion = o => o == null || this.LeafTypes.Any(bt => bt == o.GetType() || bt.IsAssignableFrom(o.GetType()));

            Logic = FilteredExploreImpl;
        }
Beispiel #20
0
    move makeMinMaxMove(List<int> vm)
    {
        move bestMove = new move ();
        List<int> validMovesClone = new List<int> ();

        for (int i = 0; i < vm.Count; i++)
        {
            move tempMove = new move();
            tempMove.pos = vm[i];
            // Make a copy of the old valid moves before doing anything
            validMovesClone = vm;
            // Should happen in a split second
            if(GameObject.Find ("GameController").GetComponent<GameController>().getIsXTurn())
            {
                GameObject.Find ("B"+vm.ToString ()).GetComponentInChildren<Text>().text = "X";
                vm.Remove(i);
                if(GameObject.Find ("GameController").GetComponent<GameController>().CheckWin() == 0)
                    tempMove.rank = 1;
                else if(GameObject.Find ("GameController").GetComponent<GameController>().CheckWin() == 1)
                    tempMove.rank = -1;
                else if (GameObject.Find ("GameController").GetComponent<GameController>().getTotalMoves () + 1 == 9)
                    tempMove.rank = 0;
                else
                {

                    if (vm.Count>0)
                        tempMove.rank = -makeMinMaxMove (vm).rank;
                    else
                        break;
                }

            }
            else
            {
                GameObject.Find ("B"+validMoves[i].ToString()).GetComponentInChildren<Text>().text = "O";
                vm.Remove(i);
                if(GameObject.Find ("GameController").GetComponent<GameController>().CheckWin() == 0)
                    tempMove.rank = -1;
                else if(GameObject.Find ("GameController").GetComponent<GameController>().CheckWin() == 1)
                    tempMove.rank = 1;
                else if (GameObject.Find ("GameController").GetComponent<GameController>().getTotalMoves ()+1 == 9)
                    tempMove.rank = 0;
                else
                {
                    if (vm.Count>0)
                        tempMove.rank = -makeMinMaxMove (vm).rank;
                    else
                        break;
                }

            }

            // revert board to original state
            GameObject.Find ("B"+vm.ToString ()).GetComponentInChildren<Text>().text = "";

        }

        Debug.Log (bestMove.pos);
        return bestMove;
    }
Beispiel #21
0
    public void InitializeSelf()
    {
        if(SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Ramen) &&
           SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Yaki_soba) &&
           SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Zaru_soba) &&
           SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Curry_with_rice) &&
           SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Tempura))
        {
            foreach(var obj in arr_foodsSprite)
                obj.gameObject.SetActiveRecursively(false);
            this.animatedSprite.Play("Play");
            this.transform.position = new Vector3(136, 25, 10);
        }
        else {
            this.animatedSprite.Play("Idle");
            this.transform.position = new Vector3(108, 25, 10);
            foreach(var obj in arr_foodsSprite)
                obj.gameObject.SetActiveRecursively(false);

            int ramen_id = (int)GoodDataStore.FoodMenuList.Ramen;
            int yakizoba_id = (int)GoodDataStore.FoodMenuList.Yaki_soba;
            int zaruzoba_id = (int)GoodDataStore.FoodMenuList.Zaru_soba;
            int curry_id = (int)GoodDataStore.FoodMenuList.Curry_with_rice;
            int tempura_id = (int)GoodDataStore.FoodMenuList.Tempura;
            List<int> temp = new List<int>();
            temp.Add(ramen_id);
            temp.Add(yakizoba_id);
            temp.Add(zaruzoba_id);
            temp.Add(curry_id);
            temp.Add(tempura_id);

            for (int i = 0; i < 3; i++) {
                if(SushiShop.NumberOfCansellItem.Contains(ramen_id) && temp.Contains(ramen_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Ramen.ToString());
                    temp.Remove(ramen_id);
                }
                else if(SushiShop.NumberOfCansellItem.Contains(yakizoba_id) && temp.Contains(yakizoba_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Yaki_soba.ToString());
                    temp.Remove(yakizoba_id);
                }
                else if(SushiShop.NumberOfCansellItem.Contains(zaruzoba_id) && temp.Contains(zaruzoba_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Zaru_soba.ToString());
                    temp.Remove(zaruzoba_id);
                }
                else if (SushiShop.NumberOfCansellItem.Contains(curry_id) && temp.Contains(curry_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Curry_with_rice.ToString());
                    temp.Remove(curry_id);
                }
                else if (SushiShop.NumberOfCansellItem.Contains(tempura_id) && temp.Contains(tempura_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Tempura.ToString());
                    temp.Remove(tempura_id);
                }
            }
        }
    }
		public void Store()
		{
			var tbl = new List<string>(Project.References.ReferencedProjectIds);
			var refs = Project.References as DefaultDReferencesCollection;

			foreach (var i in vbox_ProjectDeps)
			{
				var cb = i as CheckButton;
				
				if (cb == null)
					continue;

				var prj = cb.Data["prj"] as DProject;
				if (prj == null)
					continue;

				var id = prj.ItemId;

				if (cb.Active) {
					if (!tbl.Contains (id))
						refs.ProjectDependencies.Add(id);
					else
						tbl.Remove (id);
				} else {
					if (tbl.Contains (id)) {
						refs.ProjectDependencies.Remove (id);
						tbl.Remove (id);
					}
				}
			}

			foreach (var id in tbl)
				refs.ProjectDependencies.Remove (id);
		}
Beispiel #23
0
        private static List<int> Merge(List<int> left, List<int> right)
        {
            List<int> result = new List<int>();

            while(left.Count > 0 || right.Count>0)
            {
                if (left.Count > 0 && right.Count > 0)
                {
                    if (left.First() <= right.First())  //Comparing First two elements to see which is smaller
                    {
                        result.Add(left.First());
                        left.Remove(left.First());      //Rest of the list minus the first element
                    }
                    else
                    {
                        result.Add(right.First());
                        right.Remove(right.First());
                    }
                }
                else if(left.Count>0)
                {
                    result.Add(left.First());
                    left.Remove(left.First());
                }
                else if (right.Count > 0)
                {
                    result.Add(right.First());
                    right.Remove(right.First());
                }
            }
            return result;
        }
Beispiel #24
0
        public static List<TableField> GetFilterFields(bool isB2B)
        {
            List<TableField> filterFields = new List<TableField>();
            if (isB2B)
            {
                filterFields.AddRange(GetTableFields(m_B2BMastersTableName));
                filterFields.AddRange(GetTableFields(m_B2BContactsTableName));
                var temp = filterFields.FirstOrDefault(p => p.TableName.ToLower() == m_B2BContactsTableName.ToLower() && p.FieldName.ToLower() == "公司名称");
                if (temp != null)
                    filterFields.Remove(temp);
            }
            else
            {
                filterFields.AddRange(GetTableFields(m_B2CMastersTableName));
            }

            for (int i = filterFields.Count - 1; i >= 0; i--)
            {
                if (filterFields[i].FieldName.ToLower().IsIn("id", "indate", "lasteditdate"))
                {
                    filterFields.Remove(filterFields[i]);
                }
            }

            return filterFields;
        }
Beispiel #25
0
 Vector3 getClosestPosition(ref List<GameObject> listObject)
 {
     GameObject closest = listObject[0];
     if(listObject.Count==1){
         if(closest!=null){ // permet d'éviter de le retourner si le jouerur meurt entre temps
             return closest.transform.position;
         }
         else{
             listObject.Remove(closest);
         }
         return Vector3.zero;
     }
     else{
         if(closest!=null){
             float distanceMin = Vector3.Distance(transform.position,closest.transform.position);
             for (int i = 1; i < listObject.Count; i++){
                 if(listObject[i]!= null){
                     float distance = Vector3.Distance(transform.position, listObject[i].transform.position);
                     if(distance <= distanceMin){
                         distanceMin=distance;
                         closest = listObject[i];
                     }
                 }
                 else{
                     listObject.Remove(listObject[i]);
                     return transform.position;
                 }
             }
             return closest.transform.position;
         }
     }
     return transform.position;
 }
Beispiel #26
0
        internal static void Initialize(CompositionContainer composition)
        {
            List<Language> languages = new List<Language>();
            if (composition != null)
                languages.AddRange(composition.GetExportedValues<Language>());
            else {
                languages.Add(new CSharpLanguage());
                languages.Add(new VB.VBLanguage());
            }

            // Fix order: C#, VB, IL
            var langs2 = new List<Language>();
            var lang = languages.FirstOrDefault(a => a is CSharpLanguage);
            if (lang != null) {
                languages.Remove(lang);
                langs2.Add(lang);
            }
            lang = languages.FirstOrDefault(a => a is VB.VBLanguage);
            if (lang != null) {
                languages.Remove(lang);
                langs2.Add(lang);
            }
            langs2.Add(new ILLanguage(true));
            for (int i = 0; i < langs2.Count; i++)
                languages.Insert(i, langs2[i]);

            #if DEBUG
            languages.AddRange(ILAstLanguage.GetDebugLanguages());
            languages.AddRange(CSharpLanguage.GetDebugLanguages());
            #endif
            allLanguages = languages.AsReadOnly();
        }
Beispiel #27
0
        /// <summary>
        /// Constructor for Read dialog
        /// </summary>
        public ReadDialog(Epi.Windows.MakeView.Forms.MakeViewMainForm frm)
            : base(frm)
        {
            InitializeComponent();
            Construct();
            SourceProjectNames = new Hashtable();

            if (frm.projectExplorer != null)
            {
                if (frm.projectExplorer.currentPage != null)
                {
                    this.sourceProject = frm.projectExplorer.currentPage.view.Project;
                    this.selectedProject = this.sourceProject;
                    this.selectedDataSource = this.selectedProject;
                    //--EI-48
                    //Adds datatable names to viewlist to enable other tables in project
                    List<string> SourceViewnames = this.sourceProject.GetViewNames();
                    SourceNonViewnames = this.sourceProject.GetNonViewTableNames();
                    foreach(string str in SourceViewnames)
                    {
                        View MView = this.sourceProject.GetViewByName(str);
                        DataTable ViewPages = MView.GetMetadata().GetPagesForView(MView.Id);
                        foreach(DataRow dt in ViewPages.Rows)
                        {
                            string ViewdataTable = MView.TableName + dt[ColumnNames.PAGE_ID];
                            Sourcedatatables.Add(ViewdataTable);
                        }
                        if (SourceNonViewnames.Contains(str)) { SourceNonViewnames.Remove(str); }
                    }
                    foreach(string str in Sourcedatatables)
                    {
                        SourceViewnames.Add(str);
                        if (SourceNonViewnames.Contains(str)) { SourceNonViewnames.Remove(str);}
                    }

                   //--

                    foreach (string s in this.sourceProject.GetNonViewTableNames())
                    {
                        string key = s.ToUpper().Trim();
                        if (!SourceProjectNames.Contains(key))
                        {
                           if (SourceViewnames.Contains(s))
                             {
                                SourceProjectNames.Add(key, true);
                             }
                        }
                    }
                    foreach (string s in this.sourceProject.GetViewNames())
                    {
                        string key = s.ToUpper().Trim();
                        if (!SourceProjectNames.Contains(key))
                        {
                            SourceProjectNames.Add(key, true);
                        }
                    }

                }
            }
        }
        public bool Matches(object one, object two)
        {
            var expected = new List<object>(one.As<IEnumerable>().OfType<object>());
            var actual = new List<object>(two.As<IEnumerable>().OfType<object>());

            foreach (object o in actual.ToArray())
            {
                if (expected.Contains(o))
                {
                    actual.Remove(o);
                    expected.Remove(o);
                }
            }

            foreach (object o in expected.ToArray())
            {
                if (actual.Contains(o))
                {
                    actual.Remove(o);
                    expected.Remove(o);
                }
            }

            return actual.Count == 0 && expected.Count == 0;
        }
 //методът използва два списъка (left, right), които слива в един сортиран списък
 static List<int> Merge(List<int> left, List<int> right)
 {
     List<int> result = new List<int>();    //декларираме списъка, в който ще получим резултата от сливането и сортирането
     while (left.Count > 0 || right.Count > 0)   //докато има елементи в поне един от двата списъка
     {
         if (left.Count > 0 && right.Count > 0)   //ако има елементи и в двата списъка
         {
             if (left[0] <= right[0])    //ако първият елемент от левия списък е по-малък или равен от/на първия елемент от десния списък
             {
                 result.Add(left[0]);  //постави по-малкия елемент от двата на първо място в сортирания списък
                 left.Remove(left[0]);  //премахни по-малкия елемент от списъка, в който е бил досега
             }
             else
             {
                 result.Add(right[0]);  //постави по-малкия елемент от двата на първо място в сортирания списък
                 right.Remove(right[0]);   //премахни по-малкия елемент от списъка, в който е бил досега
             }
         }
         else if (left.Count > 0)    //ако първият списък има елементи
         {
             result.Add(left[0]);  //постави най-левият елемент от този списък на първо място в сортирания списък
             left.Remove(left[0]);    //премахни елемента от списъка, в който е бил досега
         }
         else if (right.Count > 0)  //ако вторият списък има елементи
         {
             result.Add(right[0]);    //постави най-левият елемент от този списък на първо място в сортирания списък
             right.Remove(right[0]);   //премахни елемента от списъка, в който е бил досега
         }
     }
     return result;   //върни като резултат сортирания слят списък
 }
Beispiel #30
0
 static Ostov Algoritm(List<List<int>> matrix, List<Top> tops)
 {
     var near = new Dictionary<Top, Top>();
     var w = new List<Top>(tops);
     var distance = new Dictionary<Top, int>();
     var top = tops[0];
     w.Remove(top);
     var ostov = new Ostov(Enumerable.Range(0, tops.Count).Select(x => new LinkedList<int>()).ToList(), 0);
     for (int i = 0; i < tops.Count; i++)
     {
         near.Add(tops[i], top);
         distance.Add(tops[i], matrix[i][0]);
     }
     while (w.Count != 0)
     {
         var v = distance.Where(x => x.Value != 0 && w.Contains(x.Key)).OrderBy(x => x.Value).First();
         var u = near[v.Key];
         ostov.Graph[v.Key.Number].AddLast(u.Number + 1);
         ostov.Graph[u.Number].AddLast(v.Key.Number + 1);
         ostov.Weight += v.Value;
         w.Remove(v.Key);
         foreach (var versh in w)
         {
             if (distance[versh] > matrix[versh.Number][v.Key.Number])
             {
                 near[versh] = v.Key;
                 distance[versh] = matrix[versh.Number][v.Key.Number];
             }
         }
     }
     return ostov;
 }
Beispiel #31
0
        public void RemoveConnection(string id)
        {
            Client client = clients.FirstOrDefault(c => c.Id == id);

            clients?.Remove(client);
        }
Beispiel #32
0
 public void RemoveDomainEvent(INotification eventItem)
 {
     _domainEvents?.Remove(eventItem);
 }
Beispiel #33
0
 public void RemoveDomainEvent(DomainEvent eventItem)
 {
     _domainEvents?.Remove(eventItem);
 }
 protected void RemoveDomainEvent(INotification evt)
 {
     _domainEvents?.Remove(evt);
 }
 public void RemoverEvento(Event eventItem)
 {
     _notificacoes?.Remove(eventItem);
 }
 public void RemoveDomainEvent(DomainEvent @event) => _events?.Remove(@event);
 public void RemoveAnimationData(TransitionAnimationData data)
 {
     animationDataList?.Remove(data);
 }
Beispiel #38
0
 public bool Remove(Directive item) => _directives?.Remove(item) ?? false;
 public void RemoveDomainEvent(IDomainEvent @event)
 {
     _domainEvents?.Remove(@event);
 }
Beispiel #40
0
 public void RemoveEntityEvent(EntityEvent domainEvent)
 {
     _domainEvents?.Remove(domainEvent);
 }
Beispiel #41
0
 /// <summary>
 /// Remove o evento de domínio.
 /// </summary>
 /// <param name="eventItem"></param>
 public void RemoveDomainEvent(IDomainEvent eventItem) => domainEvents?.Remove(eventItem);
Beispiel #42
0
 public void RemoveEvent(Event @event)
 {
     _notifications?.Remove(@event);
 }
Beispiel #43
0
        public override bool Remove(ObjectShape obj)
        {
            drawingObjects.Remove(obj);

            return true;
        }
Beispiel #44
0
 public void RemoveChild(Node node) => children?.Remove(node);
Beispiel #45
0
 public void DestroyKeyframe(CurveInfo info)
 {
     mCurveList?.Remove(info);
 }
Beispiel #46
0
 public void RemoveAssetTable(LocalizationAssetTableSO table)
 {
     _mTables?.Remove(table);
 }
Beispiel #47
0
        /**
         * The plan is: Generate 2*roomsNumber rooms, outshift them and then connect with corridors, removing the ones that intersect a corridor
         * adding locked doors and making sure that the it's possible to reach every room.
         * And I don't fukin' know how to do all of that.
         *
         * Okay, let's start by creating the Dungeon itself. This object will contain all the map data, that is, the map itself as well as
         * any object metadata (for monster spawners, mechanisms, chest contents, and so on.
         *
         * Each object that has metadata will hava a unique ID, as the metadata for said object will be stored separetely, in JSON format.
         * The map itself won't retain the Rooms information, and will be turned into a tileset, or so it will be for DunGen 1.0 file specification.
         *
         * Also, this comments will be very helpful, as I'm most likely going to forget everything I just said, and will come back very
         * often to remember what it is I have to implement next.
         */

        public void generate()
        {
            int gap  = 2;
            int seed = (new Random()).Next();

            rg = new Random(seed);
            int excess = 2;

            print(Heading.Attention, "Starting dungeon generation...");
            print(Heading.Info, "Seed: {0}", new object[] { seed });
            print(Heading.Info, "Generating {0} rooms", new object[] { excess *param.roomsCount });

            rooms = new List <Room>();

            rooms.Add(new BasicRoom(-3, -3, 5, 5));

            //for (int i = 0; i < 10; i++) {
            //    for (int j = 0; j < 10; j++) {
            //        rooms.Add(new BasicRoom(i * 10, j * 10, 10, 10));
            //    }
            //}

            //Application.Run(new DungeonDisplayer(this));

            //return;

            int attemptCount = 0;

            for (int i = 0; i < excess * param.roomsCount;)
            {
                if (generateRoom())
                {
                    i++;
                    attemptCount = 0;
                }
                else
                {
                    attemptCount++;
                    print(Heading.Warning, "Room failed to generate. Attempt #{0}", new object[] { attemptCount });
                }
            }

            //rooms.OrderBy((x) => Helpers.Distance(x.getCenter(), new Point(0, 0)));

            print(Heading.Attention, "Starting outshifting!");
            print(Heading.Info, "{0} set as middle, with center at {1}.", new object[] { rooms[0], rooms[0].getCenter() });
            rooms[0].finalPosition = true;

            bool changed = true;

            while (changed)
            {
                changed = false;
                foreach (var r in rooms)
                {
                    if (r.finalPosition)
                    {
                        continue;
                    }
                    r.shown = true;
                    while (!r.finalPosition)
                    {
                        Point centerR  = r.getCenter();
                        Point centerOR = rooms[0].getCenter();

                        //radialmente!
                        double d = Helpers.Distance(centerR, centerOR);
                        int[]  p;
                        if (d == 0)
                        {
                            p = new int[] { 1, 1 };
                        }
                        else
                        {
                            p = Helpers.IntegerProportion((centerR.x - centerOR.x) / (d), (centerR.y - centerOR.y) / (d), 30);
                        }

                        /*if (p[0] == 0 && p[1] == 0) {
                         *  p = new int[] { rg.Next(10) * (rg.NextDouble() > 0.5 ? 1 : -1), rg.Next(10) * (rg.NextDouble() > 0.5 ? 1 : -1) };
                         * }*/

                        print(Heading.Info, "Increment: {0} {1}", new object[] { p[0], p[1] });
                        r.shift(p[0], p[1]);

                        //Application.Run(new DungeonDisplayer(this));

                        changed = true;

                        bool fix = true;
                        foreach (var or in rooms)
                        {
                            if (r.Equals(or) || !or.finalPosition)
                            {
                                continue;
                            }

                            if (or.getDistance(r) < gap)
                            {
                                fix = false;
                            }
                        }

                        if (fix)
                        {
                            r.finalPosition = true;
                            print(Heading.Info, "{0} is now fixed.", new object[] { r });
                        }
                    }
                    r.shown = false;
                }
            }

            print(Heading.Attention, "Shift finished.");
            print(Heading.Attention, "Deleting {0} random rooms.", new object[] { (excess - 1) * param.roomsCount });

            for (int i = 0; i < (excess - 1) * param.roomsCount; i++)
            {
                Room r = rooms[rg.Next(rooms.Count)];
                rooms.Remove(r);
            }

            print(Heading.Attention, "Done. Displaying.");
            Application.Run(new DungeonDisplayer(this));
        }
Beispiel #48
0
    //
    // This parses the -arg and /arg options to the compiler, even if the strings
    // in the following text use "/arg" on the strings.
    //
    bool CSCParseOption(string option, ref string [] args)
    {
        int    idx = option.IndexOf(':');
        string arg, value;

        if (idx == -1)
        {
            arg   = option;
            value = "";
        }
        else
        {
            arg = option.Substring(0, idx);

            value = option.Substring(idx + 1);
        }

        switch (arg.ToLower(CultureInfo.InvariantCulture))
        {
        case "/nologo":
            return(true);

        case "/t":
        case "/target":
            switch (value)
            {
            case "exe":
                Target = Target.Exe;
                break;

            case "winexe":
                Target = Target.WinExe;
                break;

            case "library":
                Target    = Target.Library;
                TargetExt = ".dll";
                break;

            case "module":
                Target    = Target.Module;
                TargetExt = ".netmodule";
                break;

            default:
                return(false);
            }
            return(true);

        case "/out":
            if (value.Length == 0)
            {
                Usage();
                Environment.Exit(1);
            }
            OutputFile = value;
            return(true);

        case "/o":
        case "/o+":
        case "/optimize":
        case "/optimize+":
            Optimize = true;
            return(true);

        case "/o-":
        case "/optimize-":
            Optimize = false;
            return(true);

        case "/incremental":
        case "/incremental+":
        case "/incremental-":
            // nothing.
            return(true);

        case "/d":
        case "/define": {
            if (value.Length == 0)
            {
                Usage();
                Environment.Exit(1);
            }

            foreach (string d in value.Split(argument_value_separator))
            {
                if (defines.Length != 0)
                {
                    defines.Append(";");
                }
                defines.Append(d);
            }

            return(true);
        }

        case "/bugreport":
            //
            // We should collect data, runtime, etc and store in the file specified
            //
            return(true);

        case "/linkres":
        case "/linkresource":
        case "/res":
        case "/resource":
            bool      embeded = arg [1] == 'r' || arg [1] == 'R';
            string [] s       = value.Split(argument_value_separator);
            switch (s.Length)
            {
            case 1:
                if (s [0].Length == 0)
                {
                    goto default;
                }
                embedded_resources [s [0]] = Path.GetFileName(s [0]);
                break;

            case 2:
                embedded_resources [s [0]] = s [1];
                break;

            case 3:
                Console.WriteLine("Does not support this method yet: {0}", arg);
                Environment.Exit(1);
                break;

            default:
                Console.WriteLine("Wrong number of arguments for option `{0}'", option);
                Environment.Exit(1);
                break;
            }

            return(true);

        case "/recurse":
            Console.WriteLine("/recurse not supported");
            Environment.Exit(1);
            return(true);

        case "/r":
        case "/reference": {
            if (value.Length == 0)
            {
                Console.WriteLine("-reference requires an argument");
                Environment.Exit(1);
            }

            string [] refs = value.Split(argument_value_separator);
            foreach (string r in refs)
            {
                string val   = r;
                int    index = val.IndexOf('=');
                if (index > -1)
                {
                    reference_aliases.Add(r);
                    continue;
                }

                if (val.Length != 0)
                {
                    references.Add(val);
                }
            }
            return(true);
        }

        case "/main":
            main = value;
            return(true);

        case "/m":
        case "/addmodule":
        case "/win32res":
        case "/doc":
            if (showWarnings)
            {
                Console.WriteLine("{0} = not supported", arg);
            }
            return(true);

        case "/lib": {
            libs.Add(value);
            return(true);
        }

        case "/win32icon": {
            win32IconFile = value;
            return(true);
        }

        case "/debug-":
            want_debugging_support = false;
            return(true);

        case "/debug":
        case "/debug+":
            want_debugging_support = true;
            return(true);

        case "/checked":
        case "/checked+":
            Checked = true;
            return(true);

        case "/checked-":
            Checked = false;
            return(true);

        case "/clscheck":
        case "/clscheck+":
            return(true);

        case "/clscheck-":
            VerifyClsCompliance = false;
            return(true);

        case "/unsafe":
        case "/unsafe+":
            Unsafe = true;
            return(true);

        case "/unsafe-":
            Unsafe = false;
            return(true);

        case "/warnaserror":
        case "/warnaserror+":
            if (value.Length == 0)
            {
                WarningsAreErrors = true;
            }
            else
            {
                foreach (string wid in value.Split(argument_value_separator))
                {
                    warning_as_error.Add(wid);
                }
            }
            return(true);

        case "/-runtime":
            // Console.WriteLine ("Warning ignoring /runtime:v4");
            return(true);

        case "/warnaserror-":
            if (value.Length == 0)
            {
                WarningsAreErrors = false;
            }
            else
            {
                foreach (string wid in value.Split(argument_value_separator))
                {
                    warning_as_error.Remove(wid);
                }
            }
            return(true);

        case "/warn":
            WarningLevel = Int32.Parse(value);
            return(true);

        case "/nowarn": {
            string [] warns;

            if (value.Length == 0)
            {
                Console.WriteLine("/nowarn requires an argument");
                Environment.Exit(1);
            }

            warns = value.Split(argument_value_separator);
            foreach (string wc in warns)
            {
                try {
                    if (wc.Trim().Length == 0)
                    {
                        continue;
                    }

                    int warn = Int32.Parse(wc);
                    if (warn < 1)
                    {
                        throw new ArgumentOutOfRangeException("warn");
                    }
                    ignore_warning.Add(warn);
                } catch {
                    Console.WriteLine(String.Format("`{0}' is not a valid warning number", wc));
                    Environment.Exit(1);
                }
            }
            return(true);
        }

        case "/noconfig":
            load_default_config = false;
            return(true);

        case "/nostdlib":
        case "/nostdlib+":
            StdLib = false;
            return(true);

        case "/nostdlib-":
            StdLib = true;
            return(true);

        case "/fullpaths":
            return(true);

        case "/keyfile":
            if (value == String.Empty)
            {
                Console.WriteLine("{0} requires an argument", arg);
                Environment.Exit(1);
            }
            StrongNameKeyFile = value;
            return(true);

        case "/keycontainer":
            if (value == String.Empty)
            {
                Console.WriteLine("{0} requires an argument", arg);
                Environment.Exit(1);
            }
            StrongNameKeyContainer = value;
            return(true);

        case "/delaysign+":
        case "/delaysign":
            StrongNameDelaySign = true;
            return(true);

        case "/delaysign-":
            StrongNameDelaySign = false;
            return(true);

        case "/langversion":
            LangVersion = value;
            return(true);

        case "/codepage":
            CodePage = value;
            return(true);

        case "/publicsign":
            return(true);

        case "/deterministic":
            return(true);

        case "/runtimemetadataversion":
            return(true);

        case "/-getresourcestrings":
            return(true);

        case "/features":
            return(true);
        }

        Console.WriteLine("Failing with : {0}", arg);
        return(false);
    }
Beispiel #49
0
    // Use this for initialization
    void Start()
    {
        generatedFood = new List <GameObject>();

        foodCells = new List <Cell>();

        foodSource = Resources.Load("Prefabs/food");

        mainGrid = GridManager.instance.GetGrid(new Vector3(0, 0, 0));

        IEnumerable <Cell> allCells = mainGrid.cells;

        totalCells = mainGrid.sizeX * mainGrid.sizeZ;

        int totalFood = Mathf.RoundToInt((totalCells) / foodRatio);

        Debug.Log("Total " + totalFood + " out of " + totalCells);


        cellsClose = new List <Cell>();

        cellList = allCells.ToList();

        while (cellList.Count > totalFood)
        {
            //Debug.Log(cellList.Count);

            Cell current = cellList[Mathf.RoundToInt(Random.Range(0, cellList.Count))];

            if (generateFood(current))
            {
                cellList.Remove(current);

                cellList.Remove(current.GetNeighbour(0, 1));

                cellList.Remove(current.GetNeighbour(0, -1));

                cellList.Remove(current.GetNeighbour(-1, 0));

                cellList.Remove(current.GetNeighbour(1, 0));
            }
        }

        int quarter = Mathf.RoundToInt(generatedFood.Count / 4);

        if (selectedTerrain == terrainType.bad)
        {
            range = quarter;
        }
        else if (selectedTerrain == terrainType.medium)
        {
            range = quarter * 2;
        }
        else if (selectedTerrain == terrainType.good)
        {
            range = quarter * 3;
        }


        for (int i = 0; i < generatedFood.Count; i++)
        {
            generatedFood[i].layer = 8;
            generatedFood[i].tag   = "info";
            generatedFood[i].name  = "info" + i;
        }

        int total = generatedFood.Count;

        range = generatedFood.Count;

        while (generatedFood.Count > range)
        {
            GameObject current = generatedFood[Mathf.RoundToInt(Random.Range(0, generatedFood.Count))];

            infopointScript = current.GetComponent <infopointDynamics>();

            infopointScript.disposition = infopointDynamics.possibleDispositions.Bad;

            generatedFood.Remove(current);
        }


        Debug.Log("Generated " + generatedFood.Count + " good out of " + total);
    }
Beispiel #50
0
        public static bool checkWordPDA(string word, Automaton a, string currentState, string stack, ref List <Transition> passedTransitions)
        {
            if (a.Stack == null)
            {
                throw new ArgumentException("Automaton do NOT have a stack! It's NOT a PDA!");
            }
            bool temp_goes_to_final = true;

            if (word == "_" || word == "ε" || word == "")
            {
                return(!StackChecker.doesNotGoFinalePDA(ref passedTransitions, currentState, stack, ref temp_goes_to_final, a));
            }
            string            partToBeChecked;
            List <Transition> possibleTransitions = new List <Transition>();

            if (stack == "")
            {
                possibleTransitions = a.Transitions.Where(x =>
                                                          (x.Letter == word[0].ToString() || x.Letter == "_") &&
                                                          x.Start.Name == currentState &&
                                                          x.TakeFromStack == "_"
                                                          ).ToList();
            }
            else
            {
                possibleTransitions = a.Transitions.Where(x => (
                                                              x.Letter == word[0].ToString() || x.Letter == "_") &&
                                                          x.Start.Name == currentState &&
                                                          (x.TakeFromStack == "_" || x.TakeFromStack == stack[stack.Length - 1].ToString())
                                                          ).ToList();
            }
            possibleTransitions = possibleTransitions.OrderBy(x => x.Letter).ToList();
            possibleTransitions.ForEach(x => Trace.WriteLine(x.ToString()));
            bool result = false;

            if (possibleTransitions.Count() > 0)
            {
                if (word.Count() > 0)
                {
                    partToBeChecked = word.Remove(0, 1);
                    Trace.WriteLine("Word: " + word + " | Checking: " + partToBeChecked);
                }
                else
                {
                    return(false);
                }
                foreach (Transition t in possibleTransitions)
                {
                    if (a.Final.Contains(t.End) && word.Count() == 0 && stack == "")
                    {
                        return(true);
                    }
                    else if (word.Count() == 0)
                    {
                        result = !StackChecker.doesNotGoFinalePDA(ref passedTransitions, t.End.Name, stack, ref temp_goes_to_final, a);
                    }
                    else
                    {
                        if (t.Letter != "_")
                        {
                            if (t.TakeFromStack != "_")
                            {
                                stack = stack.Remove(stack.Length - 1);
                            }
                            if (t.PutOnStack != "_")
                            {
                                stack = stack + t.PutOnStack;
                            }
                            passedTransitions.Add(t);
                            result = checkWordPDA(partToBeChecked, a, t.End.Name, stack, ref passedTransitions);
                            passedTransitions.Remove(t);
                        }
                        else
                        {
                            if (t.TakeFromStack != "_")
                            {
                                stack = stack.Remove(stack.Length - 1);
                            }
                            if (t.PutOnStack != "_")
                            {
                                stack = stack + t.PutOnStack;
                            }
                            passedTransitions.Add(t);
                            result = checkWordPDA(word, a, t.End.Name, stack, ref passedTransitions);
                            passedTransitions.Remove(t);
                        }
                        if (result)
                        {
                            break;
                        }
                    }
                }
            }
            Trace.WriteLine(result);
            return(result);
        }
        private List <Process> GetMatchingProcessesByName()
        {
            new EnvironmentPermission(
                PermissionState.Unrestricted).Assert();

            List <Process> allProcesses =
                new List <Process>(Process.GetProcesses());

            // The keys dictionary is used for rapid lookup of
            // processes that are already in the matchingProcesses list.
            Dictionary <int, byte> keys = new Dictionary <int, byte>();

            List <Process> matchingProcesses = new List <Process>();

            if (null == this.processNames)
            {
                matchingProcesses.AddRange(allProcesses);
            }
            else
            {
                foreach (string pattern in this.processNames)
                {
                    WriteVerbose("Finding matches for process name \""
                                 + pattern + "\".");

                    // WildCard serach on the available processes
                    WildcardPattern wildcard =
                        new WildcardPattern(
                            pattern,
                            WildcardOptions.IgnoreCase);

                    bool found = false;

                    foreach (Process process in allProcesses)
                    {
                        if (!keys.ContainsKey(process.Id))
                        {
                            string processName = SafeGetProcessName(process);

                            // Remove the process from the allProcesses list
                            // so that it is not tested again.
                            if (processName.Length == 0)
                            {
                                allProcesses.Remove(process);
                            }

                            // Perform a wildcard search on this particular
                            // process name and check whether it matches the
                            // pattern specified.
                            if (!wildcard.IsMatch(processName))
                            {
                                continue;
                            }

                            WriteDebug("Found matching process id "
                                       + process.Id + ".");

                            // A match is found.
                            found = true;

                            // Store the process identifier so that the same process
                            // is not added twice.
                            keys.Add(process.Id, 0);

                            // Add the process to the processes list.
                            matchingProcesses.Add(process);
                        }
                    } // foreach (Process...

                    if (!found &&
                        !WildcardPattern.ContainsWildcardCharacters(pattern))
                    {
                        WriteError(new ErrorRecord(
                                       new ArgumentException("Cannot find process name "
                                                             + "\"" + pattern + "\"."),
                                       "ProcessNameNotFound",
                                       ErrorCategory.ObjectNotFound,
                                       pattern));
                    }
                } // foreach (string...
            }     // if (null...

            return(matchingProcesses);
        } // GetMatchingProcessesByName
 public bool Remove(byte item)
 {
     return(_Data.Remove(item));
 }
Beispiel #53
0
 /// <summary>
 ///     Removes the given item from the list and removes the highlighting
 /// </summary>
 /// <param name="item">The given item</param>
 private void DeselectItem(HierarchyItemController item)
 {
     SelectedItems.Remove(item);
     SetColor(item, false);
     _lastSelectedItem = null;
 }
        private void wVJ_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (wVJ.ReadyState == WebBrowserReadyState.Complete && !wVJ.IsBusy)
            {
                HtmlElement        head     = wVJ.Document.GetElementsByTagName("head")[0];
                HtmlElement        scriptEl = wVJ.Document.CreateElement("script");
                IHTMLScriptElement element  = (IHTMLScriptElement)scriptEl.DomElement;
                if (wVJ.Url.ToString().Contains("/Login.aspx")) // Đăng nhập
                {
                    wVJ.Document.GetElementById("txtUsernameVNiSC").SetAttribute("value", "admin");
                    wVJ.Document.GetElementById("txtMatKhau").SetAttribute("value", "11223399");
                    wVJ.Document.GetElementById("txtAgentCode").SetAttribute("value", "THD");
                    SoLanDangNhap++;
                    if (SoLanDangNhap < 4)
                    {
                        dynamic body         = wVJ.Document.Body.DomElement;
                        dynamic controlRange = body.createControlRange();
                        dynamic element1     = wVJ.Document.GetElementById("imgImageValidate").DomElement;
                        controlRange.add(element1);
                        controlRange.execCommand("Copy", false, null);

                        string res = string.Empty;
RetunA:
                        try
                        {
                            res = XuLyGiaoDien.ConvertImgToText((Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap));
                            if (res.Length < 3)
                            {
                                goto RetunA;
                            }
                        }
                        catch { wVJ.Navigate("http://ags.thanhhoang.vn/Login.aspx"); }

                        if (wVJ.Document.GetElementById("RequiredFieldValidator3").OuterHtml.Contains("VISIBILITY: hidden"))
                        {
                            wVJ.Document.GetElementById("txtImageValidate").SetAttribute("value", res);
                            wVJ.Visible = true;
                            wVJ.Document.GetElementById("btnLogin").InvokeMember("click");
                        }
                        else
                        {
                            goto RetunA;
                        }
                    }
                }  // Đăng nhập
                else if (wVJ.Url.ToString().Contains("/Default.aspx") || wVJ.Url.AbsolutePath.Contains("/Booking.aspx")) //Vào trang thêm đại lý
                {
                    wVJ.Navigate("http://ags.thanhhoang.vn/Agent.aspx?Do=SubAgent");
                }
                else if (wVJ.Url.ToString().EndsWith("Agent.aspx?Do=SubAgent&Act=Add"))// Thêm đại lý
                {
                    dldl = _lstDL.Where(w => w.MaAGS.Equals(lstDLAGS[0])).First();
                    wVJ.Document.GetElementById("ctl08_txtAgentCode").SetAttribute("value", lstDLAGS[0]);
                    wVJ.Document.GetElementById("ctl08_txtAgentName").SetAttribute("value", dldl.Ten);
                    if (lstDLAGS.Count > 0)
                    {
                        if (_lstSIChinh.Where(w => w.DaiLy.Equals(dldl.ID) && w.HangBay.Equals(3) && w.Chinh).Count() > 0)
                        {
                            lstQAGS.Remove(lstDLAGS[0]);
                        }
                        lstDLAGS.Remove(lstDLAGS[0]);
                    }
                    wVJ.Document.GetElementById("ctl08_btOK").InvokeMember("click");
                }// Thêm đại lý
                else if (wVJ.Url.ToString().EndsWith("Agent.aspx?Do=SubAgent"))//Kiểm tra tồn tại đại lý
                {
                    if (lstDLAGS.Count == 0)
                    {
                        if (lstQAGS.Count == 0)
                        {
                            wVJ.Navigate("http://ags.thanhhoang.vn/Agent.aspx?Do=Ticketing");
                        }
                        else
                        {
                            wVJ.Navigate("http://ags.thanhhoang.vn/Accounting.aspx?Do=Deposit");
                        }
                    }
                    else
                    {
                        if (!ThemDaiLy)
                        {
                            HtmlElementCollection hc = wVJ.Document.GetElementsByTagName("div");
                            for (int i = 0; i < hc.Count; i++)
                            {
                                if (hc[i].GetAttribute("classname") == "item first")
                                {
                                    if (lstDLAGS.Equals(hc[i].InnerText))
                                    {
                                        lstDLAGS.Remove(hc[i].InnerText);
                                    }
                                }
                            }
                        }

                        ThemDaiLy = lstDLAGS.Count > 0;
                        if (lstDLAGS.Count > 0)
                        {
                            wVJ.Navigate("http://ags.thanhhoang.vn/Agent.aspx?Do=SubAgent&Act=Add");
                        }
                        else
                        {
                            wVJ.Navigate("http://ags.thanhhoang.vn/Agent.aspx?Do=Ticketing");
                        }
                    }
                }//Kiểm tra tồn tại đại lý
                else if (wVJ.Url.ToString().EndsWith("Accounting.aspx?Do=Deposit&Act=Add"))// Thêm quỹ
                {
                    HtmlElementCollection hc = wVJ.Document.GetElementsByTagName("option");
                    for (int i = 4; i < hc.Count; i++)
                    {
                        lstdic.Add(hc[i].InnerText);
                    }

                    int o = lstdic.FindIndex(x => x.StartsWith("0"));
                    if (o < 0)
                    {
                        XtraMessageBox.Show("Đại lý chưa được thêm trên ags", "Thông báo");
                        Dispose();
                        Close();
                    }
                    else
                    {
                        element.text = @"function doPost() { document.getElementById('ctl08_ddlSubAgent').options.item(" + o + ").selected = true; }";
                        head.AppendChild(scriptEl);
                        wVJ.Document.InvokeScript("doPost");

                        wVJ.Document.GetElementById("ctl08_txtAmount").SetAttribute("value", "20000000");
                        wVJ.Document.GetElementById("ctl08_txtDocNo").SetAttribute("value", "1");
                        wVJ.Document.GetElementById("ctl08_txtDocDate").SetAttribute("value", DateTime.Now.ToString("dd/MM/yyyy"));
                        wVJ.Document.Window.ScrollTo(0, 170);
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        dic.Add("SoCT", 2);
                        new D_DAILY().CapNhat(dic, _lstDL.Where(w => w.MaAGS.Equals(lstDLAGS[0])).First().ID);
                    }
                }// Thêm quỹ
                else if (wVJ.Url.ToString().Contains("Accounting.aspx?Do=Deposit"))
                {
                    if (lstQAGS.Count > 0)
                    {
                        wVJ.Document.GetElementById("ctl08_btnAddNew").InvokeMember("click");
                    }
                }// Thêm quỹ
                else if (wVJ.Url.ToString().EndsWith("Agent.aspx?Do=Ticketing&Act=Add"))
                {
                    dldl      = _lstDL.Where(w => w.ID.Equals(_lstSIChinh[iVN].DaiLy)).First();
                    lstMaAGSW = lstMaAGSW.OrderByDescending(w => w).ToList();
                    HtmlElementCollection hc = wVJ.Document.GetElementsByTagName("option");
                    for (int i = 4; i < hc.Count; i++)
                    {
                        lstdic.Add(hc[i].InnerText);
                    }

                    int    o  = lstdic.FindIndex(x => x.StartsWith(dldl.MaAGS));
                    string _a = "AG" + dldl.MaAGS + "1";

                    if (lstMaAGSW.Where(w => w.Contains(dldl.MaAGS)).Count() > 0)
                    {
                        string a = lstMaAGSW.Where(w => w.Contains(dldl.MaAGS)).First();
                        _a = a.Substring(0, a.Length - 1) + (int.Parse(a.Substring(a.Length - 1, 1)) + 1);
                    }

                    wVJ.Document.GetElementById("ctl08_txtTenDangNhap").SetAttribute("value", _a);
                    wVJ.Document.GetElementById("ctl08_txtMatKhau").SetAttribute("value", _lstSIChinh[iVN].MatKhau);
                    wVJ.Document.GetElementById("ctl08_chkChangePassNextLogin").InvokeMember("click");
                    wVJ.Document.GetElementById("ctl08_txtHoTen").SetAttribute("value", dldl.Ten);

                    element.text = @"function doPost() { document.getElementById('ctl08_ddlSubAgent').options.item(" + o + ").selected = true; }";
                    head.AppendChild(scriptEl);
                    wVJ.Document.InvokeScript("doPost");

                    if (_lstSIChinh[iVN].Chinh)
                    {
                        element.text = @"function doPost() { document.getElementById('ctl08_ddlPermission').options.item(1).selected = true; }";
                        head.AppendChild(scriptEl);
                        wVJ.Document.InvokeScript("doPost");
                    }
                    Invoke(new MethodInvoker(delegate()
                    {
                        _lstSIChinh[iVN].End    = true;
                        _lstSIChinh[iVN].SignIn = _a.ToString();
                        GCSI.DataSource         = null;
                        GCSI.DataSource         = _lstSIChinh;
                        GVSI.ExpandAllGroups();
                    }));
                    iVN++;
                }
                else if (wVJ.Url.ToString().EndsWith("Agent.aspx?Do=Ticketing"))
                {
                    lstMaAGSW.Clear();

                    HtmlElementCollection hc = GetElementByClass("table", "table table-bordered").GetElementsByTagName("tr");
                    for (int i = 1; i < hc.Count; i++)
                    {
                        lstMaAGSW.Add(hc[i].GetElementsByTagName("td")[1].InnerText);
                    }

                    for (; iVN < _lstSIChinh.Count; iVN++)
                    {
                        if (_lstSIChinh[iVN].End || _lstSIChinh[iVN].HangBay != 3)
                        {
                            continue;
                        }
                        else
                        {
                            wVJ.Navigate("http://ags.thanhhoang.vn/Agent.aspx?Do=Ticketing&Act=Add");
                            break;
                        }
                    }
                }
            }
        }
Beispiel #55
0
        /// <summary>
        /// Автоматическое объединение остановок
        /// </summary>
        private static void AggregateBusstops()
        {
            using (var db = new TransportContext())
            {
                Console.Write("Очистка зон.. ");
                foreach (var busstop in db.Busstops)
                {
                    busstop.AreaId = null;
                }

                foreach (var building in db.Buildings)
                {
                    building.AreaId = null;
                }

                db.Areas.RemoveRange(db.Areas);
                db.SaveChanges();
                Console.WriteLine("завершено");

                Console.Write("Группировка остановок в остановочные пункты... ");
                // Этап 1. Группируем остановки с одинаковыми названиями
                var busstopGroups = db.Busstops.GroupBy(busstop => busstop.Name);
                var areas = new List<Area>();

                foreach (var group in busstopGroups)
                {
                    var area = new Area();
                    area.Name = @group.Key;
                    @group.ToList().ForEach(busstop => area.Busstops.Add(busstop));
                    area.Location = CalculateAreaCentre(area.Busstops.ToList());
                    areas.Add(area);
                }

                // Этап 2. Объединяем остановочные пункты, которые находятся близко друг к другу
                const double maxDistance = 250.0;
                var delAreas = new List<Area>();

                foreach (var area in areas)
                {
                    if (delAreas.Contains(area)) continue;

                    var nearestAreas = areas.Where(bs => area != bs && !delAreas.Contains(bs) &&
                                                                     area.Location.Distance(bs.Location) < maxDistance).ToList();

                    foreach (var nearestArea in nearestAreas)
                    {
                        area.Name += $"/{nearestArea.Name}";
                        nearestArea.Busstops.ToList().ForEach(busstop => area.Busstops.Add(busstop));
                        area.Location = CalculateAreaCentre(area.Busstops.ToList());
                    }

                    delAreas.AddRange(nearestAreas);
                }

                delAreas.ForEach(busstation => areas.Remove(busstation));

                var i = 1;
                foreach (var area in areas)
                {
                    area.AreaId = i++;
                }

                db.Areas.AddRange(areas);
                db.SaveChanges();
            }

            Console.WriteLine("завершено");
            Console.ReadKey();
        }
 public override void Remove(Component c)
 {
     list.Remove(c);
 }
 public void Remove(Option value)
 {
     List.Remove(value);
 }
Beispiel #58
0
 public virtual AssetResponse Remove(Player player, List <IAsset> assetList)
 {
     assetList.Remove(this);
     player.Cash += Value;
     return(AssetResponse.RemovedSuccessfully);
 }
Beispiel #59
0
 public override JSONNode Remove(JSONNode aNode)
 {
     m_List.Remove(aNode);
     return(aNode);
 }
 /// <summary>
 /// Remove the given item from the store.
 /// </summary>
 /// <param name="item"></param>
 /// <returns> Whether the item was removed. </returns>
 public bool Remove(T item)
 {
     return items.Remove(item);
 }