public bool AddPrinterpool(string p) { GlobalDataStore.Logger.Debug(string.Format("Addprinterpool {0}", p)); bool bRet = false; string AppPath = GlobalDataStore.AppPath; string RemotingConfigFilePath = AppPath + @"\ACALabelXClient.config.xml"; lock (GlobalDataStore.LockClass) { if (!File.Exists(RemotingConfigFilePath)) { throw new LabelXRemClientControlOjectException(string.Format("Remoting configuration file doesn't exist: {0}", RemotingConfigFilePath)); } } bRet = Toolbox.Toolbox.AddPrintpool(RemotingConfigFilePath, p); //How do we do this.... warn the other thread to send info... //ACA.LabelX.Managers.LabelXClientServerManager.ResendInfo(); lock (GlobalDataStore.LockClass) { if (GlobalDataStore.IsStandAlone) { GlobalDataStore.MustWriteStandAlonePrintGroups = true; } else { GlobalDataStore.ResendInfo(); } } return(bRet); }
public void OnPointerDown(PointerEventData eventData) { Debug.Log("Mouse detected"); GameObject enemy = Instantiate(prefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject; enemy.transform.SetParent(canvas.transform, false); PlaceData myPlace = new PlaceData(); myPlace.placePrefab = enemy; myPlace.CreatePlaceCallback(GlobalDataStore.places.Count); GlobalDataStore.AddPlaceToList(myPlace); }
// Use this for initialization void Awake() { mesh = GetComponent <MeshFilter>().mesh; // aww yisss Awake > Start for variable value initialization solver = GlobalDataStore.getSolver(); zFn = GlobalDataStore.getZFn(); // incase we start from "main" scene directly. if (solver == null) { solver = new AK.ExpressionSolver(); solver.SetGlobalVariable("x", 0); solver.SetGlobalVariable("y", 0); zFn = solver.SymbolicateExpression("(x^2 + y^2) / (x*y+1)"); } }
public void setZFn() { string userInputFunction = InputField.GetComponent <InputField>().text; if (userInputFunction.Length == 0) { userInputFunction = "(x^2+y^2)/(xy)"; } userInputFunction = EnsafenFnString(userInputFunction); // make 5x -> 5*x, etc Expression zFn = solver.SymbolicateExpression(EnsafenFnString(userInputFunction)); setArgs(5, 10); Debug.Log("Result: " + zFn.Evaluate()); GlobalDataStore.setSolver(solver); GlobalDataStore.setZFn(zFn); SceneManager.LoadScene("main"); }
public bool RemovePrinterpool(string p) { GlobalDataStore.Logger.Debug(string.Format("RemClientControlObject.RemovePrinterpool", p)); bool bRet = false; string AppPath = GlobalDataStore.AppPath; bRet = Toolbox.Toolbox.RemovePrintpool(AppPath + @"\ACALabelXClient.config.xml", p); //How do we do this.... warn the other thread to send info... //ACA.LabelX.Managers.LabelXClientServerManager.ResendInfo(); lock (GlobalDataStore.LockClass) { if (GlobalDataStore.IsStandAlone) { GlobalDataStore.MustWriteStandAlonePrintGroups = true; } else { GlobalDataStore.ResendInfo(); } } return(bRet); }
public bool Start() { bool updateAvailable = false; try { clientEngine = new ACALabelXClientEngine(); clientEngine.Start(); ACA.LabelX.Toolbox.Toolbox toolbox = new ACA.LabelX.Toolbox.Toolbox(); bool bStandAllone = toolbox.GetIsStandalloneInstallation(GlobalDataStore.AppPath + @"\ACALabelXClient.config.xml"); if (bStandAllone) { GlobalDataStore.Logger.Warning("This is a standallone installation."); GlobalDataStore.Logger.Warning("Not connected to a central server."); return(true); } GlobalDataStore.Logger.Warning("Starting synchronisation with the server..."); GlobalDataStore.Logger.Info("Configuration:"); GlobalDataStore.Logger.Info("MachineName: " + clientEngine.MachineName); GlobalDataStore.Logger.Info("PrintJobsRootFolder: " + clientEngine.PrintJobsRootFolder); GlobalDataStore.Logger.Info("LabelDefinitionsRootFolder: " + clientEngine.LabelDefinitionsRootFolder); GlobalDataStore.Logger.Info("PaperDefinitionsRootFolder: " + clientEngine.PaperDefinitionsRootFolder); GlobalDataStore.Logger.Info("PicturesRootFolder: " + clientEngine.PicturesRootFolder); GlobalDataStore.Logger.Info("UpdateRootFolder: " + clientEngine.UpdateRootFolder); GlobalDataStore.Logger.Info("Printgroups:"); foreach (PrintGroupItem item in clientEngine.PrintGroups) { GlobalDataStore.Logger.Info(string.Format("PrintGroup: {0}", item.Name)); } FileSystemWatcher updateFolderWatcher = new FileSystemWatcher { Filter = "*.*", InternalBufferSize = 128, Path = clientEngine.UpdateRootFolder, IncludeSubdirectories = true, NotifyFilter = (NotifyFilters.Attributes | NotifyFilters.CreationTime | NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.LastWrite | NotifyFilters.Size) }; updateFolderWatcher.Changed += onUpdChanged; updateFolderWatcher.Created += onUpdChanged; updateFolderWatcher.Deleted += onUpdChanged; updateFolderWatcher.Renamed += onUpdChanged; updateFolderWatcher.EnableRaisingEvents = true; FileSystemWatcher pictureFolderWatcher = new FileSystemWatcher { Filter = "", InternalBufferSize = 128, Path = clientEngine.PicturesRootFolder, IncludeSubdirectories = true, NotifyFilter = (NotifyFilters.Attributes | NotifyFilters.CreationTime | NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.LastWrite | NotifyFilters.Size) }; pictureFolderWatcher.Changed += onImgChanged; pictureFolderWatcher.Created += onImgChanged; pictureFolderWatcher.Deleted += onImgChanged; pictureFolderWatcher.Renamed += onImgChanged; pictureFolderWatcher.EnableRaisingEvents = true; while (true) { GlobalDataStore.Logger.Debug("Connecting..."); try { clientEngine.PingRemoteServer(); GlobalDataStore.Logger.Debug("Connected!"); lock (GlobalDataStore.LockClass) { if (GlobalDataStore.MustResendInfo) { moetinfoverzenden = true; GlobalDataStore.ResetResendInfo(); } } if (moetinfoverzenden) { GlobalDataStore.Logger.Debug("Sending client info!"); clientEngine.Login(out updateNodig); moetinfoverzenden = false; } //System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); //sw.Start(); GlobalDataStore.Logger.Debug("Synchronizing Label Definitions..."); clientEngine.SynchronizeLabelDefinitions(); GlobalDataStore.Logger.Debug("Synchronizing Paper Definitions..."); clientEngine.SynchronizePaperDefinitions(); GlobalDataStore.Logger.Debug("Synchronizing PrintJobs..."); clientEngine.SynchronizePrintJobs(); GlobalDataStore.Logger.Debug("Synchonizing Settings..."); clientEngine.SynchronizeSettings(); GlobalDataStore.Logger.Debug("Synchronizing Pictures..."); clientEngine.SynchronizePictures(); GlobalDataStore.Logger.Debug("Synchronizing Updates..."); clientEngine.SynchronizeUpdates(); GlobalDataStore.Logger.Debug("Updating Status..."); clientEngine.ReceiveStatusUpdate(out updateNodig); GlobalDataStore.Logger.Debug("Synchronization ready."); GlobalDataStore.Logger.Debug("Checking for update..."); updateAvailable = clientEngine.checkUpdate(); string MachineName = toolbox.GetMachineName(GlobalDataStore.AppPath + @"\ACALabelXClient.config.xml"); clientEngine.GetRemoteObject().updateClientXML(MachineName, "readyForUpdate", updateAvailable.ToString()); //sw.Stop(); //GlobalDataStore.Logger.Info("Time needed for Synchronization: " + sw.ElapsedMilliseconds + " ms"); } catch (RemotingException e) { GlobalDataStore.Logger.Error("Remoting error: " + e.Message); GlobalDataStore.Logger.Info("Will retry shortly..."); } catch (WebException e) { GlobalDataStore.Logger.Error("Web error: " + e.Message); GlobalDataStore.Logger.Info("Will retry shortly..."); GlobalDataStore.ResendInfo(); } catch (IOException e) { GlobalDataStore.Logger.Error("IO error: " + e.Message); GlobalDataStore.Logger.Info("Will retry shortly..."); } catch (Exception e) { GlobalDataStore.Logger.Error("Unspecified error in synchronisation: " + e.Message); GlobalDataStore.Logger.Info("Will retry shortly..."); } try { if (updateAvailable && updateNodig.Length > 0) { if (File.Exists(clientEngine.UpdateRootFolder + updateNodig)) { GlobalDataStore.Logger.Warning("Update Available, Executing"); System.Diagnostics.Process.Start(clientEngine.UpdateRootFolder + updateNodig); moetstoppen = true; //Check if this works, untested } } GlobalDataStore.Logger.Info("Waiting..."); for (int Index = clientEngine.PollFrequency; Index > 0; Index--) { GlobalDataStore.Logger.Debug(string.Format("{0:0#}", Index)); if (moetstoppen) { break; } Thread.Sleep(1000); } GlobalDataStore.Logger.Info("Ready waiting..."); if (moetstoppen) { break; } } catch (Exception e) { GlobalDataStore.Logger.Error("Unspecified post-synchronisation error: " + e.Message); GlobalDataStore.Logger.Info("Will retry shortly..."); } } } catch (Exception e) { GlobalDataStore.Logger.Error(string.Format("Error: {0} Target site:{1} Stack trace:", e.Message, e.TargetSite)); } finally { GlobalDataStore.Logger.Info("Done..."); } return(true); }
private void LoadSystemSettings(string manifestFilePath) { SystemManifest systemManifest = LegacySerializer.DeserializeDataContract <SystemManifest>(GetFileContents(manifestFilePath)); GlobalDataStore.Load(systemManifest); }
public void Start(string ConfigFilePath) { const bool methode1 = true; Hashtable Props; //IChannel ServiceChannel; string Protocol; string Address; string Port; string Uri; TcpServerChannel theTcp; if (methode1) { this.ConfigFilePath = ConfigFilePath; RemotingConfiguration.Configure(ConfigFilePath, false); Toolbox.Toolbox toolbox = new Toolbox.Toolbox(); toolbox.GetRemotingServerConfiguraton(ConfigFilePath, out Protocol, out Address, out Port, out Uri); string sipnr = GlobalDataStore.GetAppSetting("localhost"); Address = sipnr; string ClientURL = string.Format("{0}://{1}:{2}/{3}", Protocol, Address, Port, Uri); ACA.LabelX.RemoteObject objLabelXRemoteObject = (ACA.LabelX.RemoteObject)Activator.GetObject( typeof(ACA.LabelX.RemoteObject), ClientURL); if (objLabelXRemoteObject != null) { toolbox.GetGeneralServerConfiguraton(ConfigFilePath, out PrintJobsRootFolder, out LabelDefinitionsRootFolder, out PaperDefinitionsRootFolder, out SettingsRootFolder, out PictureRootFolder, out UpdateRootFolder); objLabelXRemoteObject.InitServer(PrintJobsRootFolder, LabelDefinitionsRootFolder, PaperDefinitionsRootFolder, SettingsRootFolder, UpdateRootFolder); } } else { this.ConfigFilePath = ConfigFilePath; //RemotingConfiguration.Configure(ConfigFilePath, false); Props = new Hashtable(); Toolbox.Toolbox toolbox = new Toolbox.Toolbox(); toolbox.GetRemotingServerConfiguraton(ConfigFilePath, out Protocol, out Address, out Port, out Uri); HttpChannel theHttp2; Hashtable myTable = new Hashtable(); SoapServerFormatterSinkProvider theProvider = new SoapServerFormatterSinkProvider(); //BinaryServerFormatterSinkProvider theProvider = new BinaryServerFormatterSinkProvider(); //theProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; ClientIPInjectorSinkProvider injectorProvider; injectorProvider = new ClientIPInjectorSinkProvider(); //BinaryClientFormatterSinkProvider theClientProv = new BinaryClientFormatterSinkProvider(); //Props["port"] = "8080"; Props["port"] = "18080"; Props["name"] = "ACALabelXRemoteObject"; //Props["address"] = "localhost"; Props["address"] = "127.0.0.1"; theProvider.Next = injectorProvider; //theProvider.Next = new ClientIPInjectorSinkProvider(); switch (Protocol.ToLower()) { case "http": myTable["name"] = "serversite"; theHttp2 = new HttpChannel(Props, null, theProvider); ChannelServices.RegisterChannel(theHttp2, false); break; case "tcp": myTable["name"] = "serversite"; theTcp = new TcpServerChannel(myTable, theProvider); ChannelServices.RegisterChannel(theTcp, false); break; default: throw new ApplicationException(string.Format("Could not obtain the correct protocol from: {0}\r\nFound protocol: {1}\r\nShould be: http, or tcp", ConfigFilePath, Protocol)); } RemoteObject theObject = new RemoteObject(); RemotingConfiguration.RegisterWellKnownServiceType(typeof(ACA.LabelX.RemoteObject), "ACALabelXRemoteObject", WellKnownObjectMode.Singleton); //Address = "localhost"; Address = "127.0.0.1"; string ClientURL = string.Format("{0}://{1}:{2}/{3}", Protocol, Address, Port, Uri); ACA.LabelX.RemoteObject objLabelXRemoteObject = (ACA.LabelX.RemoteObject)Activator.GetObject( typeof(ACA.LabelX.RemoteObject), ClientURL); if (objLabelXRemoteObject != null) { toolbox.GetGeneralServerConfiguraton(ConfigFilePath, out PrintJobsRootFolder, out LabelDefinitionsRootFolder, out PaperDefinitionsRootFolder, out SettingsRootFolder, out PictureRootFolder, out UpdateRootFolder); objLabelXRemoteObject.InitServer(PrintJobsRootFolder, LabelDefinitionsRootFolder, PaperDefinitionsRootFolder, SettingsRootFolder, UpdateRootFolder); } } }