コード例 #1
0
        public virtual string GetTempFilePathForComponent(ComponentKey componentKey)
        {
            string combine = Path.Combine(CurrentProject.TempFolder, componentKey.ToString());

            return(combine);

            /*
             *                      return PathHelper.GetTempFilePathFor("ArchAngel", CurrentProject.ProjectFile, componentKey);
             */
        }
コード例 #2
0
ファイル: PathHelper.cs プロジェクト: uQr/Visual-NHibernate
        /// <summary>
        /// The temp path will be of the form Temp/ArchAngel/Guid/ComponentKey
        /// where Temp is the system temp folder, the Guid is generated from the
        /// project filename, and the ComponentKey is the string representation of 
        /// the part of the ArchAngel system that needs a temp folder.
        /// </summary>
        /// <param name="product">The product we need a temp folder for.</param>
        /// <param name="projectFile">The filename of the project this is for</param>
        /// <param name="componentKey">The part of the ArchAngel system that needs the
        /// temp path.</param>
        /// <returns>Path of the form Temp/ArchAngel/Guid/ComponentKey. For a given project,
        /// the temp path will be the same as long as the project filename does not change.</returns>
        public static string GetTempFilePathFor(string product, string projectFile, ComponentKey componentKey)
        {
            if(string.IsNullOrEmpty(product))
                throw new ArgumentException("Product cannot be null");

            // Convert projectFile into a Guid string in the form {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
            byte[] hash = Utility.GetMD5FromString(projectFile ?? "");
            string filename = new Guid(hash).ToString("B").ToUpper();

            string path = Path.GetTempPath().PathSlash(product).PathSlash(filename).PathSlash(componentKey.ToString());

            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            return path;
        }
コード例 #3
0
        public override String ToString()
        {
            var str = "CCMModelItem Data:\n";

            try
            {
                str += ComponentKey.ToString();
                str += Attributes.ToString();
            }
            catch (Exception e)
            {
                var sMsg = String.Format("Failed to print CCMModelItem contents: {0}", e.Message);
            }

            return(str);
        }
コード例 #4
0
        /// <summary>
        /// The temp path will be of the form Temp/ArchAngel/Guid/ComponentKey
        /// where Temp is the system temp folder, the Guid is generated from the
        /// project filename, and the ComponentKey is the string representation of
        /// the part of the ArchAngel system that needs a temp folder.
        /// </summary>
        /// <param name="product">The product we need a temp folder for.</param>
        /// <param name="projectFile">The filename of the project this is for</param>
        /// <param name="componentKey">The part of the ArchAngel system that needs the
        /// temp path.</param>
        /// <returns>Path of the form Temp/ArchAngel/Guid/ComponentKey. For a given project,
        /// the temp path will be the same as long as the project filename does not change.</returns>
        public static string GetTempFilePathFor(string product, string projectFile, ComponentKey componentKey)
        {
            if (string.IsNullOrEmpty(product))
            {
                throw new ArgumentException("Product cannot be null");
            }

            // Convert projectFile into a Guid string in the form {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
            byte[] hash     = Utility.GetMD5FromString(projectFile ?? "");
            string filename = new Guid(hash).ToString("B").ToUpper();

            string path = Path.GetTempPath().PathSlash(product).PathSlash(filename).PathSlash(componentKey.ToString());

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            return(path);
        }
コード例 #5
0
 public virtual string GetTempFilePathForComponent(ComponentKey componentKey)
 {
     string combine = Path.Combine(CurrentProject.TempFolder, componentKey.ToString());
     return combine;
     /*
                 return PathHelper.GetTempFilePathFor("ArchAngel", CurrentProject.ProjectFile, componentKey);
     */
 }