public void ConnectToUnexistingHostFailsWithinTimeout(CompletionType completionType)
        {
            var sw = Stopwatch.StartNew();

            try
            {
                var config = new ConfigurationOptions
                {
                    EndPoints = { { "invalid", 1234 } },
                    ConnectTimeout = 1000
                };

                SocketManager.ConnectCompletionType = completionType;

                using (var muxer = ConnectionMultiplexer.Connect(config))
                {
                    Thread.Sleep(10000);
                }

                Assert.Fail("Connect should fail with RedisConnectionException exception");
            }
            catch (RedisConnectionException)
            {
                var elapsed = sw.ElapsedMilliseconds;
                if (elapsed > 9000) 
                {
                    Assert.Fail("Connect should fail within ConnectTimeout");
                }
            }
            finally
            {
                SocketManager.ConnectCompletionType = CompletionType.Any;
            }
        }
 protected CompletionContextInfo(CompletionType type, string filter, Key lastKey, char lastChar)
 {
     CompletionType = type;
     FilterText = filter;
     LastKeyPressed = lastKey;
     LastChar = lastChar;
 }
Beispiel #3
0
 private QuestStep(uint quest, byte step, CompletionType type, uint completionCount, uint completionID, uint owner)
 {
     _quest = quest;
     _step = step;
     _completionType = type;
     _completionCount = completionCount;
     _completionID = completionID;
     _ownerNPC = owner;
 }
        public IronPythonCompletionData(string text, string stub, bool isInstance, CompletionType type, IronPythonCompletionProvider provider)
        {
            this.Text = text;
            this.Stub = stub;
            this.IsInstance = isInstance;
            this.provider = provider;

            if (IronPythonCompletionData.TypeToIcon == null)
            {
                TypeToIcon = new Dictionary<CompletionType, BitmapImage>();
                var assembly = Assembly.GetExecutingAssembly();

                var bi = new BitmapImage();

                bi.BeginInit();
                bi.StreamSource = assembly.GetManifestResourceStream(@"DynamoPython.Resources.method.png");
                bi.EndInit();
                TypeToIcon.Add(CompletionType.METHOD, bi);

                var b2 = new BitmapImage();

                b2.BeginInit();
                b2.StreamSource = assembly.GetManifestResourceStream(@"DynamoPython.Resources.namespace.png");
                b2.EndInit();
                TypeToIcon.Add(CompletionType.NAMESPACE, b2);

                var b3 = new BitmapImage();

                b3.BeginInit();
                b3.StreamSource = assembly.GetManifestResourceStream(@"DynamoPython.Resources.field.png");
                b3.EndInit();
                TypeToIcon.Add(CompletionType.FIELD, b3);

                var b4 = new BitmapImage();

                b4.BeginInit();
                b4.StreamSource = assembly.GetManifestResourceStream(@"DynamoPython.Resources.class.png");
                b4.EndInit();
                TypeToIcon.Add(CompletionType.CLASS, b4);

                var b5 = new BitmapImage();

                b5.BeginInit();
                b5.StreamSource = assembly.GetManifestResourceStream(@"DynamoPython.Resources.property.png");
                b5.EndInit();
                TypeToIcon.Add(CompletionType.PROPERTY, b5);

                var b6 = new BitmapImage();

                b6.BeginInit();
                b6.StreamSource = assembly.GetManifestResourceStream(@"DynamoPython.Resources.property.png");
                b6.EndInit();
                TypeToIcon.Add(CompletionType.ENUM, b6);
            }

            this._image = TypeToIcon[type];
        }
        public IronPythonCompletionData(string text, string stub, bool isInstance, CompletionType type, IronPythonCompletionProvider provider)
        {
            this.Text = text;
            this.Stub = stub;
            this.IsInstance = isInstance;
            this.provider = provider;

            if (IronPythonCompletionData.TypeToIcon == null)
            {
                var assembly = Assembly.GetExecutingAssembly();

                TypeToIcon = new Dictionary<CompletionType, BitmapImage>();
                TypeToIcon.Add(CompletionType.METHOD, GetBitmapImage(assembly, "method.png"));
                TypeToIcon.Add(CompletionType.NAMESPACE, GetBitmapImage(assembly, @"namespace.png"));
                TypeToIcon.Add(CompletionType.FIELD, GetBitmapImage(assembly, @"field.png"));
                TypeToIcon.Add(CompletionType.CLASS, GetBitmapImage(assembly, @"class.png"));
                TypeToIcon.Add(CompletionType.PROPERTY, GetBitmapImage(assembly, @"property.png"));
                TypeToIcon.Add(CompletionType.ENUM, GetBitmapImage(assembly, @"property.png"));
            }

            this._image = TypeToIcon[type];
        }
Beispiel #6
0
        public RaceCompletedMode(CompletionType type)
        {
            _camera = new FixedChaseCamera(6.3f, 2.3f);
            _camera.FieldOfView = MathHelper.ToRadians(55.55f);
            _camera.RotationSpeed = 0.8f;
            _camera.MinHeight = 10;

            switch (type)
            {
                case CompletionType.Opponents:
                    MessageRenderer.Instance.PostHeaderMessage("Every opponent wasted!!", 10);
                    MessageRenderer.Instance.PostMainMessage("raceover.pix", 8, 0.7f, 0.003f, 1.4f);
                    SoundCache.Play(SoundIds.RaceCompleted, null, false);
                    SoundCache.Play(SoundIds.Clapping, null, false);
                    break;
                case CompletionType.Checkpoints:
                    MessageRenderer.Instance.PostHeaderMessage("All checkpoints passed!!", 10);
                    MessageRenderer.Instance.PostMainMessage("raceover.pix", 8, 0.7f, 0.003f, 1.4f);
                    SoundCache.Play(SoundIds.RaceCompleted, null, false);
                    SoundCache.Play(SoundIds.Clapping, null, false);
                    break;
                case CompletionType.Peds:
                    MessageRenderer.Instance.PostHeaderMessage("Every pedestrian murdered!!", 10);
                    MessageRenderer.Instance.PostMainMessage("raceover.pix", 8, 0.7f, 0.003f, 1.4f);
                    SoundCache.Play(SoundIds.RaceCompleted, null, false);
                    SoundCache.Play(SoundIds.Clapping, null, false);
                    break;
                case CompletionType.TimeUp:
                    MessageRenderer.Instance.PostMainMessage("timeup.pix", 8, 0.7f, 0.003f, 1.4f);
                    SoundCache.Play(SoundIds.OutOfTime, null, false);
                    break;
            }

            _camera.ResetRotation();
            _camera.RotateTo(MathHelper.Pi * 2);
            Engine.Camera = _camera;
        }
Beispiel #7
0
		IconId GetIcon(CompletionType type)
		{
			switch (type)
			{
				case CompletionType.Class:
					return Stock.Class;
				case CompletionType.Property:
					return Stock.Property;
				case CompletionType.Event:
					return Stock.Event;
				case CompletionType.Field:
					return Stock.Field;
				case CompletionType.Literal:
					return Stock.Literal;
				case CompletionType.Attribute:
					return null;
				default:
					throw new ArgumentOutOfRangeException();
			}
		}
 internal static CompletionDetails Create(
     string completionText,
     CompletionType completionType,
     string toolTipText = null,
     string symbolTypeName = null)
 {
     return new CompletionDetails
     {
         CompletionText = completionText,
         CompletionType = completionType,
         ToolTipText = toolTipText,
         SymbolTypeName = symbolTypeName
     };
 }
Beispiel #9
0
 public Completion(object value, CompletionType type)
 {
     ReturnValue = value;
     Type        = type;
 }
 internal CompletionData(string text, CompletionType type)
 {
     this.Text = text;
     this.Type = type;
 }
Beispiel #11
0
 partial void ShouldForceConnectCompletionType(ref CompletionType completionType)
 {
     completionType = SocketManager.ConnectCompletionType;
 }
 /// <summary>
 /// Test whether a list of Completion items contains an entry of the specified CompletionType
 /// </summary>
 /// <param name="completionList">The list of Completion items</param>
 /// <param name="completionType">The CompletionType to search for</param>
 /// <returns>Whether the list contains the searched CompletionType</returns>
 public Boolean contains(List<Completion> completionList, CompletionType completionType)
 {
     if (completionList != null)
     {
         foreach (Completion completion in completionList)
         {
             if (completion.getCompletionType().Equals(completionType))
             {
                 return true;
             }
         }
     }
     return false;
 }
Beispiel #13
0
 public IEnumerable <ObjectState> GetDesiredState(SchemaConnection connection, IOutput output)
 {
     yield return(CompletionType.Create());
 }
Beispiel #14
0
 public BooleanCompletion(CompletionType completionType, IValue?value, string?target, bool other) : base(completionType, value, target, other)
 {
 }
Beispiel #15
0
 public Completion(CompletionType completionType, IValue?value, string?target)
 {
     this.completionType = completionType;
     this.value          = value;
     this.target         = target;
 }
Beispiel #16
0
 public CompletionOr(CompletionType completionType, IValue?value, string?target, T other) : base(completionType, value, target)
 {
     Other = other;
 }
 public FileSystemAutoCompleteProvider(IFileSystemManager fileSystemManager, CompletionType completionType)
 {
     _fileSystemManager = fileSystemManager;
     _completionType = completionType;
 }
        internal SocketToken BeginConnect(EndPoint endpoint, ISocketCallback callback, ConnectionMultiplexer multiplexer, TextWriter log)
        {
            var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            SetFastLoopbackOption(socket);
            socket.NoDelay = true;
            try
            {
                CompletionType connectCompletionType = CompletionType.Any;
                this.ShouldForceConnectCompletionType(ref connectCompletionType);

                var formattedEndpoint = Format.ToString(endpoint);
                var tuple             = Tuple.Create(socket, callback);
                if (endpoint is DnsEndPoint)
                {
                    // A work-around for a Mono bug in BeginConnect(EndPoint endpoint, AsyncCallback callback, object state)
                    DnsEndPoint dnsEndpoint = (DnsEndPoint)endpoint;

#if CORE_CLR
                    multiplexer.LogLocked(log, "BeginConnect: {0}", formattedEndpoint);
                    socket.ConnectAsync(dnsEndpoint.Host, dnsEndpoint.Port).ContinueWith(t =>
                    {
                        multiplexer.LogLocked(log, "EndConnect: {0}", formattedEndpoint);
                        EndConnectImpl(t, multiplexer, log, tuple);
                        multiplexer.LogLocked(log, "Connect complete: {0}", formattedEndpoint);
                    });
#else
                    CompletionTypeHelper.RunWithCompletionType(
                        cb => {
                        multiplexer.LogLocked(log, "BeginConnect: {0}", formattedEndpoint);
                        return(socket.BeginConnect(dnsEndpoint.Host, dnsEndpoint.Port, cb, tuple));
                    },
                        ar => {
                        multiplexer.LogLocked(log, "EndConnect: {0}", formattedEndpoint);
                        EndConnectImpl(ar, multiplexer, log, tuple);
                        multiplexer.LogLocked(log, "Connect complete: {0}", formattedEndpoint);
                    },
                        connectCompletionType);
#endif
                }
                else
                {
#if CORE_CLR
                    multiplexer.LogLocked(log, "BeginConnect: {0}", formattedEndpoint);
                    socket.ConnectAsync(endpoint).ContinueWith(t =>
                    {
                        multiplexer.LogLocked(log, "EndConnect: {0}", formattedEndpoint);
                        EndConnectImpl(t, multiplexer, log, tuple);
                    });
#else
                    CompletionTypeHelper.RunWithCompletionType(
                        cb => {
                        multiplexer.LogLocked(log, "BeginConnect: {0}", formattedEndpoint);
                        return(socket.BeginConnect(endpoint, cb, tuple));
                    },
                        ar => {
                        multiplexer.LogLocked(log, "EndConnect: {0}", formattedEndpoint);
                        EndConnectImpl(ar, multiplexer, log, tuple);
                        multiplexer.LogLocked(log, "Connect complete: {0}", formattedEndpoint);
                    },
                        connectCompletionType);
#endif
                }
            }
            catch (NotImplementedException ex)
            {
                if (!(endpoint is IPEndPoint))
                {
                    throw new InvalidOperationException("BeginConnect failed with NotImplementedException; consider using IP endpoints, or enable ResolveDns in the configuration", ex);
                }
                throw;
            }
            var token = new SocketToken(socket);
            return(token);
        }
Beispiel #19
0
 public MyCompletion(string displayText, string insertionText, string description, ImageSource iconSource, string iconAutomationText, CompletionType completionType, DeclarationSymbol symbol, IAst[] stack) : base(displayText, insertionText, description, iconSource, iconAutomationText)
 {
     _stack         = stack;
     CompletionType = completionType;
     Symbol         = symbol;
 }
Beispiel #20
0
 public abstract bool HandHasCombination(List <Tile> tiles, CompletionType compType);
 partial void ShouldForceConnectCompletionType(ref CompletionType completionType);
    public override bool HandHasCombination(List <Tile> tiles, CompletionType compType)
    {
        List <Tile> sets = Tile.ReturnGroupedTiles(tiles);

        return(sets.Count == 3 && compType == CompletionType.Draw);
    }
Beispiel #23
0
 protected void IteratorClose(CompletionType completionType)
 {
     _iterator.Close(completionType);
 }
Beispiel #24
0
 public virtual void Close(CompletionType completion)
 {
 }
Beispiel #25
0
            public static CompletionItem New(CompletionType type)
            {
                switch (type)
                {
                case CompletionType.VariablePrimitive:
                    return(new VariablePrimitiveCompletionItem());

                case CompletionType.VariableComplex:
                    return(new VariableComplexCompletionItem());

                case CompletionType.Widget:
                    return(new WidgetCompletionItem());

                case CompletionType.TempTable:
                    return(new TempTableCompletionItem());

                case CompletionType.Table:
                    return(new TableCompletionItem());

                case CompletionType.Keyword:
                    return(new KeywordCompletionItem());

                case CompletionType.KeywordObject:
                    return(new KeywordObjectCompletionItem());

                case CompletionType.Field:
                    return(new FieldCompletionItem());

                case CompletionType.FieldPk:
                    return(new FieldPkCompletionItem());

                case CompletionType.Procedure:
                    return(new ProcedureCompletionItem());

                case CompletionType.ExternalProcedure:
                    return(new ExternalProcedureCompletionItem());

                case CompletionType.LangWord:
                    return(new LangWordCompletionItem());

                case CompletionType.LangFunction:
                    return(new LangFunctionCompletionItem());

                /*
                 * case CompletionType.Snippet:
                 *  return new SnippetCompletionItem();
                 * case CompletionType.Function:
                 *  return new FunctionCompletionItem();
                 * case CompletionType.Database:
                 *  return new DatabaseCompletionItem();
                 * case CompletionType.Sequence:
                 *  return new SequenceCompletionItem();
                 * case CompletionType.Preprocessed:
                 *  return new PreprocessedCompletionItem();
                 * case CompletionType.Label:
                 *  return new LabelCompletionItem();
                 * case CompletionType.Word:
                 *  return new WordCompletionItem();
                 * case CompletionType.LangWord:
                 *  return new LangWordCompletionItem();
                 */
                default:
                    throw new Exception("You forgot to add the type" + type + " to the factory! Noob!");
                }
            }
Beispiel #26
0
 public void setCompletionType(CompletionType id)
 {
     m_completionType = id;
 }
 public void setCompletionType(CompletionType id)
 {
     m_completionType = id;
 }
        /// <summary>
        /// Validate the entered data and close the dialog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onOk(object sender, EventArgs e)
        {
            m_completion = new Completion();
            String         value          = "";
            String         data           = "";
            Int32          count          = -1;
            CompletionType completionType = (CompletionType)guiTypeCbo.SelectedItem;

            m_completion.setCompletionType(completionType);
            if (guiValueTxt.Enabled)
            {
                value = guiValueTxt.Text;
            }
            if (guiDataTxt.Enabled)
            {
                data = guiDataTxt.Text;
            }
            if (guiAmountTxt.Enabled)
            {
                if (!Int32.TryParse(guiAmountTxt.Text, out count))
                {
                    count = -1;
                }
            }

            switch (completionType)
            {
            case CompletionType.Arrive_At:
                m_completion.setValue(value);
                break;

            case CompletionType.Nav_Message:
                m_completion.setValue(value);
                m_completion.setCount(count);
                break;

            case CompletionType.Proximity_To_Space_Npc:
                m_completion.setValue(value);
                break;

            case CompletionType.Talk_Space_Npc:
                m_completion.setValue(value);
                break;

            case CompletionType.Fight_Mob:
                m_completion.setValue(value);
                m_completion.setCount(count);
                break;

            case CompletionType.Give_Credits:
                m_completion.setValue(count.ToString());
                break;

            case CompletionType.Give_Item:
                m_completion.setValue(value);
                m_completion.setCount(count);
                break;

            case CompletionType.Nearest_Nav:
                m_completion.setValue(value);
                break;

            case CompletionType.Obtain_Items:
                m_completion.setValue(value);
                break;

            /*case CompletionType.Obtain_Items_At_Location:
             *  m_completion.setValue(value);
             *  m_completion.setData(data);
             *  break;*/
            case CompletionType.Possess_Item:
                m_completion.setValue(value);
                m_completion.setCount(count);
                break;

            case CompletionType.Receive_Item:
                m_completion.setValue(count.ToString());
                break;

            case CompletionType.Current_Sector:
                m_completion.setValue(value);
                break;

            /*case CompletionType.Take_Item_To_Location:
             *  m_completion.setValue(value);
             *  m_completion.setData(data);
             *  break;*/
            case CompletionType.Talk_To_Npc:
                m_completion.setValue(value);
                break;

            case CompletionType.Use_Skill_On_Mob_Type:
                m_completion.setValue(value);
                m_completion.setData(data);
                break;

            case CompletionType.Use_Skill_On_Object:
                m_completion.setValue(value);
                m_completion.setData(data);
                break;
            }

            String error;

            m_completion.addValidations();
            if (Database.DataConfiguration.validate(out error))
            //&& MissionEditor.Program.m_frmMission.isMissionValid(out error))
            {
                m_madeSelection = true;
                this.Close();
            }
            else
            {
                MessageBox.Show(error);
            }
        }
Beispiel #29
0
        public static void RunWithCompletionType(Func <AsyncCallback, IAsyncResult> beginAsync, AsyncCallback callback, CompletionType completionType)
        {
            AsyncCallback proxyCallback;

            if (completionType == CompletionType.Any)
            {
                proxyCallback = (ar) =>
                {
                    if (!ar.CompletedSynchronously)
                    {
                        callback(ar);
                    }
                };
            }
            else
            {
                proxyCallback = (ar) => { };
            }

            var result = beginAsync(proxyCallback);

            if (completionType == CompletionType.Any && !result.CompletedSynchronously)
            {
                return;
            }

            result.AsyncWaitHandle.WaitOne();

            switch (completionType)
            {
            case CompletionType.Async:
                ThreadPool.QueueUserWorkItem((s) => { callback(result); });
                break;

            case CompletionType.Any:
            case CompletionType.Sync:
                callback(result);
                break;
            }

            return;
        }
        private void onTypeSelected(object sender, EventArgs e)
        {
            guiValueTxt.Enabled       = false;
            guiValueSearchBtn.Enabled = false;
            guiDataTxt.Enabled        = false;
            guiDataSearchBtn.Enabled  = false;
            guiAmountTxt.Enabled      = false;

            CompletionType completionType = (CompletionType)guiTypeCbo.SelectedItem;

            switch (completionType)
            {
            case CompletionType.Arrive_At:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.sector_object);
                break;

            case CompletionType.Nav_Message:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.sector_object);
                guiAmountTxt.Enabled = true;
                break;

            case CompletionType.Proximity_To_Space_Npc:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.sector_object);
                break;

            case CompletionType.Talk_Space_Npc:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.sector_object);
                break;

            case CompletionType.Fight_Mob:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.mob);
                guiAmountTxt.Enabled = true;
                break;

            case CompletionType.Give_Credits:
                guiAmountTxt.Enabled = true;
                break;

            case CompletionType.Give_Item:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.item);
                guiAmountTxt.Enabled = true;
                break;

            case CompletionType.Nearest_Nav:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.sector_object);
                break;

            case CompletionType.Obtain_Items:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.item);
                break;

            /*case CompletionType.Obtain_Items_At_Location:
             *  guiValueTxt.Enabled = true;
             *  guiValueSearchBtn.Enabled = true;
             *  m_codeSearch[0].setDataType(DataConfiguration.DataType.sector_object);
             *  guiDataTxt.Enabled = true;
             *  guiDataSearchBtn.Enabled = true;
             *  m_codeSearch[1].setDataType(DataConfiguration.DataType.item);
             *  break;*/
            case CompletionType.Possess_Item:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.item);
                guiAmountTxt.Enabled = true;
                break;

            case CompletionType.Receive_Item:
                guiAmountTxt.Enabled = true;
                break;

            case CompletionType.Current_Sector:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.sector);
                break;

            /*case CompletionType.Take_Item_To_Location:
             *  guiValueTxt.Enabled = true;
             *  guiValueSearchBtn.Enabled = true;
             *  m_codeSearch[0].setDataType(DataConfiguration.DataType.sector_object);
             *  guiDataTxt.Enabled = true;
             *  guiDataSearchBtn.Enabled = true;
             *  m_codeSearch[1].setDataType(DataConfiguration.DataType.item);
             *  break;*/
            case CompletionType.Talk_To_Npc:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.npc);
                break;

            case CompletionType.Use_Skill_On_Mob_Type:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.mob);
                guiDataTxt.Enabled       = true;
                guiDataSearchBtn.Enabled = true;
                m_codeSearch[1].setDataType(DataConfiguration.DataType.skill);
                break;

            case CompletionType.Use_Skill_On_Object:
                guiValueTxt.Enabled       = true;
                guiValueSearchBtn.Enabled = true;
                m_codeSearch[0].setDataType(DataConfiguration.DataType.sector_object);
                guiDataTxt.Enabled       = true;
                guiDataSearchBtn.Enabled = true;
                m_codeSearch[1].setDataType(DataConfiguration.DataType.skill);
                break;
            }
        }
Beispiel #31
0
        public override void Perform(SchemaChanges changes, IOutput output)
        {
            using (var block = output.ProgressBlock())
            {
                var desired = OldVersionCacheMigrationType.AllFrom(changes.Desired).Single();

                // Because this is guaranteed to be last in the prerequisite run, we know the storage tables are fully created and we can start using them.
                changes.SetStorageAvailable();
                var storage = changes.Storage;

                // If the migration has already run, OR the storage tables already contain Complete (implying they've already been populated by a full run
                // or migration) then we don't run it again.
                if (storage.ContainsRoot(desired.Identifier) ||
                    storage.ContainsRoot(CompletionType.Create().Identifier))
                {
                    return;
                }

                var chunks = block.GetChunks(10, 40).ToList();

                // If we can't find a cache then there's no data to upgrade with.
                var nrdoCache = desired.State.FindOldVersionNrdoCache(chunks[0].Start());
                if (nrdoCache == null)
                {
                    return;
                }

                // This line serves no purpose except to cause changes to notice that this step did something and so needs to be included in the output.
                changes.Put(null);

                var total = nrdoCache.Entries.Count;

                using (var steps = chunks[1].ProgressBlock(total))
                {
                    output.Message("Migration: Processing " + total + " tables and queries...");
                    foreach (var entry in nrdoCache.Entries)
                    {
                        var cacheLine           = SmeltFile.Parse(entry.Content).Lines.Single();
                        var obsoleteVersionSpec = cacheLine.GetString(0);
                        var type = cacheLine.GetString(1);
                        var name = cacheLine.GetString(2);
                        if (obsoleteVersionSpec != "")
                        {
                            throw new ApplicationException("Unexpected value " + obsoleteVersionSpec + " found in obsolete version spec space");
                        }
                        if (name != entry.Name)
                        {
                            throw new ApplicationException("Name in cache entry does not match file name: " + name + " vs " + entry.Name);
                        }

                        if (type == "tcache")
                        {
                            output.Verbose("Migration: Table " + name + "...");
                            // Table cache structure is either
                            //[] tcache name existing { beforestatement beforestatement ... ; };

                            // OR
                            //[] tcache name {
                            //  fieldname sqltype nullable|notnull identity? ;
                            //  ...
                            //} {
                            //  pk|uk|ix indexname { fieldname; fieldname; ... } ;
                            //  ...
                            //} {
                            //  fkeyname desttable { fromfield tofield; fromfield tofield; ... } cascade? ;
                            //  ...
                            //} {
                            //  sequencename ;
                            //  triggername ;
                            //  beforestatement beforestatement ... ;
                            //};
                            if (cacheLine.Words[3] is SmeltString)
                            {
                                if (cacheLine.GetString(3) != "existing")
                                {
                                    throw new ApplicationException("Unexpected word '" + cacheLine.GetString(3) + "' in " + name);
                                }
                                var beforeStatements = cacheLine.GetBlock(4).Lines.Single();
                                if (beforeStatements.Words.Any())
                                {
                                    throw new ApplicationException("Table " + name + " was 'existing' but has before statements, which is no longer supported");
                                }
                                // In the old world "existing" tables could have before statements, but we can't do that any more
                            }
                            else
                            {
                                var table = TableType.Identifier(name);
                                storage.PutRoot(table);

                                foreach (var fieldLine in cacheLine.GetBlock(3).Lines)
                                {
                                    storage.PutSub(table, FieldType.Identifier(fieldLine.GetString(0)));
                                    // We don't care about type, nullability or identity any more because we can get all that from the database schema directly
                                }

                                foreach (var ixLine in cacheLine.GetBlock(4).Lines)
                                {
                                    var        ixTypeStr = ixLine.GetString(0);
                                    ObjectType ixType;
                                    switch (ixTypeStr)
                                    {
                                    case "ix": ixType = NonUniqueIndexType.Instance; break;

                                    case "pk":
                                    case "uk": ixType = UniqueIndexType.Instance; break;

                                    default: throw new ApplicationException("Unexpected index type " + ixTypeStr + " in " + name);
                                    }
                                    storage.PutSub(table, ixType.Identifier(ixLine.GetString(1)));
                                }

                                foreach (var fkLine in cacheLine.GetBlock(5).Lines)
                                {
                                    storage.PutSub(table, FkeyType.Identifier(fkLine.GetString(0)));
                                }

                                var others = cacheLine.GetBlock(6);

                                var seqInfo = others.Lines[0];
                                if (seqInfo.Words.Count > 1 && changes.SchemaDriver.IsSequenceUsed)
                                {
                                    storage.PutSub(table, SequenceType.Identifier("dbo." + seqInfo.GetString(1)));
                                }

                                if (seqInfo.Words.Count > 2 && changes.SchemaDriver.IsTriggerUsedForSequence)
                                {
                                    storage.PutSub(table, TriggerType.Identifier("dbo." + seqInfo.GetString(2)));
                                }

                                if (others.Lines.Count > 1)
                                {
                                    foreach (var beforeStatement in others.Lines[1].Words.Cast <SmeltString>())
                                    {
                                        storage.PutSub(table, BeforeStatementType.Identifier(beforeStatement.Text));
                                    }
                                }
                            }
                        }
                        else
                        {
                            output.Verbose("Migration: Query " + name);
                            // Query cache file structure is
                            //  [] spcache name [] { beforestatement beforestatement ... ; };
                            // OR
                            //  [] spcache|sfcache|spcache-preupgrade name [sql] { beforestatement beforestatement ... ; }

                            var isPreUpgradeHook = false;
                            switch (type)
                            {
                            case "spcache":
                            case "sfcache": break;

                            case "spcache-preupgrade": isPreUpgradeHook = true; break;

                            default: throw new ApplicationException("Unknown type of cache entry '" + type + "' in " + name);
                            }

                            var query = QueryType.Identifier(name);
                            storage.PutRoot(query);

                            if (isPreUpgradeHook)
                            {
                                storage.PutSub(query, PreUpgradeHookType.Create(query).Identifier);
                            }

                            foreach (var beforeStatement in cacheLine.GetBlock(4).Lines.Single().Words.Cast <SmeltString>())
                            {
                                storage.PutSub(query, BeforeStatementType.Identifier(beforeStatement.Text));
                            }
                        }
                        steps.Step++;
                    }
                    if (nrdoCache.IsComplete)
                    {
                        storage.PutRoot(CompletionType.Create().Identifier);
                    }
                    storage.PutRoot(desired.Identifier);
                    output.Message("Migration: Complete.");
                }
            }
        }
Beispiel #32
0
 partial void ShouldForceConnectCompletionType(ref CompletionType completionType);
Beispiel #33
0
 public Completion(object value, CompletionType type, INode location)
 {
     ReturnValue = value;
     Type        = type;
     Location    = location;
 }
 public MissionStats(TimeSpan time, CompletionType type, int levelID)
 {
     Type    = type;
     Time    = time;
     LevelID = levelID.ToString();
 }
Beispiel #35
0
		System.Windows.Media.ImageSource GetGlyph(CompletionType type)
		{
			var service = provider.GlyphService;
            switch (type)
			{
				case CompletionType.Class:
					return service.GetGlyph(StandardGlyphGroup.GlyphGroupClass, StandardGlyphItem.GlyphItemPublic);
				case CompletionType.Property:
					return service.GetGlyph(StandardGlyphGroup.GlyphGroupProperty, StandardGlyphItem.GlyphItemPublic);
				case CompletionType.Event:
					return service.GetGlyph(StandardGlyphGroup.GlyphGroupEvent, StandardGlyphItem.GlyphItemPublic);
				case CompletionType.Field:
					return service.GetGlyph(StandardGlyphGroup.GlyphGroupField, StandardGlyphItem.GlyphItemPublic);
				case CompletionType.Attribute:
					return service.GetGlyph(StandardGlyphGroup.GlyphXmlAttribute, StandardGlyphItem.GlyphItemPublic);
				default:
				case CompletionType.Literal:
					return service.GetGlyph(StandardGlyphGroup.GlyphGroupConstant, StandardGlyphItem.GlyphItemPublic);
			}
		}
        public static void RunWithCompletionType(Func<AsyncCallback, IAsyncResult> beginAsync, AsyncCallback callback, CompletionType completionType)
        { 
            AsyncCallback proxyCallback;
            if (completionType == CompletionType.Any)
            {
                proxyCallback =  (ar) =>
                {
                    if (!ar.CompletedSynchronously)
                    {
                        callback(ar);
                    }
                };
            }
            else
            {
                proxyCallback = (ar) => { };
            }

            var result = beginAsync(proxyCallback);

            if (completionType == CompletionType.Any && !result.CompletedSynchronously)
            {
                return;
            }

            result.AsyncWaitHandle.WaitOne();

            switch (completionType)
            { 
                case CompletionType.Async:
                    ThreadPool.QueueUserWorkItem((s) => { callback(result); });
                    break;
                case CompletionType.Any:
                case CompletionType.Sync:
                    callback(result);
                    break;
            }

            return;
        }
Beispiel #37
0
 internal CompletionData(string text, CompletionType type, string stub) : this(text, type)
 {
     Stub = stub;
 }
Beispiel #38
0
 public void Close(CompletionType completion)
 {
 }
 partial void ShouldForceConnectCompletionType(ref CompletionType completionType)
 {
     completionType = SocketManager.ConnectCompletionType;
 }
Beispiel #40
0
        private void BuildMemberList(SnapshotSpan span)
        {
            //
            ITrackingSpan trackingSpan = span.Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeInclusive);

            // Get the Name of the File
            XSharpModel.XFile file = this.m_textView.TextBuffer.GetFile();
            if (file != null)
            {
                //
                ITextSnapshotLine line = span.Start.GetContainingLine();
                int lineNumber         = line.LineNumber;
                int columnNumber       = span.Start.Position - line.Start.Position;
                //
                XType classDef = null;
                foreach (KeyValuePair <String, XType> kvp in file.TypeList)
                {
                    if (kvp.Value.Range.ContainsInclusive(lineNumber, columnNumber))
                    {
                        classDef = kvp.Value;
                        break;
                    }
                }
                if (classDef != null)
                {
                    // Get the Interfaces
                    // classDef.Implement DOESN'T exist currently :(
                    string[] interfaces = { };
                    // Clr Types
                    Type t = null;
                    // Our own types
                    XType          ti     = null;
                    IList <String> Usings = file.Usings;
                    // Search already implemented Members
                    bool   FoundAll = true;
                    string FullName = "";
                    // Let's build a list of Elements to add to implement the Interface
                    List <XTypeMember> toAdd = new List <XTypeMember>();
                    CompletionType     temp;
                    //
                    foreach (string iface in interfaces)
                    {
                        String iFace = iface.Trim();
                        // Search The interface
                        // --> Default NameSpace
                        temp = new CompletionType(iFace, file, "");
                        if (!temp.IsEmpty())
                        {
                            if (temp.XType != null)
                            {
                                ti = temp.XType;
                                if (ti.Kind == Kind.Interface)
                                {
                                    FullName = ti.Name;
                                    // Everything is here ?
                                    FoundAll = true;
                                    foreach (XTypeMember mbr in ti.Members)
                                    {
                                        if (!classDef.Members.Contains(mbr))
                                        {
                                            // No
                                            toAdd.Add(mbr);
                                        }
                                    }
                                    FoundAll = (toAdd.Count == 0);
                                }
                            }
                            else
                            {
                                t = temp.SType;
                                if (t.IsInterface)
                                {
                                    FullName = t.FullName;
                                    // Everything is here ?
                                    FoundAll = true;
                                    // Please create the array
                                    toAdd    = BuildMissingMembers(classDef, t.GetMembers());
                                    FoundAll = (toAdd.Count == 0);
                                }
                            }
                        }
                        //
                    }
                }
            }
            // Sorry, nothing to do....
            return;
        }
 internal CompletionData(string text, CompletionType type)
 {
     this.Text = text;
     this.Type = type;
 }
Beispiel #42
0
 public Builder(uint quest, byte step, uint owner, CompletionType type, uint completionCount, uint completionID = 0)
 {
     _step = new QuestStep(quest, step, type, completionCount, completionID, owner);
     _lastLine = 0;
     _lines = new Dictionary<int, QuestLine>();
     _rewards = new List<QuestReward>();
 }
        private static CompletionItemKind MapCompletionKind(CompletionType completionType)
        {
            switch (completionType)
            {
                case CompletionType.Command:
                    return CompletionItemKind.Function;

                case CompletionType.Method:
                    return CompletionItemKind.Method;

                case CompletionType.Variable:
                case CompletionType.ParameterName:
                    return CompletionItemKind.Variable;

                case CompletionType.Path:
                    return CompletionItemKind.File;

                default:
                    return CompletionItemKind.Text;
            }
        }
Beispiel #44
0
 private CompleteResult(CompletionType type, int sequence = 0)
 {
     Type     = type;
     Sequence = sequence;
 }
 private static StandardGlyphGroup CompletionTypeToStandardGlyphGroup(CompletionType completionType)
 {
     switch (completionType)
     {
         case CompletionType.Unknown:
             return StandardGlyphGroup.GlyphGroupUnknown;
         case CompletionType.Namespace:
             return StandardGlyphGroup.GlyphGroupNamespace;
         case CompletionType.Class:
             return StandardGlyphGroup.GlyphGroupClass;
         case CompletionType.Module:
             return StandardGlyphGroup.GlyphGroupModule;
         case CompletionType.Method:
             return StandardGlyphGroup.GlyphGroupMethod;
         case CompletionType.Variable:
             return StandardGlyphGroup.GlyphGroupVariable;
         default:
             return StandardGlyphGroup.GlyphGroupUnknown;
     }
 }
Beispiel #46
0
 public FileSystemAutoCompleteProvider(IFileSystemManager fileSystemManager, CompletionType completionType)
 {
     _fileSystemManager = fileSystemManager;
     _completionType    = completionType;
 }