private void EnsureStateIsClearedAfterServerTransfer()
        {
            HttpContext context = HttpContext.Current;

            if (context != null)
            {
                var handler = context.Handler;
                if (!ReferenceEquals(handler, _handler.Target))
                {
                    _registeredKeys.Clear();
                    _prioritizedHeadElements.Clear();
                    _hasAppendExecuted = false;
                    _handler           = new WeakReference(handler);
                }
            }
        }
Beispiel #2
0
        public void UpdateDestination()
        {
            var ignoreFiles = CheckSourceForDuplicates();

            foreach (var destination in _filesByDestination)
            {
                _filesUtility.EmptyDirectory(destination.Key);
                foreach (var copyFile in destination.Value)
                {
                    if (!ignoreFiles.Contains(copyFile.File))
                    {
                        _filesUtility.SafeCopyFile(copyFile.File, copyFile.Target);
                    }
                }
            }
            _filesByDestination.Clear();
        }
Beispiel #3
0
        /// <summary>
        /// Builds the meta.
        /// </summary>
        /// <returns>MetaExport.</returns>
        private MetaExport buildMeta()
        {
            var items = new List <MetaItem>();

            foreach (var key in _metaData.Keys)
            {
                var values     = _metaData.Get(key);
                var isMultiple = _metaMultiplicity[key];
                var item       = new MetaItem(key, isMultiple, values);

                items.Add(item);
            }

            _metaData.Clear();
            _metaMultiplicity.Clear();

            var meta = new MetaExport(items);

            return(meta);
        }
 private static void FreeSymbolMap(MultiDictionary <string, ISymbol> symbolMap)
 {
     symbolMap.Clear();
     s_symbolMapPool.Free(symbolMap);
 }
Beispiel #5
0
 private void Submit_BTN_Click(object sender, EventArgs e)
 {
     words.Clear();
     langTwo_TB.Clear();
     langTwo_TB.Text = LookUpWord(langOne_TB.Text.ToLower(), langOne_CB.Text, langTwo_CB.Text);
 }
Beispiel #6
0
 protected override void CustomizedClear()
 {
     _items.Clear();
 }
Beispiel #7
0
 public void Run(ILFunction function, ILTransformContext context)
 {
     try {
         if (this.context != null)
         {
             throw new InvalidOperationException("Reentrancy in " + nameof(TransformDisplayClassUsage));
         }
         this.context = context;
         var decompilationContext = new SimpleTypeResolveContext(context.Function.Method);
         // Traverse nested functions in post-order:
         // Inner functions are transformed before outer functions
         foreach (var f in function.Descendants.OfType <ILFunction>())
         {
             foreach (var v in f.Variables.ToArray())
             {
                 if (context.Settings.YieldReturn && HandleMonoStateMachine(function, v, decompilationContext, f))
                 {
                     continue;
                 }
                 if ((context.Settings.AnonymousMethods || context.Settings.ExpressionTrees) && IsClosure(context, v, out ITypeDefinition closureType, out var inst))
                 {
                     if (!CanRemoveAllReferencesTo(context, v))
                     {
                         continue;
                     }
                     if (inst is StObj || inst is StLoc)
                     {
                         instructionsToRemove.Add(inst);
                     }
                     AddOrUpdateDisplayClass(f, v, closureType, inst, localFunctionClosureParameter: false);
                     continue;
                 }
                 if (context.Settings.LocalFunctions && f.Kind == ILFunctionKind.LocalFunction && v.Kind == VariableKind.Parameter && v.Index > -1 && f.Method.Parameters[v.Index.Value] is IParameter p && LocalFunctionDecompiler.IsClosureParameter(p, decompilationContext))
                 {
                     AddOrUpdateDisplayClass(f, v, ((ByReferenceType)p.Type).ElementType.GetDefinition(), f.Body, localFunctionClosureParameter: true);
                     continue;
                 }
                 AnalyzeUseSites(v);
             }
         }
         VisitILFunction(function);
         if (instructionsToRemove.Count > 0)
         {
             context.Step($"Remove instructions", function);
             foreach (var store in instructionsToRemove)
             {
                 if (store.Parent is Block containingBlock)
                 {
                     containingBlock.Instructions.Remove(store);
                 }
             }
         }
         foreach (var f in TreeTraversal.PostOrder(function, f => f.LocalFunctions))
         {
             RemoveDeadVariableInit.ResetHasInitialValueFlag(f, context);
         }
     } finally {
         instructionsToRemove.Clear();
         displayClasses.Clear();
         fieldAssignmentsWithVariableValue.Clear();
         this.context = null;
     }
 }
        public void Clear()
        {
            MultiDictionary<string, string> dictionary = new MultiDictionary<string, string>(StringComparer.OrdinalIgnoreCase);

            dictionary.Add("x", "x1");
            dictionary.Add("x", "x2");
            dictionary.Add("y", "y1");

            dictionary.Clear();

            Assert.Equal(0, dictionary.KeyCount);
            Assert.Equal(0, dictionary.ValueCount);
        }
 public void Clear()
 {
     Rules.Clear();
 }
Beispiel #10
0
 protected override bool OnClearing()
 {
     _customTablesByType.Clear();
     _customTablesByCaption.Clear();
     return(base.OnClearing());
 }
 /// <summary>
 /// Disposes of a Triple Collection.
 /// </summary>
 public override void Dispose()
 {
     _triples.Clear();
 }
Beispiel #12
0
        /// <summary>
        /// Loads a zip file
        /// </summary>
        /// <param name="fse"></param>
        /// <param name="thumbnailOptions"></param>
        private async void LoadZip(FileSystemElement fse, FileSystemRetrieveService.ThumbnailFetchOptions thumbnailOptions, CancellationToken token)
        {
            elements.Clear();
            currentDepth   = 0;
            folderIndex    = 0;
            currentZIPFile = await FileSystem.GetFileAsync(fse);

            currentFSE = fse;

            using (Stream stream = await currentZIPFile.OpenStreamForReadAsync())
            {
                var reader = ReaderFactory.Open(stream);
                while (reader.MoveToNextEntry())
                {
                    if (token.IsCancellationRequested)
                    {
                        return;
                    }

                    var entry    = reader.Entry;
                    var keySplit = entry.Key.Split("/");
                    var subPath  = string.Join(@"\", keySplit, 0, keySplit.Length - 1);

                    int            depth;
                    ZipFileElement element;
                    if (entry.IsDirectory)
                    {
                        var name = keySplit[keySplit.Length - 2];
                        depth = keySplit.Length - 2;

                        element = new ZipFileElement(
                            name,
                            fse.Path + @"\" + subPath,
                            entry.LastModifiedTime.Value,
                            (ulong)entry.Size,
                            entry.Key,
                            depth
                            );

                        elements.AddFirst(depth, element);
                    }
                    else
                    {
                        var name = keySplit[keySplit.Length - 1];
                        depth = keySplit.Length - 1;

                        string fileExtension = "";
                        var    fileName      = entry.Key.Split(".");
                        if (fileName.Length > 1)
                        {
                            fileExtension = fileName[fileName.Length - 1];
                        }

                        //Store fileStream to access it later
                        var elementStream = new MemoryStream();
                        reader.WriteEntryTo(elementStream);
                        await elementStream.FlushAsync();

                        var thumbnail = await FileSystem.GetFileExtensionThumbnail(fileExtension, thumbnailOptions.Mode, thumbnailOptions.Size, thumbnailOptions.Scale);

                        element = new ZipFileElement(
                            name,
                            fse.Path + @"\" + subPath,
                            entry.LastModifiedTime.Value,
                            (ulong)entry.Size,
                            thumbnail,
                            "." + fileExtension,
                            fileExtension,
                            entry.Key,
                            depth,
                            elementStream
                            );

                        elements.Add(depth, element);
                    }

                    AddToViewItems(element);
                }
            }
        }
Beispiel #13
0
 public void Reset()
 {
     subscriptionsDictionary.Clear();
 }
 protected override ImmutableArray <PendingBranch> Scan(ref bool badRegion)
 {
     variablesCaptured.Clear();
     refLocalInitializers.Clear();
     return(base.Scan(ref badRegion));
 }
Beispiel #15
0
 public void Clear()
 {
     m_packages.Clear();
     m_packageLoadErrors.Clear();
     m_packageLookupByRoot.Clear();
 }
Beispiel #16
0
 public LogAnalyzer()
 {
     cacheOfKnownExistingBinaries.Clear();
     nonExistingReferencesToCompilerInvocationMap.Clear();
 }
Beispiel #17
0
 /// <summary>
 /// Disposes of the Graph Collection.
 /// </summary>
 /// <remarks>Invokes the <strong>Dispose()</strong> method of all Graphs contained in the Collection.</remarks>
 public override void Dispose()
 {
     _graphs.Clear();
 }
 private static void FreeSymbolMap(MultiDictionary<string, ISymbol> symbolMap)
 {
     symbolMap.Clear();
     s_symbolMapPool.Free(symbolMap);
 }
 public void Clear()
 {
     firstKeyDict.Clear();
     secondKeyDict.Clear();
 }