Пример #1
0
        public virtual void CopyJavaFilesAndReplacePackageName(string RootSourceDir, string RootDestDir)
        {
            List <string> JavaFilesToCopy = IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(RootSourceDir, true, false, true, true, true);

            foreach (string CurrentFile in JavaFilesToCopy)
            {
                if (CurrentFile.EndsWith(".java") || CurrentFile.EndsWith(".aidl"))
                {
                    string RelativeFilePath   = CurrentFile.Substring(RootSourceDir.Length + 1);
                    string NewDestinationPath = Path.Combine(RootDestDir, RelativeFilePath);

                    if (!Directory.Exists(Path.GetDirectoryName(NewDestinationPath)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(NewDestinationPath));
                    }

                    if (!File.Exists(NewDestinationPath))
                    {
                        IgorRuntimeUtils.CopyFile(CurrentFile, NewDestinationPath);

                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "com.facebook.android.R", PlayerSettings.bundleIdentifier + ".R");
                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "import com.facebook.android.*;", "import com.facebook.android.*;\nimport " + PlayerSettings.bundleIdentifier + ".R;");
                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "com.facebook.android.BuildConfig", PlayerSettings.bundleIdentifier + ".BuildConfig");
                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "import com.mikamikem.AndroidUnity.R;", "import " + PlayerSettings.bundleIdentifier + ".R;");
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Clears Unused Cache File
        /// </summary>
        /// <param name="fileNo">FileNo that is cleared. Set to 0 to clear non-Current Cache</param>
        public static void ClearUnusedCache(int fileNo = 0)
        {
            LoggingLevel log = LanguageManager.Instance.GetLoggingLevel();

            // Clear Unused File
            if (fileNo.Equals(0))
            {
                fileNo = CurrentFile.Equals(1) ? 2 : 1;
            }
            string path = string.Format("{0}/Cache{1}", CachePath, fileNo);

            try
            {
                if (!Directory.Exists(CachePath))
                {
                    LoggingLevel.Debug.Log("ResourceLoader: No Unused Cache to Clear", log);
                    return; // Directory & Files don't exist
                }
                File.Delete(path);
                LoggingLevel.Info.Log(string.Format("ResourceLoader: Cleared Cache file [{0}]", path), log);
            }
            catch (FileNotFoundException)
            {
                LoggingLevel.Debug.Log("ResourceLoader: No Unused Cache to Clear", log);
                // Cache does not exist (yet). Do Nothing
            }
        }
Пример #3
0
        private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (newTagBox.IsFocused)
            {
                return;
            }
            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (e.Key)
            {
            case Key.Left:
                ChangeImage(FilteredFileList.Delta.Prev);
                break;

            case Key.Right:
                ChangeImage(FilteredFileList.Delta.Next);
                break;

            case Key.Delete:
                CurrentFile.Delete(Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift));
                ChangeImage();
                break;

            case Key.Space:
                ToggleFullScreen();
                break;

            case Key.Escape:
                Close();
                break;
            }
        }
Пример #4
0
 private async void FilePickerVM_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(CurrentKey))
     {
         await CurrentFile.LoadFile(CurrentKey, CurrentPath);
     }
 }
Пример #5
0
        public void CopyDirectory_SourceDirectoryName_DestinationDirectoryName_OverwriteFalse()
        {
            var FullPathToSourceDirectory = System.IO.Path.Combine(TestDirectory, "SourceDirectory");
            var FullPathToTargetDirectory = System.IO.Path.Combine(TestDirectory, "TargetDirectory");

            System.IO.Directory.CreateDirectory(FullPathToSourceDirectory);
            for (int i = 0; i < 6; i++)
            {
                CreateTestFile(SourceData, PathFromBase: "SourceDirectory", TestFileName: $"NewFile{i}");
            }
            FileIO.FileSystem.CopyDirectory(FullPathToSourceDirectory, FullPathToTargetDirectory, overwrite: false);
            Assert.Equal(System.IO.Directory.GetFiles(FullPathToSourceDirectory).Length, System.IO.Directory.GetFiles(FullPathToTargetDirectory).Length);
            foreach (var CurrentFile in System.IO.Directory.GetFiles(FullPathToTargetDirectory))
            {
                // Ensure copy transferred written data
                Assert.True(HasExpectedData(CurrentFile, SourceData));
            }
            System.IO.Directory.Delete(FullPathToTargetDirectory, recursive: true);
            System.IO.Directory.CreateDirectory(FullPathToTargetDirectory);
            CreateTestFile(DestData, PathFromBase: "TargetDirectory", TestFileName: $"NewFile0");
            Assert.Throws <System.IO.IOException>(() => FileIO.FileSystem.CopyDirectory(FullPathToSourceDirectory, FullPathToTargetDirectory, overwrite: false));
            Assert.Equal(System.IO.Directory.GetFiles(FullPathToTargetDirectory).Length, System.IO.Directory.GetFiles(FullPathToSourceDirectory).Length);
            foreach (var CurrentFile in System.IO.Directory.GetFiles(FullPathToTargetDirectory))
            {
                Assert.True(HasExpectedData(CurrentFile, CurrentFile.EndsWith("0") ? DestData : SourceData));
            }
        }
Пример #6
0
        public PartialViewResult GetCurrentFiles()
        {
            CurrentFile cur = current.GetCurrentFile();

            string[] list = { cur.Path1.Split('/')[cur.Path1.Split('/').Length - 1], cur.Path2.Split('/')[cur.Path2.Split('/').Length - 1], cur.Path3.Split('/')[cur.Path3.Split('/').Length - 1] };
            return(PartialView(list));
        }
Пример #7
0
        /// <summary>
        /// Load a BGF from .bgf or .xml
        /// </summary>
        /// <param name="Filename">Full path and filename of BGF or XML</param>
        public static void Load(string Filename)
        {
            if (File.Exists(Filename))
            {
                string extension = Path.GetExtension(Filename).ToLower();

                switch (extension)
                {
                case FileExtensions.BGF:
                    CurrentFile.Load(Filename);
                    CurrentFile.DecompressAll();
                    break;

                case FileExtensions.XML:
                    CurrentFile.LoadXml(Filename);
                    break;
                }

                // set input controls in 'settings' window to values from file
                SettingsForm.ShrinkFactor = CurrentFile.ShrinkFactor;
                SettingsForm.Version      = CurrentFile.Version;
                SettingsForm.BgfName      = CurrentFile.Name;

                // set mainoverlay resource to loaded file
                RoomObject.OverlayFile = CurrentFile.Filename + ".bgf";
                RoomObject.Resource    = CurrentFile;
            }
        }
Пример #8
0
        public void UpdateFile3(string path)
        {
            CurrentFile current = Context.CurrentFiles.Find(1);

            current.Path3 = path;
            Context.SaveChanges();
        }
Пример #9
0
        public void UpdateFileID3(int id)
        {
            CurrentFile current = Context.CurrentFiles.Find(1);

            current.FileId3 = id;
            Context.SaveChanges();
        }
Пример #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            //display confirmation message if checked
            if (checkBox_confirm.Checked)
            {
                MessageBox.Show(textBox_FirstName.Text + " " + textBox_LastName.Text + " - " + textBox_Position.Text + " " + "at " + textBox_CompanyName.Text + " " + " was added to the list");
            }
            else
            {
                //do nothing
            }


            //write actual data every time we click add to list
            string        d    = textBox_FirstName.Text + "," + textBox_LastName.Text + "," + textBox_CompanyName.Text + "," + textBox_Position.Text + "," + textBox_email1.Text + "," + textBox_email2.Text + "," + textBox_City.Text + "," + textBox_State.Text + "," + URL + "," + txtbx_source.Text;
            List <string> data = new List <string>();

            data.AddRange(d.Split(','));
            CurrentFile.WriteRow(data);


            //clear fields and set button back to default
            button1.Visible          = false;
            button_GetData.Visible   = true;
            textBox_FirstName.Text   = "";
            textBox_LastName.Text    = "";
            textBox_Position.Text    = "";
            textBox_CompanyName.Text = "";
            textBox_email1.Text      = "";
            textBox_email2.Text      = "";
            textBox_City.Text        = "";
            textBox_State.Text       = "";
            URL = "";
        }
Пример #11
0
        public Stream GetContent()
        {
            var fixedPath =
                CurrentFile.Replace(fileSystem.Path.AltDirectorySeparatorChar, fileSystem.Path.DirectorySeparatorChar);

            return(fileSystem.File.OpenRead(fixedPath));
        }
Пример #12
0
        public void MoveDirectory_Source_DirectoryName_DestinationDirectoryName_UIOptionOverwriteFalse()
        {
            var FullPathToSourceDirectory = System.IO.Path.Combine(TestDirectory, "SourceDirectory");
            var FullPathToTargetDirectory = System.IO.Path.Combine(TestDirectory, "TargetDirectory");

            System.IO.Directory.CreateDirectory(FullPathToSourceDirectory);
            for (int i = 0; i < 6; i++)
            {
                CreateTestFile(SourceData, PathFromBase: "SourceDirectory", TestFileName: $"Select_Skip_this_file{i}");
            }
            System.IO.Directory.CreateDirectory(FullPathToTargetDirectory);
            var NewFile0WithPath = CreateTestFile(DestData, PathFromBase: "TargetDirectory", TestFileName: "Select_Skip_this_file0");

            FileIO.FileSystem.MoveDirectory(FullPathToSourceDirectory, FullPathToTargetDirectory, showUI: UIOption.AllDialogs, onUserCancel: UICancelOption.ThrowException);
            string[] RemainingSourceFilesWithPath = System.IO.Directory.GetFiles(FullPathToSourceDirectory);
            // We couldn't move one file
            Assert.Equal(1, RemainingSourceFilesWithPath.Length);
            // Ensure the file left has correct data
            Assert.True(HasExpectedData(RemainingSourceFilesWithPath[0], SourceData));

            string[] DestinationFilesWithPath = System.IO.Directory.GetFiles(FullPathToTargetDirectory);
            Assert.Equal(6, DestinationFilesWithPath.Length);
            foreach (var CurrentFile in DestinationFilesWithPath)
            {
                Assert.True(HasExpectedData(CurrentFile, CurrentFile.EndsWith("0") ? DestData : SourceData));
            }
        }
Пример #13
0
        public void Save(string path, SerializationFormat format)
        {
            bool error = false;

            try
            {
                FileManager.CreateBackup(path);

                Game.BeforeSerialization();
                CurrentFile.Save(path, format);
                FileManager.TryRegisterExternalFile(path);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                error = true;
            }

            if (error)
            {
                var box = new ExceptionBox();
                box.Title     = "Permissions problem";
                box.Message   = "TiTsEd does not have permission to write over this file or its backup.";
                box.Path      = path;
                box.IsWarning = true;
                box.ShowDialog(ExceptionBoxButtons.Cancel);
            }
            else
            {
                VM.Instance.NotifySaveRequiredChanged(false);
            }
        }
Пример #14
0
        /// <summary>
        /// Load a BGF from .bgf or .xml
        /// </summary>
        /// <param name="Filename">Full path and filename of BGF or XML</param>
        public static void Load(string Filename)
        {
            // stop animation playback
            Program.IsPlaying      = false;
            MainForm.btnPlay.Image = Properties.Resources.Play;

            if (File.Exists(Filename))
            {
                string extension = Path.GetExtension(Filename).ToLower();

                switch (extension)
                {
                case FileExtensions.BGF:
                    CurrentFile.Load(Filename);
                    CurrentFile.DecompressAll();
                    break;

                case FileExtensions.XML:
                    CurrentFile.LoadXml(Filename);
                    break;
                }

                // set input controls in 'settings' window to values from file
                SettingsForm.ShrinkFactor = CurrentFile.ShrinkFactor;
                SettingsForm.Version      = CurrentFile.Version;
                SettingsForm.BgfName      = CurrentFile.Name;
            }
        }
Пример #15
0
        /// <summary>
        /// Points the Equalizer APO configuration file to the specified named file.
        /// If null, the file it points to is the name found by <see cref="File.GetEqualizerFilename"/>().
        /// If <see cref="NO_FILTERS"/>, the configuration is set not to point to any file.
        /// </summary>
        /// <param name="equalizerFilename"></param>
        private void PointConfig(String equalizerFilename = null)
        {
            // get the equalizer file name
            if (CurrentFile == null && equalizerFilename == null)
            {
                return;
            }
            if (!applyEqualizer)
            {
                return;
            }
            if (equalizerFilename == null)
            {
                equalizerFilename = CurrentFile.GetEqualizerFilename();
            }
            String configPath = File.GetEqualizerAPOPath() + "config\\config.txt";

            // check for none.txt filenames
            if (equalizerFilename == NO_FILTERS)
            {
                File.WriteAllLines(configPath, new string[] { "" });
            }

            // check that the config file exists and is a file, not a directory
            if (!System.IO.File.Exists(configPath) ||
                (System.IO.File.GetAttributes(configPath) & FileAttributes.Directory) == FileAttributes.Directory)
            {
                throw new FileNotFoundException(
                          String.Format("File {0} not found or is directory.", configPath),
                          configPath);
            }

            // write the include to the config file
            File.WriteAllLines(configPath, new string[] { "Include: " + equalizerFilename });
        }
Пример #16
0
        public virtual bool BuildOculus()
        {
            List <string> BuiltDesktopFiles = new List <string>();

            BuiltDesktopFiles.AddRange(IgorCore.GetModuleProducts());

            string OculusDirectToRiftFilename = "";

            foreach (string CurrentFile in BuiltDesktopFiles)
            {
                if (CurrentFile.EndsWith(".exe"))
                {
                    OculusDirectToRiftFilename = CurrentFile.Replace(".exe", "_DirectToRift.exe");
                }
            }

            if (File.Exists(OculusDirectToRiftFilename))
            {
                BuiltDesktopFiles.Add(OculusDirectToRiftFilename);
            }

            IgorCore.SetNewModuleProducts(BuiltDesktopFiles);

            return(true);
        }
Пример #17
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (CurrentFile != null)
     {
         CurrentFile.Dispose();
     }
 }
Пример #18
0
        /// <summary>
        /// Saves the current file as .bgf or .xml/.bmp
        /// </summary>
        /// <param name="Filename"></param>
        public static void Save(string Filename)
        {
            // set values in file from input controls in 'settings' window
            CurrentFile.ShrinkFactor = SettingsForm.ShrinkFactor;
            CurrentFile.Version      = SettingsForm.Version;
            CurrentFile.Name         = SettingsForm.BgfName;

            string extension = Path.GetExtension(Filename);

            switch (extension)
            {
            case FileExtensions.BGF:
                if (SettingsForm.IsSaveCompresed)
                {
                    CurrentFile.CompressAll();
                }
                else
                {
                    CurrentFile.DecompressAll();
                }

                CurrentFile.Save(Filename);
                break;

            case FileExtensions.XML:
                CurrentFile.WriteXml(Filename);
                break;
            }
        }
Пример #19
0
 public void AddNode(INodeDataGenerator node, Point p)
 {
     if (CurrentFile.File.Exists)
     {
         TNode  g       = CurrentFile.MakeNode(node.Generate(Id <NodeTemp> .New(), new List <NodeDataGeneratorParameterData>(), CurrentFile), new NodeUIData(p));
         Action addNode = () => { CurrentFile.Add(g.Only(), Enumerable.Empty <NodeGroup>(), m_localization); };
         g.Configure(MyEdit).Do
         (
             //Configure the node and then add it. We need to configure the node before adding so that it is in a valid state
             //when added. Failure to do so results in localized string parameters having a null value meaning their undo
             //behavior can't be set up correctly.
             simpleUndoPair => { simpleUndoPair.Redo(); addNode(); },
             resultNotOk =>
         {
             if (resultNotOk == ConfigureResult.Cancel)
             {
                 //Merge the parameter into a junk source so it doesn't count towards the real source
                 foreach (var parameter in g.Data.Parameters.OfType <IDynamicEnumParameter>())
                 {
                     parameter.MergeInto(new DynamicEnumParameter.Source());
                 }
             }
             else
             {
                 addNode();      //Add the node if the user didn't cancel (i.e. no editing was required)
             }
         }
         );
     }
 }
Пример #20
0
 private void drawWindow_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         if (m_mouseController.Selected.Nodes.Any() || m_mouseController.Selected.Groups.Any())
         {
             //TODO: This would probably make more sense in MouseController.Delete
             CurrentFile.Remove(m_mouseController.Selected.Nodes.Select(CurrentFile.GetNode), m_mouseController.Selected.Groups, m_localization);
         }
         else
         {
             var delete = m_mouseController.Delete();
             if (delete != null)
             {
                 GenericUndoAction action = new GenericUndoAction(() => { delete.Value.Undo(); Redraw(); },
                                                                  () => { delete.Value.Redo(); Redraw(); },
                                                                  "Deleted");
                 CurrentFile.UndoableFile.Change(action);
             }
         }
     }
     else if (e.KeyCode == Keys.Tab && e.Control)
     {
         int index = m_context.CurrentProject.Value.Localizer.LocalizationSets.IndexOf(m_context.CurrentLocalization.Value);
         if (index >= 0)
         {
             m_context.CurrentLocalization.Value = m_context.CurrentProject.Value.Localizer.LocalizationSets.InfiniteRepeat().ElementAt(index + 1);
             Redraw();
         }
     }
 }
Пример #21
0
        private bool SaveOrSaveAs(bool saveAs)
        {
            L3dFilePath p;

            if (saveAs || L3dFilePath.IsNullOrEmpty(CurrentFile.OwnPath))
            {
                p = DialogHelpers.SaveLoksimFile(CurrentFile.OwnPath, FileExtensionForSaveAs, SAVEAS_DLG_GUID);
            }
            else
            {
                p = CurrentFile.OwnPath;
            }

            try
            {
                if (p != null)
                {
                    CurrentFile.SaveToFile(p);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format(CultureInfo.CurrentCulture, Resources.Strings.FileSaveError, CurrentFile.OwnPath, ex.Message),
                                Resources.Strings.AppName, System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
            }
            return(false);
        }
Пример #22
0
        /// <summary>
        /// Calcul des sommes md5 et update de la fenetre de progression
        /// </summary>
        /// <param name="images"></param>
        /// <returns></returns>
        public async Task Calculate_MD5(ExtImageDetails[] images, int retardateur)
        {
            ITrace.Indent++;
            ExtImageDetails[] extImages = new ExtImageDetails[images.Length];

            int i = 1;

            foreach (ExtImageDetails image in images)
            {
                ITrace.WriteLine($"[Md5] {image.ImageType} | {image.Region}");
                ITrace.WriteLine($"[Md5] {image.FilePath}");
                //extImages[i].Md5Sum =
                image.Md5Sum = await GetMD5HashFromFile(image.FilePath);

                // Pour permettre un affichage lisible retarde le calcul
                await Task.Delay(retardateur);

                ITrace.WriteLine($"[Md5] Somme: {image.Md5Sum} \n");

                CurrentFile?.Invoke(image.FilePath);
                CurrentPosition?.Invoke(i);

                i++;
            }

            ITrace.Indent--;
        }
Пример #23
0
        /// <summary>
        /// Set new values for the gains for the filters on the <see cref="CurrentFile"/>.
        /// Adds or removes filters as necessary so that there are as many filters as there are string values.
        /// Calls the <see cref="EqualizerChanged"/> event handler.
        /// </summary>
        /// <param name="newFilterGains">The new gains, as string representations of decimal values</param>
        public void SetNewGainValues(string[] newFilterGains)
        {
            // remove unnecessary filters
            while (CurrentFile.ReadFilters().Count > newFilterGains.Length)
            {
                RemoveFilter();
            }

            // go through existing filters
            int filterIndex = -1;

            foreach (KeyValuePair <double, Filter> pair in CurrentFile.ReadFilters())
            {
                filterIndex++;
                Filter filter = pair.Value;
                double gain   = Convert.ToDouble(newFilterGains[filterIndex]);

                // check that the gain will change
                if (Math.Abs(filter.Gain - gain) < GAIN_ACCURACY)
                {
                    continue;
                }

                // change the gain
                filter.Gain = gain;
            }

            // add necessary filters
            for (filterIndex = CurrentFile.ReadFilters().Count; filterIndex < newFilterGains.Length; filterIndex++)
            {
                double gain = Convert.ToDouble(newFilterGains[filterIndex]);
                AddFilter();
                CurrentFile.ReadFilters().Last().Value.Gain = gain;
            }
        }
Пример #24
0
 /// <summary>
 /// Get a page (image) of the ComicBook.
 /// </summary>
 /// <param name="pageIndex">Index number of page from the current ComicFile.</param>
 /// <returns></returns>
 public byte[] GetPage(int pageIndex)
 {
     if (CurrentFile == null || TotalFiles == 0)
     {
         return(null);
     }
     return(CurrentFile.SetIndex(pageIndex));
 }
Пример #25
0
 /// <summary>
 /// Remove the last filter in the list of filters.
 /// Calls the <see cref="EqualizerChanged"/> event handler.
 /// </summary>
 public void RemoveFilter()
 {
     if (CurrentFile == null)
     {
         return;
     }
     CurrentFile.RemoveFilter();
 }
Пример #26
0
 /// <summary>
 /// Get a list of the filters for the current file.
 /// </summary>
 /// <returns>The filters, or an empty list.</returns>
 public SortedList <double, Filter> GetFilters()
 {
     if (CurrentFile == null)
     {
         return(new SortedList <double, Filter>());
     }
     return(CurrentFile.ReadFilters());
 }
Пример #27
0
 /// <summary>
 /// Add a filter to the list of filters at the end, with zero gain.
 /// Calls the <see cref="EqualizerChanged"/> event handler.
 /// </summary>
 public void AddFilter()
 {
     if (CurrentFile == null)
     {
         return;
     }
     CurrentFile.AddFilter();
 }
Пример #28
0
 protected override void OnLoaded()
 {
     if (SetProperty(ref _netDiskUser, _localDiskUserRepository?.FirstOrDefault()?.CurrentNetDiskUser) && _netDiskUser != null)
     {
         CurrentFile = Container.Resolve <NetDiskFileNodeViewModel>(new DependencyOverride <INetDiskFile>(_netDiskUser.RootFile));
         CurrentFile?.RefreshChildren();
     }
 }
Пример #29
0
 public void CutSelection()
 {
     //TODO: This has a lot in common with the delete operation
     if (m_mouseController.Selected.Nodes.Any() || m_mouseController.Selected.Groups.Any())
     {
         m_copyPasteController.Cut(Selected.Nodes.Select(CurrentFile.GetNode), Selected.Groups);
         CurrentFile.Remove(m_mouseController.Selected.Nodes.Select(CurrentFile.GetNode), m_mouseController.Selected.Groups, m_localization);
     }
 }
Пример #30
0
 /// <summary>
 /// Get a page (image) of the ComicBook.
 /// </summary>
 /// <param name="fileIndex">Index number of the ComicFile.</param>
 /// <param name="pageIndex">Index number of page from the ComicFile.</param>
 /// <returns>The requested image.</returns>
 public byte[] GetPage(int fileIndex, int pageIndex)
 {
     if (TotalFiles == 0 || fileIndex >= Count || fileIndex < 0)
     {
         return(null);
     }
     CurrentFile = this[fileIndex];
     return(CurrentFile.SetIndex(pageIndex));
 }
Пример #31
0
 protected bool Equals(CurrentFile other)
 {
     return string.Equals(FileName, other.FileName) && Length == other.Length;
 }