public bool GenerateVariations(string mainName, Dictionary<string, VariedParameter> variedParameters, Dictionary<string, XmlFile> xmlFilesList, XmlFile activeXmlFile) { int name_var_cnt = 0; XmlFile xmlReference = new XmlFile(); List<VariedParameter> varied_parameters_list; if (mainName != "") { if ((xmlFilesList.ContainsKey(mainName)) || (xmlFilesList.ContainsKey(mainName + "_0"))) { return false; } else { xmlReference.Name = activeXmlFile.Name; xmlReference.Tag = activeXmlFile.Tag; xmlReference.TimeStamp = activeXmlFile.TimeStamp; xmlReference.Content = activeXmlFile.Content; varied_parameters_list = new List<VariedParameter>(variedParameters.Values); CreateVariation(mainName, varied_parameters_list, xmlReference, ref name_var_cnt, xmlFilesList); return true; } } else { return false; } }
public override void DoApplyTransform(XmlFile xmlFile) { FilePath root = xmlFile.Path.Parent; foreach (XmlElement compile in xmlFile.Document.SelectNodes("//x:Compile[@Include]", namespaces)) { string include = compile.GetAttribute("Include"); if (CSharp.IsMatch(include) && !AssemblyInfo.IsMatch(include)) { var filePath = root.File(include); if (File.Exists(filePath.Path)) { var content = filePath.FileContent(); var transformed = standardizer.Standardize(filePath, content); if (transformed == null || content == transformed) { continue; } using (var writer = new StreamWriter(filePath.Path, false)) { writer.Write(transformed); writer.Flush(); } } } } }
public List<string> LoadXmlFilesFromFileNames(string[] fileNames, Dictionary<string, XmlFile> xmlFilesList) { List<string> xmlNames = new List<string>(); foreach (string fileName in fileNames) { if (!File.Exists(fileName)) { continue; } XmlFile[] filesArray = new XmlFile[xmlFilesList.Values.Count]; xmlFilesList.Values.CopyTo(filesArray, 0); XmlFile item = new XmlFile(); item.GenerateID(filesArray); item.Name = Path.GetFileName(fileName); item.Content = File.ReadAllText(fileName); item.TimeStamp = File.GetLastWriteTime(fileName); if (!xmlFilesList.ContainsKey(item.Name)) { xmlFilesList.Add(item.Name, item); xmlNames.Add(item.Name); } } return xmlNames; }
public void ApplyTransform(XmlFile xmlFile) { foreach (var transform in transforms) { transform.ApplyTransform(xmlFile); } }
public SolutionProject(string start, string end, FilePath basePath) : base(start, end) { var components = start.Split('"'); type = new Guid(components[1]); name = components[3]; path = new FilePath(components[5], false); xmlFile = new XmlFile(path.ToAbsolutePath(basePath)); id = new Guid(components[7]); }
public void SavingAndLoadingLeavesItUnchanged() { XmlData data = CreateTestXmlData(); var file = new XmlFile(data); file.Save("file.xml"); XmlData loaded = new XmlFile("file.xml").Root; Assert.AreEqual(data.ToString(), loaded.ToString()); }
public void LoadXmlFromStream() { var memoryStream = new MemoryStream(); var writer = new BinaryWriter(memoryStream); writer.Write(new XmlData("MyData").ToString()); memoryStream.Seek(0, SeekOrigin.Begin); var file = new XmlFile(memoryStream); Assert.AreEqual("MyData", file.Root.Name); }
IEnumerable<XmlElement> RemovedProjectReferences(XmlFile file) { foreach (XmlElement projectReference in file.Document.SelectNodes("//x:ProjectReference", namespaces)) { var include = new FilePath(projectReference.GetAttribute("Include"), false, false); var absolute = include.ToAbsolutePath(file.Path); if (project.Path.Equals(absolute)) { yield return projectReference; } } }
public SolutionProject(FilePath relativePath, FilePath basePath, Guid projectType) : base("", "EndProject") { this.type = projectType; name = System.IO.Path.GetFileNameWithoutExtension(relativePath.Path); path = relativePath; xmlFile = new XmlFile(path.ToAbsolutePath(basePath)); id = ProjectGuid(xmlFile.Document); WriteLineBack(); }
public List<string> CreateVariation(string name, List<VariedParameter> unvaried_yet, XmlFile xmlReference, ref int name_var_cnt, Dictionary<string, XmlFile> xmlFilesList) { int list_counter = 0; string local_name = name; List<VariedParameter> locally_unvaried, locally_varied; List<string> xmlNames = new List<string>(); XmlFile xmlCopy; locally_unvaried = new List<VariedParameter>(unvaried_yet); while (locally_unvaried.Count > 0) { foreach (string value in locally_unvaried[list_counter].values) { xmlReference.SetParam(locally_unvaried[list_counter].group_id, locally_unvaried[list_counter].param_id, value); if (locally_unvaried.Count > 1) { locally_varied = new List<VariedParameter>(locally_unvaried); locally_varied.RemoveAt(list_counter); CreateVariation(local_name, locally_varied, xmlReference, ref name_var_cnt, xmlFilesList); } else { xmlCopy = new XmlFile(); xmlCopy.Name = local_name + "_" + name_var_cnt.ToString(); xmlCopy.Tag = xmlReference.Tag; xmlCopy.TimeStamp = DateTime.Now; xmlCopy.Content = xmlReference.Content; xmlFilesList.Add(xmlCopy.Name, xmlCopy); xmlNames.Add(xmlCopy.Name); name_var_cnt++; } } locally_unvaried.RemoveAt(list_counter); list_counter++; return xmlNames; } return xmlNames; }
public void SaveFileListToDatabase(string name, DataBase dataBase, Dictionary<string, XmlFile> xmlFilesList) { if (File.Exists(name)) { dataBase.DeleteAllData("XML_TAG_RELATION"); dataBase.DeleteAllData("XML_TABLE"); dataBase.DeleteAllData("TAGS"); dataBase.DeleteAllData("USER"); } else if (!dataBase.CreateNewDatabase()) { throw new Exception("Database could not be created!"); } XmlFile[] filesArray = new XmlFile[xmlFilesList.Values.Count]; xmlFilesList.Values.CopyTo(filesArray, 0); dataBase.SaveFiles(filesArray); }
public override void DoApplyTransform(XmlFile xmlFile) { foreach (XmlElement hintPath in xmlFile.Document.SelectNodes("//x:HintPath", namespaces)) { var fileName = Path.GetFileName(hintPath.InnerText); var directory = absolutePaths.FirstOrDefault(p => File.Exists(p.File(fileName).Path)); if (directory == null) { var error = string.Format("Couldn't rebase {0}.\nReference was in ({1})", hintPath.InnerText, xmlFile.Path.Path); var comment = hintPath.OwnerDocument.CreateComment(error); Console.WriteLine(error); hintPath.ParentNode.AppendChild(comment); } else { var relative = directory.File(fileName).PathFrom(xmlFile.Path).Path; hintPath.InnerText = relative; } } }
void CreateUI() { IsLogoVisible = false; // We need the full rendering window var graphics = Graphics; UIElement root = UI.Root; var cache = ResourceCache; XmlFile uiStyle = cache.GetXmlFile("UI/DefaultStyle.xml"); // Set style to the UI root so that elements will inherit it root.SetDefaultStyle(uiStyle); Font font = cache.GetFont("Fonts/Anonymous Pro.ttf"); chatHistoryText = new Text(); chatHistoryText.SetFont(font, 12); root.AddChild(chatHistoryText); buttonContainer = new UIElement(); root.AddChild(buttonContainer); buttonContainer.SetFixedSize(graphics.Width, 20); buttonContainer.SetPosition(0, graphics.Height - 20); buttonContainer.LayoutMode = LayoutMode.Horizontal; textEdit = new LineEdit(); textEdit.SetStyleAuto(null); buttonContainer.AddChild(textEdit); sendButton = CreateButton("Send", 70); connectButton = CreateButton("Connect", 90); disconnectButton = CreateButton("Disconnect", 100); startServerButton = CreateButton("Start Server", 110); UpdateButtons(); // No viewports or scene is defined. However, the default zone's fog color controls the fill color Renderer.DefaultZone.FogColor = new Color(0.0f, 0.0f, 0.1f); }
public void UAVariableTypeTestMethod() { FileInfo _testDataFileInfo = new FileInfo(@"Models\VariableTypeTest\VariableTypeTest.NodeSet2.xml"); Assert.IsTrue(_testDataFileInfo.Exists); ModelDesign _expected = XmlFile.ReadXmlFile <ModelDesign>(@"Models\VariableTypeTest.xml"); List <TraceMessage> _trace = new List <TraceMessage>(); int _diagnosticCounter = 0; ModelDesign _actual = ImportUANodeSet.Import(_testDataFileInfo, z => TraceDiagnostic(z, _trace, ref _diagnosticCounter)); Assert.Inconclusive("UAOOI.SemanticData.UANodeSetValidation 5.1.0 is available #120"); Assert.IsNotNull(_actual); //Assert.AreEqual<int>(0, _trace.Where<TraceMessage>(x => x.BuildError.Focus != Focus.Diagnostic).Count<TraceMessage>()); //Compare(_expected, _actual); //Assert.AreEqual<int>(3, _expected.Items.Length); //Assert.AreEqual<int>(3, _actual.Items.Length); //Assert.IsTrue(_actual.Items[0] is VariableTypeDesign); //Assert.IsTrue(_actual.Items[1] is VariableTypeDesign); //Assert.IsTrue(_actual.Items[2] is VariableTypeDesign); //Compare((VariableTypeDesign)_expected.Items[0], (VariableTypeDesign)_actual.Items[0]); //Compare((VariableTypeDesign)_expected.Items[1], (VariableTypeDesign)_actual.Items[1]); //Compare((VariableTypeDesign)_expected.Items[2], (VariableTypeDesign)_actual.Items[2]); }
public vmToolsDB() { Mvvm.Helpers.Observers.GlobalNavigation.Pagina = "BASE DE DADOS"; Blackbox = Visibility.Collapsed; ButtonConnection = "Alterar Connection String"; try { BackupPath = XmlFile.Value("sim.apps", "App", "Backup", "Path"); ConnectionString = XmlFile.Listar("sim.data", "Data", "Conexao", "Rede")[0]; if (BackupPath == string.Empty) { XmlFile.NovoElemento("sim.apps", "Backup", "Path", "..."); BackupPath = XmlFile.Value("sim.apps", "App", "Backup", "Path"); } } catch { ConnectionString = string.Empty; BackupPath = string.Empty; } TextboxEnabled = false; bgWorker.WorkerSupportsCancellation = true; bgWorker.WorkerReportsProgress = true; bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); bgWorker.ProgressChanged += new ProgressChangedEventHandler(bgWorker_ProgressChanged); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); StartProgressBar = true; OnNuvem = false; //bgWorker.RunWorkerAsync(); }
private void ExportToFileSkills_Click(object sender, EventArgs e) { Util.WTSaveFileDialog tempExport = new Util.WTSaveFileDialog("skills", CurrentWSG.CharacterName + ".skills"); if (tempExport.ShowDialog() == DialogResult.OK) { // Create empty xml file XmlTextWriter writer = new XmlTextWriter(tempExport.FileName(), new System.Text.ASCIIEncoding()); writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartDocument(); writer.WriteStartElement("INI"); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); writer.Close(); XmlFile Skills = new XmlFile(tempExport.FileName()); List <string> subsectionnames = new List <string>(); List <string> subsectionvalues = new List <string>(); for (int Progress = 0; Progress < CurrentWSG.NumberOfSkills; Progress++) { subsectionnames.Clear(); subsectionvalues.Clear(); subsectionnames.Add("Level"); subsectionnames.Add("Experience"); subsectionnames.Add("InUse"); subsectionvalues.Add(CurrentWSG.LevelOfSkills[Progress].ToString()); subsectionvalues.Add(CurrentWSG.ExpOfSkills[Progress].ToString()); subsectionvalues.Add(CurrentWSG.InUse[Progress].ToString()); Skills.AddSection(CurrentWSG.SkillNames[Progress], subsectionnames, subsectionvalues); } } }
internal static UIElement CreateBuildingUpgradeUIFromBuilding(UI UI, XmlFile buildingStyleXml, Building building) { if (building == null) { return(null); } var buildingWindow = UI.LoadLayout(buildingStyleXml); var properties = building.BuildingProperties; var BuildingName = buildingWindow.GetChild("BuildingName", true) as Text; BuildingName.Value = properties.Name; var BuildingDescription = buildingWindow.GetChild("BuildingDescription", true) as Text; BuildingDescription.Value = properties.Description; var BuildingLevel = buildingWindow.GetChild("BuildingLevel", true) as Text; BuildingLevel.Value = string.Format(Assets.FormatStrings.BuildingWindowLevel, building.Level); var BuildingPrice = buildingWindow.GetChild("BuildingPrice", true) as Text; BuildingPrice.Value = GetNumberSuffixed(properties.GetCostForLevel(building.Level + 1), "-{0:0.00}"); var BuildingReward = buildingWindow.GetChild("BuildingReward", true) as Text; BuildingReward.Value = string.Format("{0}/{1:0.0s}", GetNumberSuffixed(properties.GetRewardForLevel(building.Level + 1, building.Neighbors), "+{0:0.00}"), properties.TimeForReward); var BuildingType = buildingWindow.GetChild("BuildingType", true) as Text; BuildingType.Value = properties.ResourceType.ToString(); return(buildingWindow); }
private void LoadMetadata() { if (this.metadata == null) { Logger.LogInfo("We have no existing in-memory metadata"); if (File.Exists(path)) { try { this.metadata = XmlFile.ReadFile <UsersMetadata>(path); Logger.LogInfo("Succesfully loaded metadata from file"); } catch (Exception ex) { Logger.LogError("Error loading metadata from file", ex); } } if (this.metadata == null) // still null. Not loaded from file, or something went wrong when loading from file { this.metadata = new UsersMetadata(); } } }
static void WorkMethod(string file) { MyLibrary.Log.Info("当前处理文件;\r\n" + file); XmlFile xmlFile = null; try { xmlFile = new XmlFile(file); if (xmlFile.Load()) { CmdNum = xmlFile.Commands.Count; MyLibrary.Log.MonitorRunInfo("文件名称:" + file + " 命令数量:" + CmdNum); Sw_File.Restart(); foreach (var cmd in xmlFile.Commands) { cmd.Execute(); } Sw_File.Stop(); MyLibrary.Log.MonitorRunInfo(file + "单个文件共花费:" + Sw_File.ElapsedMilliseconds + "ms."); TempStr = Math.Ceiling((double)Sw_File.ElapsedMilliseconds / (double)CmdNum).ToString(); //平均处理每个命令时间 MyLibrary.Log.MonitorRunInfo(string.Format("平均每个命令花费{0}ms.", TempStr)); xmlFile.MoveTo(Config.NewXmlFilesPath); } else { xmlFile.MoveTo(Config.ErrorXmlFilesPath); } } catch (Exception ex) { MyLibrary.Log.Error(ex.ToString()); xmlFile.MoveTo(Config.ErrorXmlFilesPath); Thread.Sleep(3 * 1000); } }
public override void LoadData(object data) { ClearData(); foreach (var resView in ((ResourcesWorkspaceViewModel)data).Resources) { var resource = resView.Resource; foreach (var fragment in resource.Fragments) { try { using var ds = fragment.GetDecompressDataStream(true); if (XmlFile.IsXmlFile(ds)) { XmlFiles.Add(new ErpXmlFileViewModel(resView, fragment)); } } catch { // TODO: log } } } DisplayName = "XML Files " + xmlFiles.Count; }
internal static void UploadFile(string filePath) { using (CompAgriConnection ctx = new CompAgriConnection()) { ctx.Configuration.AutoDetectChangesEnabled = false; string path = filePath; string fileName = filePath.Substring(filePath.LastIndexOf('\\') + 1); XDocument docX = XDocument.Load(path); XmlFile documentDB = new XmlFile(); ctx.XmlFiles.Add(documentDB); documentDB.XmlFile_Name = fileName; ctx.SaveChanges(); IEnumerable <XElement> concept = docX.Descendants("CONCEPT"); foreach (XElement item in concept) { AddConcept(documentDB, item, ctx); } ctx.SaveChanges(); } }
public async Task <ActionResult <string> > GetXmlFileDownloadToken(long id) { //Should add token verification XmlFile xmlFile = await _context.XmlFiles.FindAsync(id); if (xmlFile == null) { return(BadRequest("File Not Found")); } DownloadUploadToken dut = new DownloadUploadToken("Reason", TableName.LeaveApplication, id); dut.Signer = await _userManager.GetUserAsync(User); /*if (xmlFile.DownloadUploadTokens == null) * { * xmlFile.DownloadUploadTokens = new List<DownloadUploadToken>(); * } * xmlFile.DownloadUploadTokens.Add(dut);*/ _context.DownloadUploadTokens.Add(dut); _context.XmlFiles.Update(xmlFile); await _context.SaveChangesAsync(); return(dut.Token); }
void CreateUI() { var cache = ResourceCache; // Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will // control the camera, and when visible, it will point the raycast target XmlFile style = cache.GetXmlFile("UI/DefaultStyle.xml"); Cursor cursor = new Cursor(); cursor.SetStyleAuto(style); UI.Cursor = cursor; // Set starting position of the cursor at the rendering window center var graphics = Graphics; cursor.SetPosition(graphics.Width / 2, graphics.Height / 2); // Construct new Text object, set string to display and font to use var instructionText = new Text(); instructionText.Value = "Use WASD keys to move, RMB to rotate view\n" + "LMB to set destination, SHIFT+LMB to teleport\n" + "MMB to add or remove obstacles\n" + "Space to toggle debug geometry"; instructionText.SetFont(cache.GetFont("Fonts/Anonymous Pro.ttf"), 15); // The text has multiple rows. Center them in relation to each other instructionText.TextAlignment = HorizontalAlignment.Center; // Position the text relative to the screen center instructionText.HorizontalAlignment = HorizontalAlignment.Center; instructionText.VerticalAlignment = VerticalAlignment.Center; instructionText.SetPosition(0, UI.Root.Height / 4); UI.Root.AddChild(instructionText); }
public void Generate(bool ForceRegenerate) { var XcworkspacedataPath = OutputDirectory / (SolutionName + ".xcworkspace") / "contents.xcworkspacedata"; var BaseDirPath = XcworkspacedataPath.Parent.Parent; var x = new XElement("Workspace", new XAttribute("version", "1.0")); var RelativePathToGroups = new Dictionary <PathString, XElement>(); foreach (var Project in ProjectReferences) { var VirtualDirParts = Project.VirtualDir.Parts; var xCurrentGroup = x; var CurrentPath = "".AsPath(); foreach (var Part in VirtualDirParts) { var ParentPath = CurrentPath; CurrentPath = ParentPath / Part; if (RelativePathToGroups.ContainsKey(CurrentPath)) { xCurrentGroup = RelativePathToGroups[CurrentPath]; } else { xCurrentGroup = new XElement("Group", new XAttribute("location", "group:" + CurrentPath == "." ? "" : CurrentPath.ToString(PathStringStyle.Unix)), new XAttribute("name", Part)); RelativePathToGroups.Add(CurrentPath, xCurrentGroup); x.Add(xCurrentGroup); } } xCurrentGroup.Add(new XElement("FileRef", new XAttribute("location", "group:" + Project.FilePath.RelativeTo(BaseDirPath).ToString(PathStringStyle.Unix)))); } var xFile = XmlFile.ToString(x); TextFile.WriteToFile(XcworkspacedataPath, xFile, Encoding.UTF8, !ForceRegenerate); }
void CreateUI() { var cache = ResourceCache; scene = new Scene(); // Create a scene which will not be actually rendered, but is used to hold SoundSource components while they play sounds UIElement root = UI.Root; XmlFile uiStyle = cache.GetXmlFile("UI/DefaultStyle.xml"); // Set style to the UI root so that elements will inherit it root.SetDefaultStyle(uiStyle); // Create buttons for playing back sounds int i = 0; foreach (var item in sounds) { Button button = CreateButton(i++ *140 + 20, 20, 120, 40, item.Key); button.SubscribeToReleased(args => { // Get the sound resource Sound sound = cache.GetSound(item.Value); if (sound != null) { // Create a scene node with a SoundSource component for playing the sound. The SoundSource component plays // non-positional audio, so its 3D position in the scene does not matter. For positional sounds the // SoundSource3D component would be used instead Node soundNode = scene.CreateChild("Sound"); SoundSource soundSource = soundNode.CreateComponent <SoundSource>(); soundSource.Play(sound); // In case we also play music, set the sound volume below maximum so that we don't clip the output soundSource.Gain = 0.75f; // Set the sound component to automatically remove its scene node from the scene when the sound is done playing soundSource.AutoRemove = true; } }); } // Create buttons for playing/stopping music var playMusicButton = CreateButton(20, 80, 120, 40, "Play Music"); playMusicButton.SubscribeToReleased(args => { if (scene.GetChild("Music", false) != null) { return; } var music = cache.GetSound("Music/Ninja Gods.ogg"); music.Looped = true; Node musicNode = scene.CreateChild("Music"); SoundSource musicSource = musicNode.CreateComponent <SoundSource> (); // Set the sound type to music so that master volume control works correctly musicSource.SetSoundType(SoundType.Music.ToString()); musicSource.Play(music); }); var stopMusicButton = CreateButton(160, 80, 120, 40, "Stop Music"); stopMusicButton.SubscribeToReleased(args => scene.RemoveChild(scene.GetChild("Music", false))); // Create sliders for controlling sound and music master volume var soundSlider = CreateSlider(20, 140, 200, 20, "Sound Volume"); soundSlider.Value = Audio.GetMasterGain(SoundType.Effect.ToString()); soundSlider.SubscribeToSliderChanged(args => Audio.SetMasterGain(SoundType.Effect.ToString(), args.Value)); var musicSlider = CreateSlider(20, 200, 200, 20, "Music Volume"); musicSlider.Value = Audio.GetMasterGain(SoundType.Music.ToString()); musicSlider.SubscribeToSliderChanged(args => Audio.SetMasterGain(SoundType.Music.ToString(), args.Value)); }
private static void AddParentRelationToTerm(Term currentTerm, XElement parentInfo, XmlFile documentDB, CompAgriConnection ctx) { Term parentTerm = null; parentTerm = documentDB.Term.FirstOrDefault(d => d.Term_Title == parentInfo.Value); if (parentTerm == null) { parentTerm = new Term(); parentTerm.Term_Title = parentInfo.Value; parentTerm.Term_XmlFile_Id = documentDB.XmlFile_Id; ctx.Terms.Add(parentTerm); ctx.SaveChanges(); } Relation relation = new Relation() { Term = parentTerm, Term1 = currentTerm }; ctx.Relations.Add(relation); }
public void CreateFileTree(TreeView treeView, string activeName) { _activeXmlFile = _xmlFilesList[activeName]; _activeXmlFile.CreateFileTree(treeView); }
private void buttonCreateUser_Click(object sender, EventArgs e) { try { if (this.treeViewRoles.SelectedNode == null || !(this.treeViewRoles.SelectedNode.Tag is RoleDescription)) { return; } if (string.IsNullOrEmpty(this.textBoxNewUserName.Text)) { MessageBox.Show("You must enter a username"); return; } Guid newUserId = GuidCreator.CreateGuidFromString(this.textBoxNewUserName.Text); if (this.masterKeypair == null && this.keyPair == null) { MessageBox.Show("You must load your key pair first"); return; } string filename = FileDialogs.AskUserForFileNameToSaveIn(); if (!string.IsNullOrEmpty(filename)) { if (!Path.HasExtension(filename)) { filename = filename + ".xml"; } SignKeys userSignKeyPair = DataSigner.GenerateSignKeyPair(); IPreService proxy; KeyPair userKeypair; DelegationToken userDelegationToken; if (this.masterKeypair != null) { proxy = GetPreProxy(); userKeypair = proxy.GenerateKeyPair(); userDelegationToken = new DelegationToken(); proxy = GetPreProxy(); userDelegationToken.ToUser = proxy.GenerateDelegationKey(this.masterKeypair.Private, userKeypair.Public); } else { userKeypair = this.keyPair; // I am not a DO, so when creating a new user then reuse my key userDelegationToken = null; // I do not know my own delegation key. The server will put it in for me. } proxy = GetPreProxy(); byte[] username = proxy.Encrypt(this.keyPair.Public, this.textBoxNewUserName.Text.GetBytes()); User user = new User(); user.DelegationToken = userDelegationToken; user.Id = newUserId; user.Name = username; user.SignPublicKey = userSignKeyPair.PublicOnly; RoleDescription role = (RoleDescription)this.treeViewRoles.SelectedNode.Tag; IGatewayService gateWayproxy = GetServiceProxy(); gateWayproxy.CreateUser(this.myId, role.Id, user); KeyCollection uk = new KeyCollection(); uk.PublicKey = Convert.ToBase64String(this.keyPair.Public); // use original DO public key uk.PrivateKey = Convert.ToBase64String(userKeypair.Private); uk.SignKeys = Convert.ToBase64String(userSignKeyPair.PublicAndPrivate); XmlFile.WriteFile(uk, filename); buttonRefreshRolesAndUsers_Click(this, EventArgs.Empty); } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); Logger.LogError("Error generating user keypair", ex); } }
/// <summary> /// Gets a referenced value, i.e. a value corresponding with a reference string within the scope of the source. /// Implementation is delegated to XmlFile.GetRegisteredTarget. /// </summary> /// <param name="reference">Reference</param> /// <returns>The referenced object</returns> public object GetReferencedValue(string reference) { return(XmlFile.GetRegisteredTarget(this.Source, reference)); }
private void TranslateOneFolder(string fileFolder, string dictionaryFolder, bool log = true) { void LogInner(string contents = "", bool writeNewLine = true) { if (log) { Log(contents, writeNewLine); } } LogInner("Opening dictionaries..."); string[] paths = File.ReadAllLines(Path.Combine(dictionaryFolder, "Paths.dict")); List <DictionaryFile> dicts = Directory.EnumerateFiles(Path.Combine(dictionaryFolder, "Dictionaries")) .Select(file => new DictionaryFile(file)) .ToList(); ProgressValue.Value = 0; ProgressMax.Value = paths.Length; LogInner("Translating files:"); for (int i = 0; i < paths.Length; i++) { ProgressValue.Value++; string xmlFilePath = Path.Combine(fileFolder, paths[i]); LogInner(" -- " + xmlFilePath, false); if (!IOUtils.FileExists(xmlFilePath)) { LogInner(" - skipped"); continue; } DictionaryFile dict = dicts.Find(d => Path.GetFileNameWithoutExtension(d.FileName) == i.ToString()); if (dict == null) { LogInner(" - skipped"); continue; } try { var xmlFile = new XmlFile(xmlFilePath); xmlFile.TranslateWithDictionary(dict, true); LogInner(" - translated"); } catch (Exception ex) { MessageBox.Show($"Message: {ex.Message}\nStackTrace: {ex.StackTrace}"); LogInner(" - error"); } } if (!IOUtils.FileExists(Path.Combine(dictionaryFolder, "Languages.dict"))) { return; } LogInner("Adding languages:"); string[] languages = File.ReadAllLines(Path.Combine(dictionaryFolder, "Languages.dict")); ProgressValue.Value = 0; ProgressMax.Value = languages.Length; foreach (var language in languages) { ProgressValue.Value++; LogInner(" -- " + language); IOUtils.CopyFilesRecursively( Path.Combine(dictionaryFolder, "Languages", language), Path.Combine(fileFolder, "res", language) ); } }
internal static void UploadFile(string filePath) { using (CompAgriConnection ctx = new CompAgriConnection()) { ctx.Configuration.AutoDetectChangesEnabled = false; string path = filePath; string fileName = filePath.Substring(filePath.LastIndexOf('\\') + 1); XDocument docX = XDocument.Load(path); XmlFile documentDB = new XmlFile(); ctx.XmlFiles.Add(documentDB); documentDB.XmlFile_Name = fileName; ctx.SaveChanges(); IEnumerable<XElement> concept = docX.Descendants("CONCEPT"); foreach (XElement item in concept) { AddConcept(documentDB, item, ctx); } ctx.SaveChanges(); } }
public Entidad ImportarConfiguracion(Entidad usuario) { XmlFile xmlFile = XmlFile.getInstancia(usuario.Estado); // Create an isntance of XmlTextReader and call Read method to read the file XmlTextReader textReader = new XmlTextReader(xmlFile.getXmlFolderPath()); textReader.Read(); // If the node has value textReader.WhitespaceHandling = WhitespaceHandling.None; Boolean seccionLibretas = false; int i = -1; int j = -1; int k = -1; while (textReader.Read()) { if (seccionLibretas == false) { if (textReader.Name.Equals("Correo")) { textReader.Read(); (usuario as Usuario).Correo = textReader.Value; textReader.Read(); } if (textReader.Name.Equals("Clave")) { textReader.Read(); (usuario as Usuario).Clave = textReader.Value; textReader.Read(); } if (textReader.Name.Equals("Nombre")) { Console.WriteLine("Name:" + textReader.Name); textReader.Read(); Console.WriteLine("Value:" + textReader.Value); (usuario as Usuario).Nombre = textReader.Value; textReader.Read(); } if (textReader.Name.Equals("Apellido")) { Console.WriteLine("Name:" + textReader.Name); textReader.Read(); Console.WriteLine("Value:" + textReader.Value); (usuario as Usuario).Apellido = textReader.Value; textReader.Read(); } if (textReader.Name.Equals("AccesSecret")) { textReader.Read(); (usuario as Usuario).AccesSecret = textReader.Value; textReader.Read(); } if (textReader.Name.Equals("AccesToken")) { //Console.WriteLine("Name:" + textReader.Name); textReader.Read(); //Console.WriteLine("Value:" + textReader.Value); (usuario as Usuario).AccesToken = textReader.Value; textReader.Read(); } } else { if (textReader.Name.Equals("NombreLibreta")) { i++; j = -1; textReader.Read(); Entidad libreta = FabricaEntidad.CrearLibreta(); (libreta as Libreta).NombreLibreta = textReader.Value; (usuario as Usuario).ListaLibretas.Add((libreta as Libreta)); textReader.Read(); seccionLibretas = true; } if (textReader.Name.Equals("Titulo")) { j++; textReader.Read(); Entidad nota = FabricaEntidad.CrearNota(); (nota as Nota).Titulo = textReader.Value; (usuario as Usuario).ListaLibretas[i].ListaNota.Add((nota as Nota)); textReader.Read(); } if (textReader.Name.Equals("Contenido")) { textReader.Read(); (usuario as Usuario).ListaLibretas[i].ListaNota[j].Contenido = textReader.Value; textReader.Read(); } if (textReader.Name.Equals("Fechacreacion")) { textReader.Read(); (usuario as Usuario).ListaLibretas[i].ListaNota[j].Fechacreacion = Convert.ToDateTime(textReader.Value); textReader.Read(); } if (textReader.Name.Equals("Fechamodificacion")) { textReader.Read(); if (textReader.Value.Contains("/")) { (usuario as Usuario).ListaLibretas[i].ListaNota[j].Fechacreacion = Convert.ToDateTime(textReader.Value); } textReader.Read(); } if (textReader.Name.Equals("Etiquetas")) { textReader.Read(); } if (textReader.Name.Equals("NombreEtiqueta")) { Console.WriteLine("Name:" + textReader.Name); textReader.Read(); Console.WriteLine("Value:" + textReader.Value); Entidad etiqueta = FabricaEntidad.CrearEtiqueta(); (etiqueta as Etiqueta).Nombre = textReader.Value; (usuario as Usuario).ListaLibretas[i].ListaNota[j].ListaEtiqueta.Add((etiqueta as Etiqueta)); textReader.Read(); } if (textReader.Name.Equals("Adjuntos")) { textReader.Read(); k = -1; } if (textReader.Name.Equals("NombreArchivo")) { k++; textReader.Read(); Entidad adjunto = FabricaEntidad.CrearAdjunto(); (adjunto as Adjunto).Titulo = textReader.Value; (usuario as Usuario).ListaLibretas[i].ListaNota[j].ListaAdjunto.Add((adjunto as Adjunto)); textReader.Read(); } if (textReader.Name.Equals("Urlarchivo")) { textReader.Read(); if (textReader.Value != "") { (usuario as Usuario).ListaLibretas[i].ListaNota[j].ListaAdjunto[k].Urlarchivo = textReader.Value; } textReader.Read(); } } if (textReader.Name.Equals("Libretas")) { textReader.Read(); seccionLibretas = true; } } return(usuario); }
// tag::getOrCreate[] /** * Retrieve a user by its ID, and create a new one if requested. * @return * An existing or created user. May be {@code null} if a user does not exis * and {@code create} is false. */ private static User getOrCreate(string id, string fullName, bool create) { string idkey = idStrategy().keyFor(id); byNameLock.readLock().doLock(); User u; try { u = byName.get(idkey); } finally { byNameLock.readLock().unlock(); } FileInfo configFile = getConfigFileFor(id); if (!configFile.Exists && !Directory.Exists(configFile.Directory.FullName)) { // check for legacy users and migrate if safe to do so. FileInfo[] legacy = getLegacyConfigFilesFor(id); if (legacy != null && legacy.Length > 0) { foreach (FileInfo legacyUserDir in legacy) { XmlFile legacyXml = new XmlFile(XmlFile.XSTREAM, new FileInfo(Path.Combine( legacyUserDir.FullName, "config.xml"))); try { object o = legacyXml.read(); if (o is User) { if (idStrategy().equals(id, legacyUserDir.Name) && !idStrategy() .filenameOf(legacyUserDir.Name) .Equals(legacyUserDir.Name)) { try { File.Move(legacyUserDir.FullName, configFile.Directory.FullName); } catch (IOException) { LOGGER.log(Level.WARNING, "Failed to migrate user record from {0} " + "to {1}", new Object[] {legacyUserDir, configFile.Directory.FullName }); } break; } } else { LOGGER.log(Level.FINE, "Unexpected object loaded from {0}: {1}", new object[] { legacyUserDir, o }); } } catch (IOException e) { LOGGER.log(Level.FINE, string.Format( "Exception trying to load user from {0}: {1}", new Object[] { legacyUserDir, e.Message }), e); } } } } if (u == null && (create || configFile.Exists)) { User tmp = new User(id, fullName); User prev; byNameLock.readLock().doLock(); try { prev = byName.putIfAbsent(idkey, u = tmp); } finally { byNameLock.readLock().unlock(); } if (prev != null) { u = prev; // if some has already put a value in the map, use it if (LOGGER.isLoggable(Level.FINE) && !fullName.Equals(prev.getFullName())) { LOGGER.log(Level.FINE, "mismatch on fullName (‘" + fullName + "’ vs. ‘" + prev.getFullName() + "’) for ‘" + id + "’", new Exception()); } } else if (!id.Equals(fullName) && !configFile.Exists) { // JENKINS-16332: since the fullName may not be recoverable // from the id, and various code may store the id only, we // must save the fullName try { u.save(); } catch (IOException x) { LOGGER.log(Level.WARNING, null, x); } } } return u; }
void InitTouchInput() { TouchEnabled = true; var layout = ResourceCache.GetXmlFile("UI/ScreenJoystick_Samples.xml"); if (!string.IsNullOrEmpty(JoystickLayoutPatch)) { XmlFile patchXmlFile = new XmlFile(); patchXmlFile.FromString(JoystickLayoutPatch); layout.Patch(patchXmlFile); } var screenJoystickIndex = Input.AddScreenJoystick(layout, ResourceCache.GetXmlFile("UI/DefaultStyle.xml")); Input.SetScreenJoystickVisible(screenJoystickIndex, true); }
public override void DoApplyTransform(XmlFile file) { foreach (var assemblyReference in AddedProjectReferences(file.Document)) { ConvertToProjectReference(assemblyReference, file.Path); } }
public void ApplyTransform(XmlFile xmlFile) { namespaces = MsBuild2003Namespace(xmlFile.Document); DoApplyTransform(xmlFile); }
private static void AddChildRelationToTerm(Term currentTerm, XElement child, XmlFile documentDB, CompAgriConnection ctx) { Term childTerm = null; childTerm = documentDB.Term.FirstOrDefault(d => d.Term_Title == child.Value); if (childTerm == null) { childTerm = new Term(); childTerm.Term_Title = child.Value; childTerm.Term_XmlFile_Id = documentDB.XmlFile_Id; ctx.Terms.Add(childTerm); ctx.SaveChanges(); } Relation relation = new Relation() { Term = currentTerm, Term1 = childTerm }; ctx.Relations.Add(relation); }
public Entidad ExportarConfiguracion(Clases.Entidad usuario) { XmlFile xmlFile = XmlFile.getInstancia("Configuracion" + (usuario as Usuario).Correo + ".xml"); usuario.Estado = "Configuracion" + (usuario as Usuario).Correo + ".xml"; XmlTextWriter textWriter = new XmlTextWriter(xmlFile.getXmlFolderPath(), null); //identar textWriter.Formatting = Formatting.Indented; textWriter.Indentation = 4; // Opens the document textWriter.WriteStartDocument(); // Write comments textWriter.WriteComment("Configuracion de usuario"); textWriter.WriteStartElement("Usuario"); textWriter.WriteStartElement("Correo", ""); textWriter.WriteString((usuario as Usuario).Correo); textWriter.WriteEndElement(); textWriter.WriteStartElement("Clave", ""); textWriter.WriteString((usuario as Usuario).Clave); textWriter.WriteEndElement(); textWriter.WriteStartElement("Nombre", ""); textWriter.WriteString((usuario as Usuario).Nombre); textWriter.WriteEndElement(); textWriter.WriteStartElement("Apellido", ""); textWriter.WriteString((usuario as Usuario).Apellido); textWriter.WriteEndElement(); textWriter.WriteStartElement("AccesSecret", ""); textWriter.WriteString((usuario as Usuario).AccesSecret); textWriter.WriteEndElement(); textWriter.WriteStartElement("AccesToken", ""); textWriter.WriteString((usuario as Usuario).AccesToken); textWriter.WriteEndElement(); textWriter.WriteStartElement("Libretas"); for (int i = 0; i < (usuario as Usuario).ListaLibretas.Count; i++) { textWriter.WriteStartElement("NombreLibreta", ""); textWriter.WriteString((usuario as Usuario).ListaLibretas[i].NombreLibreta); textWriter.WriteEndElement(); //textWriter.WriteString((usuario as Usuario).ListaLibretas[i].NombreLibreta); for (int j = 0; j < (usuario as Usuario).ListaLibretas[i].ListaNota.Count; j++) { textWriter.WriteStartElement("Nota"); textWriter.WriteStartElement("Titulo", ""); textWriter.WriteString((usuario as Usuario).ListaLibretas[i].ListaNota[j].Titulo); textWriter.WriteEndElement(); textWriter.WriteStartElement("Contenido", ""); textWriter.WriteString((usuario as Usuario).ListaLibretas[i].ListaNota[j].Contenido); textWriter.WriteEndElement(); textWriter.WriteStartElement("Fechacreacion", ""); textWriter.WriteString((usuario as Usuario).ListaLibretas[i].ListaNota[j].Fechacreacion.ToString()); textWriter.WriteEndElement(); textWriter.WriteStartElement("Fechamodificacion", ""); if ((usuario as Usuario).ListaLibretas[i].ListaNota[j].Fechamodificacion.Year == 1) { textWriter.WriteString("No ha sido modificada"); } else { textWriter.WriteString((usuario as Usuario).ListaLibretas[i].ListaNota[j].Fechamodificacion.ToString()); } textWriter.WriteEndElement(); textWriter.WriteStartElement("Etiquetas", ""); for (int k = 0; k < (usuario as Usuario).ListaLibretas[i].ListaNota[j].ListaEtiqueta.Count; k++) { textWriter.WriteStartElement("NombreEtiqueta", ""); textWriter.WriteString((usuario as Usuario).ListaLibretas[i].ListaNota[j].ListaEtiqueta[k].Nombre); textWriter.WriteEndElement(); } textWriter.WriteEndElement(); textWriter.WriteStartElement("Adjuntos", ""); for (int l = 0; l < (usuario as Usuario).ListaLibretas[i].ListaNota[j].ListaAdjunto.Count; l++) { textWriter.WriteStartElement("NombreArchivo", ""); textWriter.WriteString((usuario as Usuario).ListaLibretas[i].ListaNota[j].ListaAdjunto[l].Titulo); textWriter.WriteEndElement(); textWriter.WriteStartElement("Urlarchivo", ""); textWriter.WriteString((usuario as Usuario).ListaLibretas[i].ListaNota[j].ListaAdjunto[l].Urlarchivo); textWriter.WriteEndElement(); } textWriter.WriteEndElement(); textWriter.WriteEndElement(); } } //textWriter.WriteEndElement(); // Ends the document. textWriter.WriteEndDocument(); // close writer textWriter.Close(); return(usuario); }
public void XmlDataConstructor() { var data = new XmlData("name"); var file = new XmlFile(data); Assert.AreEqual(data, file.Root); }
public override void DoApplyTransform(XmlFile file) { foreach (var projectReference in RemovedProjectReferences(file)) { ConvertToAssemblyReference(projectReference); } }
private static Term AddTerm(XElement description, XmlFile documentDB, CompAgriConnection ctx) { Term currentTerm = documentDB.Term.FirstOrDefault(d => d.Term_Title == description.Value); if (currentTerm == null) { currentTerm = new Term(); currentTerm.Term_Title = description.Value; currentTerm.Term_XmlFile_Id = documentDB.XmlFile_Id; ctx.Terms.Add(currentTerm); ctx.SaveChanges(); } return currentTerm; }
public void ReleasePlugin() { CurrentWSG = null; LocationsXml = null; }
/// <summary> /// Loads the XML source. /// </summary> private void LoadXMLSource() { try { Trace("Load Sourc XML Test ", 2); //Change the mapped node back colors ChangeNodeIcon(); //target tree loaded with existing mappings XmlFile xmlFile = new XmlFile(); XmlDocument xml_doc = new XmlDocument(); XmlDocument xml_doc_target = new XmlDocument(); XmlReader readerSource = XmlReader.Create(filePath); XmlReader readerTarget = XmlReader.Create(fileTargetPath); tvSourceXML.Nodes.Clear(); tvTargetXML.Nodes.Clear(); xml_doc.Load(readerSource); xml_doc_target.Load(readerTarget); AddTreeViewChildNodes(tvSourceXML.Nodes, xml_doc); AddTreeViewChildNodes(tvTargetXML.Nodes, xml_doc_target); readerTarget.Close(); readerSource.Close(); } catch (Exception ex) { Trace(ex.Message, 5); Trace(ex.StackTrace, 5); } }
private void CreateOneFolderDictionary(string sourceFolder, string modifiedFolder, string resultFolder, bool log = true) { void LogInner(string contents = "", bool writeNewLine = true) { if (log) { Log(contents, writeNewLine); } } if (IOUtils.FolderExists(resultFolder)) { IOUtils.DeleteFolder(resultFolder); } IOUtils.CreateFolder(resultFolder); var dictFileWriter = new StreamWriter(Path.Combine(resultFolder, "Paths.dict"), false, Encoding.UTF8); var foldersFileWriter = new StreamWriter(Path.Combine(resultFolder, "Languages.dict"), false, Encoding.UTF8); if (new[] { sourceFolder, modifiedFolder, resultFolder }.Any(str => str.IsNullOrEmpty() || !IOUtils.FolderExists(str))) { return; } string dictsFolder = Path.Combine(resultFolder, "Dictionaries"); IOUtils.CreateFolder(dictsFolder); string languagesFolder = Path.Combine(resultFolder, "Languages"); IOUtils.CreateFolder(languagesFolder); LogInner("Searching for xml files in the first folder..."); List <XmlFile> firstXmlFiles = Directory.EnumerateFiles(sourceFolder, "*.xml", SearchOption.AllDirectories) .SelectSafe(file => new XmlFile(file)) .ToList(); LogInner("Searching for xml files in the second folder..."); List <XmlFile> secondXmlFiles = Directory.EnumerateFiles(modifiedFolder, "*.xml", SearchOption.AllDirectories) .SelectSafe(file => new XmlFile(file)) .ToList(); secondXmlFiles.Sort((fFile, sFile) => string.Compare(fFile.FileName, sFile.FileName, StringComparison.Ordinal)); ProgressValue.Value = 0; ProgressMax.Value = firstXmlFiles.Count; int filenameIndex = 0; var errors = new List <string>(); LogInner("Comparing..."); var comparison = new ComparisonWrapper <XmlFile>((fFile, sFile) => string.Compare( fFile.FileName.Substring(modifiedFolder.Length + 1), sFile.FileName.Substring(sourceFolder.Length + 1), StringComparison.Ordinal ) ); foreach (XmlFile file in firstXmlFiles) { try { ProgressValue.Value++; if (file.Details.Count == 0) { continue; } int index = secondXmlFiles.BinarySearch(file, comparison); if (index < 0) { continue; } XmlFile item = secondXmlFiles[index]; var dict = CreateDictionary(file, item, Path.Combine(dictsFolder, $"{filenameIndex}.xml")); if (dict.Details.Count == 0) { continue; } dict.SaveChanges(); filenameIndex++; dictFileWriter.WriteLine(file.FileName.Substring(sourceFolder.Length + 1)); } catch (Exception ex) { errors.Add(file.FileName + " - " + ex.Message); } } string resFolder = Path.Combine(sourceFolder, "res"); var sourceFolders = Directory.EnumerateDirectories(resFolder, "values-*", SearchOption.TopDirectoryOnly).Select(Path.GetFileName).ToList(); var modifiedFolders = Directory.EnumerateDirectories(resFolder, "values-*", SearchOption.TopDirectoryOnly).ToList(); LogInner("Comparing languages..."); ProgressValue.Value = 0; ProgressMax.Value = modifiedFolders.Count; foreach (string folder in modifiedFolders) { ProgressValue.Value++; string part = Path.GetFileName(folder) ?? string.Empty; if (sourceFolders.Contains(part)) { continue; } foldersFileWriter.WriteLine(part); IOUtils.CopyFilesRecursively(folder, Path.Combine(languagesFolder, part)); } if (log) { Log(); Log("Number of created dictionaries: " + filenameIndex); if (errors.Count > 0) { Log("Number of errors: " + errors.Count); foreach (var error in errors) { Log(" -- " + error); } } } dictFileWriter.Close(); foldersFileWriter.Close(); }
public static void Convert(XmlFile xml, StreamWriter writer, string localFilename) { var root = xml.Root.Children[0]; var levelName = Path.GetFileNameWithoutExtension(localFilename); var loader = new LevelLoader(levelName); writer.WriteLine("<dict>"); writer.WriteLine(" <dict name=\"game-mode\">"); writer.WriteLine(" <string name=\"Class\">HwCampaign</string>"); writer.WriteLine(" </dict>"); writer.WriteLine(" <dict name=\"lighting\">"); writer.WriteLine(" <string name=\"environment\">{0}env/{1}.env</string>", Settings.OutputPrefix, levelName); writer.WriteLine(" </dict>"); // Begin reading tilesets into our grid var tileData = root["dictionary[name=tilemap]"].Children[0]; foreach (var tileDict in tileData.Children) { if (tileDict.Name != "dictionary") { continue; } loader.LoadTileData(tileDict); } writer.WriteLine(" <array name=\"tiles\">"); foreach (string key in loader.m_tilesets.Keys) { var set = loader.m_tilesets[key]; int min_unit_x = 99999; int min_unit_y = 99999; int min_x = 99999; int min_y = 99999; int max_x = -99999; int max_y = -99999; foreach (var t in set.m_tiles) { min_unit_x = Math.Min(min_unit_x, t.m_originX + t.m_x); min_unit_y = Math.Min(min_unit_y, t.m_originY + t.m_y); min_x = Math.Min(min_x, t.m_worldX); min_y = Math.Min(min_y, t.m_worldY); max_x = Math.Max(max_x, t.m_worldX); max_y = Math.Max(max_y, t.m_worldY); } int newSide = 512 / set.m_size; min_unit_x = MakeMultiple(min_unit_x, newSide, true); min_unit_y = MakeMultiple(min_unit_y, newSide, true); min_x = MakeMultiple(min_x, 512, true); min_y = MakeMultiple(min_y, 512, true); max_x = MakeMultiple(max_x, 512, false); max_y = MakeMultiple(max_y, 512, false); int newSideOffset = newSide - 20; // old side is always 20! int newCellCountW = (int)Math.Ceiling((-min_x + max_x + newSideOffset * set.m_size) / 512.0); int newCellCountH = (int)Math.Ceiling((-min_y + max_y + newSideOffset * set.m_size) / 512.0); int newCellCount = newCellCountW * newCellCountH; Tile[][][] cells = new Tile[newCellCount][][]; for (int i = 0; i < newCellCount; i++) { cells[i] = new Tile[newSide][]; for (int j = 0; j < newSide; j++) { cells[i][j] = new Tile[newSide]; } } foreach (var t in set.m_tiles) { int x = -min_unit_x + t.m_originX + t.m_x + newSideOffset / 2; int y = -min_unit_y + t.m_originY + t.m_y + newSideOffset / 2; int cell_x = x / newSide; int cell_y = y / newSide; int cell = cell_y * newCellCountW + cell_x; x %= newSide; y %= newSide; try { cells[cell][y][x] = t; } catch { /* um yeah i dunno */ } } int w = !m_visualize ? 1 : (max_x + (min_x < 0 ? -min_x : 0)); int h = !m_visualize ? 1 : (max_y + (min_y < 0 ? -min_y : 0)); var bmp = new Bitmap(w, h); var g = Graphics.FromImage(bmp); for (int i = 0; i < newCellCount; i++) { int cell_y = i / newCellCountW; int cell_x = i % newCellCountW; var sb = new StringBuilder(); for (int y = 0; y < newSide; y++) { for (int x = 0; x < newSide; x++) { var t = cells[i][y][x]; if (t == null) { sb.Append("00"); continue; } sb.Append(t.m_i.ToString("x02")); if (m_visualize) { int col = (t.m_i * 40) % 255; g.FillRectangle(new SolidBrush(Color.FromArgb(col, col, col)), (cell_x * newSide + x) * set.m_size, (cell_y * newSide + y) * set.m_size, set.m_size, set.m_size); } } } int center_x = cell_x * newSide + min_unit_x; int center_y = cell_y * newSide + min_unit_y; writer.WriteLine(" <dict>"); writer.WriteLine(" <array name=\"datasets\">"); writer.WriteLine(" <dict>"); writer.WriteLine(" <bytes name=\"data\">{0}</bytes>", sb.ToString()); writer.WriteLine(" <string name=\"tileset\">{0}</string>", Settings.OutputPrefix + set.m_set); writer.WriteLine(" </dict>"); writer.WriteLine(" </array>"); writer.WriteLine(" <vec2 name=\"pos\">{0} {1}</vec2>", center_x * set.m_size, center_y * set.m_size); writer.WriteLine(" </dict>"); if (m_visualize) { g.DrawRectangle(Pens.Red, (cell_x * newSide) * set.m_size, (cell_y * newSide) * set.m_size, newSide * set.m_size, newSide * set.m_size); } } if (m_visualize) { var fnm = Path.GetFileNameWithoutExtension(localFilename) + "." + set.m_set.Replace('/', '_') + ".visualized.png"; bmp.Save(fnm); } g.Dispose(); bmp.Dispose(); } writer.WriteLine(" </array>"); // name=tiles var doodadsDict = root["dictionary[name=doodads]"]; if (doodadsDict != null) { loader.LoadDoodads(doodadsDict); } var actorsDict = root["dictionary[name=actors]"]; if (actorsDict != null) { loader.LoadActors(actorsDict); } var itemsDict = root["dictionary[name=items]"]; if (itemsDict != null) { loader.LoadItems(itemsDict); } var lightsDict = root["dictionary[name=lighting]"]; if (lightsDict != null) { loader.LoadLights(lightsDict); } var scriptDict = root["dictionary[name=scripting]"]; if (scriptDict != null) { loader.LoadScripts(scriptDict); } // if (scriptDict != null) // Prepare for writing (needs to be done before loading prefabs!) loader.PrepareWriting(); // Import prefabs (can contain doodads, items, actors, and script nodes) var prefabsDict = root["dictionary[name=prefabs]"]; if (prefabsDict != null) { foreach (var prefabTypeArray in prefabsDict.Children) { if (prefabTypeArray.Name != "array") { continue; } foreach (var prefabPos in prefabTypeArray.Children) { if (prefabPos.Name != "vec2") { continue; } var parse = prefabPos.Value.Split(' '); float offset_x = float.Parse(parse[0]); float offset_y = float.Parse(parse[1]); string fnm = Settings.SourcePath + prefabTypeArray.Attributes["name"]; if (!File.Exists(fnm)) { fnm = Settings.SourceFallbackPath + prefabTypeArray.Attributes["name"]; } var xmlPrefab = XmlFile.FromFile(fnm); var rootPrefab = xmlPrefab.Root.Children[0].Children[0]; // <prefab><dictionary> var prefabLoader = new LevelLoader("prefab"); prefabLoader.m_unitIDCounter = loader.m_unitIDCounter; var prefabDoodadsDict = rootPrefab["dictionary[name=doodads]"]; if (prefabDoodadsDict != null) { prefabLoader.LoadDoodads(prefabDoodadsDict); } var prefabActorsDict = rootPrefab["dictionary[name=actors]"]; if (prefabActorsDict != null) { prefabLoader.LoadActors(prefabActorsDict); } var prefabItemsDict = rootPrefab["dictionary[name=items]"]; if (prefabItemsDict != null) { prefabLoader.LoadItems(prefabItemsDict); } var prefabScriptingDict = rootPrefab["dictionary[name=scripting]"]; if (prefabScriptingDict != null) { prefabLoader.LoadScripts(prefabScriptingDict); } prefabLoader.PrepareWriting(); loader.m_unitIDCounter = prefabLoader.m_unitIDCounter; // Copy (actually reference) all units and scripts to our current loader foreach (var unitType in prefabLoader.m_unitTypes) { if (!loader.m_unitTypes.ContainsKey(unitType.Key)) { loader.m_unitTypes.Add(unitType.Key, new UnitType() { m_mutateFilename = unitType.Value.m_mutateFilename }); } foreach (var unit in unitType.Value.m_units) { unit.x += offset_x; unit.y += offset_y; loader.m_unitTypes[unitType.Key].m_units.Add(unit); } } foreach (var script in prefabLoader.m_worldScripts) { script.x += offset_x; script.y += offset_y; loader.m_worldScripts.Add(script); } foreach (var coll in prefabLoader.m_collisionAreas) { coll.x += offset_x; coll.y += offset_y; loader.m_collisionAreas.Add(coll); } } } } writer.WriteLine(" <dict name=\"units\">"); foreach (var ddtp in loader.m_unitTypes) { if (ddtp.Value.m_mutateFilename) { writer.WriteLine(" <array name=\"{0}\">", Settings.OutputPrefix + Path.ChangeExtension(ddtp.Key, "unit")); } else { writer.WriteLine(" <array name=\"{0}\">", Settings.OutputPrefix + ddtp.Key); } foreach (var unit in ddtp.Value.m_units) { unit.Write(writer); } writer.WriteLine(" </array>"); } var collsRectangle = loader.m_collisionAreas.Where(c => c is RectangleShape); if (collsRectangle.Count() > 0) { writer.WriteLine(" <array name=\":Physics_Rectangle\">"); foreach (var coll in collsRectangle) { coll.Write(writer); } writer.WriteLine(" </array>"); // name=:Physics_Rectangle } var collsCircle = loader.m_collisionAreas.Where(c => c is CircleShape); if (collsCircle.Count() > 0) { writer.WriteLine(" <array name=\":Physics_Circle\">"); foreach (var coll in collsCircle) { coll.Write(writer); } writer.WriteLine(" </array>"); // name=:Physics_Circle } writer.WriteLine(" </dict>"); // name=units if (loader.m_worldScripts.Count > 0) { writer.WriteLine(" <array name=\"scripts\">"); foreach (var ws in loader.m_worldScripts) { ws.Write(writer); } writer.WriteLine(" </array>"); // name=scripts } writer.WriteLine(" <int name=\"version\">1</int>"); writer.WriteLine("</dict>"); // root }
/// <summary> /// Writes all metainfo to a file /// </summary> /// <param name="file">The file</param> public static void Write(FileInfo file) { MetaInfo.Initialize(); XmlFile.Write(_targets, file); }
public MaterialHelper(XmlFile file) { this.Load(file.GetRoot("material")); }
/// <summary> /// Reads all metainfo from file /// </summary> /// <param name="file">The file</param> public static void Read(FileInfo file) { MetaInfo.Initialize(); XmlFile.Read(_targets, file); }
public void ReleasePlugin() { CurrentWSG = null; EchoesXml = null; }
public List<string> CreateVariation(string name, List<VariedParameter> unvaried_yet, XmlFile xmlReference, ref int name_var_cnt) { return _variator.CreateVariation(name, unvaried_yet, xmlReference, ref name_var_cnt, _xmlFilesList); }
public virtual void DoApplyTransform(XmlFile xmlFile) { DoApplyTransform(xmlFile.Document); }
/// <summary> /// 初始化文件操作类 /// </summary> /// <param name="szXmlPathName"></param> /// <param name="XmlFlag"></param> /// <param name="bSuccess"></param> public MonitorControlLogFile(string szXmlPathName, XmlFile.XmlFileFlag XmlFlag, out bool bSuccess) : base(szXmlPathName, XmlFlag, ROOT_NAME, out bSuccess) { _nTotalScale = 2; }
private static void AddConcept(XmlFile documentDB, XElement item, CompAgriConnection ctx) { Term currentTerm = null; foreach (XElement child in item.Descendants()) { if (child.Name == "DESCRIPTOR") { currentTerm = AddTerm(child, documentDB, ctx); } else if (child.Name == "BT") { AddParentRelationToTerm(currentTerm, child, documentDB, ctx); } else if (child.Name == "NT") { AddChildRelationToTerm(currentTerm, child, documentDB, ctx); } else { AddPropertyToTerm(ctx, currentTerm, child); } } ctx.SaveChanges(); }
private ArgsAppDto ParseTrt(Dictionary <string, Option> arg) { ArgsAppDto appArgs = new ArgsAppDto(); if (HasOption(_pwScriptId, arg)) { appArgs.Mode = EnumModeLancement.RunScript; appArgs.ScriptId = GetSingleOptionValue(_pwScriptId, arg); } else if (HasOption(_listId, arg)) { appArgs.Mode = EnumModeLancement.ListScript; } else if (HasOption(_initNewScriptXml, arg)) { appArgs.Mode = EnumModeLancement.NewScriptInit; } else if (HasOption(_interactiveLaunch, arg)) { appArgs.Mode = EnumModeLancement.InteractiveLaunch; } if (appArgs.Mode == EnumModeLancement.RunScript) { if (HasOption(_sArgs, arg)) { appArgs.ScriptArgsInput = _sArgs.Value; } } appArgs.HaltOnError = HasOption(_haltOnError, arg); String filepath = "scripts.xml"; if (!File.Exists(filepath)) { FileInfo fEa = new FileInfo(Assembly.GetExecutingAssembly().Location); filepath = Path.Combine(fEa.DirectoryName, filepath); } if (HasOption(_xmlScriptFile, arg)) { filepath = GetSingleOptionValue(_xmlScriptFile, arg); } if (!File.Exists(filepath)) { if (appArgs.Mode == EnumModeLancement.NewScriptInit) { XmlFile xmlF = XmlFile.NewFromEmpty(filepath, "scripts"); xmlF.Save(); } else { throw new CliParsingException($"Le fichier {filepath} n'existe pas ou n'est pas accessible."); } } log.Debug("Lecture fichier xml"); try { appArgs.XmlFile = XmlFile.InitXmlFile(filepath); } catch (XmlException e) { log.Error("Erreur lors de lecture du fichier xml {0} - {1}", filepath, e.Message); throw new CliParsingException($"Erreur lors de lecture du fichier xml {filepath} - {e.Message}", e); } return(appArgs); }
private RemarkNotes() { XmlFile = new XmlFile("RemarkNotes.dat", true); XmlFile.RootName = "RemarkNotes"; }
public XmlParser(XmlFile xmlFile) { this.xmlFile = xmlFile; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BuilderForm)); this.menuStrip = new System.Windows.Forms.MenuStrip(); this.fileMenu = new System.Windows.Forms.ToolStripMenuItem(); this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.printSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editMenu = new System.Windows.Forms.ToolStripMenuItem(); this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewMenu = new System.Windows.Forms.ToolStripMenuItem(); this.toolBarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusBarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scrollableBuildAreaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolsMenu = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.operatorsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.OperatorsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.organizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.sampleQueryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoAlignToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.queryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpBoxToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.goToToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.queryViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.windowsMenu = new System.Windows.Forms.ToolStripMenuItem(); this.newWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.cascadeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tileVerticalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tileHorizontalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.closeAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.arrangeIconsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpMenu = new System.Windows.Forms.ToolStripMenuItem(); this.contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.indexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStrip = new System.Windows.Forms.ToolStrip(); this.newToolStripButton = new System.Windows.Forms.ToolStripButton(); this.openToolStripButton = new System.Windows.Forms.ToolStripButton(); this.saveToolStripButton = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.printToolStripButton = new System.Windows.Forms.ToolStripButton(); this.printPreviewToolStripButton = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.helpToolStripButton = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); this.HideToolStripButton = new System.Windows.Forms.ToolStripButton(); this.ToolTip = new System.Windows.Forms.ToolTip(this.components); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.OperatorToolStrip = new System.Windows.Forms.ToolStrip(); this.SelectToolStripButton = new System.Windows.Forms.ToolStripButton(); this.ProjectToolStripButton = new System.Windows.Forms.ToolStripButton(); this.DupElimToolStripButton = new System.Windows.Forms.ToolStripButton(); this.GroupByToolStripButton = new System.Windows.Forms.ToolStripButton(); this.SortToolStripButton = new System.Windows.Forms.ToolStripButton(); this.JoinToolStripButton = new System.Windows.Forms.ToolStripButton(); this.IntersectToolStripButton = new System.Windows.Forms.ToolStripButton(); this.UnionToolStripButton = new System.Windows.Forms.ToolStripButton(); this.DifferenceToolStripButton = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); this.InstreamToolStripButton = new System.Windows.Forms.ToolStripButton(); this.OutstreamToolStripButton = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripButtonAlignGrid = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonOrganize = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); this.IncreaseSizeToolStripButton = new System.Windows.Forms.ToolStripButton(); this.DecreaseSizeToolStripButton = new System.Windows.Forms.ToolStripButton(); this.OrientationChangerToolStripButton = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); this.HideToolStripButton1 = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparatorDeleteOperator = new System.Windows.Forms.ToolStripSeparator(); this.toolStripButtonDeleteOperator = new System.Windows.Forms.ToolStripButton(); this.origin = new System.Windows.Forms.PictureBox(); this.buildArea = new System.Windows.Forms.Panel(); this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.statusStrip = new System.Windows.Forms.StatusStrip(); this.menuStrip.SuspendLayout(); this.toolStrip.SuspendLayout(); this.OperatorToolStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.origin)).BeginInit(); this.statusStrip.SuspendLayout(); this.SuspendLayout(); this.xmlFile = new XmlFile(); // // menuStrip // this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileMenu, this.editMenu, this.viewMenu, this.toolsMenu, this.goToToolStripMenuItem, this.windowsMenu, this.helpMenu}); this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.MdiWindowListItem = this.windowsMenu; this.menuStrip.Name = "menuStrip"; this.menuStrip.Size = new System.Drawing.Size(991, 24); this.menuStrip.TabIndex = 0; this.menuStrip.Text = "MenuStrip"; // // fileMenu // this.fileMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newToolStripMenuItem, this.openToolStripMenuItem, this.toolStripSeparator3, this.saveToolStripMenuItem, this.saveAsToolStripMenuItem, this.toolStripSeparator4, this.printToolStripMenuItem, this.printPreviewToolStripMenuItem, this.printSetupToolStripMenuItem, this.toolStripSeparator5, this.exitToolStripMenuItem}); this.fileMenu.ImageTransparentColor = System.Drawing.SystemColors.ActiveBorder; this.fileMenu.Name = "fileMenu"; this.fileMenu.Size = new System.Drawing.Size(37, 20); this.fileMenu.Text = "&File"; // // newToolStripMenuItem // this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image"))); this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.newToolStripMenuItem.Name = "newToolStripMenuItem"; this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); this.newToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.newToolStripMenuItem.Text = "&New"; this.newToolStripMenuItem.Click += new System.EventHandler(this.ShowNewForm); // // openToolStripMenuItem // this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image"))); this.openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); this.openToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.openToolStripMenuItem.Text = "&Open"; this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenFile); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Size = new System.Drawing.Size(143, 6); // // saveToolStripMenuItem // this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image"))); this.saveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); this.saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.saveToolStripMenuItem.Text = "&Save"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click); // // saveAsToolStripMenuItem // this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.saveAsToolStripMenuItem.Text = "Save &As"; this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.SaveAsToolStripMenuItem_Click); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Size = new System.Drawing.Size(143, 6); // // printToolStripMenuItem // this.printToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripMenuItem.Image"))); this.printToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.printToolStripMenuItem.Name = "printToolStripMenuItem"; this.printToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); this.printToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.printToolStripMenuItem.Text = "&Print"; // // printPreviewToolStripMenuItem // this.printPreviewToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printPreviewToolStripMenuItem.Image"))); this.printPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.printPreviewToolStripMenuItem.Text = "Print Pre&view"; // // printSetupToolStripMenuItem // this.printSetupToolStripMenuItem.Name = "printSetupToolStripMenuItem"; this.printSetupToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.printSetupToolStripMenuItem.Text = "Print Setup"; // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Size = new System.Drawing.Size(143, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolsStripMenuItem_Click); // // editMenu // this.editMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.undoToolStripMenuItem, this.redoToolStripMenuItem, this.toolStripSeparator6, this.cutToolStripMenuItem, this.copyToolStripMenuItem, this.pasteToolStripMenuItem, this.toolStripSeparator7, this.selectAllToolStripMenuItem}); this.editMenu.Name = "editMenu"; this.editMenu.Size = new System.Drawing.Size(39, 20); this.editMenu.Text = "&Edit"; // // undoToolStripMenuItem // this.undoToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("undoToolStripMenuItem.Image"))); this.undoToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); this.undoToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.undoToolStripMenuItem.Text = "&Undo"; // // redoToolStripMenuItem // this.redoToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("redoToolStripMenuItem.Image"))); this.redoToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.redoToolStripMenuItem.Name = "redoToolStripMenuItem"; this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y))); this.redoToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.redoToolStripMenuItem.Text = "&Redo"; // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Size = new System.Drawing.Size(161, 6); // // cutToolStripMenuItem // this.cutToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripMenuItem.Image"))); this.cutToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X))); this.cutToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.cutToolStripMenuItem.Text = "Cu&t"; this.cutToolStripMenuItem.Click += new System.EventHandler(this.CutToolStripMenuItem_Click); // // copyToolStripMenuItem // this.copyToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripMenuItem.Image"))); this.copyToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); this.copyToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.copyToolStripMenuItem.Text = "&Copy"; this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyToolStripMenuItem_Click); // // pasteToolStripMenuItem // this.pasteToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pasteToolStripMenuItem.Image"))); this.pasteToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V))); this.pasteToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.pasteToolStripMenuItem.Text = "&Paste"; this.pasteToolStripMenuItem.Click += new System.EventHandler(this.PasteToolStripMenuItem_Click); // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; this.toolStripSeparator7.Size = new System.Drawing.Size(161, 6); // // selectAllToolStripMenuItem // this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; this.selectAllToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A))); this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.selectAllToolStripMenuItem.Text = "Select &All"; // // viewMenu // this.viewMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolBarToolStripMenuItem, this.statusBarToolStripMenuItem, this.scrollableBuildAreaToolStripMenuItem}); this.viewMenu.Name = "viewMenu"; this.viewMenu.Size = new System.Drawing.Size(44, 20); this.viewMenu.Text = "&View"; // // toolBarToolStripMenuItem // this.toolBarToolStripMenuItem.Checked = true; this.toolBarToolStripMenuItem.CheckOnClick = true; this.toolBarToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.toolBarToolStripMenuItem.Name = "toolBarToolStripMenuItem"; this.toolBarToolStripMenuItem.Size = new System.Drawing.Size(182, 22); this.toolBarToolStripMenuItem.Text = "&Toolbar"; this.toolBarToolStripMenuItem.Click += new System.EventHandler(this.ToolBarToolStripMenuItem_Click); // // statusBarToolStripMenuItem // this.statusBarToolStripMenuItem.Checked = true; this.statusBarToolStripMenuItem.CheckOnClick = true; this.statusBarToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.statusBarToolStripMenuItem.Name = "statusBarToolStripMenuItem"; this.statusBarToolStripMenuItem.Size = new System.Drawing.Size(182, 22); this.statusBarToolStripMenuItem.Text = "&Status Bar"; this.statusBarToolStripMenuItem.Click += new System.EventHandler(this.StatusBarToolStripMenuItem_Click); // // scrollableBuildAreaToolStripMenuItem // this.scrollableBuildAreaToolStripMenuItem.Checked = true; this.scrollableBuildAreaToolStripMenuItem.CheckOnClick = true; this.scrollableBuildAreaToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.scrollableBuildAreaToolStripMenuItem.Name = "scrollableBuildAreaToolStripMenuItem"; this.scrollableBuildAreaToolStripMenuItem.Size = new System.Drawing.Size(182, 22); this.scrollableBuildAreaToolStripMenuItem.Text = "Scrollable Build Area"; this.scrollableBuildAreaToolStripMenuItem.Click += new System.EventHandler(this.scrollableBuildAreaToolStripMenuItem_Click); // // toolsMenu // this.toolsMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.optionsToolStripMenuItem, this.operatorsToolStripMenuItem1, this.queryToolStripMenuItem, this.helpBoxToolStripMenuItem1}); this.toolsMenu.Name = "toolsMenu"; this.toolsMenu.Size = new System.Drawing.Size(48, 20); this.toolsMenu.Text = "&Tools"; // // optionsToolStripMenuItem // this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.optionsToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.optionsToolStripMenuItem.Text = "&Options"; this.optionsToolStripMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem_Click); // // operatorsToolStripMenuItem1 // this.operatorsToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.OperatorsToolStripMenuItem, this.organizeToolStripMenuItem, this.sampleQueryToolStripMenuItem, this.autoAlignToolStripMenuItem}); this.operatorsToolStripMenuItem1.Name = "operatorsToolStripMenuItem1"; this.operatorsToolStripMenuItem1.ShowShortcutKeys = false; this.operatorsToolStripMenuItem1.Size = new System.Drawing.Size(164, 22); this.operatorsToolStripMenuItem1.Text = "O&perators"; // // OperatorsToolStripMenuItem // this.OperatorsToolStripMenuItem.Checked = true; this.OperatorsToolStripMenuItem.CheckOnClick = true; this.OperatorsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.OperatorsToolStripMenuItem.Name = "OperatorsToolStripMenuItem"; this.OperatorsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.O))); this.OperatorsToolStripMenuItem.Size = new System.Drawing.Size(211, 22); this.OperatorsToolStripMenuItem.Text = "O&perator Tool Bar"; this.OperatorsToolStripMenuItem.ToolTipText = "Open Operators in Child Window"; this.OperatorsToolStripMenuItem.Click += new System.EventHandler(this.operatorsToolStripMenuItem2_Click); // // organizeToolStripMenuItem // this.organizeToolStripMenuItem.Name = "organizeToolStripMenuItem"; this.organizeToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.O))); this.organizeToolStripMenuItem.Size = new System.Drawing.Size(211, 22); this.organizeToolStripMenuItem.Text = "&Organize"; this.organizeToolStripMenuItem.Click += new System.EventHandler(this.organizeToolStripMenuItem_Click); // // sampleQueryToolStripMenuItem // this.sampleQueryToolStripMenuItem.Name = "sampleQueryToolStripMenuItem"; this.sampleQueryToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) | System.Windows.Forms.Keys.S))); this.sampleQueryToolStripMenuItem.Size = new System.Drawing.Size(211, 22); this.sampleQueryToolStripMenuItem.Text = "Sample Query"; this.sampleQueryToolStripMenuItem.ToolTipText = "Add a sample query to the build area"; this.sampleQueryToolStripMenuItem.Click += new System.EventHandler(this.sampleQueryToolStripMenuItem_Click); // // autoAlignToolStripMenuItem // this.autoAlignToolStripMenuItem.CheckOnClick = true; this.autoAlignToolStripMenuItem.Name = "autoAlignToolStripMenuItem"; this.autoAlignToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) | System.Windows.Forms.Keys.A))); this.autoAlignToolStripMenuItem.Size = new System.Drawing.Size(211, 22); this.autoAlignToolStripMenuItem.Tag = "Automatically align operators to a grid when they are moved."; this.autoAlignToolStripMenuItem.Text = "Auto Align"; // // queryToolStripMenuItem // this.queryToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.testToolStripMenuItem, this.addToolStripMenuItem}); this.queryToolStripMenuItem.Name = "queryToolStripMenuItem"; this.queryToolStripMenuItem.Size = new System.Drawing.Size(164, 22); this.queryToolStripMenuItem.Text = "&Query"; // // testToolStripMenuItem // this.testToolStripMenuItem.Name = "testToolStripMenuItem"; this.testToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T))); this.testToolStripMenuItem.Size = new System.Drawing.Size(137, 22); this.testToolStripMenuItem.Text = "&Test"; this.testToolStripMenuItem.Click += new System.EventHandler(this.testToolStripMenuItem_Click); // // addToolStripMenuItem // this.addToolStripMenuItem.Name = "addToolStripMenuItem"; this.addToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.A))); this.addToolStripMenuItem.Size = new System.Drawing.Size(137, 22); this.addToolStripMenuItem.Text = "&Add"; this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click); // // helpBoxToolStripMenuItem1 // this.helpBoxToolStripMenuItem1.Name = "helpBoxToolStripMenuItem1"; this.helpBoxToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.H))); this.helpBoxToolStripMenuItem1.Size = new System.Drawing.Size(164, 22); this.helpBoxToolStripMenuItem1.Text = "Help Box"; this.helpBoxToolStripMenuItem1.Click += new System.EventHandler(this.helpBoxToolStripMenuItem1_Click); // // goToToolStripMenuItem // this.goToToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.queryViewerToolStripMenuItem}); this.goToToolStripMenuItem.Name = "goToToolStripMenuItem"; this.goToToolStripMenuItem.Size = new System.Drawing.Size(51, 20); this.goToToolStripMenuItem.Text = "&Go To"; // // queryViewerToolStripMenuItem // this.queryViewerToolStripMenuItem.Name = "queryViewerToolStripMenuItem"; this.queryViewerToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.V))); this.queryViewerToolStripMenuItem.Size = new System.Drawing.Size(181, 22); this.queryViewerToolStripMenuItem.Text = "Query Viewer"; this.queryViewerToolStripMenuItem.ToolTipText = "Open Query Viewer"; this.queryViewerToolStripMenuItem.Click += new System.EventHandler(this.queryViewerToolStripMenuItem_Click); // // windowsMenu // this.windowsMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newWindowToolStripMenuItem, this.cascadeToolStripMenuItem, this.tileVerticalToolStripMenuItem, this.tileHorizontalToolStripMenuItem, this.closeAllToolStripMenuItem, this.arrangeIconsToolStripMenuItem}); this.windowsMenu.Name = "windowsMenu"; this.windowsMenu.Size = new System.Drawing.Size(68, 20); this.windowsMenu.Text = "&Windows"; // // newWindowToolStripMenuItem // this.newWindowToolStripMenuItem.Name = "newWindowToolStripMenuItem"; this.newWindowToolStripMenuItem.Size = new System.Drawing.Size(151, 22); this.newWindowToolStripMenuItem.Text = "&New Window"; this.newWindowToolStripMenuItem.Click += new System.EventHandler(this.ShowNewForm); // // cascadeToolStripMenuItem // this.cascadeToolStripMenuItem.Name = "cascadeToolStripMenuItem"; this.cascadeToolStripMenuItem.Size = new System.Drawing.Size(151, 22); this.cascadeToolStripMenuItem.Text = "&Cascade"; this.cascadeToolStripMenuItem.Click += new System.EventHandler(this.CascadeToolStripMenuItem_Click); // // tileVerticalToolStripMenuItem // this.tileVerticalToolStripMenuItem.Name = "tileVerticalToolStripMenuItem"; this.tileVerticalToolStripMenuItem.Size = new System.Drawing.Size(151, 22); this.tileVerticalToolStripMenuItem.Text = "Tile &Vertical"; this.tileVerticalToolStripMenuItem.Click += new System.EventHandler(this.TileVerticalToolStripMenuItem_Click); // // tileHorizontalToolStripMenuItem // this.tileHorizontalToolStripMenuItem.Name = "tileHorizontalToolStripMenuItem"; this.tileHorizontalToolStripMenuItem.Size = new System.Drawing.Size(151, 22); this.tileHorizontalToolStripMenuItem.Text = "Tile &Horizontal"; this.tileHorizontalToolStripMenuItem.Click += new System.EventHandler(this.TileHorizontalToolStripMenuItem_Click); // // closeAllToolStripMenuItem // this.closeAllToolStripMenuItem.Name = "closeAllToolStripMenuItem"; this.closeAllToolStripMenuItem.Size = new System.Drawing.Size(151, 22); this.closeAllToolStripMenuItem.Text = "C&lose All"; this.closeAllToolStripMenuItem.Click += new System.EventHandler(this.CloseAllToolStripMenuItem_Click); // // arrangeIconsToolStripMenuItem // this.arrangeIconsToolStripMenuItem.Name = "arrangeIconsToolStripMenuItem"; this.arrangeIconsToolStripMenuItem.Size = new System.Drawing.Size(151, 22); this.arrangeIconsToolStripMenuItem.Text = "&Arrange Icons"; this.arrangeIconsToolStripMenuItem.Click += new System.EventHandler(this.ArrangeIconsToolStripMenuItem_Click); // // helpMenu // this.helpMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contentsToolStripMenuItem, this.indexToolStripMenuItem, this.searchToolStripMenuItem, this.toolStripSeparator8, this.aboutToolStripMenuItem}); this.helpMenu.Name = "helpMenu"; this.helpMenu.Size = new System.Drawing.Size(44, 20); this.helpMenu.Text = "&Help"; // // contentsToolStripMenuItem // this.contentsToolStripMenuItem.Name = "contentsToolStripMenuItem"; this.contentsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F1))); this.contentsToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.contentsToolStripMenuItem.Text = "&Contents"; // // indexToolStripMenuItem // this.indexToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("indexToolStripMenuItem.Image"))); this.indexToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.indexToolStripMenuItem.Name = "indexToolStripMenuItem"; this.indexToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.indexToolStripMenuItem.Text = "&Index"; // // searchToolStripMenuItem // this.searchToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("searchToolStripMenuItem.Image"))); this.searchToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Black; this.searchToolStripMenuItem.Name = "searchToolStripMenuItem"; this.searchToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.searchToolStripMenuItem.Text = "&Search"; // // toolStripSeparator8 // this.toolStripSeparator8.Name = "toolStripSeparator8"; this.toolStripSeparator8.Size = new System.Drawing.Size(165, 6); // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.aboutToolStripMenuItem.Text = "&About ..."; this.aboutToolStripMenuItem.ToolTipText = "Learn about Whitstream"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // // toolStrip // this.toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newToolStripButton, this.openToolStripButton, this.saveToolStripButton, this.toolStripSeparator1, this.printToolStripButton, this.printPreviewToolStripButton, this.toolStripSeparator2, this.helpToolStripButton, this.toolStripSeparator12, this.HideToolStripButton}); this.toolStrip.Location = new System.Drawing.Point(0, 24); this.toolStrip.Name = "toolStrip"; this.toolStrip.Size = new System.Drawing.Size(991, 25); this.toolStrip.TabIndex = 1; this.toolStrip.Text = "ToolStrip"; // // newToolStripButton // this.newToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.newToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripButton.Image"))); this.newToolStripButton.ImageTransparentColor = System.Drawing.Color.Black; this.newToolStripButton.Name = "newToolStripButton"; this.newToolStripButton.Size = new System.Drawing.Size(23, 22); this.newToolStripButton.Text = "New"; this.newToolStripButton.Click += new System.EventHandler(this.newToolStripButton_Click); // // openToolStripButton // this.openToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.openToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripButton.Image"))); this.openToolStripButton.ImageTransparentColor = System.Drawing.Color.Black; this.openToolStripButton.Name = "openToolStripButton"; this.openToolStripButton.Size = new System.Drawing.Size(23, 22); this.openToolStripButton.Text = "Open"; this.openToolStripButton.Click += new System.EventHandler(this.OpenFile); // // saveToolStripButton // this.saveToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.saveToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripButton.Image"))); this.saveToolStripButton.ImageTransparentColor = System.Drawing.Color.Black; this.saveToolStripButton.Name = "saveToolStripButton"; this.saveToolStripButton.Size = new System.Drawing.Size(23, 22); this.saveToolStripButton.Text = "Save"; this.saveToolStripButton.Click += new System.EventHandler(this.saveToolStripButton_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); // // printToolStripButton // this.printToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.printToolStripButton.Enabled = false; this.printToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripButton.Image"))); this.printToolStripButton.ImageTransparentColor = System.Drawing.Color.Black; this.printToolStripButton.Name = "printToolStripButton"; this.printToolStripButton.Size = new System.Drawing.Size(23, 22); this.printToolStripButton.Text = "Print"; // // printPreviewToolStripButton // this.printPreviewToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.printPreviewToolStripButton.Enabled = false; this.printPreviewToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("printPreviewToolStripButton.Image"))); this.printPreviewToolStripButton.ImageTransparentColor = System.Drawing.Color.Black; this.printPreviewToolStripButton.Name = "printPreviewToolStripButton"; this.printPreviewToolStripButton.Size = new System.Drawing.Size(23, 22); this.printPreviewToolStripButton.Text = "Print Preview"; // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); // // helpToolStripButton // this.helpToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.helpToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("helpToolStripButton.Image"))); this.helpToolStripButton.ImageTransparentColor = System.Drawing.Color.Black; this.helpToolStripButton.Name = "helpToolStripButton"; this.helpToolStripButton.Size = new System.Drawing.Size(23, 22); this.helpToolStripButton.Text = "Help"; this.helpToolStripButton.Click += new System.EventHandler(this.helpToolStripButton_Click); // // toolStripSeparator12 // this.toolStripSeparator12.Name = "toolStripSeparator12"; this.toolStripSeparator12.Size = new System.Drawing.Size(6, 25); // // HideToolStripButton // this.HideToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.HideToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("HideToolStripButton.Image"))); this.HideToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.HideToolStripButton.Name = "HideToolStripButton"; this.HideToolStripButton.Size = new System.Drawing.Size(23, 22); this.HideToolStripButton.ToolTipText = "Hide Toolbar"; this.HideToolStripButton.Click += new System.EventHandler(this.HideToolStripButton_Click); // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, "Difference.jpg"); this.imageList1.Images.SetKeyName(1, "DupElim.jpg"); this.imageList1.Images.SetKeyName(2, "GroupBy.jpg"); this.imageList1.Images.SetKeyName(3, "GroupByAvg.JPG"); this.imageList1.Images.SetKeyName(4, "GroupByCount.JPG"); this.imageList1.Images.SetKeyName(5, "GroupByMax.JPG"); this.imageList1.Images.SetKeyName(6, "GroupByMin.JPG"); this.imageList1.Images.SetKeyName(7, "GroupBySum.JPG"); this.imageList1.Images.SetKeyName(8, "InputStream.jpg"); this.imageList1.Images.SetKeyName(9, "Intersect.jpg"); this.imageList1.Images.SetKeyName(10, "Join.jpg"); this.imageList1.Images.SetKeyName(11, "OutputStream.jpg"); this.imageList1.Images.SetKeyName(12, "Project.jpg"); this.imageList1.Images.SetKeyName(13, "Select.jpg"); this.imageList1.Images.SetKeyName(14, "Sort.jpg"); this.imageList1.Images.SetKeyName(15, "Trash.jpg"); this.imageList1.Images.SetKeyName(16, "Union.jpg"); this.imageList1.Images.SetKeyName(17, "ZoomIn.jpg"); this.imageList1.Images.SetKeyName(18, "ZoomOut.jpg"); // // OperatorToolStrip // this.OperatorToolStrip.ImageScalingSize = new System.Drawing.Size(30, 30); this.OperatorToolStrip.ImeMode = System.Windows.Forms.ImeMode.Disable; this.OperatorToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.SelectToolStripButton, this.ProjectToolStripButton, this.DupElimToolStripButton, this.GroupByToolStripButton, this.SortToolStripButton, this.JoinToolStripButton, this.IntersectToolStripButton, this.UnionToolStripButton, this.DifferenceToolStripButton, this.toolStripSeparator9, this.InstreamToolStripButton, this.OutstreamToolStripButton, this.toolStripSeparator10, this.toolStripButtonAlignGrid, this.toolStripButtonOrganize, this.toolStripSeparator11, this.IncreaseSizeToolStripButton, this.DecreaseSizeToolStripButton, this.OrientationChangerToolStripButton, this.toolStripSeparator13, this.HideToolStripButton1, this.toolStripSeparatorDeleteOperator, this.toolStripButtonDeleteOperator}); this.OperatorToolStrip.Location = new System.Drawing.Point(0, 49); this.OperatorToolStrip.Name = "OperatorToolStrip"; this.OperatorToolStrip.Size = new System.Drawing.Size(991, 37); this.OperatorToolStrip.TabIndex = 8; this.OperatorToolStrip.Text = "toolStrip1"; this.OperatorToolStrip.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OperatorToolStrip_MouseUp); this.OperatorToolStrip.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OperatorToolStrip_MouseDown); this.OperatorToolStrip.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OperatorToolStrip_MouseMove); // // SelectToolStripButton // this.SelectToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.SelectToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("SelectToolStripButton.Image"))); this.SelectToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.SelectToolStripButton.Name = "SelectToolStripButton"; this.SelectToolStripButton.Size = new System.Drawing.Size(34, 34); this.SelectToolStripButton.Text = "Select"; this.SelectToolStripButton.Click += new System.EventHandler(this.SelectToolStripButton_Click); // // ProjectToolStripButton // this.ProjectToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.ProjectToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("ProjectToolStripButton.Image"))); this.ProjectToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.ProjectToolStripButton.Name = "ProjectToolStripButton"; this.ProjectToolStripButton.Size = new System.Drawing.Size(34, 34); this.ProjectToolStripButton.Text = "Project"; this.ProjectToolStripButton.Click += new System.EventHandler(this.ProjectToolStripButton_Click); // // DupElimToolStripButton // this.DupElimToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.DupElimToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("DupElimToolStripButton.Image"))); this.DupElimToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.DupElimToolStripButton.Name = "DupElimToolStripButton"; this.DupElimToolStripButton.Size = new System.Drawing.Size(34, 34); this.DupElimToolStripButton.Text = "DuplicateElimination"; this.DupElimToolStripButton.Click += new System.EventHandler(this.DupElimToolStripButton_Click); // // GroupByToolStripButton // this.GroupByToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.GroupByToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("GroupByToolStripButton.Image"))); this.GroupByToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.GroupByToolStripButton.Name = "GroupByToolStripButton"; this.GroupByToolStripButton.Size = new System.Drawing.Size(34, 34); this.GroupByToolStripButton.Text = "GroupBy"; this.GroupByToolStripButton.Click += new System.EventHandler(this.GroupByToolStripButton_Click); // // SortToolStripButton // this.SortToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.SortToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("SortToolStripButton.Image"))); this.SortToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.SortToolStripButton.Name = "SortToolStripButton"; this.SortToolStripButton.Size = new System.Drawing.Size(34, 34); this.SortToolStripButton.Text = "Sort"; this.SortToolStripButton.Click += new System.EventHandler(this.SortToolStripButton_Click); // // JoinToolStripButton // this.JoinToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.JoinToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("JoinToolStripButton.Image"))); this.JoinToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.JoinToolStripButton.Name = "JoinToolStripButton"; this.JoinToolStripButton.Size = new System.Drawing.Size(34, 34); this.JoinToolStripButton.Text = "Join"; this.JoinToolStripButton.Click += new System.EventHandler(this.JoinToolStripButton_Click); // // IntersectToolStripButton // this.IntersectToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.IntersectToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("IntersectToolStripButton.Image"))); this.IntersectToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.IntersectToolStripButton.Name = "IntersectToolStripButton"; this.IntersectToolStripButton.Size = new System.Drawing.Size(34, 34); this.IntersectToolStripButton.Text = "Intersect"; this.IntersectToolStripButton.Click += new System.EventHandler(this.IntersectToolStripButton_Click); // // UnionToolStripButton // this.UnionToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.UnionToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("UnionToolStripButton.Image"))); this.UnionToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.UnionToolStripButton.Name = "UnionToolStripButton"; this.UnionToolStripButton.Size = new System.Drawing.Size(34, 34); this.UnionToolStripButton.Text = "Union"; this.UnionToolStripButton.Click += new System.EventHandler(this.UnionToolStripButton_Click); // // DifferenceToolStripButton // this.DifferenceToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.DifferenceToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("DifferenceToolStripButton.Image"))); this.DifferenceToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.DifferenceToolStripButton.Name = "DifferenceToolStripButton"; this.DifferenceToolStripButton.Size = new System.Drawing.Size(34, 34); this.DifferenceToolStripButton.Text = "Difference"; this.DifferenceToolStripButton.Click += new System.EventHandler(this.DifferenceToolStripButton_Click); // // toolStripSeparator9 // this.toolStripSeparator9.Name = "toolStripSeparator9"; this.toolStripSeparator9.Size = new System.Drawing.Size(6, 37); // // InstreamToolStripButton // this.InstreamToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.InstreamToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("InstreamToolStripButton.Image"))); this.InstreamToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.InstreamToolStripButton.Name = "InstreamToolStripButton"; this.InstreamToolStripButton.Size = new System.Drawing.Size(34, 34); this.InstreamToolStripButton.Text = "Instream"; this.InstreamToolStripButton.Click += new System.EventHandler(this.InstreamToolStripButton_Click); // // OutstreamToolStripButton // this.OutstreamToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.OutstreamToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("OutstreamToolStripButton.Image"))); this.OutstreamToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.OutstreamToolStripButton.Name = "OutstreamToolStripButton"; this.OutstreamToolStripButton.Size = new System.Drawing.Size(34, 34); this.OutstreamToolStripButton.Text = "Outstream"; this.OutstreamToolStripButton.Click += new System.EventHandler(this.OutstreamToolStripButton_Click); // // toolStripSeparator10 // this.toolStripSeparator10.Name = "toolStripSeparator10"; this.toolStripSeparator10.Size = new System.Drawing.Size(6, 37); // // toolStripButtonAlignGrid // this.toolStripButtonAlignGrid.Checked = true; this.toolStripButtonAlignGrid.CheckState = System.Windows.Forms.CheckState.Checked; this.toolStripButtonAlignGrid.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonAlignGrid.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonAlignGrid.Image"))); this.toolStripButtonAlignGrid.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonAlignGrid.Name = "toolStripButtonAlignGrid"; this.toolStripButtonAlignGrid.Size = new System.Drawing.Size(34, 34); this.toolStripButtonAlignGrid.Text = "Align to Grid"; this.toolStripButtonAlignGrid.Click += new System.EventHandler(this.toolStripButtonAlignGrid_Click); // // toolStripButtonOrganize // this.toolStripButtonOrganize.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonOrganize.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonOrganize.Image"))); this.toolStripButtonOrganize.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonOrganize.Name = "toolStripButtonOrganize"; this.toolStripButtonOrganize.Size = new System.Drawing.Size(34, 34); this.toolStripButtonOrganize.Text = "Organize Operators"; this.toolStripButtonOrganize.Click += new System.EventHandler(this.toolStripButtonOrganize_Click); // // toolStripSeparator11 // this.toolStripSeparator11.Name = "toolStripSeparator11"; this.toolStripSeparator11.Size = new System.Drawing.Size(6, 37); // // IncreaseSizeToolStripButton // this.IncreaseSizeToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.IncreaseSizeToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("IncreaseSizeToolStripButton.Image"))); this.IncreaseSizeToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.IncreaseSizeToolStripButton.Name = "IncreaseSizeToolStripButton"; this.IncreaseSizeToolStripButton.Size = new System.Drawing.Size(34, 34); this.IncreaseSizeToolStripButton.Text = "Increase Size"; this.IncreaseSizeToolStripButton.Click += new System.EventHandler(this.IncreaseSizeToolStripButton_Click); // // DecreaseSizeToolStripButton // this.DecreaseSizeToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.DecreaseSizeToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("DecreaseSizeToolStripButton.Image"))); this.DecreaseSizeToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.DecreaseSizeToolStripButton.Name = "DecreaseSizeToolStripButton"; this.DecreaseSizeToolStripButton.Size = new System.Drawing.Size(34, 34); this.DecreaseSizeToolStripButton.Text = "Decrease Size"; this.DecreaseSizeToolStripButton.Click += new System.EventHandler(this.DecreaseSizeToolStripButton_Click); // // OrientationChangerToolStripButton // this.OrientationChangerToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.OrientationChangerToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("OrientationChangerToolStripButton.Image"))); this.OrientationChangerToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.OrientationChangerToolStripButton.Name = "OrientationChangerToolStripButton"; this.OrientationChangerToolStripButton.Size = new System.Drawing.Size(34, 34); this.OrientationChangerToolStripButton.Text = "Vertical/Horizontal Changer"; this.OrientationChangerToolStripButton.Click += new System.EventHandler(this.OrientationChangerToolStripButton_Click); // // toolStripSeparator13 // this.toolStripSeparator13.Name = "toolStripSeparator13"; this.toolStripSeparator13.Size = new System.Drawing.Size(6, 37); // // HideToolStripButton1 // this.HideToolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.HideToolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("HideToolStripButton1.Image"))); this.HideToolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.HideToolStripButton1.Name = "HideToolStripButton1"; this.HideToolStripButton1.Size = new System.Drawing.Size(34, 34); this.HideToolStripButton1.Text = "Hide Toolbar"; this.HideToolStripButton1.Click += new System.EventHandler(this.HideToolStripButton1_Click); // // toolStripSeparatorDeleteOperator // this.toolStripSeparatorDeleteOperator.Name = "toolStripSeparatorDeleteOperator"; this.toolStripSeparatorDeleteOperator.Size = new System.Drawing.Size(6, 37); this.toolStripSeparatorDeleteOperator.Visible = false; // // toolStripButtonDeleteOperator // this.toolStripButtonDeleteOperator.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonDeleteOperator.Enabled = false; this.toolStripButtonDeleteOperator.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonDeleteOperator.Image"))); this.toolStripButtonDeleteOperator.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonDeleteOperator.Name = "toolStripButtonDeleteOperator"; this.toolStripButtonDeleteOperator.Size = new System.Drawing.Size(34, 34); this.toolStripButtonDeleteOperator.Tag = "Deletes the selected operator"; this.toolStripButtonDeleteOperator.Text = "Delete Selected Operator"; this.toolStripButtonDeleteOperator.Visible = false; this.toolStripButtonDeleteOperator.Click += new System.EventHandler(this.toolStripButtonDeleteOperator_Click); // // origin // this.origin.Location = new System.Drawing.Point(0, 0); this.origin.Name = "origin"; this.origin.Size = new System.Drawing.Size(100, 50); this.origin.TabIndex = 0; this.origin.TabStop = false; // // buildArea // this.buildArea.AutoScroll = true; this.buildArea.AutoSize = true; this.buildArea.BackColor = System.Drawing.SystemColors.ActiveBorder; this.buildArea.Dock = System.Windows.Forms.DockStyle.Fill; this.buildArea.Location = new System.Drawing.Point(0, 86); this.buildArea.Name = "buildArea"; this.buildArea.Size = new System.Drawing.Size(991, 424); this.buildArea.TabIndex = 10; this.buildArea.Paint += new System.Windows.Forms.PaintEventHandler(this.buildArea_Paint); this.buildArea.ControlAdded += new System.Windows.Forms.ControlEventHandler(this.buildArea_ControlAdded); this.buildArea.Click += new System.EventHandler(this.BuildArea_Click); // // toolStripStatusLabel // this.toolStripStatusLabel.BackColor = System.Drawing.SystemColors.Menu; this.toolStripStatusLabel.Name = "toolStripStatusLabel"; this.toolStripStatusLabel.Size = new System.Drawing.Size(166, 17); this.toolStripStatusLabel.Text = "Welcome to the Query Builder"; // // statusStrip // this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel}); this.statusStrip.Location = new System.Drawing.Point(0, 510); this.statusStrip.Name = "statusStrip"; this.statusStrip.Size = new System.Drawing.Size(991, 22); this.statusStrip.TabIndex = 2; this.statusStrip.Text = "StatusStrip"; // // BuilderForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.InactiveBorder; this.ClientSize = new System.Drawing.Size(991, 532); this.Controls.Add(this.buildArea); this.Controls.Add(this.OperatorToolStrip); this.Controls.Add(this.statusStrip); this.Controls.Add(this.toolStrip); this.Controls.Add(this.menuStrip); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.ImeMode = System.Windows.Forms.ImeMode.On; this.IsMdiContainer = true; this.MainMenuStrip = this.menuStrip; this.MinimumSize = new System.Drawing.Size(380, 206); this.Name = "BuilderForm"; this.ShowInTaskbar = false; this.Text = "Query Builder"; this.ToolTip.SetToolTip(this, "Whitstream Builder Form"); this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Paint += new System.Windows.Forms.PaintEventHandler(this.BuilderForm_Paint); this.Shown += new System.EventHandler(this.BuilderForm_Shown); this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); this.toolStrip.ResumeLayout(false); this.toolStrip.PerformLayout(); this.OperatorToolStrip.ResumeLayout(false); this.OperatorToolStrip.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.origin)).EndInit(); this.statusStrip.ResumeLayout(false); this.statusStrip.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); }
private PhoneBook() { XmlFile = new XmlFile("PhoneBook.dat", true); XmlFile.RootName = "PhoneBook"; }
private static void Convert(string f) { string magic; string xmlMagic; using (var fs = File.Open(f, FileMode.Open, FileAccess.Read, FileShare.Read)) { PkgBinaryReader reader = new PkgBinaryReader(fs); magic = reader.ReadString(4); // Skip first byte since BXMLBig starts with \0 causing empty string reader.Seek(1, SeekOrigin.Begin); xmlMagic = reader.ReadString(3); } if (xmlMagic == "\"Rr" || xmlMagic == "BXM") { using var fsi = File.Open(f, FileMode.Open, FileAccess.Read, FileShare.Read); using var fso = File.Open(f + ".xml", FileMode.Create, FileAccess.Write, FileShare.Read); XmlFile file = new XmlFile(fsi); file.Write(fso, XMLType.Text); Console.WriteLine("Success! XML converted."); } else if (magic == "LNGT") { using var fsi = File.Open(f, FileMode.Open, FileAccess.Read, FileShare.Read); using var fso = File.Open(f + ".xml", FileMode.Create, FileAccess.Write, FileShare.Read); LngFile file = new LngFile(fsi); file.WriteXml(fso); Console.WriteLine("Success! Lng converted."); } else if (magic == "!pkg") { using var fsi = File.Open(f, FileMode.Open, FileAccess.Read, FileShare.Read); using var fso = File.Open(f + ".json", FileMode.Create, FileAccess.Write, FileShare.Read); PkgFile file = PkgFile.ReadPkg(fsi); file.WriteJson(fso); Console.WriteLine("Success! Pkg converted."); } else { bool isJSON = false; JsonException jsonEx = null; try { using var fsi = File.Open(f, FileMode.Open, FileAccess.Read, FileShare.Read); using var fso = File.Open(f + ".pkg", FileMode.Create, FileAccess.Write, FileShare.Read); PkgFile pkgFile = PkgFile.ReadJson(fsi); pkgFile.WritePkg(fso); Console.WriteLine("Success! JSON converted."); isJSON = true; } catch (JsonException e) { jsonEx = e; } if (!isJSON) { XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(f); } catch (XmlException e) { throw new AggregateException("Could not determine the file type! Showing json, and xml errors: ", jsonEx, e); } if (xmlDoc.DocumentElement.Name == "language") { using var fsi = File.Open(f, FileMode.Open, FileAccess.Read, FileShare.Read); using var fso = File.Open(f + ".lng", FileMode.Create, FileAccess.Write, FileShare.Read); DataSet dataSet = new DataSet("language"); dataSet.ReadXml(fsi, XmlReadMode.ReadSchema); LngFile file = new LngFile(dataSet); file.Write(fso); Console.WriteLine("Success! XML converted."); } else { using var fsi = File.Open(f, FileMode.Open, FileAccess.Read, FileShare.Read); using var fso = File.Open(f + ".xml", FileMode.Create, FileAccess.Write, FileShare.Read); XmlFile file = new XmlFile(fsi); file.Write(fso); Console.WriteLine("Success! XML converted."); } } } }