internal RiakDtMapEntry(MapEntry entry)
        {
            Field = new RiakDtMapField(entry.field);

            if (Field.Type == RiakDtMapField.RiakDtMapFieldType.Counter)
            {
                Counter = new RiakDtCounter { Value = entry.counter_value };
            }

            if (Field.Type == RiakDtMapField.RiakDtMapFieldType.Flag)
            {
                FlagValue = entry.flag_value;
            }

            if (Field.Type == RiakDtMapField.RiakDtMapFieldType.Map)
            {
                MapValue = entry.map_value.Select(mv => new RiakDtMapEntry(mv)).ToList();
            }

            if (Field.Type == RiakDtMapField.RiakDtMapFieldType.Register)
            {
                RegisterValue = entry.register_value;
            }

            if (Field.Type == RiakDtMapField.RiakDtMapFieldType.Set)
            {
                SetValue = entry.set_value;
            }
        }
Example #2
0
        /// <summary>
        /// Creates a new ChestScreen object.
        /// </summary>
        /// <param name="chestEntry">The chest entry shown in the screen</param>
        public ChestScreen(MapEntry<Chest> chestEntry)
            : base(true)
        {
            // check the parameter
            if ((chestEntry == null) || (chestEntry.Content == null))
            {
                throw new ArgumentNullException("chestEntry.Content");
            }
            this.chestEntry = chestEntry;

            // clean up any empty entries
            this.chestEntry.Content.Entries.RemoveAll(
                delegate(ContentEntry<Gear> contentEntry)
                {
                    return (contentEntry.Count <= 0);
                });

            // sort the chest entries by name
            this.chestEntry.Content.Entries.Sort(
                delegate(ContentEntry<Gear> gearEntry1, ContentEntry<Gear> gearEntry2)
                {
                    // handle null values
                    if ((gearEntry1 == null) || (gearEntry1.Content == null))
                    {
                        return ((gearEntry2 == null) || (gearEntry2.Content == null) ?
                            0 : 1);
                    }
                    else if ((gearEntry2 == null) || (gearEntry2.Content == null))
                    {
                        return -1;
                    }

                    // sort by name
                    return gearEntry1.Content.Name.CompareTo(gearEntry2.Content.Name);
                });

            // set up the initial selected-quantity values
            ResetSelectedQuantity();

            // configure the menu strings
            titleText = chestEntry.Content.Name;
            selectButtonText = "Take";
            backButtonText = "Close";
            xButtonText = String.Empty;
            yButtonText = "Take All";
            leftTriggerText = String.Empty;
            rightTriggerText = String.Empty;
        }
        /// <summary>
        /// Set the map in use by the tile engine.
        /// </summary>
        /// <param name="map">The new map for the tile engine.</param>
        /// <param name="portal">The portal the party is entering on, if any.</param>
        public static void SetMap(Map newMap, MapEntry<Portal> portalEntry)
        {
            // check the parameter
            if (newMap == null)
            {
                throw new ArgumentNullException("newMap");
            }

            // assign the new map
            map = newMap;

            // reset the map origin, which will be recalculate on the first update
            mapOriginPosition = Vector2.Zero;

            // move the party to its initial position
            if (portalEntry == null)
            {
                // no portal - use the spawn position
                partyLeaderPosition.TilePosition = map.SpawnMapPosition;
                partyLeaderPosition.TileOffset = Vector2.Zero;
                partyLeaderPosition.Direction = Direction.South;
            }
            else
            {
                // use the portal provided, which may include automatic movement
                partyLeaderPosition.TilePosition = portalEntry.MapPosition;
                partyLeaderPosition.TileOffset = Vector2.Zero;
                partyLeaderPosition.Direction = portalEntry.Direction;
                autoPartyLeaderMovement = Vector2.Multiply(
                    new Vector2(map.TileSize.X, map.TileSize.Y), new Vector2(
                    portalEntry.Content.LandingMapPosition.X - 
                        partyLeaderPosition.TilePosition.X,
                    portalEntry.Content.LandingMapPosition.Y - 
                        partyLeaderPosition.TilePosition.Y));
            }
        }
Example #4
0
        private static MapEntry parseLine(string line)
        {
            MapEntry entry = new MapEntry();

            int mode = 0;
            //00: TypeName
            //01: Name
            string current = "";
            foreach (char c in line)
            {
                if (mode == 0)
                {
                    if (c != '[')
                        current += c;
                    else
                    {
                        entry.TypeName = current.Trim();
                        current = "";
                        mode = 1;
                    }
                }
                else if (mode == 1)
                {
                    if (c != ']')
                        current += c;
                    else
                    {
                        entry.EntryName = current.Trim();
                        current = "";
                        mode = 2;
                    }
                }
                else if (mode == 2)
                {
                    if (c != '|')
                        current += c;
                    else
                    {
                        entry.Values.Add(current.Trim());
                        current = "";
                    }
                }
            }

            entry.Values.Add(current.Trim());
            return entry;
        }
Example #5
0
        /// <summary>
        /// Performs the actions associated with encountering a FixedCombat entry.
        /// </summary>
        public static void EncounterFixedCombat(MapEntry<FixedCombat> fixedCombatEntry)
        {
            // check the parameter
            if ((fixedCombatEntry == null) || (fixedCombatEntry.Content == null))
            {
                throw new ArgumentNullException("fixedCombatEntry");
            }

            if (!CombatEngine.IsActive)
            {
                // start combat
                CombatEngine.StartNewCombat(fixedCombatEntry);
            }
        }
Example #6
0
            /// <summary>
            /// Builds an <see cref="SynonymMap"/> and returns it.
            /// </summary>
            public virtual SynonymMap Build()
            {
                ByteSequenceOutputs outputs = ByteSequenceOutputs.Singleton;
                // TODO: are we using the best sharing options?
                var builder = new Builder <BytesRef>(FST.INPUT_TYPE.BYTE4, outputs);

                BytesRef            scratch       = new BytesRef(64);
                ByteArrayDataOutput scratchOutput = new ByteArrayDataOutput();

                ISet <int?> dedupSet;

                if (dedup)
                {
                    dedupSet = new JCG.HashSet <int?>();
                }
                else
                {
                    dedupSet = null;
                }


                var spare = new byte[5];

                ICollection <CharsRef> keys = workingSet.Keys;

                CharsRef[] sortedKeys = new CharsRef[keys.Count];
                keys.CopyTo(sortedKeys, 0);
#pragma warning disable 612, 618
                System.Array.Sort(sortedKeys, CharsRef.UTF16SortedAsUTF8Comparer);
#pragma warning restore 612, 618


                Int32sRef scratchIntsRef = new Int32sRef();

                //System.out.println("fmap.build");
                for (int keyIdx = 0; keyIdx < sortedKeys.Length; keyIdx++)
                {
                    CharsRef input  = sortedKeys[keyIdx];
                    MapEntry output = workingSet[input];

                    int numEntries = output.ords.Count;
                    // output size, assume the worst case
                    int estimatedSize = 5 + numEntries * 5; // numEntries + one ord for each entry

                    scratch.Grow(estimatedSize);
                    scratchOutput.Reset(scratch.Bytes, scratch.Offset, scratch.Bytes.Length);
                    if (Debugging.AssertsEnabled)
                    {
                        Debugging.Assert(scratch.Offset == 0);
                    }

                    // now write our output data:
                    int count = 0;
                    for (int i = 0; i < numEntries; i++)
                    {
                        if (dedupSet != null)
                        {
                            // box once
                            int?ent = output.ords[i];
                            if (dedupSet.Contains(ent))
                            {
                                continue;
                            }
                            dedupSet.Add(ent);
                        }
                        scratchOutput.WriteVInt32(output.ords[i]);
                        count++;
                    }

                    int pos = scratchOutput.Position;
                    scratchOutput.WriteVInt32(count << 1 | (output.includeOrig ? 0 : 1));
                    int pos2    = scratchOutput.Position;
                    int vIntLen = pos2 - pos;

                    // Move the count + includeOrig to the front of the byte[]:
                    Array.Copy(scratch.Bytes, pos, spare, 0, vIntLen);
                    Array.Copy(scratch.Bytes, 0, scratch.Bytes, vIntLen, pos);
                    Array.Copy(spare, 0, scratch.Bytes, 0, vIntLen);

                    if (dedupSet != null)
                    {
                        dedupSet.Clear();
                    }

                    scratch.Length = scratchOutput.Position - scratch.Offset;
                    //System.out.println("  add input=" + input + " output=" + scratch + " offset=" + scratch.offset + " length=" + scratch.length + " count=" + count);
                    builder.Add(Lucene.Net.Util.Fst.Util.ToUTF32(input.ToString(), scratchIntsRef), BytesRef.DeepCopyOf(scratch));
                }

                FST <BytesRef> fst = builder.Finish();
                return(new SynonymMap(fst, words, maxHorizontalContext));
            }
Example #7
0
        static void Main(string[] args)
        {
            ReadSettings();

            ParseArgs(args);

            if (String.IsNullOrWhiteSpace(ServerSpec))
            {
                Console.WriteLine("Must specify a server connection (host:port)!");
                Environment.Exit(1);
            }
            if (String.IsNullOrWhiteSpace(User))
            {
                Console.WriteLine("Must specify a user!");
                Environment.Exit(1);
            }

            DateTime buildTime = DateTime.Now;
            String buildId = buildTime.ToString("MMddyyHHmmss");
            String buildFolder = buildTime.ToString("MM-dd-yy_HHmmss");
            String buildPath = Path.Combine(Environment.CurrentDirectory, buildFolder);

            int idx = 0;
            while ((Directory.Exists(buildPath)) && (idx < 26))
            {
                buildPath = Path.Combine(Environment.CurrentDirectory, buildTime.ToString("MM-dd-yy HHmmss") + ((char)((int)'a' + idx)));
            }
            if (idx >= 26)
                Environment.Exit(1);

            Directory.CreateDirectory(buildPath);

            Server pServer = new Server(new ServerAddress(ServerSpec));
            Repository rep = new Repository(pServer);

            using (Connection con = rep.Connection)
            {
                con.UserName = User;
                con.Client = new Client();
                con.Client.Name = Workspace;
                Options options = new Options();
                options["Password"] = Password;

                con.Connect(options);

                Client buildClient = new Client();

                buildClient.Name = "p4apinet_solution_builder_sample_application_client";
                buildClient.OwnerName = User;
                buildClient.ViewMap = new ViewMap();
                buildClient.Root = buildPath;
                buildClient.Options = ClientOption.AllWrite;
                buildClient.LineEnd = LineEnd.Local;
                buildClient.SubmitOptions = new ClientSubmitOptions(false, SubmitType.SubmitUnchanged);

                string depotPath = Target;
                if (Target.EndsWith(".sln"))
                {
                    depotPath = Target.Substring(0, Target.LastIndexOf('/'));
                }
                string depotFolder = depotPath.Substring(depotPath.LastIndexOf('/') + 1);

                depotPath += "/...";

                String clientPath = String.Format("//{0}/{1}/...", buildClient.Name, depotFolder);

                MapEntry entry = new MapEntry(MapType.Include, new DepotPath(depotPath), new ClientPath(clientPath));

                buildClient.ViewMap.Add(entry);

                Console.Write("Creating "+buildClient.Name+"...\r\n");

                rep.CreateClient(buildClient);

                con.Disconnect(null);
                con.Client = new Client();
                con.Client.Name = buildClient.Name;
                con.Connect(options);

                Console.Write("Running command 'p4 sync -p...\r\n");

                Options sFlags = new Options(SyncFilesCmdFlags.PopulateClient, -1);

                IList<FileSpec> rFiles = con.Client.SyncFiles(sFlags, null);

                Console.Write("Deleting " + buildClient.Name + "...\r\n");
                rep.DeleteClient(buildClient, null);

                string localPath = clientPath;
                localPath = localPath.TrimStart('/');
                localPath = localPath.TrimEnd('.');
                localPath = localPath.Substring(localPath.IndexOf('/') + 1);
                localPath = localPath.Replace('/', '\\');
                string solutionName = Target.Substring(depotPath.LastIndexOf('/'));
                solutionName = solutionName.TrimStart('/');
                localPath = Path.Combine(buildPath, localPath, solutionName);

                RunBuidProc(localPath);
            }
        }
Example #8
0
        /// <summary>
        /// Stores the entry for a chest on the current map or quest that has been
        /// modified but not emptied.
        /// </summary>
        public static void StoreModifiedChest(MapEntry<Chest> mapEntry)
        {
            // check the parameter
            if ((mapEntry == null) || (mapEntry.Content == null))
            {
                throw new ArgumentNullException("mapEntry");
            }

            Predicate<ModifiedChestEntry> checkModifiedChests =
                delegate(ModifiedChestEntry entry)
                {
                    return
                        (TileEngine.Map.AssetName.EndsWith(
                            entry.WorldEntry.MapContentName) &&
                        (entry.WorldEntry.ContentName == mapEntry.ContentName) &&
                        (entry.WorldEntry.MapPosition == mapEntry.MapPosition));
                };

            // check the map for the item first
            if ((TileEngine.Map != null) && TileEngine.Map.ChestEntries.Exists(
                delegate(MapEntry<Chest> entry)
                {
                    return ((entry.ContentName == mapEntry.ContentName) &&
                        (entry.MapPosition == mapEntry.MapPosition));
                }))
            {
                singleton.modifiedMapChests.RemoveAll(checkModifiedChests);
                ModifiedChestEntry modifiedChestEntry = new ModifiedChestEntry();
                modifiedChestEntry.WorldEntry.Content = mapEntry.Content;
                modifiedChestEntry.WorldEntry.ContentName = mapEntry.ContentName;
                modifiedChestEntry.WorldEntry.Count = mapEntry.Count;
                modifiedChestEntry.WorldEntry.Direction = mapEntry.Direction;
                modifiedChestEntry.WorldEntry.MapContentName =
                    TileEngine.Map.AssetName;
                modifiedChestEntry.WorldEntry.MapPosition = mapEntry.MapPosition;
                Chest chest = mapEntry.Content;
                modifiedChestEntry.ChestEntries.AddRange(chest.Entries);
                modifiedChestEntry.Gold = chest.Gold;
                singleton.modifiedMapChests.Add(modifiedChestEntry);
                return;
            }

            // look for the map entry within the quest
            if ((singleton.quest != null) && singleton.quest.ChestEntries.Exists(
                delegate(WorldEntry<Chest> entry)
                {
                    return ((entry.ContentName == mapEntry.ContentName) &&
                        (entry.MapPosition == mapEntry.MapPosition) &&
                        TileEngine.Map.AssetName.EndsWith(entry.MapContentName));
                }))
            {
                singleton.modifiedQuestChests.RemoveAll(checkModifiedChests);
                ModifiedChestEntry modifiedChestEntry = new ModifiedChestEntry();
                modifiedChestEntry.WorldEntry.Content = mapEntry.Content;
                modifiedChestEntry.WorldEntry.ContentName = mapEntry.ContentName;
                modifiedChestEntry.WorldEntry.Count = mapEntry.Count;
                modifiedChestEntry.WorldEntry.Direction = mapEntry.Direction;
                modifiedChestEntry.WorldEntry.MapContentName = TileEngine.Map.AssetName;
                modifiedChestEntry.WorldEntry.MapPosition = mapEntry.MapPosition;
                Chest chest = mapEntry.Content;
                modifiedChestEntry.ChestEntries.AddRange(chest.Entries);
                modifiedChestEntry.Gold = chest.Gold;
                singleton.modifiedQuestChests.Add(modifiedChestEntry);
                return;
            }
        }
Example #9
0
 internal void OnDBDReceive(IPHeader ipHeader, OspfHeader ospfHeader, Tuple<OspfDbdHeader, OspfLsaHeader[]> dbdHeaderData)
 {
     lock (Lock)
     {
         Log.Write("OSPF", "NEIGHBOR", string.Format("DBD received. From: {0}, State: {1}", ospfHeader.RouterID, OspfNeighborState));
         var tupleData = new Tuple<IPHeader, OspfHeader, Tuple<OspfDbdHeader, OspfLsaHeader[]>>(ipHeader, ospfHeader, dbdHeaderData);
         var ospfDBDHeader = dbdHeaderData.Item1;
         var ospfLsaHeaderArray = (OspfLsaHeader[])dbdHeaderData.Item2;
         switch (OspfNeighborState)
         {
             case OspfNeighborState.Down:
             case OspfNeighborState.Attempt:
                 return;
             case OspfNeighborState.Init:
                 RaiseEvent(NeighborEventType.TwoWayReceived, new Tuple<IPHeader, OspfHeader, Tuple<IPAddress, IPAddress>>(ipHeader, ospfHeader,
                                                                                                                               new Tuple<IPAddress, IPAddress>(DR, BDR)));
                 return;
             case OspfNeighborState.TwoWay:
                 return;
             case OspfNeighborState.ExStart:
                 if (ospfDBDHeader.IsInitial &&
                     ospfDBDHeader.HasMore &&
                     ospfDBDHeader.IsMaster &&
                     (dbdHeaderData.Item2 == null || ospfLsaHeaderArray.Length == 0) &&
                     ospfHeader.RouterID > Module.RouterID)
                 {
                     Log.Write("OSPF", "NEIGHBOR---------EXSTART", "IS SLAVE TO " + ospfHeader.RouterID);
                     LocalMSState = MasterSlaveState.Slave;
                     _dbdPendingAck = null;
                     DDSequenceNumber = ospfDBDHeader.SequenceNumber;
                     LastOspfDBDSeen = ospfDBDHeader;
                     DiscoveredOptions = ospfDBDHeader.OspfOptions;
                     RaiseEvent(NeighborEventType.NegotiationDone);
                     ProcessDBD(tupleData);
                 }
                 else if (!ospfDBDHeader.IsInitial && !ospfDBDHeader.IsMaster &&
                          DDSequenceNumber == dbdHeaderData.Item1.SequenceNumber &&
                          ospfHeader.RouterID < Module.RouterID)
                 {
                     Log.Write("OSPF", "NEIGHBOR---------EXSTART", "IS MASTER OF" + ospfHeader.RouterID);
                     LocalMSState = MasterSlaveState.Master;
                     _dbdPendingAck = null;
                     LastOspfDBDSeen = ospfDBDHeader;
                     DiscoveredOptions = ospfDBDHeader.OspfOptions;
                     RaiseEvent(NeighborEventType.NegotiationDone);
                     ProcessDBD(tupleData);
                 }
                 return;
             case OspfNeighborState.Exchange:
                 //TODO: duplicate check?
                 if (dbdHeaderData.Item1.IsMaster && LocalMSState == MasterSlaveState.Master)
                 {
                     RaiseEvent(NeighborEventType.SeqNumberMismatch,
                                new Tuple<IPHeader, OspfHeader, Tuple<OspfDbdHeader, OspfLsaHeader[]>>(ipHeader, ospfHeader,
                                                                                                             new Tuple<OspfDbdHeader, OspfLsaHeader[]>(ospfDBDHeader, null)));
                     return;
                 }
                 else if (!dbdHeaderData.Item1.IsMaster && LocalMSState == MasterSlaveState.Slave)
                 {
                     RaiseEvent(NeighborEventType.SeqNumberMismatch,
                                new Tuple<IPHeader, OspfHeader, Tuple<OspfDbdHeader, OspfLsaHeader[]>>(ipHeader, ospfHeader,
                                                                                                             new Tuple<OspfDbdHeader, OspfLsaHeader[]>(ospfDBDHeader, null)));
                     return;
                 }
                 else if (dbdHeaderData.Item1.IsInitial)
                 {
                     RaiseEvent(NeighborEventType.SeqNumberMismatch, tupleData);
                     return;
                 }
                 else if (dbdHeaderData.Item1.OspfOptions != DiscoveredOptions)
                 {
                     RaiseEvent(NeighborEventType.SeqNumberMismatch, tupleData);
                     return;
                 }
                 else if ((LocalMSState == MasterSlaveState.Master && dbdHeaderData.Item1.SequenceNumber == DDSequenceNumber) ||
                          (LocalMSState == MasterSlaveState.Slave && dbdHeaderData.Item1.SequenceNumber == DDSequenceNumber + 1))
                 {
                     LastOspfDBDSeen = dbdHeaderData.Item1;
                     ProcessDBD(tupleData);
                     RaiseEvent(NeighborEventType.ExchangeDone);
                     return;
                 }
                 else
                 {
                     RaiseEvent(NeighborEventType.SeqNumberMismatch, tupleData);
                     return;
                 }
             case OspfNeighborState.Loading:
                 break;
             case OspfNeighborState.Full:
                 break;
             default:
                 throw new ArgumentOutOfRangeException();
         }
     }
 }
Example #10
0
 private void SendDBDReady()
 {
     if (_dbdPendingAck != null && (DateTime.Now - _dbdSendTimerLastSend).Seconds >= Interface.RxmtInterval)
     {
         _dbdSendList.Add(_dbdPendingAck.Key, _dbdPendingAck.Value);
         _dbdPendingAck = null;
     }
     if (_dbdPendingAck == null && _dbdSendList.Count > 0)
     {
         var dbd = _dbdSendList.OrderBy(p => p.Key).FirstOrDefault();
         _dbdSendList.Remove(dbd.Key);
         if (dbd.Value != null)
         {
             _dbdPendingAck = MapEntry<uint, Tuple<IPAddress, OspfDbdHeader, OspfLlsDataBlockHeader, OspfLlsDataBlockTlv>>.Create(dbd.Key, dbd.Value);
             _dbdSendTimerLastSend = DateTime.Now;
             var count = dbd.Value.Item2.LsaList == null ? 0 : dbd.Value.Item2.LsaList.Count;
             Log.Write("OSPF", "NEIGHBOR", string.Format("Sending DBD (to {0}). SN: {1}, LSA count: {2}, List count: {3}", dbd.Value.Item1, dbd.Value.Item2.SequenceNumber, count, _dbdSendList.Count));
             SendDBD(dbd.Value);
         }
     }
 }
 public void Add(ITaskItem item, bool includedByDefault)
 {
     string targetPath = GetItemTargetPath(item);
     Debug.Assert(!String.IsNullOrEmpty(targetPath));
     if (String.IsNullOrEmpty(targetPath)) return;
     string key = targetPath.ToLowerInvariant();
     Debug.Assert(!_dictionary.ContainsKey(key), String.Format(CultureInfo.CurrentCulture, "Two or more items with same '{0}' attribute detected", ItemMetadataNames.targetPath));
     MapEntry entry = new MapEntry(item, includedByDefault);
     if (!_dictionary.ContainsKey(key))
         _dictionary.Add(key, entry);
 }
Example #12
0
        private void RunBuild(bool async)
        {
            DateTime buildTime = DateTime.Now;
            String buildId = buildTime.ToString("MMddyyHHmmss");
            String buildFolder = buildTime.ToString("MM-dd-yy_HHmmss");
            String buildPath = Path.Combine(mBuildFolderTxt.Text, buildFolder);

            int idx = 0;
            while ((Directory.Exists(buildPath)) && (idx < 26))
            {
                buildPath = Path.Combine(mBuildFolderTxt.Text, buildTime.ToString("MM-dd-yy HHmmss") + ((char)((int)'a' + idx)));
            }
            if (idx >= 26)
                return;

            string logFile = Path.Combine(buildPath, "BuildLog.txt");

            Directory.CreateDirectory(buildPath);

            String ConStr = mServerConnection.Text;
            String User = mUserText.Text;
            String Password = mPaswordTxt.Text;
            String Target = mSolutionPath.Text;
            Server pServer = new Server(new ServerAddress(ConStr));
            rep = new Repository(pServer);

            Connection con = rep.Connection;

            con.Connect(null);
            log = new StreamWriter(logFile);

            Client buildClient = new Client();

            buildClient.Name = "p4apinet_solution_builder_sample_application_client";
            buildClient.OwnerName = con.UserName;
            buildClient.ViewMap = new ViewMap();
            buildClient.Root = buildPath;
            buildClient.Options = ClientOption.AllWrite;
            buildClient.LineEnd = LineEnd.Local;
            buildClient.SubmitOptions = new ClientSubmitOptions(false, SubmitType.SubmitUnchanged);

            string depotPath = mSolutionPath.Text;

            IList<FileMetaData> fmd = null;

            try
            {
                fmd = rep.GetFileMetaData(null, FileSpec.DepotSpec(depotPath));
            }

            catch{}

            if (( fmd == null) || (fmd.Count !=1))
            {
                string message = string.Format("The solution file \"{0}\" does not exist in the depot.", depotPath);
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (mSolutionPath.Text.EndsWith(".sln"))
            {
                depotPath = mSolutionPath.Text.Substring(0, mSolutionPath.Text.LastIndexOf('/'));
            }
                string depotFolder = depotPath.Substring(depotPath.LastIndexOf('/') + 1);

                depotPath += "/...";

                String clientPath = String.Format("//{0}/{1}/...", buildClient.Name, depotFolder);

                MapEntry entry = new MapEntry(MapType.Include, new DepotPath(depotPath), new ClientPath(clientPath));

                buildClient.ViewMap.Add(entry);

                rep.CreateClient(buildClient);
                con.Client = rep.GetClient(buildClient.Name);

                string localPath = clientPath;
                localPath = localPath.TrimStart('/');
                localPath = localPath.TrimEnd('.');
                localPath = localPath.Substring(localPath.IndexOf('/') + 1);
                localPath = localPath.Replace('/', '\\');
                string solutionName = Target.Substring(depotPath.LastIndexOf('/'));
                solutionName = solutionName.TrimStart('/');
                localPath = Path.Combine(buildPath, localPath, solutionName);

                int lastChange = GetLastChange();
                AsynchSetLastChange(lastChange);

                IList<Changelist> changes = GetChangesAfter(changeAtLastBuild, lastChange);

                 changeAtLastBuild = lastChange;

                if (changes != null)
                {
                    for (idx = 0; idx < changes.Count; idx++)
                    {
                        AsynchAddLineToLog(changes[idx].ToString(true));
                    }
                }

                if (async)
                {
                    Thread buildThread = new Thread(new ParameterizedThreadStart(RunBuildProc));
                    buildThread.IsBackground = true;
                    buildThread.Start(localPath);
                }
                else
                {
                    RunBuildProc(localPath);
                }

                con.Disconnect(null);
        }
Example #13
0
 private void Start()
 {
     map = (MapEntry)currentMap.value;
 }
Example #14
0
        public override string ToString()
        {
            var  sb      = new StringBuilder("TTypeEntry(");
            bool __first = true;

            if (PrimitiveEntry != null && __isset.primitiveEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("PrimitiveEntry: ");
                sb.Append(PrimitiveEntry == null ? "<null>" : PrimitiveEntry.ToString());
            }
            if (ArrayEntry != null && __isset.arrayEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("ArrayEntry: ");
                sb.Append(ArrayEntry == null ? "<null>" : ArrayEntry.ToString());
            }
            if (MapEntry != null && __isset.mapEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("MapEntry: ");
                sb.Append(MapEntry == null ? "<null>" : MapEntry.ToString());
            }
            if (StructEntry != null && __isset.structEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("StructEntry: ");
                sb.Append(StructEntry == null ? "<null>" : StructEntry.ToString());
            }
            if (UnionEntry != null && __isset.unionEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("UnionEntry: ");
                sb.Append(UnionEntry == null ? "<null>" : UnionEntry.ToString());
            }
            if (UserDefinedTypeEntry != null && __isset.userDefinedTypeEntry)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("UserDefinedTypeEntry: ");
                sb.Append(UserDefinedTypeEntry == null ? "<null>" : UserDefinedTypeEntry.ToString());
            }
            sb.Append(")");
            return(sb.ToString());
        }
Example #15
0
 protected override void disable()
 {
     selectedEntry = null;
     //selectionPanel.Visible = false;
     level.RemoveNode(cursor);
 }
Example #16
0
        public override void Update(float time, float dTime)
        {
            MouseUsed = Window.MouseLeftDown;

            if (selectedEntry != null)
            {
                return;
            }

            Vector3 rayStart = EngineBase.Renderer.Unproject(Window.MousePos, 0f);
            Vector3 rayEnd   = EngineBase.Renderer.Unproject(Window.MousePos, 1f);
            Vector3 dir      = (rayEnd - rayStart).Normalized();

            Editor.Profiler.Begin("RAYCAST");
            RayCastResult rc = level.Collisions.RayCast(rayStart, dir);

            Editor.Profiler.End("RAYCAST");

            if (rc.Hit)
            {
                level.AddNode(cursor);

                float h    = rc.PositionOfEntry.Y;
                int   mode = rc.PositionEntry.Column == null ? 1 : 0;

                cursor.Configure(0,
                                 level.Terrain.GetMapEntry(rc.PositionEntry.X + 1, rc.PositionEntry.Z).Height - h,
                                 level.Terrain.GetMapEntry(rc.PositionEntry.X + 1, rc.PositionEntry.Z + 1).Height - h,
                                 level.Terrain.GetMapEntry(rc.PositionEntry.X, rc.PositionEntry.Z + 1).Height - h,
                                 mode, cursorColors[mode]
                                 );

                cursor.Position = rc.PositionOfEntry;

                if (Window.MouseLeftDown && selectedEntry == null)
                {
                    selectedEntry = rc.PositionEntry;
                    level.FocusMapEntry(rc.PositionEntry);
                    showEditPanel();

                    /*
                     * foreach(ListItem item in columnsList.Items)
                     * {
                     *  KeyValuePair<int, ColumnDefinition> pair = (KeyValuePair<int, ColumnDefinition>)item.Tag;
                     *  if (pair.Key == selectedEntry.Column.ID)
                     *  {
                     *      item.Selected = true;
                     *      return;
                     *  }
                     * }
                     */
                    //columnsList.SelectItemByTag(selectedEntry.Column);
                }

                //if (Window.MouseLeftDown) editPanel.Visible = true;
            }
            else
            {
                level.RemoveNode(cursor);
            }

            base.Update(time, dTime);
        }
Example #17
0
 private void closeEditPanel(Button obj)
 {
     editPanel.Visible = false;
     selectedEntry     = null;
 }
Example #18
0
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("TTypeEntry");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                if (PrimitiveEntry != null && __isset.primitiveEntry)
                {
                    field.Name = "primitiveEntry";
                    field.Type = TType.Struct;
                    field.ID   = 1;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await PrimitiveEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (ArrayEntry != null && __isset.arrayEntry)
                {
                    field.Name = "arrayEntry";
                    field.Type = TType.Struct;
                    field.ID   = 2;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await ArrayEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (MapEntry != null && __isset.mapEntry)
                {
                    field.Name = "mapEntry";
                    field.Type = TType.Struct;
                    field.ID   = 3;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await MapEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (StructEntry != null && __isset.structEntry)
                {
                    field.Name = "structEntry";
                    field.Type = TType.Struct;
                    field.ID   = 4;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await StructEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (UnionEntry != null && __isset.unionEntry)
                {
                    field.Name = "unionEntry";
                    field.Type = TType.Struct;
                    field.ID   = 5;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await UnionEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (UserDefinedTypeEntry != null && __isset.userDefinedTypeEntry)
                {
                    field.Name = "userDefinedTypeEntry";
                    field.Type = TType.Struct;
                    field.ID   = 6;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await UserDefinedTypeEntry.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Example #19
0
		internal bool GetSuccessorEntry(MapEntry entry, ref MapEntry successorEntry)
		{
			successorEntry = GetSuccessor((Node)entry);
			return successorEntry != null;
		}
Example #20
0
		// NOTE: while it's tempting to make this public, since
		// caller's parser likely knows the
		// numInput/numOutputWords, sneaky exceptions, much later
		// on, will result if these values are wrong; so we always
		// recompute ourselves to be safe:
		internal virtual void Add(CharsRef input, int numInputWords, CharsRef output, int numOutputWords, bool includeOrig)
		{
		  // first convert to UTF-8
		  if (numInputWords <= 0)
		  {
			throw new System.ArgumentException("numInputWords must be > 0 (got " + numInputWords + ")");
		  }
		  if (input.Length <= 0)
		  {
			throw new System.ArgumentException("input.length must be > 0 (got " + input.Length + ")");
		  }
		  if (numOutputWords <= 0)
		  {
			throw new System.ArgumentException("numOutputWords must be > 0 (got " + numOutputWords + ")");
		  }
		  if (output.Length <= 0)
		  {
			throw new System.ArgumentException("output.length must be > 0 (got " + output.Length + ")");
		  }

		  Debug.Assert(!HasHoles(input), "input has holes: " + input);
		  Debug.Assert(!HasHoles(output), "output has holes: " + output);

		  //System.out.println("fmap.add input=" + input + " numInputWords=" + numInputWords + " output=" + output + " numOutputWords=" + numOutputWords);
		  UnicodeUtil.UTF16toUTF8(output.Chars, output.Offset, output.Length, utf8Scratch);
		  // lookup in hash
		  int ord = words.Add(utf8Scratch);
		  if (ord < 0)
		  {
			// already exists in our hash
			ord = (-ord) - 1;
			//System.out.println("  output=" + output + " old ord=" + ord);
		  }
		  else
		  {
			//System.out.println("  output=" + output + " new ord=" + ord);
		  }

		  MapEntry e = workingSet[input];
		  if (e == null)
		  {
			e = new MapEntry();
			workingSet[CharsRef.DeepCopyOf(input)] = e; // make a copy, since we will keep around in our map
		  }

		  e.ords.Add(ord);
		  e.includeOrig |= includeOrig;
		  maxHorizontalContext = Math.Max(maxHorizontalContext, numInputWords);
		  maxHorizontalContext = Math.Max(maxHorizontalContext, numOutputWords);
		}
Example #21
0
		internal bool GetPredecessorEntry(MapEntry entry, ref MapEntry predecessorEntry)
		{
			predecessorEntry = GetPredecessor((Node)entry);
			return predecessorEntry != null;
		}
Example #22
0
 private void ProcessAdjacency(Tuple<IPAddress, IPAddress, IPAddress> tupleData)
 {
     OspfNeighborState = OspfNeighborState.ExStart;
     if (_hasAttemptedAdjacency)
     {
         DDSequenceNumber++;
     }
     else
     {
         //++ sending blank DBDs to start things off
         DDSequenceNumber = (uint)DateTime.Now.Ticks;
         LocalMSState = MasterSlaveState.Master;
         Action sendDBD = () =>
                          {
                              _dbdPendingAck = null;
                              PrepareSendDBD(tupleData.Item3, GetDBDOptions(isFirstRun: true, hasMore: true));
                          };
         //_dbdResendTimer = new Timer(1000);
         //_dbdResendTimer.Elapsed += (s, e) =>
         //                         {
         //                             //TODO: does this need a "stillWaitingOnFirst" check or something?
         //                             if ((DateTime.Now - _dbdSendTimerLastSend).Seconds == Interface.RxmtInterval)
         //                             {
         //                                 sendDBD();
         //                             }
         //                         };
         sendDBD();
         _dbdSendTimerLastSend = DateTime.Now;
         //_dbdResendTimer.Start();
         //TODO: should this ever be reset?
         _hasAttemptedAdjacency = true;
     }
 }
Example #23
0
		internal bool ContainsEntry(MapEntry entry)
		{
			Node node = FindNode(entry.getKey());
			return node != null && node.Value.Equals(entry.getValue());
		}
Example #24
0
        public void AddMapEntry(String key, MapEntry entry)
        {
            AccessLock.EnterWriteLock();

            if (!_mapEntries.ContainsKey(key))
                _mapEntries.Add(key, entry);

            if (!_mapNameLookup.ContainsKey(entry.ContinentId))
                _mapNameLookup.Add(entry.ContinentId, key);

            AccessLock.ExitWriteLock();
        }
Example #25
0
        /// <summary>
        /// Performs the actions associated with encountering a player-NPC entry.
        /// </summary>
        public static void EncounterPlayerNpc(MapEntry<Player> playerEntry)
        {
            // check the parameter
            if ((playerEntry == null) || (playerEntry.Content == null))
            {
                throw new ArgumentNullException("playerEntry");
            }

            // add the player-NPC screen
            singleton.screenManager.AddScreen(new PlayerNpcScreen(playerEntry));
        }
Example #26
0
        /// <summary>
        /// Remove the given player NPC entry from the current map or quest.
        /// </summary>
        public static void RemovePlayerNpc(MapEntry<Player> mapEntry)
        {
            // check the parameter
            if (mapEntry == null)
            {
                return;
            }

            // check the map for the item
            if (TileEngine.Map != null)
            {
                int removedEntries = TileEngine.Map.PlayerNpcEntries.RemoveAll(
                    delegate(MapEntry<Player> entry)
                    {
                        return ((entry.ContentName == mapEntry.ContentName) &&
                            (entry.MapPosition == mapEntry.MapPosition));
                    });
                if (removedEntries > 0)
                {
                    WorldEntry<Player> worldEntry = new WorldEntry<Player>();
                    worldEntry.Content = mapEntry.Content;
                    worldEntry.ContentName = mapEntry.ContentName;
                    worldEntry.Count = mapEntry.Count;
                    worldEntry.Direction = mapEntry.Direction;
                    worldEntry.MapContentName = TileEngine.Map.AssetName;
                    worldEntry.MapPosition = mapEntry.MapPosition;
                    singleton.removedMapPlayerNpcs.Add(worldEntry);
                    return;
                }
            }

            // quests don't have a list of player NPCs
        }
Example #27
0
        /// <summary>
        /// Performs the actions associated with encountering a QuestNpc entry.
        /// </summary>
        public static void EncounterQuestNpc(MapEntry<QuestNpc> questNpcEntry)
        {
            // check the parameter
            if ((questNpcEntry == null) || (questNpcEntry.Content == null))
            {
                throw new ArgumentNullException("questNpcEntry");
            }

            // add the quest-NPC screen
            singleton.screenManager.AddScreen(new QuestNpcScreen(questNpcEntry));
        }
Example #28
0
        /// <summary>
        /// Performs the actions associated with encountering a Chest entry.
        /// </summary>
        public static void EncounterChest(MapEntry<Chest> chestEntry)
        {
            // check the parameter
            if ((chestEntry == null) || (chestEntry.Content == null))
            {
                throw new ArgumentNullException("chestEntry");
            }

            // add the chest screen
            singleton.screenManager.AddScreen(new ChestScreen(chestEntry));
        }
Example #29
0
        /// <summary>
        /// Remove the given fixed-combat entry from the current map or quest.
        /// </summary>
        public static void RemoveFixedCombat(MapEntry<FixedCombat> mapEntry)
        {
            // check the parameter
            if (mapEntry == null)
            {
                return;
            }

            // check the map for the item first
            if (TileEngine.Map != null)
            {
                int removedEntries = TileEngine.Map.FixedCombatEntries.RemoveAll(
                    delegate(MapEntry<FixedCombat> entry)
                    {
                        return ((entry.ContentName == mapEntry.ContentName) &&
                            (entry.MapPosition == mapEntry.MapPosition));
                    });
                if (removedEntries > 0)
                {
                    WorldEntry<FixedCombat> worldEntry = new WorldEntry<FixedCombat>();
                    worldEntry.Content = mapEntry.Content;
                    worldEntry.ContentName = mapEntry.ContentName;
                    worldEntry.Count = mapEntry.Count;
                    worldEntry.Direction = mapEntry.Direction;
                    worldEntry.MapContentName = TileEngine.Map.AssetName;
                    worldEntry.MapPosition = mapEntry.MapPosition;
                    singleton.removedMapFixedCombats.Add(worldEntry);
                    return;
                }
            }

            // look for the map entry within the quest
            if (singleton.quest != null)
            {
                int removedEntries = singleton.quest.FixedCombatEntries.RemoveAll(
                    delegate(WorldEntry<FixedCombat> entry)
                    {
                        return ((entry.ContentName == mapEntry.ContentName) &&
                            (entry.MapPosition == mapEntry.MapPosition) &&
                            TileEngine.Map.AssetName.EndsWith(entry.MapContentName));
                    });
                if (removedEntries > 0)
                {
                    WorldEntry<FixedCombat> worldEntry = new WorldEntry<FixedCombat>();
                    worldEntry.Content = mapEntry.Content;
                    worldEntry.ContentName = mapEntry.ContentName;
                    worldEntry.Count = mapEntry.Count;
                    worldEntry.Direction = mapEntry.Direction;
                    worldEntry.MapContentName = TileEngine.Map.AssetName;
                    worldEntry.MapPosition = mapEntry.MapPosition;
                    singleton.removedQuestFixedCombats.Add(worldEntry);
                    return;
                }
            }
        }
Example #30
0
        /// <summary>
        /// Performs the actions associated with encountering an Inn entry.
        /// </summary>
        public static void EncounterInn(MapEntry<Inn> innEntry)
        {
            // check the parameter
            if ((innEntry == null) || (innEntry.Content == null))
            {
                throw new ArgumentNullException("innEntry");
            }

            // add the inn screen
            singleton.screenManager.AddScreen(new InnScreen(innEntry.Content));
        }
        private void GetOutputAssemblies(PublishInfo[] publishInfos, ref List <ITaskItem> assemblyList)
        {
            AssemblyMap map = new AssemblyMap();

            if (this.managedAssemblies != null)
            {
                foreach (ITaskItem item in this.managedAssemblies)
                {
                    if (!IsFiltered(item))
                    {
                        item.SetMetadata("AssemblyType", "Managed");
                        map.Add(item);
                    }
                }
            }
            if (this.nativeAssemblies != null)
            {
                foreach (ITaskItem item2 in this.nativeAssemblies)
                {
                    if (!IsFiltered(item2))
                    {
                        item2.SetMetadata("AssemblyType", "Native");
                        map.Add(item2);
                    }
                }
            }
            foreach (PublishInfo info in publishInfos)
            {
                MapEntry entry = map[info.key];
                if (entry != null)
                {
                    entry.publishInfo = info;
                }
                else
                {
                    base.Log.LogWarningWithCodeFromResources("ResolveManifestFiles.PublishFileNotFound", new object[] { info.key });
                }
            }
            foreach (MapEntry entry2 in (IEnumerable)map)
            {
                if (entry2.publishInfo == null)
                {
                    entry2.publishInfo = new PublishInfo();
                }
                if (entry2.publishInfo.state == PublishState.Auto)
                {
                    string metadata = entry2.item.GetMetadata("DependencyType");
                    if (string.Equals(metadata, "Prerequisite", StringComparison.Ordinal))
                    {
                        entry2.publishInfo.state = PublishState.Prerequisite;
                    }
                    else if (string.Equals(metadata, "Install", StringComparison.Ordinal))
                    {
                        entry2.publishInfo.state = PublishState.Include;
                    }
                }
                bool         itemCopyLocal = GetItemCopyLocal(entry2.item);
                PublishFlags assemblyFlags = PublishFlags.GetAssemblyFlags(entry2.publishInfo.state, itemCopyLocal);
                if ((assemblyFlags.IsPublished && string.Equals(entry2.publishInfo.includeHash, "false", StringComparison.OrdinalIgnoreCase)) && this.SigningManifests)
                {
                    this.canPublish = false;
                }
                if (assemblyFlags.IsPublished)
                {
                    assemblyList.Add(CreateAssemblyItem(entry2.item, entry2.publishInfo.group, entry2.publishInfo.targetPath, entry2.publishInfo.includeHash));
                }
                else if (assemblyFlags.IsPrerequisite)
                {
                    assemblyList.Add(CreatePrerequisiteItem(entry2.item));
                }
            }
        }
Example #32
0
        /// <summary>
        /// Performs the actions associated with encountering a Portal entry.
        /// </summary>
        public static void EncounterPortal(MapEntry<Portal> portalEntry)
        {
            // check the parameter
            if ((portalEntry == null) || (portalEntry.Content == null))
            {
                throw new ArgumentNullException("portalEntry");
            }

            // change to the new map
            ChangeMap(portalEntry.Content.DestinationMapContentName,
                portalEntry.Content);
        }
		public override void Get(FieldDescriptor ds_, IDataReader dr_)
		{
			switch( ds_.Pos )
			{
				case 0: Name = dr_.AsString(); break;
				case 1: { var _kv1_= new MapEntry(_rcmap_desc); dr_.AsMessage(_kv1_, ds_); _rcmap.Add(_kv1_); } break;
			}
		}
Example #34
0
        /// <summary>
        /// Performs the actions associated with encountering a Store entry.
        /// </summary>
        public static void EncounterStore(MapEntry<Store> storeEntry)
        {
            // check the parameter
            if ((storeEntry == null) || (storeEntry.Content == null))
            {
                throw new ArgumentNullException("storeEntry");
            }

            // add the store screen
            singleton.screenManager.AddScreen(new StoreScreen(storeEntry.Content));
        }
		public override void Get(FieldDescriptor ds_, IDataReader dr_)
		{
			switch( ds_.Pos )
			{
				case 0: Name = dr_.AsString(); break;
				case 1: { var _kv1_= new MapEntry(_m1_desc); dr_.AsMessage(_kv1_, ds_); _m1.Add(_kv1_); } break;
				case 2: { var _kv2_= new MapEntry(_m2_desc); dr_.AsMessage(_kv2_, ds_); _m2.Add(_kv2_); } break;
				case 3: { var _kv3_= new MapEntry(_m3_desc); dr_.AsMessage(_kv3_, ds_); _m3.Add(_kv3_); } break;
			}
		}
Example #36
0
        /// <summary>
        /// Start a new combat from the given FixedCombat object.
        /// </summary>
        public static void StartNewCombat(MapEntry<FixedCombat> fixedCombatEntry)
        {
            // check the parameter
            if (fixedCombatEntry == null)
            {
                throw new ArgumentNullException("fixedCombatEntry");
            }
            FixedCombat fixedCombat = fixedCombatEntry.Content;
            if (fixedCombat == null)
            {
                throw new ArgumentException("fixedCombatEntry has no content.");
            }

            // generate the monster combatant list
            List<CombatantMonster> generatedMonsters = new List<CombatantMonster>();
            foreach (ContentEntry<Monster> entry in fixedCombat.Entries)
            {
                for (int i = 0; i < entry.Count; i++)
                {
                    generatedMonsters.Add(
                        new CombatantMonster(entry.Content));
                }
            }

            // randomize the list of monsters
            List<CombatantMonster> randomizedMonsters = new List<CombatantMonster>();
            while ((generatedMonsters.Count > 0) && 
                (randomizedMonsters.Count <= MonsterPositions.Length))
            {
                int index = Session.Random.Next(generatedMonsters.Count);
                randomizedMonsters.Add(generatedMonsters[index]);
                generatedMonsters.RemoveAt(index);
            }

            // start the combat
            StartNewCombat(GenerateCombatantsFromParty(), randomizedMonsters, 0);
            singleton.fixedCombatEntry = fixedCombatEntry;
        }
Example #37
0
        /// <summary>
        /// Performs the actions associated with encountering a Portal entry.
        /// </summary>
        public static void EncounterPortal(MapEntry<Portal> portalEntry)
        {
            // check the parameter

            if (portalEntry == null)
            {

            }
            else if ((portalEntry.Content == null))
            {
                throw new ArgumentNullException("portalEntry");
            }

            if (singleton.fadeTransition == false)
            {
                singleton.fadeTransition = true;
                singleton.transitionMovement = TileEngine.userMovement;
                singleton.transitionPortal = portalEntry;
                loadFade(MAP_TRANSITION_FADE_TIME, 0, 1);
            }

            bool fadeFound = false;

            foreach (MapOverlay overlay in mapOverlays)
                if (overlay.name == "fade")
                    fadeFound = true;

            if (singleton.fadeTransition)
            {
                if (fadeFound)
                {
                    TileEngine.autoPartyLeaderMovement = singleton.transitionMovement;
                }
                else
                {
                    singleton.fadeTransition = false;
                    // change to the new map
                    ChangeMap(singleton.transitionPortal.Content.DestinationMapContentName,
                        singleton.transitionPortal.Content);
                }
            }
        }
Example #38
0
        /// <summary>
        /// Performs the actions associated with encountering a QuestNpc entry.
        /// </summary>
        public static void EncounterQuestNpc(MapEntry<QuestNpc> questNpcEntry)
        {
            // check the parameter
            if ((questNpcEntry == null) || (questNpcEntry.Content == null))
            {
                throw new ArgumentNullException("questNpcEntry");
            }

            // add the quest-NPC screen
            //singleton.screenManager.AddScreen(new QuestNpcScreen(questNpcEntry));

            foreach (Cutscene cutscene in singleton.cutscenes)
            {
                if (cutscene.name == questNpcEntry.Content.Name)
                    singleton.currentCutscene = cutscene;
            }
        }
        public void Should_Construct_MapResponse_From_DtUpdateResp()
        {
            var key     = new RiakString("riak_generated_key");
            var context = new RiakString("1234");

            var updateResp = new DtUpdateResp();

            updateResp.key     = key;
            updateResp.context = context;

            Func <IEnumerable <MapEntry> > createMapEntries = () =>
            {
                var mapEntries = new List <MapEntry>();

                var mapField = new MapField();
                mapField.type = MapField.MapFieldType.COUNTER;
                mapField.name = new RiakString("counter_1");
                var mapEntry = new MapEntry();
                mapEntry.field         = mapField;
                mapEntry.counter_value = 50;
                mapEntries.Add(mapEntry);

                mapField       = new MapField();
                mapField.type  = MapField.MapFieldType.SET;
                mapField.name  = new RiakString("set_1");
                mapEntry       = new MapEntry();
                mapEntry.field = mapField;
                mapEntry.set_value.Add(RiakString.ToBytes("value_1"));
                mapEntry.set_value.Add(RiakString.ToBytes("value_2"));
                mapEntries.Add(mapEntry);

                mapField                = new MapField();
                mapField.type           = MapField.MapFieldType.REGISTER;
                mapField.name           = new RiakString("register_1");
                mapEntry                = new MapEntry();
                mapEntry.field          = mapField;
                mapEntry.register_value = RiakString.ToBytes("1234");
                mapEntries.Add(mapEntry);

                mapField            = new MapField();
                mapField.type       = MapField.MapFieldType.FLAG;
                mapField.name       = new RiakString("flag_1");
                mapEntry            = new MapEntry();
                mapEntry.field      = mapField;
                mapEntry.flag_value = true;
                mapEntries.Add(mapEntry);

                return(mapEntries);
            };

            updateResp.map_value.AddRange(createMapEntries());

            var map_1_field = new MapField();

            map_1_field.type = MapField.MapFieldType.MAP;
            map_1_field.name = new RiakString("map_1");
            var map_1_entry = new MapEntry();

            map_1_entry.field = map_1_field;
            map_1_entry.map_value.AddRange(createMapEntries());

            updateResp.map_value.Add(map_1_entry);

            Action <Map> verifyMap = (map) =>
            {
                Assert.AreEqual(50, map.Counters["counter_1"]);
                Assert.AreEqual(RiakString.ToBytes("value_1"), map.Sets["set_1"][0]);
                Assert.AreEqual(RiakString.ToBytes("value_2"), map.Sets["set_1"][1]);
                Assert.AreEqual(RiakString.ToBytes("1234"), map.Registers["register_1"]);
                Assert.IsTrue(map.Flags["flag_1"]);
            };

            var mapOp = new UpdateMap.MapOperation();

            var update = new UpdateMap.Builder(mapOp)
                         .WithBucketType("maps")
                         .WithBucket("myBucket")
                         .WithKey("map_1")
                         .Build();

            update.OnSuccess(updateResp);

            MapResponse response = update.Response;

            Assert.NotNull(response);
            Assert.AreEqual(key, response.Key);
            Assert.AreEqual(RiakString.ToBytes(context), response.Context);

            verifyMap(response.Value);
            verifyMap(response.Value.Maps["map_1"]);
        }