コード例 #1
0
ファイル: Log.cs プロジェクト: mateoKlab/AMD
 public static void W(string title, params object[] args)
 {
     #if !NO_DEBUG
     string[] stringData = Array.ConvertAll <object, string>(args, o => o.ToString());
     Debug.LogWarningFormat(FORMAT, title.SetColor(COLOR_WARNING), string.Join(" ", stringData));
     #endif
 }
コード例 #2
0
ファイル: BuildTools.cs プロジェクト: wudaozhiye/ECSRealEnd
    // Token: 0x06000025 RID: 37 RVA: 0x00003880 File Offset: 0x00001A80
    private static void PackData()
    {
        bool flag = !Directory.Exists(ProjectConfig.DataPath);

        if (flag)
        {
            Debug.LogError("UnExist path " + ProjectConfig.DataPath);
        }
        else
        {
            string directoryName = Path.GetDirectoryName(ProjectConfig.StreamDataPath);
            bool   flag2         = !Directory.Exists(directoryName);
            if (flag2)
            {
                Directory.CreateDirectory(directoryName);
            }
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            ZipUtil.ZipDir(ProjectConfig.ExcelPath, ProjectConfig.ExcelZipPath, "*.*", 4);
            ZipUtil.ZipDir(ProjectConfig.MapPath, ProjectConfig.MapZipPath, "*.*", 4);
            stopwatch.Stop();
            Debug.LogWarningFormat("Zip Data.zip, Cost Time:{0}", new object[]
            {
                stopwatch.Elapsed.ToString()
            });
        }
    }
コード例 #3
0
        /// <summary>
        /// Get the compressions settings for the specified asset bundle.
        /// </summary>
        /// <param name="identifier">The identifier of the asset bundle.</param>
        /// <returns>The compression setting for the asset group.  If the group is not found, the default compression is used.</returns>
        public override BuildCompression GetCompressionForIdentifier(string identifier)
        {
            string groupGuid;

            if (m_bundleToAssetGroup.TryGetValue(identifier, out groupGuid))
            {
                var group = m_settings.FindGroup(g => g.Guid == groupGuid);
                if (group != null)
                {
                    var abSchema = group.GetSchema <BundledAssetGroupSchema>();
                    if (abSchema != null)
                    {
                        return(abSchema.GetBuildCompressionForBundle(identifier));
                    }
                    else
                    {
                        Debug.LogWarningFormat("Bundle group {0} does not have BundledAssetGroupSchema.", group.name);
                    }
                }
                else
                {
                    Debug.LogWarningFormat("Unable to find group with guid {0}", groupGuid);
                }
            }
            return(base.GetCompressionForIdentifier(identifier));
        }
コード例 #4
0
        public UPRToolSetting Load()
        {
            UPRToolSetting uprToolSetting = new UPRToolSetting();

            string    tempFilePath = string.Empty;
            TextAsset tempAsset    = Resources.Load <TextAsset>(Path.GetFileNameWithoutExtension(UPRSettingFile));
            var       datas        = tempAsset?.bytes;

            if (datas == null)
            {
                Debug.LogWarningFormat("[UPRToolSetting] can't load {0} at {1},just creat it.", UPRSettingFile, tempFilePath);
                Save();
                return(uprToolSetting);
            }

            using (var memoryStream = new MemoryStream(datas))
            {
                using (var binaryReader = new BinaryReader(memoryStream))
                {
                    uprToolSetting.m_loadScene       = binaryReader.ReadBoolean();
                    uprToolSetting.m_loadAsset       = binaryReader.ReadBoolean();
                    uprToolSetting.m_loadAssetBundle = binaryReader.ReadBoolean();
                    uprToolSetting.m_instantiate     = binaryReader.ReadBoolean();
                }
            }

            return(uprToolSetting);
        }
コード例 #5
0
        public static void OpenFile(string path)
        {
            string filePath = Path.GetFullPath(path);

            if (!File.Exists(filePath))
            {
                Debug.LogError(string.Format("Path {0} doesn't exists", path));
                return;
            }

            string externalScriptEditor = ScriptEditorUtility.GetExternalScriptEditor();

            if (externalScriptEditor != "internal")
            {
                ProcessStartInfo psi = CreateProcessStartInfo(filePath);
                Process.Start(psi);
            }
            else
            {
                Process p = new Process();
                p.StartInfo.FileName  = filePath;
                p.EnableRaisingEvents = true;
                p.Exited += (Object obj, EventArgs args) =>
                {
                    if (p.ExitCode != 0)
                    {
                        Debug.LogWarningFormat("Unable to open {0}: Check external editor in preferences", filePath);
                    }
                };
                p.Start();
            }
        }
コード例 #6
0
    static void OpenReleaseNotes(int num)
    {
        string url = "", version = "";

        if (currentList.Values[num].Contains("a"))
        {
            Debug.LogWarningFormat("Release Notes for alpha version {0} are not available", currentList.Values[num]);
            EditorApplication.Beep();
            return;
        }
        if (currentList.Values[num].Contains("p"))
        {
            version = currentList.Values[num].Split(' ')[0];
            url     = patchRN + version;
        }
        if (currentList.Values[num].Contains("f"))
        {
            version = currentList.Values[num].Split('f')[0];
            url     = finalRN + version;
        }
        if (currentList.Values[num].Contains("b"))
        {
            version = currentList.Values[num].Split(' ')[0];
            url     = betaRN + version;
        }
        if (!string.IsNullOrEmpty(url))
        {
            Application.OpenURL(url);
        }
    }
コード例 #7
0
        void Init(string assetPath)
        {
            config = AssetDatabase.LoadAssetAtPath <ProjectAuditorConfig>(assetPath);
            if (config == null)
            {
                Debug.LogWarningFormat("Project Auditor: {0} not found.", assetPath);

                var path = Path.GetDirectoryName(assetPath);
                if (!File.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                config = ScriptableObject.CreateInstance <ProjectAuditorConfig>();
                AssetDatabase.CreateAsset(config, assetPath);

                Debug.LogFormat("Project Auditor: {0} has been created.", assetPath);
            }

            foreach (var type in AssemblyHelper.GetAllTypesInheritedFromInterface <IAuditor>())
            {
                var instance = Activator.CreateInstance(type) as IAuditor;
                instance.Initialize(config);
                instance.Reload(DataPath);
                m_Auditors.Add(instance);
            }
        }
コード例 #8
0
    private static void RunCommand(string command, bool asAdmin = true)
    {
        ProcessStartInfo psi = new ProcessStartInfo("cmd", String.Format("/c \"{0}\"", command))
        {
            UseShellExecute = true,
            Verb            = asAdmin ? "runas" : null,
            CreateNoWindow  = true,
        };
        Process commandProcess = Process.Start(psi);

        if (commandProcess == null)
        {
            throw new UnityException("Unable to start process to run command '{0}'." + command);
        }

        if (!commandProcess.WaitForExit(30000))
        {
            throw new UnityException("Command '{0}' has not completed after 30 seconds.  Unable to determine if it has succeeded.");
        }

        if (commandProcess.ExitCode != 0)
        {
            Debug.LogWarningFormat("Command '{0}' failed.  Exit code: {1}", command, commandProcess.ExitCode);
        }
    }
コード例 #9
0
 // Simple analog of the Linux/BSD "rmdir" command.
 public static bool RmDir(string path)
 {
     Debug.Log("Removing directory: " + path);
     if (!Directory.Exists(path))
     {
         Debug.LogWarningFormat("Ignoring, directory not found: {0}", path);
         return(false);
     }
     try {
         Directory.Delete(path, true);
         if (string.IsNullOrEmpty(Path.GetFileName(path)))
         {
             path = Path.GetDirectoryName(path);
         }
         path += ".meta";
         if (File.Exists(path))
         {
             File.Delete(path);
         }
     } catch (Exception e) {
         Debug.LogErrorFormat("Exception while deleting '{0}': {1}", path, e);
         return(false);
     }
     return(true);
 }
コード例 #10
0
 static void Wait(WWW www, EditorApplication.CallbackFunction caller, Action <WWW> action, Action done = null)
 {
     if (www != null && www.isDone)
     {
         EditorApplication.update -= caller;
         if (string.IsNullOrEmpty(www.error) && www.bytesDownloaded > 0)
         {
             //Debug.LogFormat("{0} kB: {1}", www.size/1024, www.url);
             if (action != null)
             {
                 action(www);
             }
             if (done != null)
             {
                 done();
             }
         }
         else
         {
             Debug.LogWarningFormat("{0} {1}", www.url, www.error);
         }
         www = null;
     }
     else
     {
         if (www == null)
         {
             EditorApplication.update -= caller;
         }
     }
 }
コード例 #11
0
        private void DoAcceptTcpClientCallback(IAsyncResult ar)
        {
            TcpListener listener = ar.AsyncState as TcpListener;

            try
            {
                TcpClient client = listener.EndAcceptTcpClient(ar);
                lock (clientsLock)
                {
                    clients.Add(client);
                    Debug.Log("[OVRNetworkTcpServer] client added");
                }

                try
                {
                    tcpListener.BeginAcceptTcpClient(new AsyncCallback(DoAcceptTcpClientCallback), tcpListener);
                }
                catch (Exception e)
                {
                    Debug.LogWarningFormat("[OVRNetworkTcpServer] can't accept new client: {0}", e.Message);
                }
            }
            catch (Exception e)
            {
                Debug.LogWarningFormat("[OVRNetworkTcpServer] EndAcceptTcpClient failed: {0}", e.Message);
            }
        }
コード例 #12
0
ファイル: VisualElement.cs プロジェクト: tfart/DeLightingTool
        protected bool SetValue <TPropertyType>(ClassProperty <TPropertyType> property, TPropertyType value)
        {
            var resolvedDataContext = dataContext;

            if (resolvedDataContext == null)
            {
                UnityDebug.LogWarning("SetValue without data context");
                return(false);
            }

            try
            {
                if (!property.ValueEquals(resolvedDataContext, value))
                {
                    property.SetValue(resolvedDataContext, value);
                    return(true);
                }

                return(false);
            }
            catch (Exception e)
            {
                UnityDebug.LogWarningFormat("Could not set property {0} in data context {1} with {2} ({3})", property.propertyName, m_DataContext, value, e);
                return(false);
            }
        }
コード例 #13
0
        private void DoAcceptTcpClientCallback(IAsyncResult ar)
        {
            TcpListener listener = ar.AsyncState as TcpListener;

            try
            {
                TcpClient client = listener.EndAcceptTcpClient(ar);
                lock (clientsLock)
                {
                    clients.Add(client);
                    Debug.Log("[OVRNetworkTcpServer] client added");
                }

                try
                {
                    tcpListener.BeginAcceptTcpClient(new AsyncCallback(DoAcceptTcpClientCallback), tcpListener);
                }
                catch (Exception e)
                {
                    Debug.LogWarningFormat("[OVRNetworkTcpServer] can't accept new client: {0}", e.Message);
                }
            }
            catch (ObjectDisposedException)
            {
                // Do nothing. It happens when stop preview in editor, which is normal behavior.
            }
            catch (Exception e)
            {
                Debug.LogWarningFormat("[OVRNetworkTcpServer] EndAcceptTcpClient failed: {0}", e.Message);
            }
        }
コード例 #14
0
        public void StartListening(int listeningPort)
        {
            if (tcpListener != null)
            {
                Debug.LogWarning("[OVRNetworkTcpServer] tcpListener is not null");
                return;
            }

            IPAddress localAddr = IPAddress.Any;

            tcpListener = new TcpListener(localAddr, listeningPort);
            try
            {
                tcpListener.Start();
                //Debug.LogFormat("TcpListener started. Local endpoint: {0}", tcpListener.LocalEndpoint.ToString());
            }
            catch (SocketException e)
            {
                tcpListener = null;
            }

            if (tcpListener != null)
            {
                //Debug.LogFormat("[OVRNetworkTcpServer] Start Listening on port {0}", listeningPort);

                try
                {
                    tcpListener.BeginAcceptTcpClient(new AsyncCallback(DoAcceptTcpClientCallback), tcpListener);
                }
                catch (Exception e)
                {
                    Debug.LogWarningFormat("[OVRNetworkTcpServer] can't accept new client: {0}", e.Message);
                }
            }
        }
コード例 #15
0
ファイル: OVRNetwork.cs プロジェクト: ssuto-jp/VRVideo
        public void StartListening(int listeningPort)
        {
            if (tcpListener != null)
            {
                Debug.LogWarning("[OVRNetworkTcpServer] tcpListener is not null");
                return;
            }

            IPAddress localAddr = IPAddress.Parse("127.0.0.1");

            tcpListener = new TcpListener(localAddr, listeningPort);
            try
            {
                tcpListener.Start();
            }
            catch (SocketException e)
            {
                Debug.LogWarningFormat("[OVRNetworkTcpServer] Unsable to start TcpListener. Socket exception: {0}", e.Message);
                Debug.LogWarning("It could be caused by multiple instances listening at the same port, or the port is forwarded to the Android device through ADB");
                Debug.LogWarning("If the port is forwarded through ADB, use the Android Tools in Tools/Oculus/System Metrics Profiler to kill the server");
                tcpListener = null;
            }

            if (tcpListener != null)
            {
                Debug.LogFormat("[OVRNetworkTcpServer] Start Listening on port {0}", listeningPort);
            }
        }
コード例 #16
0
        public static Type FindTypeInAssembly(String typeName, Assembly assembly = null)
        {
            Type type = null;

            if (assembly == null)
            {
                type = Type.GetType(typeName, false);
            }
            if (type == null && assembly != null)
            {
                var types = assembly.GetTypes();
                for (int j = 0; j < types.Length; ++j)
                {
                    var b = types[j];
                    if (b.FullName == typeName)
                    {
                        type = b;
                        break;
                    }
                }
            }
            if (type == null)
            {
                Debug.LogWarningFormat("FindType( \"{0}\", \"{1}\" ) failed!",
                                       typeName, assembly != null ? assembly.FullName : "--");
            }
            return(type);
        }
コード例 #17
0
    private static ScriptableObject GetOrCreate(string typeName, string instanceName)
    {
        var assembly = Assembly.GetAssembly(typeof(ICsvConfigurable));
        var type     = assembly
                       .GetExportedTypes()
                       .FirstOrDefault(_ => _.FullName.Equals(typeName, StringComparison.InvariantCultureIgnoreCase));

        if (type == null)
        {
            Debug.LogWarningFormat("Type {0} not found", typeName);
            return(null);
        }

        var assetPath         = Path.Combine("Assets/Data/Remote Data/", type.Name);
        var assetPathWithName = assetPath + "/" + instanceName + ".asset";

        var instance = AssetDatabase.LoadAssetAtPath <ScriptableObject>(assetPathWithName);

        if (instance == null)
        {
            instance = ScriptableObject.CreateInstance(type);
            Directory.CreateDirectory(assetPath).Attributes = FileAttributes.Normal;
            AssetDatabase.CreateAsset(instance, assetPathWithName);
        }

        EditorUtility.SetDirty(instance);

        return(instance);
    }
コード例 #18
0
        private static List <MetadataEntity> CreateEntityDataList(MetadataAssetSettings settings, DataTable table, Type entityClassType, List <MetadataEntityRawInfo> rawInfoList)
        {
            var list     = new List <MetadataEntity>();
            var rowCount = table.Rows.Count;

            for (var i = settings.EntityDataStartingRowIndex; i < rowCount; ++i)
            {
                var entityData = (MetadataEntity)entityClassType.InvokeConstructor();

                for (int j = 0, propertiesCount = rawInfoList.Count; j < propertiesCount; ++j)
                {
                    var cellValue  = table.Rows[i][j].ToString();
                    var rowInfo    = rawInfoList[j];
                    var typeParser = PropertyTypeConverterFactory.GetTypeConverter(rowInfo.PropertyType, rowInfo.PropertyName);

                    if (typeParser != null)
                    {
                        var value = typeParser.Parse(cellValue.Trim(), rowInfo.Parameters);
                        entityData.SetPropertyValue(rowInfo.PropertyName, value);
                    }
                    else
                    {
                        UnityDebug.LogWarningFormat("Type '{0}' is not supported!", rowInfo.PropertyType);
                    }
                }

                list.Add(entityData);
            }

            return(list);
        }
コード例 #19
0
        public int RunExternalProcessSync(string command, string[] argsArray, out string outputString, out string errorString)
        {
            string args = string.Join(" ", argsArray);

            Debug.Log("command:" + command + " " + args);

            int exitCode  = -1;
            var startInfo = new ProcessStartInfo(command, args);

            startInfo.UseShellExecute        = false;
            startInfo.RedirectStandardOutput = true;
            startInfo.RedirectStandardError  = true;
            startInfo.RedirectStandardInput  = false;           // 入力を読み取り不可.
            startInfo.CreateNoWindow         = true;

            outputStringBuilder = new StringBuilder("");
            errorStringBuilder  = new StringBuilder("");

            process = Process.Start(startInfo);
            process.OutputDataReceived += new DataReceivedEventHandler(OutputDataReceivedHandler);
            process.ErrorDataReceived  += new DataReceivedEventHandler(ErrorDataReceivedHandler);

            process.BeginOutputReadLine();
            process.BeginErrorReadLine();

            try
            {
                var maxRetryNum = (int)(timeout.TotalMilliseconds / interval);
                var retryCount  = 0;

                while (!process.WaitForExit(interval))
                {
                    Debug.Log("Waiting...");

                    // 制限時間を超えたら子プロセスを終了させる。(無限リトライさせない)
                    if (retryCount++ >= maxRetryNum)
                    {
                        process.Kill();
                        throw new TimeoutException("Timeout: " + command + " " + args);
                    }
                }

                // Timeout時はExitCodeはないので、ここを通ってはならない
                exitCode = process.ExitCode;
            }
            catch (Exception e)
            {
                Debug.LogWarningFormat("exception {0}", e.Message);
            }

            process.Close();

            outputString = outputStringBuilder.ToString();
            errorString  = errorStringBuilder.ToString();

            outputStringBuilder = null;
            errorStringBuilder  = null;

            return(exitCode);
        }
コード例 #20
0
        public static int GenerateGameVersion(bool commit)
        {
            var projectPath = Directory.GetParent(Application.dataPath).FullName;
            var local       = CommandHelper.SvnRevision(projectPath);
            var head        = CommandHelper.SvnRevision(projectPath, "HEAD");

            if (local != head)
            {
                Debug.LogWarningFormat(
                    "Current project is not up to date. You should update first before set version. local: {0}, remote {1} ",
                    local, head);
            }

            var lastLog = CommandHelper.SvnLogRemote(projectPath);

            if (lastLog.StartsWith("BUILD VERSION NUMBER"))
            {
                Debug.LogWarningFormat("BUILD VERSION NUMBER has been updated\n{0}", lastLog);
                return(0);
            }

            var version = ModifyVersionNumber(local, "BUILD VERSION NUMBER", commit);

            AssetDatabase.Refresh();

            return(version);
        }
コード例 #21
0
 static public void LogWarningFormat(Object context, string message, params object[] args)
 {
     if (EnableLog)
     {
         LogToFile(string.Format(message, args));
         Debug.LogWarningFormat(context, message, args);
     }
 }
コード例 #22
0
        private void OnProfilingLineGUI(Rect profilingLinePosition, string label, Stopwatch stopwatch)
        {
            if (stopwatch != null && stopwatch.IsRunning)
            {
                Debug.LogWarningFormat("Missing EndProfiling call for '{0}'.", label);
            }

            EditorGUI.LabelField(profilingLinePosition, $"{label}: {(stopwatch != null ? stopwatch.ElapsedTicks.ToString() : "-")}", profilingLabel);
        }
コード例 #23
0
    static void AutoAddBaseType(ToLuaMenu.BindType bt, bool beDropBaseType)
    {
        Type t = bt.baseType;

        if (t == null)
        {
            return;
        }

        if (t.IsInterface)
        {
            Debug.LogWarningFormat("{0} has a base type {1} is Interface, use SetBaseType to jump it", bt.name, t.FullName);
            bt.baseType = t.BaseType;
        }
        else if (ToLuaMenu.dropType.IndexOf(t) >= 0)
        {
            Debug.LogWarningFormat("{0} has a base type {1} is a drop type", bt.name, t.FullName);
            bt.baseType = t.BaseType;
        }
        else if (!beDropBaseType || ToLuaMenu.baseType.IndexOf(t) < 0)
        {
            int index = allTypes.FindIndex((iter) => { return(iter.type == t); });

            if (index < 0)
            {
#if JUMP_NODEFINED_ABSTRACT
                if (t.IsAbstract && !t.IsSealed)
                {
                    Debug.LogWarning("not defined bindtype for {0}, it is abstract class, jump it, child class is {1}", t.FullName, bt.name);
                    bt.baseType = t.BaseType;
                }
                else
                {
                    Debug.LogWarning("not defined bindtype for {0}, autogen it, child class is {1}", t.FullName, bt.name);
                    bt = new BindType(t);
                    allTypes.Add(bt);
                }
#else
                Debug.LogWarningFormat("not defined bindtype for {0}, autogen it, child class is {1}", t.FullName, bt.name);
                bt = new ToLuaMenu.BindType(t);
                allTypes.Add(bt);
#endif
            }
            else
            {
                return;
            }
        }
        else
        {
            return;
        }

        AutoAddBaseType(bt, beDropBaseType);
    }
コード例 #24
0
        /// <summary>
        /// Opens the local documentation PDF if present.
        /// </summary>
        public static void OpenLocalHelpDocumentation()
        {
            var unityPdfAssetPath = AssetDatabase.GUIDToAssetPath(PDF_ASSET_GUID);

            if (string.IsNullOrEmpty(unityPdfAssetPath))
            {
                Debug.LogWarningFormat(WearableEditorConstants.LOCAL_PDF_NOT_FOUND, PDF_ASSET_GUID);
                return;
            }

            OpenFile(GetLocalDocumentationPdfFilePath());
        }
コード例 #25
0
        private static string _getScene(string sceneName)
        {
            var scenes = EditorBuildSettings.scenes.Where(s => s.path.Contains(sceneName + ".unity")).ToArray();

            if (scenes.Count() > 0)
            {
                return(scenes[0].path);
            }

            Debug.LogWarningFormat("No match for scene '{0}'", sceneName);
            return(string.Empty);
        }
コード例 #26
0
        /// <summary>
        /// Attempts to open the local license file included with the SDK.
        /// </summary>
        public static void OpenLocalLicense()
        {
            var assetPath = AssetDatabase.GUIDToAssetPath(LICENSE_ASSET_GUID);

            if (string.IsNullOrEmpty(assetPath))
            {
                Debug.LogWarningFormat(WearableEditorConstants.LOCAL_LICENSE_NOT_FOUND, LICENSE_ASSET_GUID);
                return;
            }

            OpenFile(GetLocalLicenseFilePath());
        }
コード例 #27
0
        // Methods
        /// <summary>
        /// Load the settings from the resources folder.
        /// </summary>
        public static void LoadResources()
        {
            // Try to load from resources
            settings = Resources.Load <RoslynCSharp>(settingsName);

            // Check for error
            if (settings == null)
            {
                settings = CreateInstance <RoslynCSharp>();
                Debug.LogWarningFormat("Failed to load settings asset '{0}' from resources. Default values will be used", settingsName);
            }
        }
コード例 #28
0
ファイル: Log.cs プロジェクト: ThinhHB/SampleAudioManager2D
 public static void Warning(bool condition, Object context, string format, params object[] args)
 {
     if (!IsWarning())
     {
         return;
     }
     if (condition)
     {
         return;
     }
     Debug.LogWarningFormat(context, format, args);
 }
コード例 #29
0
        private void OnTravellerEnterPortal(PortalTraveller traveller)
        {
            if (_trackedTravellers.Contains(traveller))
            {
                return;
            }
            Debug.LogWarningFormat(traveller, "Traveller {0}={2} entered portal {1}={3}.", traveller.EntityTransform.gameObject.name, gameObject.name, traveller.transform.position, transform.position);

            traveller.EnterPortalThreshold();
            traveller.PreviousOffsetFromPortal = traveller.EntityTransform.position - transform.position;
            _trackedTravellers.Add(traveller);
        }
コード例 #30
0
    // Simple analog of the Linux/BSD "mv" command.  If source is...
    // > a file (ending in anything BUT / or *), it will be moved to dest.
    // > a directory (ending in /), it will be recursively moved to dest.
    // > a directory with wildcard (ending in /*), the directory contents will be recursively moved to dest, then the
    // remaining empty directory is removed.
    public static bool Mv(string source, string dest)
    {
        if (source.EndsWith("/*"))
        {
            source = Path.GetDirectoryName(source);
            if (!dest.EndsWith("/")) // Make sure dest is treated as a directory.
            {
                dest += "/";
            }
            Debug.LogFormat("Moving directory contents from '{0}' to '{1}'", source, dest);
            var result = Find(source, recursive: false)
                         .Select(p => Path.Combine(source, p))
                         .All(p => Mv(p, dest)) &&
                         RmDir(source);
            if (result)
            {
                Rm(source + ".meta");
            }
            return(result);
        }

        if (!File.Exists(source) && !Directory.Exists(source))
        {
            Debug.LogWarningFormat("Source doesn't exist: {0}", source);
            return(false);
        }
        if (string.IsNullOrEmpty(Path.GetFileName(dest)) || File.Exists(source) && Directory.Exists(dest))
        {
            dest = Path.Combine(dest, Path.GetFileName(source));
        }

        if (File.Exists(dest) || Directory.Exists(dest))
        {
            Debug.LogWarningFormat("Ignoring, destination already exists: {0}", dest);
            return(false);
        }

        Debug.LogFormat("Moving '{0}' to '{1}'", source, dest);
        try {
            Mkdir(Path.GetDirectoryName(dest)); // Parent dirs in dest.
            Directory.Move(source, dest);       // This works if source is file or directory.
            source += ".meta";
            dest   += ".meta";
            if (File.Exists(source) && !File.Exists(dest))
            {
                Directory.Move(source, dest);
            }
            return(true);
        } catch (Exception e) {
            Debug.LogErrorFormat("Exception while moving '{0}' to '{1}': {2}", source, dest, e);
            return(false);
        }
    }