private static void RenameFileOrDirectory(string oldPath, string newPath)
 {
     try
     {
         UnityRestClient.RestClient.MoveAssetRequest(oldPath, newPath);
         UnityModeAddin.UpdateUnityProjectStateRename(oldPath, newPath);
     }
     catch (Exception)
     {
         LoggingService.LogInfo("Unity rename failed: " + oldPath + " -> " + newPath);
     }
 }
Пример #2
0
        void InitializeRestServiceAndPair()
        {
            UnityModeAddin.Initialize();

            restService = new RestService(fileOpenRequest =>
            {
                var fileOpenInformation = new FileOpenInformation(fileOpenRequest.File, null, fileOpenRequest.Line, 0, OpenDocumentOptions.BringToFront);

                try
                {
                    DispatchService.GuiDispatch(() =>
                    {
                        if (IdeApp.Workbench.Documents.Any(d => d.FileName == fileOpenInformation.FileName))
                        {
                            var docs = IdeApp.Workbench.Documents.Where(d => d.FileName == fileOpenInformation.FileName);
                            docs.ElementAt(0).Select();
                        }
                        else
                        {
                            IdeApp.Workbench.OpenDocument(fileOpenInformation);
                            DispatchService.GuiDispatch(IdeApp.Workbench.GrabDesktopFocus);
                        }
                    });
                }
                catch (Exception e)
                {
                    LoggingService.LogError(e.ToString());
                }
            }
                                          );

            DispatchService.BackgroundDispatch(() =>
            {
                LoggingService.LogInfo("Sending Unity Pair request");
                var result = RestClient.Pair(restService.Url, "MonoDevelop " + MonoDevelop.BuildInfo.VersionLabel);
                LoggingService.LogInfo("Unity Pair Request: " + result.Result);
                StartupOptions.UnityProcessId = result.unitypid;
            });

            UnityModeAddin.UpdateUnityProjectState();
        }
        void CopyDirectory(FilePath src, FilePath dest, FilePath subdir)
        {
            string destDir = Path.Combine(dest, subdir);

            if (!Directory.Exists(destDir))
            {
                FileService.CreateDirectory(destDir);
            }

            foreach (string file in Directory.GetFiles(src))
            {
                FileService.CopyFile(file, Path.Combine(destDir, Path.GetFileName(file)));
            }

            foreach (string dir in Directory.GetDirectories(src))
            {
                CopyDirectory(dir, dest, Path.Combine(subdir, Path.GetFileName(dir)));
            }

            UnityModeAddin.UpdateUnityProjectState();
        }
Пример #4
0
        public void AddNewFolder()
        {
            var    folder        = CurrentNode.GetParentDataItem(typeof(Folder), true) as Folder;
            string directoryName = folder.AbsolutePath + "/" + GettextCatalog.GetString("New Folder");
            int    index         = -1;

            if (Directory.Exists(directoryName))
            {
                while (Directory.Exists(directoryName + (++index + 1)))
                {
                    ;
                }
            }

            if (index >= 0)
            {
                directoryName += index + 1;
            }

            Directory.CreateDirectory(directoryName);

            UnityModeAddin.UpdateUnityProjectState();
        }
 public override void CopyDirectory(FilePath sourcePath, FilePath destPath)
 {
     CopyDirectory(sourcePath, destPath, "");
     UnityModeAddin.UpdateUnityProjectState();
 }
 public override void CreateDirectory(FilePath path)
 {
     Directory.CreateDirectory(path);
     UnityModeAddin.UpdateUnityProjectState();
 }
 public override void DeleteDirectory(FilePath path)
 {
     Directory.Delete(path, true);
     UnityModeAddin.UpdateUnityProjectState();
 }
 public override void DeleteFile(FilePath file)
 {
     System.IO.File.Delete(file);
     UnityModeAddin.UpdateUnityProjectState();
 }
 public override void CopyFile(FilePath source, FilePath dest, bool overwrite)
 {
     System.IO.File.Copy(source, dest, overwrite);
     UnityModeAddin.UpdateUnityProjectState();
 }
Пример #10
0
 private void WorkbenchFocusInEvent(object o, Gtk.FocusInEventArgs args)
 {
     UnityModeAddin.UpdateUnityProjectState();
 }