IOException: Sharing violation on path...
IOException: Sharing violation on path D:\Company\WBT\3DAssemOrNot\MyVersion\3DAssemOrNot_10_2015.12.16\Assets\Json.txt
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/FileStream.cs:320) System.IO.FileStream..ctor (System.String path, FileMode mode) (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode) DisassembleParts.GetJsonData () (at Assets/Editor/DisassembleParts.cs:763) DisassembleParts.CreateUI () (at Assets/Editor/DisassembleParts.cs:876) DisassembleParts.OnGUI () (at Assets/Editor/DisassembleParts.cs:526) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:187) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:180) UnityEditor.HostView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:76)
void SaveString(string str)
{
Debug.Log("保存数据");
FileInfo fi = new FileInfo(Application.dataPath + "\\Json.txt");
StreamWriter sw = null;
if (fi.Exists)
{
sw = fi.CreateText();
}
else
{
sw = fi.CreateText();
}
sw.WriteLine(str);
sw.Close();
}
string TransListToJson(List<ViewPoint> list)
{
StringBuilder sb = new StringBuilder();
try
{
for (int i = 0; i < list.Count; i++)
{
if (i > 0)
{
sb.Append(",");
}
sb.Append(list[i]);
}
}
catch (System.Exception ex)
{
Debug.LogWarning(string.Format("Catch={0}", ex.$$anonymous$$essage));
}
return sb.ToString();
}
if (GUILayout.Button("Complete", InitialStyle.CreateInstance().buttonStyle, GUILayout.Height(25)))
{
CreateUI();
string str = TransListToJson(viewPoints);
SaveString(str);
Close();
}
Your answer
Follow this Question
Related Questions
Top Notch Specs, Poor Performance on the Editor 0 Answers
[Help] I keep getting an error with empty message when I create a C# script 1 Answer
Unity 5.4 - unity 2017 ruin GPU instansing 1 Answer
webGl not running in Browser showing Message 0 Answers
How to get an object and align it perfectly on another object with arrow button 0 Answers