void Start() { reader = GetComponent <LogReader>(); writer = GetComponent <AnalysisWriter>(); calulator = GetComponent <Calculator>(); rae = GetComponent <ReplayAnalysisEngine>(); extender = GetComponent <ReplayExtender>(); gameWidth = float.IsNaN(gameWidth) ? Screen.height * Camera.mainCamera.aspect : gameWidth; originX = (Screen.width - gameWidth) / 2f; gameHeight = float.IsNaN(gameHeight) ? Screen.height : gameHeight; overalOptionsRect = new Rect(originX, 0, gameWidth, gameHeight); optionsLabelRect = new Rect(overalOptionsRect.x + overalOptionsRect.width / 2 - standardButtonWidth / 2, overalOptionsRect.y + borderSpacing, standardButtonWidth, standardButtonHeight); optionToolbarRect = new Rect(originX + borderSpacing, optionsLabelRect.yMax + borderSpacing, overalOptionsRect.width - 2 * borderSpacing, standardButtonHeight); mainOptionsRect = new Rect(overalOptionsRect.x + borderSpacing, optionToolbarRect.yMax + borderSpacing, overalOptionsRect.width - 2 * borderSpacing, overalOptionsRect.yMax - optionToolbarRect.yMax - 2 * borderSpacing - standardButtonHeight); optionNames.Add("Replay Options"); optionNames.Add(reader.GUIName); optionNames.Add(writer.GUIName); optionNames.Add(calulator.GUIName); optionNames.Add(extender.GUIName); }
static void Main(string[] args) { //Config.SubDirectories.DeleteExistingData(); //Config.StockTickers.DownloadRawData(); //ReturnsFilesWriter.CreateReturnsFiles(); AnalysisWriter.CreateFiles(); }
// Use this for initialization void Start() { dictionary = GetComponent <PrefabDictionary>(); reader = GetComponent <LogReader>(); if (reader == null) { Debug.LogError("No LogReader attached to the Replay Analysis Engine."); } calculator = GetComponent <Calculator>(); if (calculator == null) { Debug.LogError("No Calculator attached to the Replay Analysis Engine."); } writer = GetComponent <AnalysisWriter>(); if (writer == null) { Debug.LogError("No LogWriter attached to the Replay Analysis Engine."); } extender = GetComponent <ReplayExtender>(); if (extender == null) { Debug.LogWarning("No ReplayExtender attached to the Replay Analysis Engine. Adding a DummyExtender."); } this.gameObject.AddComponent <ReplayExtender>(); foreach (GameObject go in (FindObjectsOfType(typeof(GameObject)) as GameObject[])) { if (go != this.gameObject && go.GetComponent <ReplayBehavior>() == null) { ReplayBehavior rb = go.AddComponent <ReplayBehavior>(); rb.ReplayTag = ReplayBehavior.RAETag.Given; rb.RecordTouching = false; } } }
void Start() { reader = GetComponent<LogReader>(); writer = GetComponent<AnalysisWriter>(); calulator = GetComponent<Calculator>(); rae = GetComponent<ReplayAnalysisEngine>(); extender = GetComponent<ReplayExtender>(); gameWidth = float.IsNaN(gameWidth) ? Screen.height * Camera.mainCamera.aspect : gameWidth; originX = (Screen.width - gameWidth) / 2f; gameHeight = float.IsNaN(gameHeight) ? Screen.height : gameHeight; overalOptionsRect = new Rect(originX, 0, gameWidth, gameHeight); optionsLabelRect = new Rect(overalOptionsRect.x + overalOptionsRect.width / 2 - standardButtonWidth / 2, overalOptionsRect.y + borderSpacing, standardButtonWidth, standardButtonHeight); optionToolbarRect = new Rect(originX + borderSpacing, optionsLabelRect.yMax + borderSpacing, overalOptionsRect.width - 2 * borderSpacing, standardButtonHeight); mainOptionsRect = new Rect(overalOptionsRect.x + borderSpacing, optionToolbarRect.yMax + borderSpacing, overalOptionsRect.width - 2 * borderSpacing, overalOptionsRect.yMax - optionToolbarRect.yMax - 2 * borderSpacing - standardButtonHeight); optionNames.Add("Replay Options"); optionNames.Add(reader.GUIName); optionNames.Add(writer.GUIName); optionNames.Add(calulator.GUIName); optionNames.Add(extender.GUIName); }
// Use this for initialization void Start() { dictionary = GetComponent<PrefabDictionary>(); reader = GetComponent<LogReader>(); if(reader == null) Debug.LogError("No LogReader attached to the Replay Analysis Engine."); calculator = GetComponent<Calculator>(); if (calculator == null) Debug.LogError("No Calculator attached to the Replay Analysis Engine."); writer = GetComponent<AnalysisWriter>(); if (writer == null) Debug.LogError("No LogWriter attached to the Replay Analysis Engine."); extender = GetComponent<ReplayExtender>(); if (extender == null) Debug.LogWarning("No ReplayExtender attached to the Replay Analysis Engine. Adding a DummyExtender."); this.gameObject.AddComponent<ReplayExtender>(); foreach (GameObject go in (FindObjectsOfType(typeof(GameObject)) as GameObject[])) { if (go != this.gameObject && go.GetComponent<ReplayBehavior>() == null) { ReplayBehavior rb = go.AddComponent<ReplayBehavior>(); rb.ReplayTag = ReplayBehavior.RAETag.Given; rb.RecordTouching = false; } } }
protected override void OnStart(string[] args) { if (args.Length >= 2) { CredentialManager.SaveCredentials(ServiceName, new NetworkCredential(args[0], args[1])); Logger.LogEvent("Credential changed to " + args[0], eventType: EventTypes.Configuration); RecursiveSave(args.Skip(2), new List <string>() { CAS_API_ENDPOINT, OPTOPLUS_API_ENDPOINT, INPUT_PATH, OUTPUT_PATH, PROCESSED_PATH, ERROR_PATH, SURFACE_PATH, ANALYSIS_PATH, OUTPUT_FORMAT, GAX, LAPGAX }); } string defaultPath = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), ServiceName); string defaultFallbackPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ServiceName); string chosenDefaultPath = null; string[] attemptedPaths = { defaultPath, defaultFallbackPath }; foreach (string attemptedPath in attemptedPaths) { try { Directory.CreateDirectory(attemptedPath); chosenDefaultPath = attemptedPath; break; } catch (Exception e) { Logger.LogEvent("Unable to use " + attemptedPath + " as default directory" + Environment.NewLine + e.StackTrace, EventLogEntryType.Warning); } } new List <string>() { INPUT_PATH, OUTPUT_PATH, PROCESSED_PATH, ERROR_PATH, SURFACE_PATH, ANALYSIS_PATH }.FindAll(key => configuration.AppSettings.Settings[key] is null || string.IsNullOrWhiteSpace(configuration.AppSettings.Settings[key].Value)).ForEach( key => { if (chosenDefaultPath != null) { SaveSetting(key, Path.Combine(chosenDefaultPath, key)); } else { string error = key + ": unable to find a writable default path. Please check the previous Application warnings emitted by " + ServiceName + " or manually specify a writable path for " + key; Logger.LogEvent(error, EventLogEntryType.Warning); throw new Exception(error); } } ); new List <string>() { INPUT_PATH, OUTPUT_PATH, PROCESSED_PATH, ERROR_PATH, SURFACE_PATH, ANALYSIS_PATH }.ForEach(key => Directory.CreateDirectory(configuration.AppSettings.Settings[key].Value)); if (configuration.AppSettings.Settings[OUTPUT_FORMAT] is null) { SaveSetting(OUTPUT_FORMAT, OutputFormat.sdf.ToString()); } Logger.LogEvent(configuration.AppSettings.Settings.AllKeys.Select(key => key + " " + configuration.AppSettings.Settings[key].Value).Aggregate((v1, v2) => string.Join(Environment.NewLine, new List <string> { v1, v2 }))); NetworkCredential NetworkCredential = CredentialManager.GetCredentials(ServiceName); if (!new List <string>() { CAS_API_ENDPOINT, OPTOPLUS_API_ENDPOINT }.All(key => configuration.AppSettings.Settings.AllKeys.Contains(key)) || NetworkCredential is null) { Environment.FailFast("Missing Parameter"); } SDFWriter = new SDFWriter(configuration.AppSettings.Settings[SURFACE_PATH].Value); HMFWriter = new HMFWriter(configuration.AppSettings.Settings[SURFACE_PATH].Value); XYZWriter = new XYZWriter(configuration.AppSettings.Settings[SURFACE_PATH].Value); OmaWriter = new OmaWriter(configuration.AppSettings.Settings[OUTPUT_PATH].Value, configuration.AppSettings.Settings[GAX].Value, configuration.AppSettings.Settings[LAPGAX].Value); AnalysisWriter = new AnalysisWriter(configuration.AppSettings.Settings[ANALYSIS_PATH].Value); IAuthenticatingMessageInspector authenticatingMessageInspector = new AuthenticatingMessageInspector { HttpRequestMessageProperty = new HttpRequestMessageProperty() }; LoggingMessageInspector loggingMessageInspector = new LoggingMessageInspector(); ICallbackMessageInspector callbackMessageInspector = new CallbackMessageInspector(); callbackMessageInspector.RequestCallbacks.Add(message => Logger.LogEvent("REQUEST " + message)); callbackMessageInspector.ResponseCallbacks.Add(message => Logger.LogEvent("RESPONSE")); ICollection <IClientMessageInspector> inspectors = new Collection <IClientMessageInspector>() { authenticatingMessageInspector, loggingMessageInspector, callbackMessageInspector }; ICollection <Action <HttpWebResponse> > handlers = new Collection <Action <HttpWebResponse> >() { HttpWebReponseHandler }; ICollection <Action <FaultException> > faultHandlers = new Collection <Action <FaultException> >() { FaultHandler }; ICollection <Action <Exception> > exceptionHandlers = new Collection <Action <Exception> >() { ExceptionHandler }; IProvider <HttpClientHandler> HttpClientHandlerProvider = new HttpClientHandlerProvider(); IProvider <HttpClient> HttpClientProvider = new HttpClientProvider(HttpClientHandlerProvider); IAuthenticationService authenticationService = new AuthenticationService(new Uri(new Uri(configuration.AppSettings.Settings[CAS_API_ENDPOINT].Value), "cas/v1/tickets/"), "optoplus", HttpClientProvider); CredentialSoap credentialSoap = ClientBaseUtils.InitClientBase <CredentialSoap, CredentialSoapClient>(new EndpointAddress(configuration.AppSettings.Settings[OPTOPLUS_API_ENDPOINT].Value + "/optoplus-services-web/CredentialSoap"), inspectors, handlers, faultHandlers, exceptionHandlers); CredentialGroupingSoap credentialGroupingSoap = ClientBaseUtils.InitClientBase <CredentialGroupingSoap, CredentialGroupingSoapClient>(new EndpointAddress(configuration.AppSettings.Settings[OPTOPLUS_API_ENDPOINT].Value + "/optoplus-services-web/CredentialGroupingSoap"), inspectors, handlers, faultHandlers, exceptionHandlers); LogoutSoap logoutSoap = ClientBaseUtils.InitClientBase <LogoutSoap, LogoutSoapClient>(new EndpointAddress(configuration.AppSettings.Settings[OPTOPLUS_API_ENDPOINT].Value + "/optoplus-services-web/LogoutSoap"), inspectors, handlers, faultHandlers, exceptionHandlers); SharedServiceProvider.Reset(); SharedServiceProvider.Services.Clear(); SharedServiceProvider.Services.AddSingleton(serviceProvider => HttpClientHandlerProvider); SharedServiceProvider.Services.AddSingleton(serviceProvider => HttpClientProvider); SharedServiceProvider.Services.AddSingleton(serviceProvider => authenticatingMessageInspector); SharedServiceProvider.Services.AddSingleton(serviceProvider => loggingMessageInspector); SharedServiceProvider.Services.AddSingleton(serviceProvider => callbackMessageInspector); SharedServiceProvider.Services.AddSingleton(serviceProvider => authenticationService); SharedServiceProvider.Services.AddSingleton(serviceProvider => credentialSoap); SharedServiceProvider.Services.AddSingleton(serviceProvider => credentialGroupingSoap); SharedServiceProvider.Services.AddSingleton(serviceProvider => logoutSoap); RequestBuilder = new RequestBuilder(ProviderComputeSoap); Watcher = new FileSystemWatcher(configuration.AppSettings.Settings[INPUT_PATH].Value, "*" + LdsFileExtension); Watcher.Created += Watcher_Created; Watcher.Renamed += Watcher_Renamed; LoginManager = new LoginManager(Logger, ServiceName, authenticationService, authenticatingMessageInspector, credentialSoap, credentialGroupingSoap); LoginManager.Login(10000, LoggedIn); }