public void PerformUpdate(List <SyncMarker> markers) { // Start a transaction and attach it to the publisher client. // Note that the publisher client can only be attached to one transaction at a time. PublisherTransaction transaction = m_PublisherClient.StartTransaction(); for (int i = 0; i < markers.Count; i++) { //Send the update transaction.Send(markers[i]); } //Finish the transaction transaction.Commit(); //The publisher is finished transaction.Dispose(); }
void PerformExportTransaction() { // Report the progress of the export to 0% m_PublisherClient.ReportProgress(0); // Start a transaction ; note that the publisher client can only run one transaction at a time. PublisherTransaction transaction = m_PublisherClient.StartTransaction(); // add sample plane // { // Build a SyncMesh and send it to the server var mesh = BuildMesh(); transaction.Send(mesh); // Build a SyncMaterial and send it to the server var material = BuildMaterial(SyncColor.White); transaction.Send(material); // Report in between parsing progress m_PublisherClient.ReportProgress(50); // Build a SyncObject and send it to the server. var obj = BuildObject(mesh, material); transaction.Send(obj); // Build a SyncObjectInstance and send it to the server var instance = BuildObjectInstance(obj); transaction.Send(instance); } // add sample plane // // objファイルを開く // DataUtil meshData = new DataUtil(); meshData.fileName = @"D:\model\house.obj"; meshData.OpenObj(@"D:\model\house.obj"); int num = meshData.obj.MeshList.Count; for (int i = 0; i < num; i++) { ObjParser.Obj currentObj = meshData.obj.MeshList[i]; Console.WriteLine("Mesh: " + currentObj.Name); SyncMesh mesh = meshData.BuildMesh(currentObj); transaction.Send(mesh); Console.WriteLine("\tMesh Id: " + mesh.Id); Console.WriteLine("\tMesh Name: " + mesh.Name); SyncMaterial material = meshData.BuildMaterial(currentObj, transaction); transaction.Send(material); Console.WriteLine("\tMaterial Id: " + material.Id); Console.WriteLine("\tMaterial Name: " + material.Name); // Report in between parsing progress m_PublisherClient.ReportProgress(i * num / 100); // Build a SyncObject and send it to the server. var obj = meshData.BuildObject(mesh, material, i); transaction.Send(obj); Console.WriteLine("\tObject Id: " + obj.Id); Console.WriteLine("\tObject Name: " + obj.Name); // Build a SyncObjectInstance and send it to the server var instance = meshData.BuildObjectInstance(obj); transaction.Send(instance); Console.WriteLine("\tObject Instance Id: " + instance.Id); Console.WriteLine("\tObject Instance Name: " + instance.Name); } #if false for (int i = 0; i < meshData.obj.MeshList.Count; i++) { List <SyncMesh> meshAry = meshData.BuildMesh(); foreach (SyncMesh mesh in meshAry) { transaction.Send(mesh); } List <SyncMaterial> materialAry = meshData.BuildMaterial(); foreach (SyncMaterial material in materialAry) { transaction.Send(material); } // Report in between parsing progress //m_PublisherClient.ReportProgress(50); // Build a SyncObject and send it to the server. foreach (SyncMesh mesh in meshAry) { var obj = meshData.BuildObject(mesh); transaction.Send(obj); // Build a SyncObjectInstance and send it to the server var instance = meshData.BuildObjectInstance(obj); transaction.Send(instance); } } #endif // Commit the transaction, then detach it from the publisher client. transaction.Commit(); // Report the completion of the export m_PublisherClient.ReportProgress(100); }