示例#1
0
    public bool Lock(string filename)
    {
        if (!Initialized)
        {
            return(false);
        }

        string commandline = string.Format(" lock {0} ", filename);

        commandline += GetAuthenCmd();
        ProcessCommand(commandline);

        if (OutputResult.Contains("is already locked by"))
        {
            int pos = 0;
            pos = OutputResult.IndexOf('\'', pos + 1);
            pos = OutputResult.IndexOf('\'', pos + 1);
            int    start = OutputResult.IndexOf('\'', pos + 1);
            int    end   = OutputResult.IndexOf('\'', start + 1);
            string name  = OutputResult.Substring(start + 1, end - start - 1);
            if (name != UserName)
            {
                UnityEditor.EditorUtility.DisplayDialog("Error", OutputResult, "OK");
                return(false);
            }
        }

        OutputResult = "";

        return(true);
    }