public static ascx_CodeStreams load_by_File_and_MethodName(this ascx_CodeStreams ascxCodeStreams, string file, string methodName)
        {
            if (ascxCodeStreams.AllSavedMethodStreams.isNull())
            {
                "There are no SavedMethodStreams loaded".error();
            }
            else
            if (ascxCodeStreams.AllSavedMethodStreams_MappedByFileName.hasKey(file).isFalse())
            {
                "There is no MethodStream loaded for file: {0}".error(file);
            }
            else
            {
                foreach (var savedMethodStream in        ascxCodeStreams.AllSavedMethodStreams_MappedByFileName[file])
                {
                    if (savedMethodStream.RootMethod.Name == methodName)
                    {
                        "Found a match, loading data for method: {0}".info(savedMethodStream.RootMethod.Signature);
                        ascxCodeStreams.loadMethodStream(savedMethodStream);
                        return(ascxCodeStreams);
                    }
                }

                "could not find a match for method {0} inside file {1}".error(methodName, file);
            }
            return(ascxCodeStreams);
        }
        public static ascx_CodeStreams calculate_XRefs_AllSavedMethodStreams(this ascx_CodeStreams ascxCodeStreams)
        {
            var savedMethodStreams = ascxCodeStreams.AllSavedMethodStreams;

            if (savedMethodStreams.notNull())
            {
                ascxCodeStreams.AllSavedMethodStreams_MappedByFileName = new Dictionary <string, List <Saved_MethodStream> >();
                foreach (var savedMethodStream in savedMethodStreams)
                {
                    ascxCodeStreams.AllSavedMethodStreams_MappedByFileName.add(savedMethodStream.RootMethod.Location.File, savedMethodStream);
                }
            }
            return(ascxCodeStreams);
        }
 public static ascx_CodeStreams load_SavedMethodStreams(this ascx_CodeStreams ascxCodeStreams, List <string> files)
 {
     ascxCodeStreams.AllSavedMethodStreams = new List <Saved_MethodStream>();
     "Loading {0} savedMethodStreams: {0}".info(files.size());
     foreach (var file in files)
     {
         var savedMethodStream = file.load <Saved_MethodStream>();
         if (savedMethodStream.notNull())
         {
             ascxCodeStreams.AllSavedMethodStreams.add(savedMethodStream);
         }
         else
         {
             "Could not load savedMethodStream from file: {0}".error(file);
         }
     }
     ascxCodeStreams.calculate_XRefs_AllSavedMethodStreams();
     return(ascxCodeStreams);
 }
        public static ascx_CodeStreams buildGuiToViewFolderContents(this ascx_CodeStreams ascxCodeStreams, string initialFolder)
        {
            "in buildGuiToViewFolderContents, with initialFolder set to: {0}".info(initialFolder);
            var availableStreamsPanel = ascxCodeStreams.insert_Left(200, "Available Streams");

            var sourceFolder = availableStreamsPanel.insert_Above(20)
                               .add_Label("Source Folder:")
                               .top(2)
                               .append_TextBox("")
                               .align_Right(availableStreamsPanel);

            Action <string> loadFilesFromFolder =
                (folder) => {
                var availableStreams = availableStreamsPanel.clear().add_TreeViewWithFilter(folder.files());                                                //, (filePath)=> filePath.fileName());

                availableStreams.afterSelect <string>(
                    (file) => {
                    var savedMethodStream = file.load <Saved_MethodStream>();
                    ascxCodeStreams.loadMethodStream(savedMethodStream);
                });
                availableStreams.selectFirst();
            };



            sourceFolder.onDrop(
                (folder) => {
                sourceFolder.set_Text(folder);
                loadFilesFromFolder(folder);
            });

            sourceFolder.onEnter(loadFilesFromFolder);

            if (initialFolder.valid() && initialFolder.dirExists())
            {
                loadFilesFromFolder(initialFolder);
            }
            return(ascxCodeStreams);
        }
 public static ascx_CodeStreams buildGuiToViewFolderContents(this ascx_CodeStreams ascxCodeStreams)
 {
     return(ascxCodeStreams.buildGuiToViewFolderContents(null));
 }
 public static ascx_CodeStreams load_SavedMethodStreams_fromFolder(this ascx_CodeStreams ascxCodeStreams, string folder)
 {
     "Loading all savedMethodStreams from folder: {0}".info(folder);
     return(ascxCodeStreams.load_SavedMethodStreams(folder.files()));
 }