예제 #1
0
        /// <summary>
        /// Creates a new untitled OpenedFile.
        /// </summary>
        public static OpenedFile CreateUntitledOpenedFile(string defaultName, byte[] content)
        {
            if (defaultName == null)
            {
                throw new ArgumentNullException("defaultName");
            }

            OpenedFile file = new FileServiceOpenedFile(content);

            file.FileName = new FileName(file.GetHashCode() + "/" + defaultName);
            openedFileDict[file.FileName] = file;
            return(file);
        }
예제 #2
0
        /// <summary>
        /// Gets or creates an opened file.
        /// Warning: the opened file will be a file without any views attached.
        /// Make sure to attach a view to it, or call CloseIfAllViewsClosed on the OpenedFile to
        /// unload the OpenedFile instance if no views were attached to it.
        /// </summary>
        public static OpenedFile GetOrCreateOpenedFile(FileName fileName)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }

            OpenedFile file;

            if (!openedFileDict.TryGetValue(fileName, out file))
            {
                openedFileDict[fileName] = file = new FileServiceOpenedFile(fileName);
            }
            return(file);
        }
예제 #3
0
        /// <summary>
        /// Gets or creates an opened file.
        /// Warning: the opened file will be a file without any views attached.
        /// Make sure to attach a view to it, or call CloseIfAllViewsClosed on the OpenedFile to
        /// unload the OpenedFile instance if no views were attached to it.
        /// </summary>
        public static OpenedFile GetOrCreateOpenedFile(string fileName)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }

            fileName = FileUtility.NormalizePath(fileName);
            OpenedFile file;

            if (!openedFileDict.TryGetValue(fileName, out file))
            {
                openedFileDict[fileName] = file = new FileServiceOpenedFile(fileName);
            }
            return(file);
        }
예제 #4
0
		/// <summary>
		/// Creates a new untitled OpenedFile.
		/// </summary>
		public static OpenedFile CreateUntitledOpenedFile(string defaultName, byte[] content)
		{
			if (defaultName == null)
				throw new ArgumentNullException("defaultName");
			
			OpenedFile file = new FileServiceOpenedFile(content);
			file.FileName = new FileName(file.GetHashCode() + "/" + defaultName);
			openedFileDict[file.FileName] = file;
			return file;
		}
예제 #5
0
		/// <summary>
		/// Gets or creates an opened file.
		/// Warning: the opened file will be a file without any views attached.
		/// Make sure to attach a view to it, or call CloseIfAllViewsClosed on the OpenedFile to
		/// unload the OpenedFile instance if no views were attached to it.
		/// </summary>
		public static OpenedFile GetOrCreateOpenedFile(FileName fileName)
		{
			if (fileName == null)
				throw new ArgumentNullException("fileName");
			
			OpenedFile file;
			if (!openedFileDict.TryGetValue(fileName, out file)) {
				openedFileDict[fileName] = file = new FileServiceOpenedFile(fileName);
			}
			return file;
		}