1
1
mirror of https://github.com/dgis/xsddiagram.git synced 2024-09-11 18:47:19 +03:00

Change integer parsing system (without try/catch) and add support for Visual Studio 2010/2008.

This commit is contained in:
dgis 2011-12-10 00:03:40 +01:00
parent e353030650
commit 6f0d0e4d0d
12 changed files with 162 additions and 40 deletions

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3053
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -19,7 +19,7 @@ namespace XSDDiagram.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -168,7 +168,7 @@ namespace XSDDiagram.Properties {
/// <summary>
/// Looks up a localized string similar to XSD Diagram is a free xml schema definition diagram viewer (http://regis.cosnier.free.fr).
///
///Version 0.5 Copyright © 2006-2008 Régis Cosnier, All Rights Reserved.
///Version 0.10 Copyright (c) 2006-2011 Regis Cosnier, All Rights Reserved.
///
///This program is free software and may be distributed
///according to the terms of the GNU General Public License (GPL).
@ -176,11 +176,10 @@ namespace XSDDiagram.Properties {
///
///FEATURES:
///
///- GPL
///- Need of the Microsoft Framework.NET 2.0 (if not already install)
///- GPL (Part of the source code are dual licensed with LGPL and MS-PL)
///- Need of the Microsoft Framework.NET 2.0 (if not already install) or Mono
///- Display the elements, the groups and the attributes
///- Show the text/HTML documentation of element and attribute when available
///- P [rest of string was truncated]&quot;;.
///- Sh [rest of string was truncated]&quot;;.
/// </summary>
internal static string ReadMe {
get {

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3053
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -12,7 +12,7 @@ namespace XSDDiagram.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -234,7 +234,7 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="XsdDiagrams\XSDDiagrams.csproj">
<ProjectReference Include="XsdDiagrams\XSDDiagrams2008.csproj">
<Project>{6D3DACE7-D51B-4259-883A-6899BF4D52E2}</Project>
<Name>XSDDiagrams</Name>
</ProjectReference>

View File

@ -1,11 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagram", "XSDDiagram.csproj", "{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagram2008", "XSDDiagram2008.csproj", "{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagramConsole", "XSDDiagramConsole\XSDDiagramConsole.csproj", "{1D732DFD-D631-4BFB-8057-C34B9327A08F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagramConsole2008", "XSDDiagramConsole\XSDDiagramConsole2008.csproj", "{1D732DFD-D631-4BFB-8057-C34B9327A08F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagrams", "XsdDiagrams\XSDDiagrams.csproj", "{6D3DACE7-D51B-4259-883A-6899BF4D52E2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagrams2008", "XsdDiagrams\XSDDiagrams2008.csproj", "{6D3DACE7-D51B-4259-883A-6899BF4D52E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,5 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -14,7 +34,7 @@
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<PublishUrl>http://localhost/XSDDiagram/</PublishUrl>
@ -34,7 +54,6 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
<StartupObject>
</StartupObject>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -70,7 +89,6 @@
<Compile Include="AboutForm.Designer.cs">
<DependentUpon>AboutForm.cs</DependentUpon>
</Compile>
<Compile Include="Diagram.cs" />
<Compile Include="DiagramControl.cs">
<SubType>UserControl</SubType>
</Compile>
@ -148,9 +166,6 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Schema.cs" />
<Compile Include="XSD\XMLSchema.cs" />
<Compile Include="XSD\XMLSchemaEx.cs" />
</ItemGroup>
<ItemGroup>
<None Include="XSD\GenerateClasses.xml" />
@ -216,6 +231,12 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="XsdDiagrams\XSDDiagrams2010.csproj">
<Project>{6D3DACE7-D51B-4259-883A-6899BF4D52E2}</Project>
<Name>XSDDiagrams</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -5,20 +5,38 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagram2010", "XSDDiagra
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagramConsole2010", "XSDDiagramConsole\XSDDiagramConsole2010.csproj", "{1D732DFD-D631-4BFB-8057-C34B9327A08F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagrams2010", "XsdDiagrams\XSDDiagrams2010.csproj", "{6D3DACE7-D51B-4259-883A-6899BF4D52E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Debug|x86.ActiveCfg = Debug|x86
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Debug|x86.Build.0 = Debug|x86
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Release|Any CPU.Build.0 = Release|Any CPU
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Release|x86.ActiveCfg = Release|x86
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Release|x86.Build.0 = Release|x86
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Debug|x86.ActiveCfg = Debug|x86
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Debug|x86.Build.0 = Debug|x86
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Release|Any CPU.Build.0 = Release|Any CPU
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Release|x86.ActiveCfg = Release|x86
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Release|x86.Build.0 = Release|x86
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Debug|x86.ActiveCfg = Debug|Any CPU
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Release|Any CPU.Build.0 = Release|Any CPU
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -62,7 +62,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\XSDDiagram.csproj">
<ProjectReference Include="..\XSDDiagram2008.csproj">
<Project>{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}</Project>
<Name>XSDDiagram</Name>
</ProjectReference>

View File

@ -10,13 +10,27 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>XSDDiagramConsole</RootNamespace>
<AssemblyName>XSDDiagramConsole</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -35,6 +49,26 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
@ -45,14 +79,36 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\XSDDiagram.csproj">
<ProjectReference Include="..\XSDDiagram2010.csproj">
<Project>{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}</Project>
<Name>XSDDiagram</Name>
<Name>XSDDiagram2010</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,3 +1,3 @@
<?xml version="1.0"?>
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
<startup/></configuration>

View File

@ -132,10 +132,19 @@ namespace XSDDiagram.Rendering
childDiagramElement.Name = childElement.name != null ? childElement.name : "";
childDiagramElement.NameSpace = nameSpace;
childDiagramElement.ItemType = DiagramItemType.element;
try { childDiagramElement.MinOccurrence = int.Parse(referenceElement != null ? referenceElement.minOccurs : childElement.minOccurs); }
catch { childDiagramElement.MinOccurrence = -1; }
try { childDiagramElement.MaxOccurrence = int.Parse(referenceElement != null ? referenceElement.maxOccurs : childElement.maxOccurs); }
catch { childDiagramElement.MaxOccurrence = -1; }
int occurrence;
if (int.TryParse(referenceElement != null ? referenceElement.minOccurs : childElement.minOccurs, out occurrence))
childDiagramElement.MinOccurrence = occurrence;
else
childDiagramElement.MinOccurrence = -1;
//try { childDiagramElement.MinOccurrence = int.Parse(referenceElement != null ? referenceElement.minOccurs : childElement.minOccurs); }
//catch { childDiagramElement.MinOccurrence = -1; }
if (int.TryParse(referenceElement != null ? referenceElement.maxOccurs : childElement.maxOccurs, out occurrence))
childDiagramElement.MaxOccurrence = occurrence;
else
childDiagramElement.MaxOccurrence = -1;
//try { childDiagramElement.MaxOccurrence = int.Parse(referenceElement != null ? referenceElement.maxOccurs : childElement.maxOccurs); }
//catch { childDiagramElement.MaxOccurrence = -1; }
bool hasChildren;
bool isSimpleType;
@ -263,10 +272,20 @@ namespace XSDDiagram.Rendering
childDiagramElement.Name = "any " + childElement.@namespace;
childDiagramElement.NameSpace = nameSpace;
childDiagramElement.ItemType = DiagramItemType.group; //DiagramBase.TypeEnum.element;
try { childDiagramElement.MinOccurrence = int.Parse(childElement.minOccurs); }
catch { childDiagramElement.MinOccurrence = -1; }
try { childDiagramElement.MaxOccurrence = int.Parse(childElement.maxOccurs); }
catch { childDiagramElement.MaxOccurrence = -1; }
int occurrence;
if (int.TryParse(childElement.minOccurs, out occurrence))
childDiagramElement.MinOccurrence = occurrence;
else
childDiagramElement.MinOccurrence = -1;
//try { childDiagramElement.MinOccurrence = int.Parse(childElement.minOccurs); }
//catch { childDiagramElement.MinOccurrence = -1; }
if (int.TryParse(childElement.maxOccurs, out occurrence))
childDiagramElement.MaxOccurrence = occurrence;
else
childDiagramElement.MaxOccurrence = -1;
//try { childDiagramElement.MaxOccurrence = int.Parse(childElement.maxOccurs); }
//catch { childDiagramElement.MaxOccurrence = -1; }
childDiagramElement.IsReference = false;
childDiagramElement.IsSimpleContent = false;
childDiagramElement.HasChildElements = false; // true;
@ -331,10 +350,19 @@ namespace XSDDiagram.Rendering
childDiagramGroup.Diagram = this;
childDiagramGroup.TabSchema = childGroup;
try { childDiagramGroup.MinOccurrence = int.Parse(childGroup.minOccurs); }
catch { childDiagramGroup.MinOccurrence = -1; }
try { childDiagramGroup.MaxOccurrence = int.Parse(childGroup.maxOccurs); }
catch { childDiagramGroup.MaxOccurrence = -1; }
int occurrence;
if (int.TryParse(childGroup.minOccurs, out occurrence))
childDiagramGroup.MinOccurrence = occurrence;
else
childDiagramGroup.MinOccurrence = -1;
//try { childDiagramGroup.MinOccurrence = int.Parse(childGroup.minOccurs); }
//catch { childDiagramGroup.MinOccurrence = -1; }
if (int.TryParse(childGroup.maxOccurs, out occurrence))
childDiagramGroup.MaxOccurrence = occurrence;
else
childDiagramGroup.MaxOccurrence = -1;
//try { childDiagramGroup.MaxOccurrence = int.Parse(childGroup.maxOccurs); }
//catch { childDiagramGroup.MaxOccurrence = -1; }
childDiagramGroup.HasChildElements = true;
childDiagramGroup.GroupType = type;

View File

@ -1,3 +1,3 @@
<?xml version="1.0"?>
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
<startup/></configuration>