예제 #1
0
        internal static void CacheDirectories
            (LocalDirectory local, WebDirectory web, BuildHandler handler)
        {
            CacheLocalDirectories(local, handler); CacheWebDirectories(web, handler);

            GenerateDifferenceIndex(handler);
        }
예제 #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()); }
        }
예제 #3
0
        internal static void CacheWebDirectories(WebDirectory web, BuildHandler handler)
        {
            string temp_error_data = string.Empty;

            try
            {
                WebCache.Clear();
                for (int i = 0; i < web.AddressIndex.Count; i++)
                {
                    temp_error_data += web.AddressIndex[i] + " : " + web.SizeIndex[i].ToString() + " | ";

                    if (!WebCache.ContainsKey(web.AddressIndex[i]))
                    {
                        WebCache.Add(web.AddressIndex[i], web.SizeIndex[i]);
                    }

                    handler.UserInterface.UpdatePatchNotes
                        (string.Format("Caching Web Bytes: [{1}] {0}", web.AddressIndex[i], web.SizeIndex[i]));

                    handler.UserInterface.UpdateProgressBar();
                }

                for (int n = 0; n < web.SubDirectories.Count; n++)
                {
                    CacheWebDirectories(web.SubDirectories[n], handler);
                }
            }

            catch (Exception e)
            {
                LogHandler.LogErrors(e.ToString(), handler);
                LogHandler.LogErrors(temp_error_data, handler);
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        public LocalDirectory(string path, BuildHandler handler)
        {
            Handler       = handler;
            DirectoryPath = path;

            directoryInfo = new DirectoryInfo(path);
            BuildFileIndex(directoryInfo);
        }
예제 #6
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);
            }
        }
예제 #7
0
        public BuilderInterface()
        {
            InitializeComponent();

            handler = new BuildHandler(this);

            OpacityBar.Maximum = 100;
            OpacityBar.Minimum = 20;

            OpacityBar.Value = 100;

            Task.Factory.StartNew(ReadSettings);
        }
예제 #8
0
        internal static void GenerateDifferenceIndex(BuildHandler handler)
        {
            try
            {
                DifferenceIndex.Clear();
                foreach (KeyValuePair <string, long> kvp in WebCache)
                {
                    handler.UserInterface.UpdateProgressBar();

                    string[] addressSplit = kvp.Key.Split('/');
                    string   name         = addressSplit[addressSplit.Length - 1];

                    if (!LocalCache.ContainsKey(name))
                    {
                        handler.UserInterface.UpdatePatchNotes
                            (string.Format("Unable to find local match for: {0}", name));

                        if (!DifferenceIndex.Contains(new PatchFile(kvp.Key, name, kvp.Value, PatchHelper.VersionString())))
                        {
                            DifferenceIndex.Add(new PatchFile(kvp.Key, name, kvp.Value, PatchHelper.VersionString()));
                        }
                    }

                    else if (LocalCache.ContainsKey(name))
                    {
                        if (LocalCache.ContainsKey(kvp.Key) && kvp.Value != LocalCache[kvp.Key])
                        {
                            handler.UserInterface.UpdatePatchNotes
                                (string.Format("File Size Difference Found For: {0}", kvp.Key));

                            if (!DifferenceIndex.Contains(new PatchFile(kvp.Key, name, kvp.Value, PatchHelper.VersionString())))
                            {
                                DifferenceIndex.Add(new PatchFile(kvp.Key, name, kvp.Value, PatchHelper.VersionString()));
                            }
                        }
                    }
                }
            }

            catch (Exception e)
            {
                LogHandler.LogErrors(e.ToString(), handler);
            }
        }
예제 #9
0
 internal static void LogErrors(string text, BuildHandler handler)
 {
     handler.UserInterface.UpdatePatchNotes(text); LogErrors(text);
 }
예제 #10
0
 public WebDirectory(string url, BuildHandler handler)
 {
     URL     = url;
     Handler = handler;
     CurrentDirectories++;
 }