コード例 #1
0
        static void Main(string[] args)
        {
            String original = "abcde FGHIJ ABC abc DEFG      ";
            String s1       = original.ToUpper();
            String s2       = original.ToLower();
            String s3       = original.Trim();


            int n1 = original.IndexOf("bc");
            int n2 = original.LastIndexOf("bc");

            String s4 = original.Substring(3);
            String s5 = original.Substring(3, 5);
            String s6 = original.Replace('a', 'x');
            String s7 = original.Replace("abc", "xy");

            bool    b1 = String.IsNullOrEmpty(original);
            bool    b2 = String.IsNullOrWhiteSpace(original);
            String *p1 = original;

            Console.WriteLine("Original: -" + original + "-");
            Console.WriteLine("ToUpper: -" + s1 + "-");
            Console.WriteLine("ToLower: -" + s2 + "-");
            Console.WriteLine("Trim :-" + s3 + "-");
            Console.WriteLine("IndexOf ('bc') :" + n1);
            Console.WriteLine("LastIndexOf('bc') :" + n2);
            Console.WriteLine("substring(3) :" + s4);
            Console.WriteLine("substring(3,5) :" + s5);
            Console.WriteLine("Replace('a','x'): " + s6);
            Console.WriteLine("Replace('abc', 'xy'):" + s7);
            Console.WriteLine("IsNullOrEmpty(original): " + b1);
            Console.WriteLine("IsNullOrWhiteSpace(original): " + b2);
            Console.WriteLine("===========================================================");
        }
コード例 #2
0
ファイル: Marshaler.cs プロジェクト: Qibbi/Builder
        public static unsafe void Marshal(string text, String *str, Tracker tracker)
        {
            IntPtr hglobal = InteropMarshal.StringToHGlobalAnsi(text);
            sbyte *textPtr = (sbyte *)hglobal.ToPointer();
            sbyte *lenPtr  = textPtr;

            while (*lenPtr != 0)
            {
                ++lenPtr;
            }
            int length = (int)(lenPtr - textPtr);

            str->Length = length;
            if (tracker.IsBigEndian)
            {
                Tracker.ByteSwap32((uint *)&str->Length);
            }
            tracker.Push((void **)&str->Data, 1, length + 1);
            sbyte *strValue = (sbyte *)str->Data;
            int    c;

            do
            {
                *strValue = *textPtr++;
                c = *strValue++;
            }while (c != 0);
            tracker.Pop();
            InteropMarshal.FreeHGlobal(hglobal);
            hglobal = IntPtr.Zero;
        }
コード例 #3
0
        public object FindIcon()
        {
#if false
            SwitchBoardInterpreterData *interp = (SwitchBoardInterpreterData *)_interpreterData;
            SwitchBoardCellAspect *     asp    = interp._aspects;
            String *p = 0;
            int     ix;
            String  curState;

            curState = this._currentState;

            while (asp)
            {
                if (!wxStricmp(asp._name, curState))
                {
                    break;
                }
                asp = asp._next;
            }
            if (!asp)
            {
                return(0);
            }
            p = asp._icons[0];
            if (!p || !*p)
            {
                return(0);
            }
            if (_isFlashing)
            {
                if (!p[_nextFlashingIcon])
                {
                    _nextFlashingIcon = 0;
                }
                p = &p[_nextFlashingIcon];
            }
            if ((ix = get_pixmap_index(*p)) < 0)
            {
                return(0);
            }
            return(pixmaps[ix].pixels);
#else
            return(0);
#endif
        }
コード例 #4
0
 public static extern void ConfigSetCachePath([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *cachePath);
コード例 #5
0
 public static extern void EnablePlatformFileSystem([NativeTypeName("ULString")] String *baseDir);
コード例 #6
0
ファイル: KeyEvent.cs プロジェクト: TYoung86/UltralightSharp
 public static unsafe KeyEvent *Create(KeyEventType type, uint modifiers, int virtualKeyCode, int nativeKeyCode, String *text, String *unmodifiedText, bool isKeypad, bool isAutoRepeat, bool isSystemKey)
 => Ultralight.CreateKeyEvent(type, modifiers, virtualKeyCode, nativeKeyCode, text, unmodifiedText, isKeypad, isAutoRepeat, isSystemKey);
コード例 #7
0
ファイル: DemoProgram.cs プロジェクト: nesk/UltralightNet
 private static unsafe void LoggerCallback(LogLevel logLevel, String *msg)
 => Console.WriteLine($"{logLevel.ToString()}: {msg->Read()}");
コード例 #8
0
 public static extern void ConfigSetUserAgent([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *agentString);
コード例 #9
0
 public static extern KeyEvent *CreateKeyEvent(KeyEventType type, [NativeTypeName("unsigned int")] uint modifiers, int virtualKeyCode, int nativeKeyCode, [NativeTypeName("ULString")] String *text,
                                               [NativeTypeName("ULString")] String *unmodifiedText, bool isKeypad, bool isAutoRepeat, bool isSystemKey);
コード例 #10
0
 public static extern void StringAssignString([NativeTypeName("ULString")] String *str, [NativeTypeName("ULString")] String *newStr);
コード例 #11
0
 public static extern Session *CreateSession([NativeTypeName("ULRenderer")] Renderer *renderer, bool isPersistent, [NativeTypeName("ULString")] String *name);
コード例 #12
0
ファイル: Form1.cs プロジェクト: StevenGann/EMG-Hand
 public static extern unsafe bool  FindDevicesSimple(String *DevicePortNameList[], Int32 *DeviceCount, Int32 MaxDeviceCount, Int32 PortNameStrLen);
コード例 #13
0
 public static extern void SettingsSetFileSystemPath([NativeTypeName("ULSettings")] Settings *settings, [NativeTypeName("ULString")] String *path);
コード例 #14
0
 public static extern void EnableDefaultLogger([NativeTypeName("ULString")] String *logPath);
コード例 #15
0
 public static extern UIntPtr StringGetLength([NativeTypeName("ULString")] String *str);
コード例 #16
0
 public static extern bool StringIsEmpty([NativeTypeName("ULString")] String *str);
コード例 #17
0
 public static extern void ViewLoadUrl([NativeTypeName("ULView")] View *view, [NativeTypeName("ULString")] String *urlString);
コード例 #18
0
 public static extern void StringAssignCString([NativeTypeName("ULString")] String *str, [NativeTypeName("const char *")] sbyte *cStr);
コード例 #19
0
 public static extern String *ViewEvaluateScript([NativeTypeName("ULView")] View *view, [NativeTypeName("ULString")] String *jsString, [NativeTypeName("ULString *")] String **exception);
コード例 #20
0
 public static extern void ConfigSetFontFamilySansSerif([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *fontName);
コード例 #21
0
 public static extern void ConfigSetResourcePath([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *resourcePath);
コード例 #22
0
 public static extern void ConfigSetUserStylesheet([NativeTypeName("ULConfig")] Config *config, [NativeTypeName("ULString")] String *cssString);
コード例 #23
0
 public static extern String *CreateStringFromCopy([NativeTypeName("ULString")] String *str);
コード例 #24
0
 public static unsafe Session *Create(Renderer *renderer, bool isPersistent, String *name)
 => Ultralight.CreateSession(renderer, isPersistent, name);
コード例 #25
0
 public static extern void DestroyString([NativeTypeName("ULString")] String *str);
コード例 #26
0
 public static extern char *StringGetData([NativeTypeName("ULString")] String *str);
コード例 #27
0
 public static extern void SettingsSetAppName([NativeTypeName("ULSettings")] Settings *settings, [NativeTypeName("ULString")] String *name);