internal static void CacheDirectories
            (LocalDirectory local, WebDirectory web, BuildHandler handler)
        {
            CacheLocalDirectories(local, handler); CacheWebDirectories(web, handler);

            GenerateDifferenceIndex(handler);
        }
Beispiel #2
0
        internal static void GenerateXMLSizeIndex(LocalDirectory directory, BuildHandler handler)
        {
            try
            {
                if (!Directory.Exists(savePath))
                {
                    Directory.CreateDirectory(savePath);
                }

                using (StreamWriter writer = new StreamWriter
                                                 (Path.Combine(savePath, "index.xml")))
                {
                    XmlTextWriter xml = new XmlTextWriter(writer);

                    xml.Formatting  = Formatting.Indented;
                    xml.IndentChar  = '\t';
                    xml.Indentation = 2;

                    xml.WriteStartDocument(true);
                    xml.WriteStartElement("Size-Index");

                    ParseLocalDirectory(directory, handler, xml);

                    xml.WriteEndElement();
                    xml.WriteEndDocument();
                    xml.Close();
                }
            }

            catch (Exception e) { LogHandler.LogErrors(e.ToString()); }
        }
        internal static void CacheLocalDirectories(LocalDirectory local, BuildHandler handler)
        {
            try
            {
                LocalCache.Clear();
                for (int i = 0; i < local.FileIndex.Count; i++)
                {
                    string name = local.FileIndex[i].
                                  FullName.Substring(local.DirectoryPath.Length);

                    if (!LocalCache.ContainsKey(name.Replace("\\", string.Empty)))
                    {
                        LocalCache.Add
                            (name.Replace("\\", string.Empty), local.FileIndex[i].Length);
                    }

                    handler.UserInterface.UpdatePatchNotes
                        (string.Format("Caching Local Bytes: [{1}] {0}",
                                       name.Replace("\\", string.Empty), local.FileIndex[i].Length));

                    handler.UserInterface.UpdateProgressBar();
                }

                for (int n = 0; n < local.subDirectories.Count; n++)
                {
                    CacheLocalDirectories(local.subDirectories[n], handler);
                }
            }

            catch (Exception e)
            {
                LogHandler.LogErrors(e.ToString(), handler);
            }
        }
Beispiel #4
0
        private static void ParseLocalDirectory
            (LocalDirectory directory, BuildHandler handler, XmlTextWriter xml)
        {
            IterateFileSizeIndex
                (directory.FileIndex, directory.DirectoryPath, xml);

            for (int i = 0; i < directory.subDirectories.Count; i++)
            {
                ParseLocalDirectory(directory.subDirectories[i], handler, xml);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Generates new local directory object based on path of the .exe
        /// </summary>
        private void QueryLocalDirectory()
        {
            try
            {
                string localPath = new FileInfo
                                       (System.Reflection.Assembly.GetEntryAssembly().Location).Directory.ToString();

                localDirectory = new LocalDirectory(localPath, this);
            }

            catch (Exception e) { LogHandler.LogErrors(e.ToString(), this); }
        }