Esempio n. 1
0
        public static Saved_MethodStream Create(O2MappedAstData astData, IMethod iMethod, string methodStreams_CacheLocation, bool forceCreate)
        {
            if (methodStreams_CacheLocation.isNull())
            {
                methodStreams_CacheLocation = "_methodStreams_CacheLocation".tempDir();
            }
            var safeFileName = iMethod.fullName().safeFileName();         //240 - methodStreams_CacheLocation.size());
            var pathToSaveSerializedObject = methodStreams_CacheLocation.pathCombine_MaxSize(safeFileName + ".methodStream.xml");

            if (forceCreate.isFalse() && pathToSaveSerializedObject.fileExists())
            {
                "Skipping iMethod '{0}' since serialized object already exists ".debug(iMethod.Name);
                var loaded_SavedMethodStream = pathToSaveSerializedObject.load <Saved_MethodStream>();
                if (loaded_SavedMethodStream.notNull())
                {
                    return(loaded_SavedMethodStream);
                }
            }

            var savedMethodStream = new Saved_MethodStream(astData, iMethod);

            if (savedMethodStream.isNull())
            {
                return(null);
            }
            else
            {
                savedMethodStream.Serialized_Saved_MethodStream_FileCache = pathToSaveSerializedObject;
                savedMethodStream.saveAs(pathToSaveSerializedObject);
                "Serialized method stream object saved to: {0}".debug(pathToSaveSerializedObject);
                return(savedMethodStream);
            }
        }
    	public static Saved_MethodStream Create(O2MappedAstData astData, IMethod iMethod, string methodStreams_CacheLocation, bool forceCreate)
    	{
    		if (methodStreams_CacheLocation.isNull())
    			methodStreams_CacheLocation = "_methodStreams_CacheLocation".tempDir();
    		var safeFileName = 	iMethod.fullName().safeFileName();//240 - methodStreams_CacheLocation.size());
    		var pathToSaveSerializedObject = methodStreams_CacheLocation.pathCombine_MaxSize(safeFileName + ".methodStream.xml");    											
			if (forceCreate.isFalse() && pathToSaveSerializedObject.fileExists())												
			{
				"Skipping iMethod '{0}' since serialized object already exists ".debug(iMethod.Name);
				var loaded_SavedMethodStream = pathToSaveSerializedObject.load<Saved_MethodStream>();
				if (loaded_SavedMethodStream.notNull())
					return loaded_SavedMethodStream;
			}
																			
			var savedMethodStream = new Saved_MethodStream(astData, iMethod);
			if (savedMethodStream.isNull())
				return null;
			else
			{	
				savedMethodStream.Serialized_Saved_MethodStream_FileCache = pathToSaveSerializedObject;
				savedMethodStream.saveAs(pathToSaveSerializedObject);					
				"Serialized method stream object saved to: {0}".debug(pathToSaveSerializedObject);													
				return savedMethodStream;
			}					
    	}