// try // { // // bool bGo = true; // PlatformCommand command = null; // do // { // command = this.shell.NextCommand(); // // bool bCannotIssueCommand = false; // switch(command.Level) // { // case CommandLevel.FailStart : // if (this.state != PlatformState.FailStart) // bCannotIssueCommand = true; // break; // // case CommandLevel.Ready : // if (this.state != PlatformState.Idle) // bCannotIssueCommand = true; // break; // // case CommandLevel.Run : // if (this.state != PlatformState.Running) // bCannotIssueCommand = true; // break; // // case CommandLevel.Run | // CommandLevel.Ready : // if ((this.state != PlatformState.Running) && // (this.state != PlatformState.Idle)) // bCannotIssueCommand = true; // break; // // case CommandLevel.FailStart | // CommandLevel.Run : // if ((this.state != PlatformState.Running) && // (this.state != PlatformState.FailStart)) // bCannotIssueCommand = true; // break; // // case CommandLevel.FailStart | // CommandLevel.Ready : // if ((this.state != PlatformState.Idle) && // (this.state != PlatformState.FailStart)) // bCannotIssueCommand = true; // break; // // case CommandLevel.Run | // CommandLevel.Ready | // CommandLevel.FailStart : // if ((this.state == PlatformState.Starting) || // (this.state == PlatformState.ShuttingDown)) // bCannotIssueCommand = true; // break; // // } // // if (bCannotIssueCommand) // this.writer.WriteError(String.Format("[SHELL] - Cannot issue command {0} [platform state: {1}]", // command, // this.state)); // else // { // // TODO: Platform.RunShell : dispatch the command // if (command.Type == Commands.Commands.Start) // { // this.Start(); // } // else // if (command.Type == Commands.Commands.Stop) // { // this.Shutdown(); // } // else // if (command.Type == Commands.Commands.CloseSession) // { // bGo = false; // } // else // if (command.Type == Commands.Commands.InstallModule) // { // InstallModuleCommand install = command as InstallModuleCommand; // // bool bFound = false; // switch (install.Category) // { // case ModuleCategory.Other: // foreach(ModuleInfo mi in this.conf.AdditionalModules) // { // if (mi.FullTypeName.CompareTo(install.FullTypeName) == 0) // { // bFound = true; // break; // } // } // break; // case ModuleCategory.Messaging: // bFound = (this.conf.MessagingModule.FullTypeName.CompareTo(install.FullTypeName) == 0); // break; // case ModuleCategory.Logging: // bFound = (this.conf.LoggingModule.FullTypeName.CompareTo(install.FullTypeName) == 0); // break; // case ModuleCategory.Storage: // bFound = (this.conf.StorageModule.FullTypeName.CompareTo(install.FullTypeName) == 0); // break; // case ModuleCategory.Persistence: // bFound = (this.conf.PersistenceModule.FullTypeName.CompareTo(install.FullTypeName) == 0); // break; // } // // if (bFound) // { // this.writer.WriteError(String.Format("[SHELL] - Module {0} is already installed", install.FullTypeName)); // break; // } // // string dllDestPath = ""; // string confDestPath = ""; // // if (install.Category == ModuleCategory.Other) // { // dllDestPath = this.conf.BaseDirPath + this.conf.AdditionalModulesBinPath; // confDestPath = this.conf.BaseDirPath + this.conf.AdditionalModulesConfPath; // } // else // { // dllDestPath = this.conf.BaseDirPath + this.conf.CoreModulesBinPath; // confDestPath = this.conf.BaseDirPath + this.conf.CoreModulesConfPath; // } // // // first see if the assembly path is local or not // string assemblyName = ""; // if (install.AssemblyPath.StartsWith("#") == true) // { // // ok we have do not have to copy the assembly because // string assemblyFile = install.AssemblyPath.Substring(1); // assemblyName = System.IO.Path.GetFileName(assemblyFile); // // if (System.IO.File.Exists(dllDestPath + assemblyName) == false) // { // this.writer.WriteError("[SHELL] - cound not find assembly : " + assemblyName); // break; // } // // } // else // { // if (System.IO.File.Exists(dllDestPath + System.IO.Path.GetFileName(install.AssemblyPath)) == true) // { // this.writer.WriteError(String.Format("[SHELL] - could not copy assembly {0}, an assembly with the same name already exists", install.AssemblyPath)); // break; // } // // try // { // assemblyName = System.IO.Path.GetFileName(install.AssemblyPath); // System.IO.File.Copy(install.AssemblyPath, dllDestPath + assemblyName); // // } // catch(System.IO.IOException ioex) // { // this.writer.WriteError("[SHELL] - Unexpected IO error while copying assembly : " + ioex.Message); // break; // } // } // // string configFile = ""; // if (install.ConfigPath.StartsWith("#") == false) // { // // if (System.IO.File.Exists(confDestPath + System.IO.Path.GetFileName(install.ConfigPath)) == true) // { // this.writer.WriteError(String.Format("[SHELL] - could not copy config file {0}, a file with the same name already exists", install.ConfigPath)); // break; // } // // try // { // configFile = System.IO.Path.GetFileName(install.ConfigPath); // System.IO.File.Copy(install.ConfigPath, confDestPath + System.IO.Path.GetFileName(install.ConfigPath)); // } // catch(System.IO.IOException ioex) // { // this.writer.WriteError("[SHELL] - Unexpected IO error while copying config file : " + ioex.Message); // break; // } // } // else // { // configFile = System.IO.Path.GetFileName(install.ConfigPath.Substring(1)); // } // // if (install.Category == ModuleCategory.Other) // { // ModuleInfo mi = new ModuleInfo(install.FullTypeName, assemblyName, configFile, ""); // // if (this.InstallModule(mi) == true) // { // this.conf.AddModule(mi); // } // // } // else // { // // // TODO: // // // ok first uninstall the core corresponding core module // // // than install the new module // this.InstallCoreModule(null,install.Category); // } // } // else // if (command.Type == Commands.Commands.UninstallModule) // { // // } // else // if (command.Type == Commands.Commands.AttachModule) // { // // } // else // if (command.Type == Commands.Commands.DetachModule) // { // // } // else // if (command.Type == Commands.Commands.LoadAssembly) // { // // } // else // if (command.Type == Commands.Commands.RemoveAssembly) // { // // } // else // if (command.Type == Commands.Commands.CreateAgent) // { // // } // else // if (command.Type == Commands.Commands.TerminateAgent) // { // // } // else // { // // } // // } // // } // while (bGo == true); // } // catch(System.Threading.ThreadAbortException taex) // { // // ok the thread has been stopped. // }