Moved programs into the Programs folder
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1958 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
33
Programs/SLImageUpload/Properties/AssemblyInfo.cs
Normal file
33
Programs/SLImageUpload/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SLImageUpload")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Metaverse Industries LLC")]
|
||||
[assembly: AssemblyProduct("SLImageUpload")]
|
||||
[assembly: AssemblyCopyright("Copyright © Metaverse Industries LLC 2007")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("d8a0ec17-daf9-4a17-b72f-d32ed7f6962a")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
Programs/SLImageUpload/Properties/Resources.Designer.cs
generated
Normal file
71
Programs/SLImageUpload/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SLImageUpload.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// 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.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SLImageUpload.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
Programs/SLImageUpload/Properties/Resources.resx
Normal file
117
Programs/SLImageUpload/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
Programs/SLImageUpload/Properties/Settings.Designer.cs
generated
Normal file
30
Programs/SLImageUpload/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.42
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SLImageUpload.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Programs/SLImageUpload/Properties/Settings.settings
Normal file
7
Programs/SLImageUpload/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
84
Programs/SLImageUpload/SLImageUpload.build
Normal file
84
Programs/SLImageUpload/SLImageUpload.build
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="libsecondlife" default="build">
|
||||
|
||||
<!-- global framework settings -->
|
||||
<property name="target.framework" value="${framework::get-target-framework()}" />
|
||||
<property name="assembly.dir" value="${framework::get-assembly-directory(target.framework)}" />
|
||||
|
||||
<!-- global project settings -->
|
||||
<xmlpeek
|
||||
file="../libsecondlife.build"
|
||||
xpath="/project/property[@name = 'project.version']/@value"
|
||||
property="project.version" />
|
||||
<property name="build.number"
|
||||
value="${math::abs(math::floor(timespan::get-total-days(datetime::now()
|
||||
- datetime::parse('01/01/2002'))))}" />
|
||||
<property name="assembly" value="SLImageUpload"/>
|
||||
<property name="bin_dir" value="../bin" />
|
||||
|
||||
<!-- default configuration -->
|
||||
<property name="project.config" value="debug" /> <!-- debug|release -->
|
||||
|
||||
<!-- named configurations -->
|
||||
<target name="init" description="Initializes build properties">
|
||||
<call target="${project.config}" />
|
||||
</target>
|
||||
|
||||
<target name="debug" description="configures a debug build">
|
||||
<property name="build.debug" value="true" />
|
||||
<property name="package.name"
|
||||
value="${project::get-name()}-${project.version}-${project.config}" />
|
||||
<property name="assembly.configuration"
|
||||
value="${framework::get-target-framework()}.${platform::get-name()} [${project.config}]" />
|
||||
</target>
|
||||
|
||||
<target name="release" description="configures a release build">
|
||||
<property name="project.config" value="release" />
|
||||
<property name="build.debug" value="false" />
|
||||
<property name="package.name"
|
||||
value="${project::get-name()}-${project.version}" />
|
||||
<property name="assembly.configuration"
|
||||
value="${framework::get-target-framework()}.${platform::get-name()}" />
|
||||
</target>
|
||||
|
||||
<!-- build tasks -->
|
||||
<target name="build" depends="build-main"
|
||||
description="Main build target">
|
||||
</target>
|
||||
|
||||
<target name="build-main" depends="init"
|
||||
description="Builds the binaries for the current configuration">
|
||||
<echo message="Build Directory is ${bin_dir}/" />
|
||||
<mkdir dir="${bin_dir}" failonerror="false" />
|
||||
<csc
|
||||
target="exe"
|
||||
debug="${build.debug}"
|
||||
output="${bin_dir}/SLImageUpload.exe">
|
||||
<sources failonempty="true">
|
||||
<include name="*.cs" />
|
||||
</sources>
|
||||
<references basedir="${bin_dir}/">
|
||||
<include name="libsecondlife.dll"/>
|
||||
<include name="System.Data.dll" />
|
||||
<include name="System.Drawing.dll" />
|
||||
<include name="System.Windows.Forms.dll" />
|
||||
</references>
|
||||
</csc>
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="init"
|
||||
description="Deletes the current configuration">
|
||||
<delete failonerror="false">
|
||||
<fileset basedir="${bin_dir}/">
|
||||
<include name="SLImageUpload.exe" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="*"
|
||||
description="Handles unknown targets">
|
||||
<echo message="skipping unknown target" />
|
||||
</target>
|
||||
</project>
|
||||
20
Programs/SLImageUpload/SLImageUpload.cs
Normal file
20
Programs/SLImageUpload/SLImageUpload.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SLImageUpload
|
||||
{
|
||||
static class SLImageUpload
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new frmSLImageUpload());
|
||||
}
|
||||
}
|
||||
}
|
||||
95
Programs/SLImageUpload/SLImageUpload.csproj
Normal file
95
Programs/SLImageUpload/SLImageUpload.csproj
Normal file
@@ -0,0 +1,95 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F3BDC0BC-74EB-451E-8FFE-AA162474F2F2}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SLImageUpload</RootNamespace>
|
||||
<AssemblyName>SLImageUpload</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-docs|AnyCPU' ">
|
||||
<OutputPath>bin\Release-docs\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisRuleAssemblies>C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="frmSLImageUpload.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmSLImageUpload.Designer.cs">
|
||||
<DependentUpon>frmSLImageUpload.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SLImageUpload.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="frmSLImageUpload.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>frmSLImageUpload.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libsecondlife\OpenMetaverse.csproj">
|
||||
<Project>{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}</Project>
|
||||
<Name>OpenMetaverse</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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
279
Programs/SLImageUpload/frmSLImageUpload.Designer.cs
generated
Normal file
279
Programs/SLImageUpload/frmSLImageUpload.Designer.cs
generated
Normal file
@@ -0,0 +1,279 @@
|
||||
namespace SLImageUpload
|
||||
{
|
||||
partial class frmSLImageUpload
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.grpLogin = new System.Windows.Forms.GroupBox();
|
||||
this.cmdConnect = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtPassword = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtLastName = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtFirstName = new System.Windows.Forms.TextBox();
|
||||
this.grpUpload = new System.Windows.Forms.GroupBox();
|
||||
this.txtAssetID = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.lblSize = new System.Windows.Forms.Label();
|
||||
this.prgUpload = new System.Windows.Forms.ProgressBar();
|
||||
this.picPreview = new System.Windows.Forms.PictureBox();
|
||||
this.cmdLoad = new System.Windows.Forms.Button();
|
||||
this.txtSendtoName = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.chkLossless = new System.Windows.Forms.CheckBox();
|
||||
this.cmdUpload = new System.Windows.Forms.Button();
|
||||
this.grpLogin.SuspendLayout();
|
||||
this.grpUpload.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picPreview)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// grpLogin
|
||||
//
|
||||
this.grpLogin.Controls.Add(this.cmdConnect);
|
||||
this.grpLogin.Controls.Add(this.label3);
|
||||
this.grpLogin.Controls.Add(this.txtPassword);
|
||||
this.grpLogin.Controls.Add(this.label2);
|
||||
this.grpLogin.Controls.Add(this.txtLastName);
|
||||
this.grpLogin.Controls.Add(this.label1);
|
||||
this.grpLogin.Controls.Add(this.txtFirstName);
|
||||
this.grpLogin.Location = new System.Drawing.Point(11, 260);
|
||||
this.grpLogin.Name = "grpLogin";
|
||||
this.grpLogin.Size = new System.Drawing.Size(379, 101);
|
||||
this.grpLogin.TabIndex = 67;
|
||||
this.grpLogin.TabStop = false;
|
||||
//
|
||||
// cmdConnect
|
||||
//
|
||||
this.cmdConnect.Location = new System.Drawing.Point(251, 62);
|
||||
this.cmdConnect.Name = "cmdConnect";
|
||||
this.cmdConnect.Size = new System.Drawing.Size(120, 24);
|
||||
this.cmdConnect.TabIndex = 3;
|
||||
this.cmdConnect.Text = "Connect";
|
||||
this.cmdConnect.Click += new System.EventHandler(this.cmdConnect_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Location = new System.Drawing.Point(251, 20);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(120, 16);
|
||||
this.label3.TabIndex = 72;
|
||||
this.label3.Text = "Password";
|
||||
//
|
||||
// txtPassword
|
||||
//
|
||||
this.txtPassword.Location = new System.Drawing.Point(251, 36);
|
||||
this.txtPassword.Name = "txtPassword";
|
||||
this.txtPassword.PasswordChar = '*';
|
||||
this.txtPassword.Size = new System.Drawing.Size(120, 20);
|
||||
this.txtPassword.TabIndex = 2;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Location = new System.Drawing.Point(132, 20);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(120, 16);
|
||||
this.label2.TabIndex = 70;
|
||||
this.label2.Text = "Last Name";
|
||||
//
|
||||
// txtLastName
|
||||
//
|
||||
this.txtLastName.Location = new System.Drawing.Point(132, 36);
|
||||
this.txtLastName.Name = "txtLastName";
|
||||
this.txtLastName.Size = new System.Drawing.Size(112, 20);
|
||||
this.txtLastName.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(6, 20);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(120, 16);
|
||||
this.label1.TabIndex = 68;
|
||||
this.label1.Text = "First Name";
|
||||
//
|
||||
// txtFirstName
|
||||
//
|
||||
this.txtFirstName.Location = new System.Drawing.Point(6, 36);
|
||||
this.txtFirstName.Name = "txtFirstName";
|
||||
this.txtFirstName.Size = new System.Drawing.Size(120, 20);
|
||||
this.txtFirstName.TabIndex = 0;
|
||||
//
|
||||
// grpUpload
|
||||
//
|
||||
this.grpUpload.Controls.Add(this.txtAssetID);
|
||||
this.grpUpload.Controls.Add(this.label4);
|
||||
this.grpUpload.Controls.Add(this.lblSize);
|
||||
this.grpUpload.Controls.Add(this.prgUpload);
|
||||
this.grpUpload.Controls.Add(this.picPreview);
|
||||
this.grpUpload.Controls.Add(this.cmdLoad);
|
||||
this.grpUpload.Controls.Add(this.txtSendtoName);
|
||||
this.grpUpload.Controls.Add(this.label6);
|
||||
this.grpUpload.Controls.Add(this.chkLossless);
|
||||
this.grpUpload.Controls.Add(this.cmdUpload);
|
||||
this.grpUpload.Location = new System.Drawing.Point(12, 12);
|
||||
this.grpUpload.Name = "grpUpload";
|
||||
this.grpUpload.Size = new System.Drawing.Size(379, 242);
|
||||
this.grpUpload.TabIndex = 68;
|
||||
this.grpUpload.TabStop = false;
|
||||
//
|
||||
// txtAssetID
|
||||
//
|
||||
this.txtAssetID.Location = new System.Drawing.Point(90, 204);
|
||||
this.txtAssetID.Name = "txtAssetID";
|
||||
this.txtAssetID.ReadOnly = true;
|
||||
this.txtAssetID.Size = new System.Drawing.Size(280, 20);
|
||||
this.txtAssetID.TabIndex = 8;
|
||||
this.txtAssetID.TabStop = false;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(6, 207);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(66, 13);
|
||||
this.label4.TabIndex = 79;
|
||||
this.label4.Text = "Asset UUID:";
|
||||
//
|
||||
// lblSize
|
||||
//
|
||||
this.lblSize.AutoSize = true;
|
||||
this.lblSize.Location = new System.Drawing.Point(79, 96);
|
||||
this.lblSize.Name = "lblSize";
|
||||
this.lblSize.Size = new System.Drawing.Size(0, 13);
|
||||
this.lblSize.TabIndex = 77;
|
||||
//
|
||||
// prgUpload
|
||||
//
|
||||
this.prgUpload.Location = new System.Drawing.Point(9, 175);
|
||||
this.prgUpload.Name = "prgUpload";
|
||||
this.prgUpload.Size = new System.Drawing.Size(362, 23);
|
||||
this.prgUpload.TabIndex = 76;
|
||||
//
|
||||
// picPreview
|
||||
//
|
||||
this.picPreview.Location = new System.Drawing.Point(9, 96);
|
||||
this.picPreview.Name = "picPreview";
|
||||
this.picPreview.Size = new System.Drawing.Size(64, 64);
|
||||
this.picPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.picPreview.TabIndex = 75;
|
||||
this.picPreview.TabStop = false;
|
||||
//
|
||||
// cmdLoad
|
||||
//
|
||||
this.cmdLoad.Location = new System.Drawing.Point(160, 136);
|
||||
this.cmdLoad.Name = "cmdLoad";
|
||||
this.cmdLoad.Size = new System.Drawing.Size(102, 24);
|
||||
this.cmdLoad.TabIndex = 6;
|
||||
this.cmdLoad.Text = "Load Texture";
|
||||
this.cmdLoad.UseVisualStyleBackColor = true;
|
||||
this.cmdLoad.Click += new System.EventHandler(this.cmdLoad_Click);
|
||||
//
|
||||
// txtSendtoName
|
||||
//
|
||||
this.txtSendtoName.Location = new System.Drawing.Point(131, 64);
|
||||
this.txtSendtoName.Name = "txtSendtoName";
|
||||
this.txtSendtoName.Size = new System.Drawing.Size(239, 20);
|
||||
this.txtSendtoName.TabIndex = 5;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(6, 67);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(112, 13);
|
||||
this.label6.TabIndex = 71;
|
||||
this.label6.Text = "Send Copy To Avatar:";
|
||||
//
|
||||
// chkLossless
|
||||
//
|
||||
this.chkLossless.Location = new System.Drawing.Point(9, 19);
|
||||
this.chkLossless.Name = "chkLossless";
|
||||
this.chkLossless.Size = new System.Drawing.Size(362, 37);
|
||||
this.chkLossless.TabIndex = 4;
|
||||
this.chkLossless.Text = "Single Layer Lossless (only useful for pixel perfect reproductions of small image" +
|
||||
"s, such as sculpt maps)";
|
||||
this.chkLossless.UseVisualStyleBackColor = true;
|
||||
this.chkLossless.CheckedChanged += new System.EventHandler(this.chkLossless_CheckedChanged);
|
||||
//
|
||||
// cmdUpload
|
||||
//
|
||||
this.cmdUpload.Enabled = false;
|
||||
this.cmdUpload.Location = new System.Drawing.Point(268, 136);
|
||||
this.cmdUpload.Name = "cmdUpload";
|
||||
this.cmdUpload.Size = new System.Drawing.Size(103, 24);
|
||||
this.cmdUpload.TabIndex = 7;
|
||||
this.cmdUpload.Text = "Upload Texture";
|
||||
this.cmdUpload.UseVisualStyleBackColor = true;
|
||||
this.cmdUpload.Click += new System.EventHandler(this.cmdUpload_Click);
|
||||
//
|
||||
// frmSLImageUpload
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(402, 373);
|
||||
this.Controls.Add(this.grpUpload);
|
||||
this.Controls.Add(this.grpLogin);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(410, 400);
|
||||
this.MinimumSize = new System.Drawing.Size(410, 400);
|
||||
this.Name = "frmSLImageUpload";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "SL Image Upload";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmSLImageUpload_FormClosed);
|
||||
this.grpLogin.ResumeLayout(false);
|
||||
this.grpLogin.PerformLayout();
|
||||
this.grpUpload.ResumeLayout(false);
|
||||
this.grpUpload.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picPreview)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox grpLogin;
|
||||
private System.Windows.Forms.Button cmdConnect;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox txtPassword;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox txtLastName;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtFirstName;
|
||||
private System.Windows.Forms.GroupBox grpUpload;
|
||||
private System.Windows.Forms.Button cmdUpload;
|
||||
private System.Windows.Forms.CheckBox chkLossless;
|
||||
private System.Windows.Forms.TextBox txtSendtoName;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.PictureBox picPreview;
|
||||
private System.Windows.Forms.Button cmdLoad;
|
||||
private System.Windows.Forms.ProgressBar prgUpload;
|
||||
private System.Windows.Forms.Label lblSize;
|
||||
private System.Windows.Forms.TextBox txtAssetID;
|
||||
private System.Windows.Forms.Label label4;
|
||||
}
|
||||
}
|
||||
|
||||
390
Programs/SLImageUpload/frmSLImageUpload.cs
Normal file
390
Programs/SLImageUpload/frmSLImageUpload.cs
Normal file
@@ -0,0 +1,390 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Capabilities;
|
||||
using OpenMetaverse.Imaging;
|
||||
|
||||
namespace SLImageUpload
|
||||
{
|
||||
public partial class frmSLImageUpload : Form
|
||||
{
|
||||
private GridClient Client;
|
||||
private byte[] UploadData = null;
|
||||
private int Transferred = 0;
|
||||
private string FileName = String.Empty;
|
||||
private LLUUID SendToID;
|
||||
private LLUUID AssetID;
|
||||
|
||||
public frmSLImageUpload()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitClient();
|
||||
}
|
||||
|
||||
private void InitClient()
|
||||
{
|
||||
Client = new GridClient();
|
||||
Client.Network.OnEventQueueRunning += new NetworkManager.EventQueueRunningCallback(Network_OnEventQueueRunning);
|
||||
Client.Network.OnLogin += new NetworkManager.LoginCallback(Network_OnLogin);
|
||||
|
||||
// Turn almost everything off since we are only interested in uploading textures
|
||||
Settings.LOG_LEVEL = Helpers.LogLevel.None;
|
||||
Client.Settings.ALWAYS_DECODE_OBJECTS = false;
|
||||
Client.Settings.ALWAYS_REQUEST_OBJECTS = false;
|
||||
Client.Settings.SEND_AGENT_UPDATES = true;
|
||||
Client.Settings.OBJECT_TRACKING = false;
|
||||
Client.Settings.STORE_LAND_PATCHES = false;
|
||||
Client.Settings.MULTIPLE_SIMS = false;
|
||||
Client.Self.Movement.Camera.Far = 32.0f;
|
||||
Client.Throttle.Cloud = 0.0f;
|
||||
Client.Throttle.Land = 0.0f;
|
||||
Client.Throttle.Wind = 0.0f;
|
||||
|
||||
Client.Throttle.Texture = 446000.0f;
|
||||
}
|
||||
|
||||
private void EnableUpload()
|
||||
{
|
||||
if (UploadData != null)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
BeginInvoke(new MethodInvoker(EnableUpload));
|
||||
else
|
||||
cmdUpload.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void DisableUpload()
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
BeginInvoke(new MethodInvoker(DisableUpload));
|
||||
else
|
||||
cmdUpload.Enabled = false;
|
||||
}
|
||||
|
||||
private void UpdateAssetID()
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
BeginInvoke(new MethodInvoker(UpdateAssetID));
|
||||
else
|
||||
txtAssetID.Text = AssetID.ToString();
|
||||
}
|
||||
|
||||
private void LoadImage()
|
||||
{
|
||||
if (FileName == null || FileName == "")
|
||||
return;
|
||||
|
||||
string lowfilename = FileName.ToLower();
|
||||
Bitmap bitmap = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (lowfilename.EndsWith(".jp2") || lowfilename.EndsWith(".j2c"))
|
||||
{
|
||||
Image image;
|
||||
ManagedImage managedImage;
|
||||
|
||||
// Upload JPEG2000 images untouched
|
||||
UploadData = System.IO.File.ReadAllBytes(FileName);
|
||||
|
||||
OpenJPEG.DecodeToImage(UploadData, out managedImage, out image);
|
||||
bitmap = (Bitmap)image;
|
||||
|
||||
Logger.Log("Loaded raw JPEG2000 data " + FileName, Helpers.LogLevel.Info, Client);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lowfilename.EndsWith(".tga"))
|
||||
bitmap = LoadTGAClass.LoadTGA(FileName);
|
||||
else
|
||||
bitmap = (Bitmap)System.Drawing.Image.FromFile(FileName);
|
||||
|
||||
Logger.Log("Loaded image " + FileName, Helpers.LogLevel.Info, Client);
|
||||
|
||||
int oldwidth = bitmap.Width;
|
||||
int oldheight = bitmap.Height;
|
||||
|
||||
if (!IsPowerOfTwo((uint)oldwidth) || !IsPowerOfTwo((uint)oldheight))
|
||||
{
|
||||
Logger.Log("Image has irregular dimensions " + oldwidth + "x" + oldheight + ", resizing to 256x256",
|
||||
Helpers.LogLevel.Info, Client);
|
||||
|
||||
Bitmap resized = new Bitmap(256, 256, bitmap.PixelFormat);
|
||||
Graphics graphics = Graphics.FromImage(resized);
|
||||
|
||||
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
graphics.InterpolationMode =
|
||||
System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
||||
graphics.DrawImage(bitmap, 0, 0, 256, 256);
|
||||
|
||||
bitmap.Dispose();
|
||||
bitmap = resized;
|
||||
|
||||
oldwidth = 256;
|
||||
oldheight = 256;
|
||||
}
|
||||
|
||||
// Handle resizing to prevent excessively large images
|
||||
if (oldwidth > 1024 || oldheight > 1024)
|
||||
{
|
||||
int newwidth = (oldwidth > 1024) ? 1024 : oldwidth;
|
||||
int newheight = (oldheight > 1024) ? 1024 : oldheight;
|
||||
|
||||
Logger.Log("Image has oversized dimensions " + oldwidth + "x" + oldheight + ", resizing to " +
|
||||
newwidth + "x" + newheight, Helpers.LogLevel.Info, Client);
|
||||
|
||||
Bitmap resized = new Bitmap(newwidth, newheight, bitmap.PixelFormat);
|
||||
Graphics graphics = Graphics.FromImage(resized);
|
||||
|
||||
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||
graphics.InterpolationMode =
|
||||
System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
|
||||
graphics.DrawImage(bitmap, 0, 0, newwidth, newheight);
|
||||
|
||||
bitmap.Dispose();
|
||||
bitmap = resized;
|
||||
}
|
||||
|
||||
Logger.Log("Encoding image...", Helpers.LogLevel.Info, Client);
|
||||
|
||||
UploadData = OpenJPEG.EncodeFromImage(bitmap, chkLossless.Checked);
|
||||
|
||||
Logger.Log("Finished encoding", Helpers.LogLevel.Info, Client);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UploadData = null;
|
||||
cmdUpload.Enabled = false;
|
||||
MessageBox.Show(ex.ToString(), "SL Image Upload", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
picPreview.Image = bitmap;
|
||||
lblSize.Text = Math.Round((double)UploadData.Length / 1024.0d, 2) + "KB";
|
||||
prgUpload.Maximum = UploadData.Length;
|
||||
if (Client.Network.Connected) cmdUpload.Enabled = true;
|
||||
}
|
||||
|
||||
private void cmdConnect_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (cmdConnect.Text == "Connect") {
|
||||
cmdConnect.Text = "Disconnect";
|
||||
txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = false;
|
||||
LoginParams lp = new LoginParams();
|
||||
lp.FirstName = txtFirstName.Text;
|
||||
lp.LastName = txtLastName.Text;
|
||||
lp.Password = txtPassword.Text;
|
||||
lp.URI = Client.Settings.LOGIN_SERVER;
|
||||
lp.Start = "last";
|
||||
cmdConnect.Enabled = false;
|
||||
Client.Network.BeginLogin(lp);
|
||||
return;
|
||||
} else {
|
||||
Client.Network.Logout();
|
||||
cmdConnect.Text = "Connect";
|
||||
txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true;
|
||||
DisableUpload();
|
||||
InitClient();
|
||||
}
|
||||
}
|
||||
|
||||
void Network_OnLogin(LoginStatus login, string message)
|
||||
{
|
||||
if (InvokeRequired) {
|
||||
BeginInvoke(new MethodInvoker(
|
||||
delegate()
|
||||
{
|
||||
Network_OnLogin(login, message);
|
||||
}
|
||||
));
|
||||
return;
|
||||
}
|
||||
if (login == LoginStatus.Success) {
|
||||
MessageBox.Show("Connected: " + message);
|
||||
cmdConnect.Enabled = true;
|
||||
} else if (login == LoginStatus.Failed) {
|
||||
MessageBox.Show(this, String.Format("Error logging in ({0}): {1}", Client.Network.LoginErrorKey,
|
||||
Client.Network.LoginMessage));
|
||||
cmdConnect.Text = "Connect";
|
||||
cmdConnect.Enabled = true;
|
||||
txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true;
|
||||
DisableUpload();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cmdLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.Filter =
|
||||
"Image Files (*.jp2,*.j2c,*.jpg,*.jpeg,*.gif,*.png,*.bmp,*.tga,*.tif,*.tiff,*.ico,*.wmf,*.emf)|" +
|
||||
"*.jp2;*.j2c;*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.tga;*.tif;*.tiff;*.ico;*.wmf;*.emf;";
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
FileName = dialog.FileName;
|
||||
LoadImage();
|
||||
}
|
||||
}
|
||||
|
||||
private void cmdUpload_Click(object sender, EventArgs e)
|
||||
{
|
||||
SendToID = LLUUID.Zero;
|
||||
string sendTo = txtSendtoName.Text.Trim();
|
||||
|
||||
if (sendTo.Length > 0)
|
||||
{
|
||||
AutoResetEvent lookupEvent = new AutoResetEvent(false);
|
||||
LLUUID thisQueryID = LLUUID.Random();
|
||||
bool lookupSuccess = false;
|
||||
|
||||
DirectoryManager.DirPeopleReplyCallback callback =
|
||||
delegate(LLUUID queryID, List<DirectoryManager.AgentSearchData> matchedPeople)
|
||||
{
|
||||
if (queryID == thisQueryID)
|
||||
{
|
||||
if (matchedPeople.Count > 0)
|
||||
{
|
||||
SendToID = matchedPeople[0].AgentID;
|
||||
lookupSuccess = true;
|
||||
}
|
||||
|
||||
lookupEvent.Set();
|
||||
}
|
||||
};
|
||||
|
||||
Client.Directory.OnDirPeopleReply += callback;
|
||||
Client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, sendTo, 0, thisQueryID);
|
||||
|
||||
bool eventSuccess = lookupEvent.WaitOne(10 * 1000, false);
|
||||
Client.Directory.OnDirPeopleReply -= callback;
|
||||
|
||||
if (eventSuccess && lookupSuccess)
|
||||
{
|
||||
Logger.Log("Will send uploaded image to avatar " + SendToID.ToString(), Helpers.LogLevel.Info, Client);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Could not find avatar \"" + sendTo + "\", upload cancelled");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (UploadData != null)
|
||||
{
|
||||
prgUpload.Value = 0;
|
||||
cmdLoad.Enabled = false;
|
||||
cmdUpload.Enabled = false;
|
||||
grpLogin.Enabled = false;
|
||||
|
||||
string name = System.IO.Path.GetFileNameWithoutExtension(FileName);
|
||||
|
||||
Client.Inventory.RequestCreateItemFromAsset(UploadData, name, "Uploaded with SL Image Upload", AssetType.Texture,
|
||||
InventoryType.Texture, Client.Inventory.FindFolderForType(AssetType.Texture),
|
||||
|
||||
delegate(CapsClient client, long bytesReceived, long bytesSent, long totalBytesToReceive, long totalBytesToSend)
|
||||
{
|
||||
if (bytesSent > 0)
|
||||
{
|
||||
Transferred = (int)bytesSent;
|
||||
BeginInvoke((MethodInvoker)delegate() { SetProgress(); });
|
||||
}
|
||||
},
|
||||
|
||||
delegate(bool success, string status, LLUUID itemID, LLUUID assetID)
|
||||
{
|
||||
if (this.InvokeRequired)
|
||||
BeginInvoke(new MethodInvoker(EnableControls));
|
||||
else
|
||||
EnableControls();
|
||||
|
||||
if (success)
|
||||
{
|
||||
AssetID = assetID;
|
||||
UpdateAssetID();
|
||||
|
||||
// Fix the permissions on the new upload since they are fscked by default
|
||||
InventoryItem item = Client.Inventory.FetchItem(itemID, Client.Self.AgentID, 1000 * 15);
|
||||
|
||||
Transferred = UploadData.Length;
|
||||
BeginInvoke((MethodInvoker)delegate() { SetProgress(); });
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
item.Permissions.EveryoneMask = PermissionMask.All;
|
||||
item.Permissions.NextOwnerMask = PermissionMask.All;
|
||||
Client.Inventory.RequestUpdateItem(item);
|
||||
|
||||
Logger.Log("Created inventory item " + itemID.ToString(), Helpers.LogLevel.Info, Client);
|
||||
MessageBox.Show("Created inventory item " + itemID.ToString());
|
||||
|
||||
// FIXME: We should be watching the callback for RequestUpdateItem instead of a dumb sleep
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
|
||||
if (SendToID != LLUUID.Zero)
|
||||
{
|
||||
Logger.Log("Sending item to " + SendToID.ToString(), Helpers.LogLevel.Info, Client);
|
||||
Client.Inventory.GiveItem(itemID, name, AssetType.Texture, SendToID, true);
|
||||
MessageBox.Show("Sent item to " + SendToID.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.DebugLog("Created inventory item " + itemID.ToString() + " but failed to fetch it," +
|
||||
" cannot update permissions or send to another avatar", Client);
|
||||
MessageBox.Show("Created inventory item " + itemID.ToString() + " but failed to fetch it," +
|
||||
" cannot update permissions or send to another avatar");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Asset upload failed: " + status);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetProgress()
|
||||
{
|
||||
prgUpload.Value = Transferred;
|
||||
}
|
||||
|
||||
private void Network_OnEventQueueRunning(Simulator simulator)
|
||||
{
|
||||
Logger.DebugLog("Event queue is running for " + simulator.ToString() + ", enabling uploads", Client);
|
||||
EnableUpload();
|
||||
}
|
||||
|
||||
private void EnableControls()
|
||||
{
|
||||
cmdLoad.Enabled = true;
|
||||
cmdUpload.Enabled = true;
|
||||
grpLogin.Enabled = true;
|
||||
}
|
||||
|
||||
private void frmSLImageUpload_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
if (Client.Network.Connected)
|
||||
Client.Network.Logout();
|
||||
}
|
||||
|
||||
private void chkLossless_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
LoadImage();
|
||||
}
|
||||
|
||||
private bool IsPowerOfTwo(uint n)
|
||||
{
|
||||
return (n & (n - 1)) == 0 && n != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
Programs/SLImageUpload/frmSLImageUpload.resx
Normal file
120
Programs/SLImageUpload/frmSLImageUpload.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user