Exemplo n.º 1
0
        public void Clean()
        {
            if (Project == null)
            {
                return;
            }

            currentBuild = BuildStep.Clean;
            BuildStatusChanged?.BeginInvoke(this, BuildStep.Clean, null, null);
            buildingThread = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
            {
                string outputDir = getOutputDir();
                IsBuilding       = true;
                foreach (var file in cache.Files.Where(x => x.Value.IsBuilt(outputDir)).Select(x => x.Value.InputFile))
                {
                    ContentFile item;
                    if (builtFiles.TryGetValue(file, out item))
                    {
                        ItemProgress?.BeginInvoke(this, new ItemProgressEventArgs(BuildStep.Clean, item), null, null);
                        if (System.IO.File.Exists(getDestinationFileAbsolute(item)))
                        {
                            System.IO.File.Delete(getDestinationFileAbsolute(item));
                        }
                    }
                }
                IsBuilding = false;
                BuildStatusChanged?.Invoke(this, BuildStep.Clean | BuildStep.Finished);
            }));
            buildingThread.Start();
        }
Exemplo n.º 2
0
 public void Abort()
 {
     if (!IsBuilding)
     {
         return;
     }
     buildingThread.Abort();//TODO: better solution?
     IsBuilding = false;
     BuildStatusChanged?.Invoke(this, currentBuild | BuildStep.Abort);
 }
Exemplo n.º 3
0
 private void CleanThread()
 {
     IsBuilding = true;
     foreach (var cachedItem in cache.Files)
     {
         var item = Project.GetElement(cachedItem.Value.InputFile) as ContentFile;
         if (item != null)
         {
             ItemProgress?.BeginInvoke(this, new ItemProgressEventArgs(BuildStep.Clean, item), null, null);
             if (System.IO.File.Exists(GetDestinationFileAbsolute(item)))
             {
                 System.IO.File.Delete(GetDestinationFileAbsolute(item));
             }
         }
     }
     IsBuilding = false;
     BuildStatusChanged?.Invoke(this, BuildStep.Clean | BuildStep.Finished);
 }